MyController.php 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311
  1. <?php
  2. namespace App\Http\Controllers\Api\V1;
  3. use App\Models\AccountLog;
  4. use App\Models\BaseDictionaryOptionModel;
  5. use App\Models\BaseSettingsModel;
  6. use App\Models\CommentInfoModel;
  7. use App\Models\DreamInfoModel;
  8. use App\Models\InteractionInfo;
  9. use App\Models\SearchInfoModel;
  10. use App\Models\Suggest;
  11. use App\Models\SystemInfoModel;
  12. use App\Models\UserBank;
  13. use App\Models\UserCareDream;
  14. use App\Models\UserCareUser;
  15. use App\Models\UserCashOut;
  16. use App\Models\UserInfoModel;
  17. use Illuminate\Http\Request;
  18. use App\Services\Base\ErrorCode;
  19. use App\Helper\JpushHelper;
  20. class MyController extends Controller
  21. {
  22. use JpushHelper;
  23. /**
  24. * @api {get} /api/my/show 个人首页
  25. * @apiDescription 个人首页
  26. * @apiGroup My
  27. * @apiPermission Passport
  28. * @apiSuccessExample {json} Success-Response:
  29. * HTTP/1.1 200 O* "status": true,
  30. {
  31. "status": true,
  32. "status_code": 0,
  33. "message": "",
  34. "data": {
  35. "id": 1,
  36. "phone": "13880642880",
  37. "nickname": "name1",
  38. "avatar": "/upload/user/20170629/e77068cc14c82086fb6b16e5bb7c3dd1.jpg",
  39. "birthday": "2000-06-21",
  40. "sign": 0,
  41. "money": 0,
  42. "coin": 308,
  43. "sex": 1,
  44. "signture": "我的个性签名1",
  45. "height": 170,
  46. "work": "网红",
  47. "emotion": 1,
  48. "address": "",
  49. "city": "上海",
  50. "detail_address": "",
  51. "status": 1,
  52. "wechat": "",
  53. "weibo": "",
  54. "remember_token": "",
  55. "created_at": "2017-06-25 10:27:08",
  56. "updated_at": "2017-08-19 13:24:29",
  57. "deleted_at": null,
  58. "care_number": 0, 关注
  59. "fans_number": 0, 粉丝
  60. "dreams_number": 9, 梦想
  61. "collection_number": 0, 收藏
  62. "interaction_number": 0, 发帖
  63. "huitie": 1, 回复
  64. }
  65. }
  66. * @apiErrorExample {json} Error-Response:
  67. * HTTP/1.1 400 Bad Request
  68. *{
  69. * "status": true,
  70. * "status_code": 0,
  71. * "message": "",
  72. * "data": {
  73. * "user": null
  74. * }
  75. *}
  76. */
  77. public function show()
  78. {
  79. $user = $this->getUser();
  80. /*
  81. * 我的关注人数,我的粉丝,收藏
  82. * 点赞?徽章?
  83. * */
  84. $care_num = $user->UserCareUser;
  85. $user->care_number = count($care_num);
  86. $fens = UserCareUser::where('other_user_id',$user->id)->get();
  87. $user->fans_number = count($fens);
  88. $dreams = $user->dreams;
  89. $user->dreams_number = count($dreams);
  90. $collection = $user->collection;
  91. $user->collection_number = count($collection);
  92. $interaction_infos = $user->allInteraction;
  93. $user->interaction_number = count($interaction_infos);
  94. $huitie = CommentInfoModel::where('user_id',$user->id)->orWhere('to_user_id',$user->id)->get()->groupBy('interaction_id');
  95. $user->huitie = count($huitie);
  96. return $this->api($user);
  97. }
  98. /**
  99. * @api {get} /api/my/edit 修改个人信息
  100. * @apiDescription 修改个人信息
  101. * @apiGroup My
  102. * @apiPermission Passport
  103. * @apiVersion 0.1.0
  104. * @apiSuccessExample {json} Success-Response:
  105. * HTTP/1.1 200 OK
  106. *{
  107. * "status": true,
  108. * "status_code": 0,
  109. * "message": "",
  110. "data": {
  111. "emotion": [
  112. {
  113. "value": "1",
  114. "name": "未婚"
  115. },
  116. {
  117. "value": "2",
  118. "name": "已婚"
  119. },
  120. {
  121. "value": "3",
  122. "name": "离异"
  123. }
  124. ],
  125. "sex": [
  126. {
  127. "value": "0",
  128. "name": "男"
  129. },
  130. {
  131. "value": "1",
  132. "name": "女"
  133. }
  134. ]
  135. }
  136. * }
  137. * @apiErrorExample {json} Error-Response:
  138. * HTTP/1.1 400 Bad Request
  139. * {
  140. * "status": false,
  141. * "status_code": 1500,
  142. * "message": "会员不存在",
  143. * "data": null
  144. * }
  145. */
  146. public function edit()
  147. {
  148. $sex = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
  149. where('dictionary_code','sex')->get();
  150. $emotion = BaseDictionaryOptionModel::where('dictionary_table_code','user_info')->
  151. where('dictionary_code','emotion')->get();
  152. return $this->api(compact('emotion','sex'));
  153. }
  154. /**
  155. * @api {post} /api/my/update 保存个人信息
  156. * @apiDescription 保存个人信息
  157. * @apiParam {string} pic 头像
  158. * @apiParam {int} sex 性别
  159. * @apiParam {string} signture 个性签名
  160. * @apiParam {int} emotion 情感状态
  161. * @apiParam {string} work 职业
  162. * @apiParam {int} height 身高
  163. * @apiGroup My
  164. * @apiPermission Passport
  165. * @apiVersion 0.1.0
  166. * @apiSuccessExample {json} Success-Response:
  167. * HTTP/1.1 200 OK
  168. *{
  169. * "status": true,
  170. * "status_code": 0,
  171. * "message": "",
  172. * "data": ""
  173. *}
  174. * @apiErrorExample {json} Error-Response:
  175. * HTTP/1.1 400 Bad Request
  176. *{
  177. * "status": false,
  178. * "status_code": 600,
  179. * "message": "保存用户数据失败",
  180. * "data": null
  181. * }
  182. */
  183. public function update(Request $request)
  184. {
  185. $user = $this->getUser();
  186. $data = $request->except('_token');
  187. $ok = $user->update($data);
  188. if ($ok == true) {
  189. return $this->api('');
  190. }else{
  191. return $this->error(ErrorCode::SAVE_USER_FAILED);
  192. }
  193. }
  194. /**
  195. * @api {post} /api/my/recharge 充值
  196. * @apiDescription 充值
  197. * @apiGroup My
  198. * @apiParam {int} coin 充值金额
  199. * @apiPermission Passport
  200. * @apiVersion 0.1.0
  201. * @apiSuccessExample {json} Success-Response:
  202. * HTTP/1.1 200 OK
  203. * @apiErrorExample {json} Error-Response:
  204. * HTTP/1.1 400 Bad Request
  205. */
  206. public function recharge(Request $request)
  207. {
  208. $validator = \Validator::make($request->all(),
  209. [
  210. 'coin' => 'required|integer',
  211. ],
  212. [
  213. 'coin.required' => '请填写金额',
  214. 'coin.integer' => '请输入整数',
  215. ]
  216. );
  217. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  218. $user = $this->getUser();
  219. $user->coin += $request->coin;
  220. $user->save();
  221. return $this->api('');
  222. }
  223. /**
  224. * @api {get} /api/my/dream_info 梦想消息
  225. * @apiDescription 梦想消息
  226. * @apiGroup My
  227. * @apiPermission Passport
  228. * @apiVersion 0.1.0
  229. * @apiSuccessExample {json} Success-Response:
  230. * HTTP/1.1 200 OK
  231. *{
  232. * "status": true,
  233. * "status_code": 0,
  234. * "message": "",
  235. * "data": [
  236. * {
  237. * ....
  238. * }
  239. * ]
  240. * @apiErrorExample {json} Error-Response:
  241. * HTTP/1.1 400 Bad Request
  242. */
  243. public function dreamInfo()
  244. {
  245. // 梦想消息分为 1支持 2收藏 3互动 4提现 5梦想暂停 6结束
  246. $user = $this->getUser();
  247. $data1 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->where('attr_id',1)->orderBy('id','desc')->get()->toArray();
  248. $new_data1 = [] ;
  249. if (count($data1) > 0) {
  250. if (count($data1) >= 5) {
  251. $data1[0]['message'] = "已经有".count($data1)."个人支持了你的梦想!";
  252. $new_data1[] = $data1[0];
  253. }else{
  254. $new_data1 = $data1;
  255. }
  256. }
  257. $data2 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->where('attr_id',2)->orderBy('id','desc')->get()->toArray();
  258. $new_data2 = [] ;
  259. if (count($data2) > 0) {
  260. if (count($data2) >= 5) {
  261. $data2[0]['message'] = "已经有".count($data2)."个人收藏了你的梦想!";
  262. $new_data2[] = $data2[0];
  263. }else{
  264. $new_data2 = $data2;
  265. }
  266. }
  267. $data3 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->where('attr_id',3)->orderBy('id','desc')->get()->toArray();
  268. $new_data3 = [] ;
  269. if (count($data3) > 0) {
  270. if (count($data3) >= 5) {
  271. $data3[0]['message'] = "你的互动已经有".count($data3)."个留言啦!快点击看看!";
  272. $new_data3[] = $data3[0];
  273. }else{
  274. $new_data3 = $data3;
  275. }
  276. }
  277. $data456 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)
  278. ->where(function ($query) {
  279. $query->where('attr_id',4)->orWhere('attr_id',5)->orWhere('attr_id',6);
  280. })->orderBy('id','desc')->get()->toArray();
  281. $data = array_merge($new_data1,$new_data2,$new_data3,$data456);
  282. SystemInfoModel::where('to_user_id',$user->id)->where('type_id',1)->update(['is_read' => 1]);
  283. return $this->api($data);
  284. // foreach ($data as $item){ //访问接口 标记已读
  285. // $item->update(['is_read'=>0]);
  286. // $info = InteractionInfo::find($item->interaction_id);
  287. // $dream_id =empty($info) ? 0 : $info->dream_id;
  288. // $item->dreamid = $dream_id;
  289. // }
  290. }
  291. /**
  292. * @api {get} /api/my/sup_info 支持消息
  293. * @apiDescription 支持消息
  294. * @apiGroup My
  295. * @apiPermission Passport
  296. * @apiVersion 0.1.0
  297. * @apiSuccessExample {json} Success-Response:
  298. * HTTP/1.1 200 OK
  299. *{
  300. * "status": true,
  301. * "status_code": 0,
  302. * "message": "",
  303. * "data": [
  304. * {
  305. * ....
  306. * }
  307. * ]
  308. * @apiErrorExample {json} Error-Response:
  309. * HTTP/1.1 400 Bad Request
  310. */
  311. public function supInfo()
  312. {
  313. // 支持消息有 7私信 8@ 9梦想倒计时 10排名 梦想结束
  314. // XX在互动上已经提起了你999次!你还不去瞧一瞧?你也太大牌啦!
  315. $user = $this->getUser();
  316. $data8 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->where('attr_id',8)->orderBy('id','desc')->get()->toArray();
  317. dd($data8);
  318. $new_data8 = [] ;
  319. if (count($data8) > 0) {
  320. if (count($data8) >= 5) {
  321. $data8[0]['message'] = "梦想互动上已经提起了你".count($data8)."次!你还不去瞧一瞧?你也太大牌啦!";
  322. $new_data8[] = $data8[0];
  323. }else{
  324. $new_data8 = $data8;
  325. }
  326. }
  327. $data9 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->where('attr_id','!=',8)->orderBy('id','desc')->get()->toArray();
  328. $data = array_merge($new_data8,$data9);
  329. SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->update(['is_read' => 1]);
  330. return $this->api($data);
  331. }
  332. /**
  333. * @api {get} /api/my/system_info 通知消息
  334. * @apiDescription 通知消息
  335. * @apiGroup My
  336. * @apiPermission Passport
  337. * @apiVersion 0.1.0
  338. * @apiSuccessExample {json} Success-Response:
  339. * HTTP/1.1 200 OK
  340. *{
  341. * "status": true,
  342. * "status_code": 0,
  343. * "message": "",
  344. * "data": [
  345. * {
  346. * ....
  347. * }
  348. * ]
  349. * @apiErrorExample {json} Error-Response:
  350. * HTTP/1.1 400 Bad Request
  351. */
  352. public function systemInfo()
  353. {
  354. $user = $this->getUser();
  355. $data = SystemInfoModel::where('user_id',$user->id)->where('type_id',0)->orderBy('id','desc')->get();
  356. foreach ($data as $item){ //访问接口 标记已读
  357. $item->update(['is_read'=>1]);
  358. }
  359. return $this->api($data);
  360. }
  361. /**
  362. * @api {get} /api/my/info 消息中心
  363. * @apiDescription 消息中心
  364. * @apiGroup My
  365. * @apiPermission Passport
  366. * @apiVersion 0.1.0
  367. * @apiSuccessExample {json} Success-Response:
  368. * HTTP/1.1 200 OK
  369. *{
  370. * "status": true,
  371. * "status_code": 0,
  372. * "message": "",
  373. * "data": {
  374. * "dream_info": {
  375. * "number": 3,
  376. * },
  377. * "sup_info": {
  378. * "number": 0,
  379. * },
  380. * "system_info": {
  381. * "number": 3,
  382. * }
  383. * }
  384. *}
  385. * @apiErrorExample {json} Error-Response:
  386. * HTTP/1.1 400 Bad Request
  387. */
  388. public function info()
  389. {
  390. $user = $this->getUser();
  391. /* $systemInfo1 = SystemInfoModel::where('user_id',$user->id)->whereNull('to_user_id')->orderBy('id','desc')->get();
  392. $systemInfo2 = SystemInfoModel::where('user_id',$user->id)->where('is_read','0')
  393. ->whereNull('to_user_id')->orderBy('id','desc')->get();
  394. $letter1 = SystemInfoModel::where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
  395. $letter2 = SystemInfoModel::where('user_id',$user->id)->where('is_read','0')
  396. ->whereNotNull('to_user_id')->orderBy('id','desc')->get();
  397. $comments1 = CommentInfoModel::where('to_user_id',$user->id)->orderBy('id','desc')->get();
  398. $comments2 = CommentInfoModel::where('to_user_id',$user->id)->where('is_read','1')->orderBy('id','desc')->get();
  399. $arr = [];
  400. $arr['systemInfo']['number'] = count($systemInfo1) ;
  401. $arr['systemInfo']['is_read'] = count($systemInfo2) ;
  402. $arr['letter']['number'] = count($letter1) ;
  403. $arr['letter']['is_read'] = count($letter2) ;
  404. $arr['reply']['number'] = count($comments1) ;
  405. $arr['reply']['is_read'] = count($comments2) ;*/
  406. // 梦想消息 支持消息 通知消息
  407. $user_id = $user->id;
  408. $dream_info = SystemInfoModel::where('to_user_id',$user_id)->where('type_id',1)->where('is_read',0)->orderBy('id','desc')->get();
  409. $sup_info = SystemInfoModel::where('to_user_id',$user_id)->where('type_id',2)->where('is_read',0)->orderBy('id','desc')->get();
  410. $system_info = SystemInfoModel::where('to_user_id',$user_id)->where('type_id',0)->where('is_read',0)->orderBy('id','desc')->get();
  411. $arr['dream_info']['number'] = count($dream_info) ;
  412. $arr['sup_info']['number'] = count($sup_info) ;
  413. $arr['system_info']['number'] = count($system_info) ;
  414. return $this->api($arr);
  415. }
  416. /**
  417. * @api {get} /api/my/read 设为已读
  418. * @apiDescription 设为已读
  419. * @apiGroup My
  420. * @apiPermission Passport
  421. * @apiVersion 0.1.0
  422. * @apiSuccessExample {json} Success-Response:
  423. * HTTP/1.1 200 OK
  424. *{
  425. * "status": true,
  426. * "status_code": 0,
  427. * "message": "",
  428. * "data": ""
  429. *}
  430. * @apiErrorExample {json} Error-Response:
  431. * HTTP/1.1 400 Bad Request
  432. * {
  433. * "status": false,
  434. * "status_code": 700,
  435. * "message": "操作失败",
  436. * "data": null
  437. *}
  438. */
  439. public function read()
  440. {
  441. $user = $this->getUser();
  442. $id = $user->id;
  443. $system_infos = SystemInfoModel::where(function ($query) use($id){
  444. $query->where('user_id',$id)->where('is_read','0');
  445. })->orWhere(function ($query) use($id){
  446. $query->where('to_user_id',$id)->where('is_read','0');
  447. })->orderBy('id','desc')->get();
  448. $comments = CommentInfoModel::where('user_id',$user->id)->where('is_read','0')->orderBy('id','desc')->get();
  449. foreach ($system_infos as $system_info){
  450. $system_info->update(['is_read'=>1]);
  451. }
  452. foreach ($comments as $comment){
  453. $comment->update(['is_read'=>1]);
  454. }
  455. if (count($system_infos) > 0 || count($comments) > 0) {
  456. return $this->api('');
  457. }else{
  458. return $this->error(ErrorCode::OPERATION_FAILED);
  459. }
  460. }
  461. /**
  462. * @api {get} /api/my/pay/article 支付说明
  463. * @apiDescription 支付说明
  464. * @apiGroup My
  465. * @apiPermission Passport
  466. * @apiVersion 0.1.0
  467. * @apiSuccessExample {json} Success-Response:
  468. * HTTP/1.1 200 OK
  469. *{
  470. * "status": true,
  471. * "status_code": 0,
  472. * "message": "",
  473. *"data": {
  474. * "key": "23453423453", 标题
  475. * "value": "<p><span style=\"color: rgb(255, 0, 0);\">42352345234534是大法官地方<
  476. * img src=\"/ueditor/php/upload/image/20170815/1502779635.jpg\" title=\"1502779635.jpg\" alt=\"a1.jpg\"/>234534</span><
  477. * br/></p>", 内容
  478. *}
  479. * ]
  480. *}
  481. * @apiErrorExample {json} Error-Response:
  482. * HTTP/1.1 400 Bad Request
  483. */
  484. public function payArticle()
  485. {
  486. $data = BaseSettingsModel::where('category','pay_article')->first();
  487. return $this->api($data);
  488. }
  489. /**
  490. * @api {post} /api/my/cash 提现
  491. * @apiDescription 提现
  492. * @apiGroup My
  493. * @apiParam {int} data[bank_id] 银行卡号id
  494. * @apiParam {int} data[cash] 提现金额
  495. * @apiPermission Passport
  496. * @apiVersion 0.1.0
  497. * @apiSuccessExample {json} Success-Response:
  498. * HTTP/1.1 200 OK
  499. *{
  500. * "status": false,
  501. * "status_code": 1413,
  502. * "message": "系统审核中",
  503. * "data": null
  504. *}
  505. * @apiErrorExample {json} Error-Response:
  506. *{
  507. * "status": false,
  508. * "status_code": 700,
  509. * "message": "操作失败",
  510. * "data": null
  511. *}
  512. */
  513. public function cash(Request $request)
  514. {
  515. $data = $request->data;
  516. $user = $this->getUser();
  517. $validator = \Validator::make($request->all(),
  518. [
  519. 'data.bank_id' => 'required|integer',
  520. 'data.cash' => 'required',
  521. ],
  522. [
  523. 'data.bank_id.required' => '请选择提现账号',
  524. 'data.bank_id.integer' => '提现账号不存在',
  525. 'data.cash.required' => '请输入金额',
  526. ]
  527. );
  528. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  529. // $info = [] ;
  530. // $info['from_type'] = '余额';
  531. // $info['from_id'] = $user->id;
  532. // $info['from_name'] = $user->name;
  533. // $info['op'] = '提现';
  534. // $info['from_amount'] = $data['coin'];
  535. // $info['to_type'] = '现金';
  536. // $info['to_id'] = $user->id;
  537. // $info['to_name'] = $data['account']; //账号
  538. // $info['note'] = $data['type'].$data['name'];
  539. // $ok = AccountLog::create($info);
  540. $data['user_id'] = $user->id;
  541. $data['status'] = 1;
  542. $ok = UserCashOut::create($data);
  543. $message = '你提现的¥'.$data["cash"].'已经到账啦,去实现梦想吧!喵~ ';
  544. $info = [
  545. 'user_id' => $user->id,
  546. 'message' => $message,
  547. 'attr_id' => 4,
  548. 'type_id' => 1,
  549. ];
  550. SystemInfoModel::create($info);
  551. // 长连接
  552. $this->jPush($message,'',$user->id);
  553. if ($ok) {
  554. return $this->api(ErrorCode::verify);
  555. }else{
  556. return $this->error(ErrorCode::OPERATION_FAILED);
  557. }
  558. }
  559. // 联系客服
  560. /**
  561. * @api {post} /api/my/suggest 联系客服
  562. * @apiDescription 联系客服
  563. * @apiGroup My
  564. * @apiParam {string} data[content] 内容
  565. * @apiParam {string} data[email] 邮箱
  566. * @apiPermission Passport
  567. * @apiVersion 0.1.0
  568. * @apiSuccessExample {json} Success-Response:
  569. * HTTP/1.1 200 OK
  570. *{
  571. * "status": true,
  572. * "status_code": 0,
  573. * "message": "",
  574. * "data": ""
  575. *}
  576. * @apiErrorExample {json} Error-Response:
  577. *{
  578. * "status": false,
  579. * "status_code": 700,
  580. * "message": "操作失败",
  581. * "data": null
  582. *}
  583. */
  584. public function suggest(Request $request)
  585. {
  586. $data = $request->data;
  587. $user = $this->getUser();
  588. $validator = \Validator::make($request->all(),
  589. [
  590. 'data.content' => 'required',
  591. 'data.email' => 'required|email',
  592. ],
  593. [
  594. 'data.content.required' => '请输入你遇到的问题',
  595. 'data.email.required' => '请输入正确的邮箱地址',
  596. 'data.email.email' => '请输入正确的邮箱地址',
  597. ]
  598. );
  599. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  600. $data['user_id'] = $user->id;
  601. $ok =Suggest::create($data);
  602. if ($ok) {
  603. return $this->api('');
  604. }else{
  605. return $this->error(ErrorCode::OPERATION_FAILED);
  606. }
  607. }
  608. // 回复我的
  609. // public function replyMy()
  610. // {
  611. //
  612. // $user = $this->getUser();
  613. //// 梦想
  614. // $dreams = $user->UserDream;
  615. //
  616. // $data = $user->allInteraction;
  617. // foreach ($data as $item) {
  618. // $item->get_money = $item->dream->get_money;
  619. // $item->money = $item->dream->money;
  620. // }
  621. // dd($data) ;
  622. // if (count($dreams) == 0)
  623. // return $this->error(ErrorCode::DREAM_NOT_EXIST);
  624. // $comments_infos = [];
  625. // foreach ($dreams as $dream){
  626. // $comments_info = $dream->DreamInfo;
  627. // if (count($comments_info) > 0) {
  628. // foreach ($comments_info as $k => $value) {
  629. // $value->dream_name = $dream->dream;
  630. // $value->dream_about = $dream->about;
  631. // $value->dream_pic = count($dream->dreamImgsFirst) > 0 ? $dream->dreamImgsFirst->pic : '';
  632. // $value->progress = $dream->money == 0 ? 0 : floor($dream->get_money/$dream->money);
  633. // $value->reviewer = $value->CommentUser->nickname;
  634. // $value->reviewer_pic = $value->CommentUser->pic;
  635. // }
  636. // $comments_infos[] = $comments_info;
  637. // }
  638. // }
  639. //
  640. // return $this->api(compact('comments_infos'));
  641. // }
  642. /**
  643. * @api {get} /api/my/dream 我的梦想
  644. * @apiDescription 我的梦想
  645. * @apiGroup My
  646. * @apiPermission Passport
  647. * @apiVersion 0.1.0
  648. * @apiSuccessExample {json} Success-Response:
  649. * HTTP/1.1 200 OK
  650. {
  651. "status": true,
  652. "status_code": 0,
  653. "message": "",
  654. "data": {
  655. "current_page": 1,
  656. "data": [
  657. {
  658. "id": 32,
  659. "user_id": 1,
  660. "name": "name",
  661. "about": "13880642880",
  662. "coin": 100,
  663. "end_time": "0000-00-00 00:00:00",
  664. "get_coin": 2017,
  665. "mark": 100,
  666. "status": 127,
  667. "video": "0",
  668. "score": 0,
  669. "sign": "158730",
  670. "code": "http://www.miao.com/qrcodes/WECHATPAY_201708191324294255.png",
  671. "parameter": 0,
  672. "created_at": "2017-08-19 05:22:12",
  673. "updated_at": "2017-08-19 05:24:30",
  674. "img": {
  675. "title": "",
  676. "pic": "http://q8.9026.com/upload/dream/20170629/79c11614cc8a9d37f747e3974d055331.jpg"
  677. }
  678. },
  679. ],
  680. "from": 1,
  681. "last_page": 4,
  682. "next_page_url": "http://www.miao.com/api/my/dream?page=2",
  683. "path": "http://www.miao.com/api/my/dream",
  684. "per_page": 10,
  685. "prev_page_url": null,
  686. "to": 10,
  687. "total": 36
  688. }
  689. }
  690. * @apiErrorExample {json} Error-Response:
  691. * HTTP/1.1 400 Bad Request
  692. */
  693. public function dream()
  694. {
  695. $user = $this->getUser();
  696. $dreams = DreamInfoModel::where('user_id',$user->id)->orderBy('created_at','desc')->with('img')->paginate();
  697. return $this->api($dreams);
  698. }
  699. /**
  700. * @api {get} /api/my/collection 我的收藏
  701. * @apiDescription 我的收藏
  702. * @apiGroup My
  703. * @apiPermission Passport
  704. * @apiParam {string} [keyword] 关键字可选
  705. * @apiVersion 0.1.0
  706. * @apiSuccessExample {json} Success-Response:
  707. * HTTP/1.1 200 OK
  708. *{
  709. * "status": true,
  710. * "status_code": 0,
  711. * "message": "",
  712. * "data": {
  713. * "data": [
  714. * { 梦想详情
  715. * "id": 12,
  716. * "user_id": 2,
  717. * "name": "用户2梦想标题166",
  718. * "about": "用户2梦想介绍666",
  719. * "coin": 2500,
  720. * "time": 21,
  721. * "get_coin": 0,
  722. * "status": 0,
  723. * "video": null,
  724. * "sign": "",
  725. * },
  726. * "img": {
  727. * "title": "",
  728. * "pic": "https://f12f.jpg" 梦想封面图片
  729. * }
  730. * ],
  731. * "users": {
  732. * "2": "https://xxx.jpeg" ID号和头像
  733. * }
  734. * }
  735. *}
  736. * keyword存在
  737. *{
  738. * "status": true,
  739. * "status_code": 0,
  740. * "message": "",
  741. * "data": [
  742. * {
  743. * "id": 2,
  744. * "user_id": 1,
  745. * "dream_id": 12,
  746. * "dream_user_id": 2,
  747. * "interaction_number": 0,
  748. * "created_at": "2017-06-25 13:11:45",
  749. * "updated_at": "2017-06-25 13:11:45",
  750. * "dreams": [ 梦想
  751. * {
  752. * "id": 12,
  753. * "user_id": 2,
  754. * "name": "用户2梦想标题166",
  755. * "about": "用户2梦想介绍666",
  756. * "coin": 2500,
  757. * "end_time": 72000,
  758. * "get_coin": 792,
  759. * "mark": 5484,
  760. * "status": 0,
  761. * "video": "e",
  762. * "score": 158730,
  763. * "sign": "梦想达人",
  764. * "created_at": "2017-06-25 13:10:56",
  765. * "updated_at": "2017-06-28 16:53:39"
  766. * "img": { 图片
  767. * "title": "",
  768. * "pic": "https://timgsa.baidu.com/timg9&di2f.jpg"
  769. * },
  770. * "user": {
  771. *
  772. * }
  773. * }
  774. * ]
  775. * }
  776. * ]
  777. *}
  778. * @apiErrorExample {json} Error-Response:
  779. * HTTP/1.1 400 Bad Request
  780. */
  781. public function collection(Request $request)
  782. {
  783. $user = $this->getUser();
  784. if ($request->keyword) {
  785. $keyword ='%'.$request->keyword.'%';
  786. $data = UserCareDream::where('user_id',$user->id)->
  787. whereHas('dreams',function ($query) use($keyword){
  788. $query->where('end_time','>=',time())->where('name','like',$keyword);
  789. })->with('dreams')->get();
  790. foreach ($data as $item) {
  791. foreach ($item->dreams as $dream) {
  792. $dream->img;
  793. }
  794. }
  795. $this->insertSearchTable($user->id,$request->keyword);
  796. return $this->api($data);
  797. }else{
  798. $dreams = $user->collection;
  799. // $users = [];
  800. foreach ($dreams as $item) {
  801. /* if ($item->pivot->interaction_number > 0) {
  802. $user_info = UserInfoModel::find($item->pivot->dream_user_id);
  803. $avatar = $user_info ? $user_info->avatar : '';
  804. if (!array_key_exists($item->pivot->dream_user_id,$users)) {
  805. $users[$item->pivot->dream_user_id] = $avatar;
  806. }
  807. }*/
  808. $item->img;
  809. $item->user;
  810. }
  811. return $this->api(compact('dreams'));
  812. }
  813. }
  814. /**
  815. * @api {get} /api/my/miao 关于喵喵
  816. * @apiDescription 关于喵喵
  817. * @apiGroup My
  818. * @apiPermission Passport
  819. * @apiVersion 0.1.0
  820. * @apiSuccessExample {json} Success-Response:
  821. * HTTP/1.1 200 OK
  822. *{
  823. * "status": true,
  824. * "status_code": 0,
  825. * "message": "",
  826. * "data": {
  827. * "key": "2511789", 电话
  828. * "value": "关于喵喵介绍" 关于喵喵
  829. * }
  830. *}
  831. * @apiErrorExample {json} Error-Response:
  832. * HTTP/1.1 400 Bad Request
  833. */
  834. public function aboutMiao()
  835. {
  836. $data = BaseSettingsModel::where('category','miaomiao')->select('key','value')->first();
  837. return $this->api($data);
  838. }
  839. /**
  840. * @api {get} /api/my/care 我关注的用户
  841. * @apiDescription 我关注的用户
  842. * @apiGroup My
  843. * @apiPermission Passport
  844. * @apiVersion 0.1.0
  845. * @apiSuccessExample {json} Success-Response:
  846. * HTTP/1.1 200 OK
  847. *{
  848. * "status": true,
  849. * "status_code": 0,
  850. * "message": "",
  851. * "data":[] or
  852. * "data": [
  853. * {
  854. * "id": 2,
  855. * "phone": "13880642881",
  856. * "nickname": "name2",
  857. * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
  858. * "birthday": "2000-06-21",
  859. * "sign": 0,
  860. * "money": 0,
  861. * "coin": 800,
  862. * "sex": 1,
  863. * "signture": "我的个性签名2",
  864. * "height": 200,
  865. * "work": "兼职",
  866. * "emotion": 2,
  867. * "address": "370105",
  868. * "city": "成都",
  869. * "detail_address": "",
  870. * "status": 1,
  871. * "wechat": "",
  872. * "weibo": "",
  873. * "remember_token": "",
  874. * "created_at": "2017-06-25 10:42:06",
  875. * "updated_at": "2017-06-30 09:15:04",
  876. * "deleted_at": null,
  877. * }
  878. * ]
  879. *}
  880. * @apiErrorExample {json} Error-Response:
  881. * HTTP/1.1 400 Bad Request
  882. */
  883. public function care()
  884. {
  885. $user = $this->getUser();
  886. $users =$user->UserCareUser;
  887. return $this->api($users);
  888. }
  889. /**
  890. * @api {get} /api/my/careme 关注我的用户
  891. * @apiDescription 关注我的用户
  892. * @apiGroup My
  893. * @apiPermission Passport
  894. * @apiVersion 0.1.0
  895. * @apiSuccessExample {json} Success-Response:
  896. * HTTP/1.1 200 OK
  897. *{
  898. * "status": true,
  899. * "status_code": 0,
  900. * "message": "",
  901. * "data":[] or
  902. * "data": [
  903. * {
  904. * "id": 2,
  905. * "phone": "13880642881",
  906. * "nickname": "name2",
  907. * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
  908. * "birthday": "2000-06-21",
  909. * "sign": 0,
  910. * "money": 0,
  911. * "coin": 800,
  912. * "sex": 1,
  913. * "signture": "我的个性签名2",
  914. * "height": 200,
  915. * "work": "兼职",
  916. * "emotion": 2,
  917. * "address": "370105",
  918. * "city": "成都",
  919. * "detail_address": "",
  920. * "status": 1,
  921. * "wechat": "",
  922. * "weibo": "",
  923. * "remember_token": "",
  924. * "created_at": "2017-06-25 10:42:06",
  925. * "updated_at": "2017-06-30 09:15:04",
  926. * "deleted_at": null,
  927. * }
  928. * ]
  929. *}
  930. * @apiErrorExample {json} Error-Response:
  931. * HTTP/1.1 400 Bad Request
  932. */
  933. public function careMe()
  934. {
  935. $user = $this->getUser();
  936. $users =$user->UserCareMe;
  937. return $this->api($users);
  938. }
  939. public function insertSearchTable($id,$keyword)
  940. {
  941. $info = SearchInfoModel::where('user_id',$id)->
  942. where('search',trim($keyword))->first();
  943. if (count($info) == 0) {
  944. SearchInfoModel::create(['user_id'=>$id,'search'=>trim($keyword),'times'=>1]);
  945. }else{
  946. $info->times += 1;
  947. $info->save();
  948. }
  949. }
  950. //我的银行账户
  951. /**
  952. * @api {get} /api/my/bank/list 我的银行账户
  953. * @apiDescription 我的银行账户
  954. * @apiGroup My
  955. * @apiPermission Passport
  956. * @apiVersion 0.1.0
  957. * @apiSuccessExample {json} Success-Response:
  958. * HTTP/1.1 200 OK
  959. *{
  960. * "status": true,
  961. * "status_code": 0,
  962. * "message": "",
  963. * "data":[] or
  964. * "data": [
  965. * {
  966. * "id": 1,
  967. * "user_id": 1,
  968. * "bank_name": "1",
  969. * "bank_number": "1", /账号
  970. * "bank_phone": "1",
  971. * "bank_user": "" 用户名/
  972. * "type": 微信, 微信(支付宝)二维码
  973. * "url": wwww.ddf, 二维码地址
  974. * "is_img": 1,
  975. * }
  976. *]
  977. * @apiErrorExample {json} Error-Response:
  978. * HTTP/1.1 400 Bad Request
  979. */
  980. public function bankList()
  981. {
  982. $user = $this->getUser();
  983. $data = UserBank::where('user_id',$user->id)->orderBy('id','desc')->get();
  984. return $this->api($data);
  985. }
  986. /**
  987. * @api {get} /api/my/bank/account 账户余额
  988. * @apiDescription 账户余额
  989. * @apiGroup My
  990. * @apiPermission Passport
  991. * @apiVersion 0.1.0
  992. * @apiSuccessExample {json} Success-Response:
  993. * HTTP/1.1 200 OK
  994. *{
  995. * "status": true,
  996. * "status_code": 0,
  997. * "message": "",
  998. * "data":[] or
  999. * "data": {
  1000. * "coin": 508, 余额
  1001. * }
  1002. *]
  1003. * @apiErrorExample {json} Error-Response:
  1004. * HTTP/1.1 400 Bad Request
  1005. */
  1006. public function account()
  1007. {
  1008. $user = $this->getUser();
  1009. return $this->api($user);
  1010. }
  1011. // 添加银行卡
  1012. /**
  1013. * @api {post} /api/my/bank/create 添加银行卡
  1014. * @apiDescription 添加银行卡
  1015. * @apiGroup My
  1016. * @apiParam {string} data[bank_name] 银行名称
  1017. * @apiParam {string} data[bank_number] 银行卡号
  1018. * @apiParam {int} data[bank_phone] 银行卡绑定手机号
  1019. * @apiParam {string} data[bank_user] 银行卡用户姓名
  1020. * @apiPermission Passport
  1021. * @apiVersion 0.1.0
  1022. * @apiSuccessExample {json} Success-Response:
  1023. * HTTP/1.1 200 OK
  1024. *{
  1025. * "status": true,
  1026. * "status_code": 0,
  1027. * "message": "",
  1028. * "data": ""
  1029. *}
  1030. * @apiErrorExample {json} Error-Response:
  1031. *{
  1032. * "status": false,
  1033. * "status_code": 700,
  1034. * "message": "操作失败",
  1035. * "data": null
  1036. *}
  1037. */
  1038. public function bankCreate(Request $request)
  1039. {
  1040. $data = $request->data;
  1041. $user = $this->getUser();
  1042. $validator = \Validator::make($request->all(),
  1043. [
  1044. 'data.bank_name' => 'required',
  1045. 'data.bank_number' => 'required',
  1046. 'data.bank_phone' => 'required',
  1047. 'data.bank_user' => 'required',
  1048. ],
  1049. [
  1050. 'data.bank_name.required' => '请选择账号类型',
  1051. 'data.bank_number.required' => '请输入账号',
  1052. 'data.bank_phone.required' => '请输入账号绑定手机号码',
  1053. 'data.bank_user.required' => '请输入账号绑定用户姓名',
  1054. ]
  1055. );
  1056. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1057. $data['user_id'] = $user->id;
  1058. $ok =UserBank::create($data);
  1059. if ($ok) {
  1060. return $this->api('');
  1061. }else{
  1062. return $this->error(ErrorCode::OPERATION_FAILED);
  1063. }
  1064. } /**
  1065. * @api {post} /api/my/bank/qrcode 添加二维码
  1066. * @apiDescription 添加二维码
  1067. * @apiGroup My
  1068. * @apiParam {string} data[type] 类型
  1069. * @apiParam {string} data[qrcode] 二维码图片
  1070. * @apiPermission Passport
  1071. * @apiVersion 0.1.0
  1072. * @apiSuccessExample {json} Success-Response:
  1073. * HTTP/1.1 200 OK
  1074. *{
  1075. * "status": true,
  1076. * "status_code": 0,
  1077. * "message": "",
  1078. * "data": ""
  1079. *}
  1080. * @apiErrorExample {json} Error-Response:
  1081. *{
  1082. * "status": false,
  1083. * "status_code": 700,
  1084. * "message": "操作失败",
  1085. * "data": null
  1086. *}
  1087. */
  1088. public function bankImgCreate(Request $request)
  1089. {
  1090. $data = $request->data;
  1091. $user = $this->getUser();
  1092. $validator = \Validator::make($request->all(),
  1093. [
  1094. 'data.type' => 'required',
  1095. 'data.qrcode' => 'required',
  1096. ],
  1097. [
  1098. 'data.type.required' => '请选择账号类型',
  1099. 'data.qrcode.required' => '请上传二维码图片',
  1100. ]
  1101. );
  1102. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1103. $data['user_id'] = $user->id;
  1104. /* $data['bank_user'] = '';
  1105. $data['bank_phone'] = '';
  1106. $data['bank_number'] = '';
  1107. $data['bank_name'] = '';*/
  1108. $info = UserBank::whereNotNull('qrcode')->where('user_id',$user->id)
  1109. ->where('type',$data['type'])->first(); //定义为二维码
  1110. if (empty($info)) {
  1111. $ok =UserBank::create($data);
  1112. }else{
  1113. $ok = $info->update($data);
  1114. }
  1115. if ($ok) {
  1116. return $this->api('');
  1117. }else{
  1118. return $this->error(ErrorCode::OPERATION_FAILED);
  1119. }
  1120. }
  1121. /**
  1122. * @api {get} /api/my/bank/delete 删除银行卡
  1123. * @apiDescription 删除银行卡
  1124. * @apiGroup My
  1125. * @apiParam {int} id 银行卡id
  1126. * @apiPermission Passport
  1127. * @apiVersion 0.1.0
  1128. * @apiSuccessExample {json} Success-Response:
  1129. * HTTP/1.1 200 OK
  1130. *{
  1131. * "status": true,
  1132. * "status_code": 0,
  1133. * "message": "",
  1134. * "data": ""
  1135. *}
  1136. * @apiErrorExample {json} Error-Response:
  1137. *{
  1138. * "status": false,
  1139. * "status_code": 700,
  1140. * "message": "操作失败",
  1141. * "data": null
  1142. *}
  1143. */
  1144. public function bankDelete(Request $request)
  1145. {
  1146. $id = $request->id;
  1147. $validator = \Validator::make($request->all(),
  1148. [
  1149. 'id' => 'required',
  1150. ],
  1151. [
  1152. 'id.required' => '银行账号不存在',
  1153. ]
  1154. );
  1155. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1156. $ok =UserBank::destroy($id);
  1157. if ($ok) {
  1158. return $this->api('');
  1159. }else{
  1160. return $this->error(ErrorCode::OPERATION_FAILED);
  1161. }
  1162. }
  1163. // 发私信
  1164. /**
  1165. * @api {post} /api/my/letter/store 发送私信
  1166. * @apiDescription 发送私信
  1167. * @apiGroup My
  1168. * @apiParam {string} content 私信内容
  1169. * @apiParam {int} to_user_id 私信对象
  1170. * @apiPermission Passport
  1171. * @apiVersion 0.1.0
  1172. * @apiSuccessExample {json} Success-Response:
  1173. * HTTP/1.1 200 OK
  1174. *{
  1175. * "status": true,
  1176. * "status_code": 0,
  1177. * "message": "",
  1178. * "data": ""
  1179. *}
  1180. * @apiErrorExample {json} Error-Response:
  1181. *{
  1182. * "status": false,
  1183. * "status_code": 700,
  1184. * "message": "操作失败",
  1185. * "data": null
  1186. *}
  1187. */
  1188. public function letterStore(Request $request)
  1189. {
  1190. $validator = \Validator::make($request->all(),
  1191. [
  1192. 'content' => 'required',
  1193. 'to_user_id' => 'required',
  1194. ],
  1195. [
  1196. 'content.required' => '私信内容不存在',
  1197. 'to_user_id.required' => '私信对象不存在',
  1198. ]
  1199. );
  1200. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1201. $user = $this->getUser();
  1202. $user_id = $user->id;
  1203. $info = $request->input('content');
  1204. $to_user_id = $request->input('to_user_id');
  1205. // 链接到最近的一个梦想
  1206. $dream = DreamInfoModel::where('user_id',$user_id)->orderBy('id','desc')->first();
  1207. $dream_id = empty($dream) ? 0 : $dream->id;
  1208. $arr = [
  1209. 'user_id'=>$to_user_id,
  1210. 'info'=>$info,
  1211. 'message'=>$user->nickname.'给你发了个私信哦~点击看看!',
  1212. 'to_user_id'=>$user_id,
  1213. 'dream_id'=>$dream_id,
  1214. 'type_id'=>2,
  1215. 'is_url'=>1,
  1216. 'attr_id'=>9,
  1217. ];
  1218. $ok =SystemInfoModel::create($arr);
  1219. if ($ok) {
  1220. $this->jPush($user->nickname.'给你发了个私信哦~点击看看!','',$to_user_id);
  1221. return $this->api('');
  1222. }else{
  1223. return $this->error(ErrorCode::OPERATION_FAILED);
  1224. }
  1225. } /**
  1226. * @api {get} /api/my/letter/show 查看私信
  1227. * @apiDescription 查看私信
  1228. * @apiGroup My
  1229. * @apiParam {int} id 私信主键id
  1230. * @apiPermission Passport
  1231. * @apiVersion 0.1.0
  1232. * @apiSuccessExample {json} Success-Response:
  1233. * HTTP/1.1 200 OK
  1234. *{
  1235. * "status": true,
  1236. * "status_code": 0,
  1237. * "message": "",
  1238. * "data": ""
  1239. *}
  1240. * @apiErrorExample {json} Error-Response:
  1241. *{
  1242. * "status": false,
  1243. * "status_code": 700,
  1244. * "message": "操作失败",
  1245. * "data": null
  1246. *}
  1247. */
  1248. public function letterShow(Request $request)
  1249. {
  1250. $validator = \Validator::make($request->all(),
  1251. [
  1252. 'id' => 'required',
  1253. ],
  1254. [
  1255. 'id.required' => '私信id不存在',
  1256. ]
  1257. );
  1258. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1259. $user = $this->getUser();
  1260. $user_id = $user->id;
  1261. $id = $request->input('id');
  1262. $data = SystemInfoModel::find($id);
  1263. return $this->api($data);
  1264. }
  1265. }