123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851 |
- <?php
- namespace App\Http\Controllers\Api\V1;
- use App\Models\AccountLog;
- use App\Models\BaseDictionaryOptionModel;
- use App\Models\BaseSettingsModel;
- use App\Models\DreamInfoModel;
- use App\Models\SearchInfoModel;
- use App\Models\Suggest;
- use App\Models\SystemInfoModel;
- use App\Models\UserBank;
- use App\Models\UserCareDream;
- use App\Models\UserCashOut;
- use App\Models\UserInfoModel;
- use Illuminate\Http\Request;
- use App\Services\Base\ErrorCode;
- class MyController extends Controller
- {
- /**
- * @api {get} /api/my/show 个人首页
- * @apiDescription 个人首页
- * @apiGroup My
- * @apiPermission Passport
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 O* "status": true,
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": {
- * "id": 1,
- * "phone": "13880642880",
- * "nickname": "name1",
- * "avatar": "https://tims%2Fitem%225_kzrcM.thumb.224_0.jpeg",
- * "birthday": "2000-06-21",
- * "sign": 0,
- * "money": 0,
- * "coin": 1300,
- * "sex": 1,
- * "signture": "",
- * "height": 170,
- * "work": "",
- * "emotion": 1,
- * "address": "",
- * "city": "",
- * "detail_address": "",
- * "status": 1,
- * "wechat": "",
- * "weibo": "",
- * "remember_token": "",
- * "created_at": "2017-06-25 10:27:08",
- * "updated_at": "2017-06-25 15:20:11",
- * "deleted_at": null,
- * "care_dreams_number": 2,
- * "fans_number": 0,
- * "collection_number": 0,
- * "interaction_number": 0,
- * }
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": {
- * "user": null
- * }
- *}
- */
- public function show()
- {
- $user = $this->getUser();
- /*
- * 我的关注人数,我的粉丝,收藏
- * 点赞?徽章?
- * */
- $care_num = $user->careDreams;
- $user->care_dreams_number = count($care_num);
- $fens = UserCareDream::where('dream_user_id',$user->id)->get();
- $user->fans_number = count($fens);
- $collection = $user->myCollection;
- $user->collection_number = count($collection);
- $interaction_infos = $user->allInteraction;
- $user->interaction_number = count($interaction_infos);
- return $this->api($user);
- }
- /**
- * @api {get} /api/my/edit 修改个人信息
- * @apiDescription 修改个人信息
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- "data": {
- "emotion": [
- {
- "value": "1",
- "name": "未婚"
- },
- {
- "value": "2",
- "name": "已婚"
- },
- {
- "value": "3",
- "name": "离异"
- }
- ],
- "sex": [
- {
- "value": "0",
- "name": "男"
- },
- {
- "value": "1",
- "name": "女"
- }
- ]
- }
- * }
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- * {
- * "status": false,
- * "status_code": 1500,
- * "message": "会员不存在",
- * "data": null
- * }
- */
- public function edit()
- {
- $sex = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
- where('dictionary_code','sex')->get();
- $emotion = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
- where('dictionary_code','emotion')->get();
- return $this->api(compact('emotion','sex'));
- }
- /**
- * @api {post} /api/my/update 保存个人信息
- * @apiDescription 保存个人信息
- * @apiParam {string} pic 头像
- * @apiParam {int} sex 性别
- * @apiParam {string} signture 个性签名
- * @apiParam {int} emotion 情感状态
- * @apiParam {string} work 职业
- * @apiParam {int} height 身高
- * @apiGroup My
- * @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:
- * HTTP/1.1 400 Bad Request
- *{
- * "status": false,
- * "status_code": 600,
- * "message": "保存用户数据失败",
- * "data": null
- * }
- */
- public function update(Request $request)
- {
- $user = $this->getUser();
- $data = $request->except('_token');
- $ok = $user->update($data);
- if ($ok == true) {
- return $this->api('');
- }else{
- return $this->error(ErrorCode::SAVE_USER_FAILED);
- }
- }
- /**
- * @api {post} /api/my/recharge 充值
- * @apiDescription 充值
- * @apiGroup My
- * @apiParam {int} coin 充值金额
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function recharge(Request $request)
- {
- $validator = \Validator::make($request->all(),
- [
- 'coin' => 'required|integer',
- ],
- [
- 'coin.required' => '请填写金额',
- 'coin.integer' => '请输入整数',
- ]
- );
- if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
- $user = $this->getUser();
- $user->coin += $request->coin;
- $user->save();
- return $this->api('');
- }
- /**
- * @api {get} /api/my/system_info 系统消息
- * @apiDescription 系统消息
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": {
- * "data": [
- * ...
- * ]
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function systemInfo()
- {
- $user = $this->getUser();
- $data = SystemInfoModel::where('user_id',$user->id)->orderBy('id','desc')->get();
- return $this->api(compact('data'));
- }
- /**
- * @api {get} /api/my/cash/page 提现页面
- * @apiDescription 提现页面
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": [
- * {
- * "id": 1,
- * "user_id": 1,
- * "bank_name": "4",
- * "bank_number": "3",
- * "bank_phone": "2",
- * "bank_user": "1",
- * "created_at": "2017-08-14 18:09:03",
- * "updated_at": "2017-08-14 18:09:03"
- * }
- * ]
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function cashPage()
- {
- $user = $this->getUser();
- $data = $user->bank;
- return $this->api($data);
- }
- /**
- * @api {post} /api/my/cash 提现
- * @apiDescription 提现
- * @apiGroup My
- * @apiParam {int} data[bank_id] 银行卡号id
- * @apiParam {int} data[cash] 银行卡号id
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": false,
- * "status_code": 1413,
- * "message": "系统审核中",
- * "data": null
- *}
- * @apiErrorExample {json} Error-Response:
- *{
- * "status": false,
- * "status_code": 700,
- * "message": "操作失败",
- * "data": null
- *}
- */
- public function cash(Request $request)
- {
- $data = $request->data;
- $user = $this->getUser();
- $validator = \Validator::make($request->all(),
- [
- 'data.bank_id' => 'required|integer',
- 'data.cash' => 'required',
- ],
- [
- 'data.id.required' => '请选择提现账号',
- 'data.id.integer' => '提现账号不存在',
- 'data.cash.required' => '请输入金额',
- ]
- );
- if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
- // $info = [] ;
- // $info['from_type'] = '余额';
- // $info['from_id'] = $user->id;
- // $info['from_name'] = $user->name;
- // $info['op'] = '提现';
- // $info['from_amount'] = $data['coin'];
- // $info['to_type'] = '现金';
- // $info['to_id'] = $user->id;
- // $info['to_name'] = $data['account']; //账号
- // $info['note'] = $data['type'].$data['name'];
- // $ok = AccountLog::create($info);
- $data['user_id'] = $user->id;
- $data['status'] = 0;
- $ok = UserCashOut::create($data);
- if ($ok) {
- return $this->error(ErrorCode::verify);
- }else{
- return $this->error(ErrorCode::OPERATION_FAILED);
- }
- }
- // 联系客服
- /**
- * @api {post} /api/my/suggest 联系客服
- * @apiDescription 联系客服
- * @apiGroup My
- * @apiParam {string} data[content] 内容
- * @apiParam {string} data[email] 邮箱
- * @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 suggest(Request $request)
- {
- $data = $request->data;
- $user = $this->getUser();
- $validator = \Validator::make($request->all(),
- [
- 'data.content' => 'required',
- 'data.email' => 'required|email',
- ],
- [
- 'data.content.required' => '请输入你遇到的问题',
- 'data.email.required' => '请输入正确的邮箱地址',
- 'data.email.email' => '请输入正确的邮箱地址',
- ]
- );
- if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
- $data['user_id'] = $user->id;
- $ok =Suggest::create($data);
- if ($ok) {
- return $this->api('');
- }else{
- return $this->error(ErrorCode::OPERATION_FAILED);
- }
- }
- // 回复我的
- // public function replyMy()
- // {
- //
- // $user = $this->getUser();
- //// 梦想
- // $dreams = $user->UserDream;
- //
- // $data = $user->allInteraction;
- // foreach ($data as $item) {
- // $item->get_money = $item->dream->get_money;
- // $item->money = $item->dream->money;
- // }
- // dd($data) ;
- // if (count($dreams) == 0)
- // return $this->error(ErrorCode::DREAM_NOT_EXIST);
- // $comments_infos = [];
- // foreach ($dreams as $dream){
- // $comments_info = $dream->DreamInfo;
- // if (count($comments_info) > 0) {
- // foreach ($comments_info as $k => $value) {
- // $value->dream_name = $dream->dream;
- // $value->dream_about = $dream->about;
- // $value->dream_pic = count($dream->dreamImgsFirst) > 0 ? $dream->dreamImgsFirst->pic : '';
- // $value->progress = $dream->money == 0 ? 0 : floor($dream->get_money/$dream->money);
- // $value->reviewer = $value->CommentUser->nickname;
- // $value->reviewer_pic = $value->CommentUser->pic;
- // }
- // $comments_infos[] = $comments_info;
- // }
- // }
- //
- // return $this->api(compact('comments_infos'));
- // }
- /**
- * @api {get} /api/my/dream 我的梦想
- * @apiDescription 我的梦想
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": [
- * {
- * "id": 5,
- * "user_id": 1,
- * "name": "梦想标题1",
- * "about": "梦想介绍",
- * "coin": 2500,
- * "time": 21,
- * "get_coin": 0,
- * "status": 0,
- * "video": null,
- * "sign": "",
- * "created_at": "2017-06-25 12:45:22",
- * "updated_at": "2017-06-25 12:45:22",
- * "pic": "https://timgsa.baidu.com/timg?image7b14f12f.jpg",
- * },
- * ]
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function dream()
- {
- $user = $this->getUser();
- $dreams = $user->dreams;
- if (count($dreams) == 0)
- return $this->error(ErrorCode::DREAM_NOT_EXIST);
- foreach ($dreams as $dream){
- $dream->pic = count($dream->img) > 0 ? $dream->img->pic : '';
- }
- return $this->api($dreams);
- }
- /**
- * @api {get} /api/my/collection 我的收藏
- * @apiDescription 我的收藏
- * @apiGroup My
- * @apiPermission Passport
- * @apiParam {string} [keyword] 关键字可选
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": {
- * "data": [
- * { 梦想详情
- * "id": 12,
- * "user_id": 2,
- * "name": "用户2梦想标题166",
- * "about": "用户2梦想介绍666",
- * "coin": 2500,
- * "time": 21,
- * "get_coin": 0,
- * "status": 0,
- * "video": null,
- * "sign": "",
- * },
- * "img": {
- * "title": "",
- * "pic": "https://f12f.jpg" 梦想封面图片
- * }
- * ],
- * "users": {
- * "2": "https://xxx.jpeg" ID号和头像
- * }
- * }
- *}
- * keyword存在
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": [
- * {
- * "id": 2,
- * "user_id": 1,
- * "dream_id": 12,
- * "dream_user_id": 2,
- * "interaction_number": 0,
- * "created_at": "2017-06-25 13:11:45",
- * "updated_at": "2017-06-25 13:11:45",
- * "dreams": [ 梦想
- * {
- * "id": 12,
- * "user_id": 2,
- * "name": "用户2梦想标题166",
- * "about": "用户2梦想介绍666",
- * "coin": 2500,
- * "end_time": 72000,
- * "get_coin": 792,
- * "mark": 5484,
- * "status": 0,
- * "video": "e",
- * "score": 158730,
- * "sign": "梦想达人",
- * "created_at": "2017-06-25 13:10:56",
- * "updated_at": "2017-06-28 16:53:39"
- * "img": { 图片
- * "title": "",
- * "pic": "https://timgsa.baidu.com/timg9&di2f.jpg"
- * },
- * "user": {
- *
- * }
- * }
- * ]
- * }
- * ]
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function collection(Request $request)
- {
- $user = $this->getUser();
- if ($request->keyword) {
- $keyword ='%'.$request->keyword.'%';
- $data = UserCareDream::where('user_id',$user->id)->
- whereHas('dreams',function ($query) use($keyword){
- $query->where('end_time','>=',time())->where('name','like',$keyword);
- })->with('dreams')->get();
- foreach ($data as $item) {
- foreach ($item->dreams as $dream) {
- $dream->img;
- }
- }
- $this->insertSearchTable($user->id,$request->keyword);
- return $this->api($data);
- }else{
- $dreams = $user->collection;
- // $users = [];
- foreach ($dreams as $item) {
- /* if ($item->pivot->interaction_number > 0) {
- $user_info = UserInfoModel::find($item->pivot->dream_user_id);
- $avatar = $user_info ? $user_info->avatar : '';
- if (!array_key_exists($item->pivot->dream_user_id,$users)) {
- $users[$item->pivot->dream_user_id] = $avatar;
- }
- }*/
- $item->img;
- $item->user;
- }
- return $this->api(compact('dreams'));
- }
- }
- /**
- * @api {get} /api/my/setting 设置
- * @apiDescription 设置
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data": {
- * "key": "2511789", 电话
- * "value": "关于喵喵介绍" 关于喵喵
- * }
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function setting()
- {
- $data = BaseSettingsModel::where('category','miaomiao')->select('key','value')->first();
- return $this->api($data);
- }
- /**
- * @api {get} /api/my/care 我关注的用户
- * @apiDescription 我关注的用户
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data":[] or
- * "data": [
- * {
- * "id": 2,
- * "phone": "13880642881",
- * "nickname": "name2",
- * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
- * "birthday": "2000-06-21",
- * "sign": 0,
- * "money": 0,
- * "coin": 800,
- * "sex": 1,
- * "signture": "我的个性签名2",
- * "height": 200,
- * "work": "兼职",
- * "emotion": 2,
- * "address": "370105",
- * "city": "成都",
- * "detail_address": "",
- * "status": 1,
- * "wechat": "",
- * "weibo": "",
- * "remember_token": "",
- * "created_at": "2017-06-25 10:42:06",
- * "updated_at": "2017-06-30 09:15:04",
- * "deleted_at": null,
- * }
- * ]
- *}
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function care()
- {
- $user = $this->getUser();
- $users =$user->UserCareUser;
- return $this->api($users);
- }
- public function insertSearchTable($id,$keyword)
- {
- $info = SearchInfoModel::where('user_id',$id)->
- where('search',trim($keyword))->first();
- if (count($info) == 0) {
- SearchInfoModel::create(['user_id'=>$id,'search'=>trim($keyword),'times'=>1]);
- }else{
- $info->times += 1;
- $info->save();
- }
- }
- //我的银行账户
- /**
- * @api {get} /api/my/bank/list 我的银行账户
- * @apiDescription 我的银行账户
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data":[] or
- * "data": [
- * {
- * "id": 1,
- * "user_id": 1,
- * "bank_name": "1",
- * "bank_number": "1",
- * "bank_phone": "1",
- * "bank_user": "1"
- * }
- *]
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function bankList()
- {
- $user = $this->getUser();
- $data = UserBank::where('user_id',$user->id)->orderBy('id','desc')->get();
- return $this->api($data);
- }
- /**
- * @api {get} /api/my/bank/account 账户余额
- * @apiDescription 账户余额
- * @apiGroup My
- * @apiPermission Passport
- * @apiVersion 0.1.0
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- *{
- * "status": true,
- * "status_code": 0,
- * "message": "",
- * "data":[] or
- * "data": {
- * "coin": 508, 余额
- * }
- *]
- * @apiErrorExample {json} Error-Response:
- * HTTP/1.1 400 Bad Request
- */
- public function account()
- {
- $user = $this->getUser();
- return $this->api($user);
- }
- // 添加银行卡
- /**
- * @api {post} /api/my/bank/create 添加银行卡
- * @apiDescription 添加银行卡
- * @apiGroup My
- * @apiParam {string} data[bank_name] 银行名称
- * @apiParam {string} data[bank_number] 银行卡号
- * @apiParam {int} data[bank_phone] 银行卡绑定手机号
- * @apiParam {string} data[bank_user] 银行卡用户姓名
- * @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 bankCreate(Request $request)
- {
- $data = $request->data;
- $user = $this->getUser();
- $validator = \Validator::make($request->all(),
- [
- 'data.bank_name' => 'required',
- 'data.bank_number' => 'required',
- 'data.bank_phone' => 'required',
- 'data.bank_user' => 'required',
- ],
- [
- 'data.bank_name.required' => '请选择账号类型',
- 'data.bank_number.required' => '请输入账号',
- 'data.bank_phone.required' => '请输入账号绑定手机号码',
- 'data.bank_user.required' => '请输入账号绑定用户姓名',
- ]
- );
- if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
- $data['user_id'] = $user->id;
- $ok =UserBank::create($data);
- if ($ok) {
- return $this->api('');
- }else{
- return $this->error(ErrorCode::OPERATION_FAILED);
- }
- }
- /**
- * @api {get} /api/my/bank/delete 删除银行卡
- * @apiDescription 删除银行卡
- * @apiGroup My
- * @apiParam {int} id 银行卡id
- * @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 bankDelete(Request $request)
- {
- $id = $request->id;
- $validator = \Validator::make($request->all(),
- [
- 'id' => 'required',
- ],
- [
- 'id.required' => '银行账号不存在',
- ]
- );
- if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
- $ok =UserBank::destroy($id);
- if ($ok) {
- return $this->api('');
- }else{
- return $this->error(ErrorCode::OPERATION_FAILED);
- }
- }
- }
|