|
@@ -832,6 +832,59 @@ class MyController extends Controller
|
|
}else{
|
|
}else{
|
|
return $this->error(ErrorCode::OPERATION_FAILED);
|
|
return $this->error(ErrorCode::OPERATION_FAILED);
|
|
}
|
|
}
|
|
|
|
+ } /**
|
|
|
|
+ * @api {post} /api/my/bank/img 添加二维码
|
|
|
|
+ * @apiDescription 添加二维码
|
|
|
|
+ * @apiGroup My
|
|
|
|
+ * @apiParam {string} data[bank_name] 类型
|
|
|
|
+ * @apiParam {string} data[bank_number] 二维码图片
|
|
|
|
+ * @apiPermission Passport
|
|
|
|
+ * @apiVersion 0.1.0
|
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
|
+ * HTTP/1.1 200 OK
|
|
|
|
+ *{
|
|
|
|
+ * "status": true,
|
|
|
|
+ * "status_code": 0,
|
|
|
|
+ * "message": "",
|
|
|
|
+ * "data": ""
|
|
|
|
+ *}
|
|
|
|
+ * @apiErrorExample {json} Error-Response:
|
|
|
|
+ *{
|
|
|
|
+ * "status": false,
|
|
|
|
+ * "status_code": 700,
|
|
|
|
+ * "message": "操作失败",
|
|
|
|
+ * "data": null
|
|
|
|
+ *}
|
|
|
|
+ */
|
|
|
|
+ public function bankImgCreate(Request $request)
|
|
|
|
+ {
|
|
|
|
+ $data = $request->data;
|
|
|
|
+ $user = $this->getUser();
|
|
|
|
+ $validator = \Validator::make($request->all(),
|
|
|
|
+ [
|
|
|
|
+ 'data.bank_name' => 'required',
|
|
|
|
+ 'data.bank_number' => 'required',
|
|
|
|
+ ],
|
|
|
|
+ [
|
|
|
|
+ 'data.bank_name.required' => '请选择账号类型',
|
|
|
|
+ 'data.bank_number.required' => '请输入账号',
|
|
|
|
+ ]
|
|
|
|
+ );
|
|
|
|
+ if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
|
|
|
|
+ $data['user_id'] = $user->id;
|
|
|
|
+ $data['bank_user'] = $data['bank_name'];
|
|
|
|
+ $data['bank_phone'] = '';
|
|
|
|
+ $info = UserBank::whereNull('bank_phone')->where('bank_user',$data['bank_name'])->first(); //定义为二维码
|
|
|
|
+ if (empty($info)) {
|
|
|
|
+ $ok =UserBank::create($data);
|
|
|
|
+ }else{
|
|
|
|
+ $ok = $info->update($data);
|
|
|
|
+ }
|
|
|
|
+ if ($ok) {
|
|
|
|
+ return $this->api('');
|
|
|
|
+ }else{
|
|
|
|
+ return $this->error(ErrorCode::OPERATION_FAILED);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|