| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace Modules\Api\Controllers;
- use App\Models\MerchantModel;
- use Illuminate\Support\Facades\Validator;
- use Modules\Api\Services\PaymentService;
- class MerchantChannelController extends BaseController
- {
- /**
- * 商户支付通道列表
- *
- * @return \Illuminate\Http\JsonResponse|mixed
- */
- public function channelLists()
- {
- $inputData = $this->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);
- }
- }
|