|
@@ -20,8 +20,8 @@ class PayConfigController extends CatchController
|
|
|
public function list(Request $request) {
|
|
|
$this->validate($request,[
|
|
|
'name' => 'nullable|string|max:256',
|
|
|
- 'pay_type' => 'nullable|string|in:palmpay,wechatpay,tiktokpay',
|
|
|
- 'miniprogram_type' => 'nullable|string|in:wechat,tiktok',
|
|
|
+ 'pay_type' => 'nullable|in:1,2,3',
|
|
|
+ 'miniprogram_type' => 'nullable|in:1,2',
|
|
|
'remark' => 'nullable|string|max:256',
|
|
|
'pay_appid' => 'nullable|string|max:256',
|
|
|
]);
|
|
@@ -53,9 +53,11 @@ class PayConfigController extends CatchController
|
|
|
$result = $sql->paginate($request->input('limit', 15));
|
|
|
}
|
|
|
|
|
|
+ $payTypeMap = collect($commonConfig['payType'])->keyBy('key');
|
|
|
+ $miniprogramTypeMap = collect($commonConfig['miniprogramType'])->keyBy('key');
|
|
|
foreach ($result as $item) {
|
|
|
- $item->pay_type_str = $commonConfig['payType'][$item->pay_type] ?? '';
|
|
|
- $item->miniprogram_type_str = $commonConfig['miniprogramType'][$item->miniprogram_type] ?? '';
|
|
|
+ $item->pay_type_str = $payTypeMap[$item->pay_type]['val'] ?? '';
|
|
|
+ $item->miniprogram_type_str = $miniprogramTypeMap[$item->miniprogram_type]['val'] ?? '';
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
@@ -84,14 +86,15 @@ class PayConfigController extends CatchController
|
|
|
'name' => 'required|string|max:256',
|
|
|
'payee_name' => 'required|string|max:256',
|
|
|
'pay_appid' => 'required',
|
|
|
- 'pay_type' => 'required|string|in:palmpay,wechatpay,tiktokpay',
|
|
|
+ 'pay_type' => 'required|integer|in:1,2,3',
|
|
|
'pay_common_params' => 'required',
|
|
|
- 'miniprogram_type' => 'required|in:wechat,tiktok',
|
|
|
+ 'miniprogram_type' => 'required|in:1,2',
|
|
|
'remark' => 'nullable|string|max:256'
|
|
|
]);
|
|
|
$data = $request->only(['name', 'payee_name', 'pay_appid', 'pay_type', 'miniprogram_type']);
|
|
|
$now = date('Y-m-d H:i:s');
|
|
|
$data['created_at'] = $data['updated_at'] = $now;
|
|
|
+ $data['pay_common_params'] = \json_encode($request->input('pay_common_params', []));
|
|
|
$data['remark'] = $request->input('remark', '');
|
|
|
DB::table('pay_merchants')
|
|
|
->insert($data);
|