getJsonData(); $rules = [ 'merchant_code' => 'required|string', 'key' => 'required|string', ]; $validator = Validator::make($inputData, $rules); if ($validator->fails()) { // 如果有错误(可能是多个信息),这里只取第一个错误信息返回. return json_fail($validator->errors()->first()); } $merchantInfo = MerchantModel::query()->where(['merchant_code' => $inputData['merchant_code'], 'key' => $inputData['key'], 'status' => 1])->first(); if (empty($merchantInfo)) { return json_fail('该商户不存在'); } $res = make(PaymentService::class)->getAllPayments($merchantInfo->uid); return json_success($res); } }