MyController.php 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312
  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. $count = array_count_values(array_column($data8,"interaction_id"));
  318. dd($count);
  319. $new_data8 = [] ;
  320. if (count($data8) > 0) {
  321. if (count($data8) >= 5) {
  322. $data8[0]['message'] = "梦想互动上已经提起了你".count($data8)."次!你还不去瞧一瞧?你也太大牌啦!";
  323. $new_data8[] = $data8[0];
  324. }else{
  325. $new_data8 = $data8;
  326. }
  327. }
  328. $data9 = SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->where('attr_id','!=',8)->orderBy('id','desc')->get()->toArray();
  329. $data = array_merge($new_data8,$data9);
  330. SystemInfoModel::where('to_user_id',$user->id)->where('type_id',2)->update(['is_read' => 1]);
  331. return $this->api($data);
  332. }
  333. /**
  334. * @api {get} /api/my/system_info 通知消息
  335. * @apiDescription 通知消息
  336. * @apiGroup My
  337. * @apiPermission Passport
  338. * @apiVersion 0.1.0
  339. * @apiSuccessExample {json} Success-Response:
  340. * HTTP/1.1 200 OK
  341. *{
  342. * "status": true,
  343. * "status_code": 0,
  344. * "message": "",
  345. * "data": [
  346. * {
  347. * ....
  348. * }
  349. * ]
  350. * @apiErrorExample {json} Error-Response:
  351. * HTTP/1.1 400 Bad Request
  352. */
  353. public function systemInfo()
  354. {
  355. $user = $this->getUser();
  356. $data = SystemInfoModel::where('user_id',$user->id)->where('type_id',0)->orderBy('id','desc')->get();
  357. foreach ($data as $item){ //访问接口 标记已读
  358. $item->update(['is_read'=>1]);
  359. }
  360. return $this->api($data);
  361. }
  362. /**
  363. * @api {get} /api/my/info 消息中心
  364. * @apiDescription 消息中心
  365. * @apiGroup My
  366. * @apiPermission Passport
  367. * @apiVersion 0.1.0
  368. * @apiSuccessExample {json} Success-Response:
  369. * HTTP/1.1 200 OK
  370. *{
  371. * "status": true,
  372. * "status_code": 0,
  373. * "message": "",
  374. * "data": {
  375. * "dream_info": {
  376. * "number": 3,
  377. * },
  378. * "sup_info": {
  379. * "number": 0,
  380. * },
  381. * "system_info": {
  382. * "number": 3,
  383. * }
  384. * }
  385. *}
  386. * @apiErrorExample {json} Error-Response:
  387. * HTTP/1.1 400 Bad Request
  388. */
  389. public function info()
  390. {
  391. $user = $this->getUser();
  392. /* $systemInfo1 = SystemInfoModel::where('user_id',$user->id)->whereNull('to_user_id')->orderBy('id','desc')->get();
  393. $systemInfo2 = SystemInfoModel::where('user_id',$user->id)->where('is_read','0')
  394. ->whereNull('to_user_id')->orderBy('id','desc')->get();
  395. $letter1 = SystemInfoModel::where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
  396. $letter2 = SystemInfoModel::where('user_id',$user->id)->where('is_read','0')
  397. ->whereNotNull('to_user_id')->orderBy('id','desc')->get();
  398. $comments1 = CommentInfoModel::where('to_user_id',$user->id)->orderBy('id','desc')->get();
  399. $comments2 = CommentInfoModel::where('to_user_id',$user->id)->where('is_read','1')->orderBy('id','desc')->get();
  400. $arr = [];
  401. $arr['systemInfo']['number'] = count($systemInfo1) ;
  402. $arr['systemInfo']['is_read'] = count($systemInfo2) ;
  403. $arr['letter']['number'] = count($letter1) ;
  404. $arr['letter']['is_read'] = count($letter2) ;
  405. $arr['reply']['number'] = count($comments1) ;
  406. $arr['reply']['is_read'] = count($comments2) ;*/
  407. // 梦想消息 支持消息 通知消息
  408. $user_id = $user->id;
  409. $dream_info = SystemInfoModel::where('to_user_id',$user_id)->where('type_id',1)->where('is_read',0)->orderBy('id','desc')->get();
  410. $sup_info = SystemInfoModel::where('to_user_id',$user_id)->where('type_id',2)->where('is_read',0)->orderBy('id','desc')->get();
  411. $system_info = SystemInfoModel::where('to_user_id',$user_id)->where('type_id',0)->where('is_read',0)->orderBy('id','desc')->get();
  412. $arr['dream_info']['number'] = count($dream_info) ;
  413. $arr['sup_info']['number'] = count($sup_info) ;
  414. $arr['system_info']['number'] = count($system_info) ;
  415. return $this->api($arr);
  416. }
  417. /**
  418. * @api {get} /api/my/read 设为已读
  419. * @apiDescription 设为已读
  420. * @apiGroup My
  421. * @apiPermission Passport
  422. * @apiVersion 0.1.0
  423. * @apiSuccessExample {json} Success-Response:
  424. * HTTP/1.1 200 OK
  425. *{
  426. * "status": true,
  427. * "status_code": 0,
  428. * "message": "",
  429. * "data": ""
  430. *}
  431. * @apiErrorExample {json} Error-Response:
  432. * HTTP/1.1 400 Bad Request
  433. * {
  434. * "status": false,
  435. * "status_code": 700,
  436. * "message": "操作失败",
  437. * "data": null
  438. *}
  439. */
  440. public function read()
  441. {
  442. $user = $this->getUser();
  443. $id = $user->id;
  444. $system_infos = SystemInfoModel::where(function ($query) use($id){
  445. $query->where('user_id',$id)->where('is_read','0');
  446. })->orWhere(function ($query) use($id){
  447. $query->where('to_user_id',$id)->where('is_read','0');
  448. })->orderBy('id','desc')->get();
  449. $comments = CommentInfoModel::where('user_id',$user->id)->where('is_read','0')->orderBy('id','desc')->get();
  450. foreach ($system_infos as $system_info){
  451. $system_info->update(['is_read'=>1]);
  452. }
  453. foreach ($comments as $comment){
  454. $comment->update(['is_read'=>1]);
  455. }
  456. if (count($system_infos) > 0 || count($comments) > 0) {
  457. return $this->api('');
  458. }else{
  459. return $this->error(ErrorCode::OPERATION_FAILED);
  460. }
  461. }
  462. /**
  463. * @api {get} /api/my/pay/article 支付说明
  464. * @apiDescription 支付说明
  465. * @apiGroup My
  466. * @apiPermission Passport
  467. * @apiVersion 0.1.0
  468. * @apiSuccessExample {json} Success-Response:
  469. * HTTP/1.1 200 OK
  470. *{
  471. * "status": true,
  472. * "status_code": 0,
  473. * "message": "",
  474. *"data": {
  475. * "key": "23453423453", 标题
  476. * "value": "<p><span style=\"color: rgb(255, 0, 0);\">42352345234534是大法官地方<
  477. * img src=\"/ueditor/php/upload/image/20170815/1502779635.jpg\" title=\"1502779635.jpg\" alt=\"a1.jpg\"/>234534</span><
  478. * br/></p>", 内容
  479. *}
  480. * ]
  481. *}
  482. * @apiErrorExample {json} Error-Response:
  483. * HTTP/1.1 400 Bad Request
  484. */
  485. public function payArticle()
  486. {
  487. $data = BaseSettingsModel::where('category','pay_article')->first();
  488. return $this->api($data);
  489. }
  490. /**
  491. * @api {post} /api/my/cash 提现
  492. * @apiDescription 提现
  493. * @apiGroup My
  494. * @apiParam {int} data[bank_id] 银行卡号id
  495. * @apiParam {int} data[cash] 提现金额
  496. * @apiPermission Passport
  497. * @apiVersion 0.1.0
  498. * @apiSuccessExample {json} Success-Response:
  499. * HTTP/1.1 200 OK
  500. *{
  501. * "status": false,
  502. * "status_code": 1413,
  503. * "message": "系统审核中",
  504. * "data": null
  505. *}
  506. * @apiErrorExample {json} Error-Response:
  507. *{
  508. * "status": false,
  509. * "status_code": 700,
  510. * "message": "操作失败",
  511. * "data": null
  512. *}
  513. */
  514. public function cash(Request $request)
  515. {
  516. $data = $request->data;
  517. $user = $this->getUser();
  518. $validator = \Validator::make($request->all(),
  519. [
  520. 'data.bank_id' => 'required|integer',
  521. 'data.cash' => 'required',
  522. ],
  523. [
  524. 'data.bank_id.required' => '请选择提现账号',
  525. 'data.bank_id.integer' => '提现账号不存在',
  526. 'data.cash.required' => '请输入金额',
  527. ]
  528. );
  529. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  530. // $info = [] ;
  531. // $info['from_type'] = '余额';
  532. // $info['from_id'] = $user->id;
  533. // $info['from_name'] = $user->name;
  534. // $info['op'] = '提现';
  535. // $info['from_amount'] = $data['coin'];
  536. // $info['to_type'] = '现金';
  537. // $info['to_id'] = $user->id;
  538. // $info['to_name'] = $data['account']; //账号
  539. // $info['note'] = $data['type'].$data['name'];
  540. // $ok = AccountLog::create($info);
  541. $data['user_id'] = $user->id;
  542. $data['status'] = 1;
  543. $ok = UserCashOut::create($data);
  544. $message = '你提现的¥'.$data["cash"].'已经到账啦,去实现梦想吧!喵~ ';
  545. $info = [
  546. 'user_id' => $user->id,
  547. 'message' => $message,
  548. 'attr_id' => 4,
  549. 'type_id' => 1,
  550. ];
  551. SystemInfoModel::create($info);
  552. // 长连接
  553. $this->jPush($message,'',$user->id);
  554. if ($ok) {
  555. return $this->api(ErrorCode::verify);
  556. }else{
  557. return $this->error(ErrorCode::OPERATION_FAILED);
  558. }
  559. }
  560. // 联系客服
  561. /**
  562. * @api {post} /api/my/suggest 联系客服
  563. * @apiDescription 联系客服
  564. * @apiGroup My
  565. * @apiParam {string} data[content] 内容
  566. * @apiParam {string} data[email] 邮箱
  567. * @apiPermission Passport
  568. * @apiVersion 0.1.0
  569. * @apiSuccessExample {json} Success-Response:
  570. * HTTP/1.1 200 OK
  571. *{
  572. * "status": true,
  573. * "status_code": 0,
  574. * "message": "",
  575. * "data": ""
  576. *}
  577. * @apiErrorExample {json} Error-Response:
  578. *{
  579. * "status": false,
  580. * "status_code": 700,
  581. * "message": "操作失败",
  582. * "data": null
  583. *}
  584. */
  585. public function suggest(Request $request)
  586. {
  587. $data = $request->data;
  588. $user = $this->getUser();
  589. $validator = \Validator::make($request->all(),
  590. [
  591. 'data.content' => 'required',
  592. 'data.email' => 'required|email',
  593. ],
  594. [
  595. 'data.content.required' => '请输入你遇到的问题',
  596. 'data.email.required' => '请输入正确的邮箱地址',
  597. 'data.email.email' => '请输入正确的邮箱地址',
  598. ]
  599. );
  600. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  601. $data['user_id'] = $user->id;
  602. $ok =Suggest::create($data);
  603. if ($ok) {
  604. return $this->api('');
  605. }else{
  606. return $this->error(ErrorCode::OPERATION_FAILED);
  607. }
  608. }
  609. // 回复我的
  610. // public function replyMy()
  611. // {
  612. //
  613. // $user = $this->getUser();
  614. //// 梦想
  615. // $dreams = $user->UserDream;
  616. //
  617. // $data = $user->allInteraction;
  618. // foreach ($data as $item) {
  619. // $item->get_money = $item->dream->get_money;
  620. // $item->money = $item->dream->money;
  621. // }
  622. // dd($data) ;
  623. // if (count($dreams) == 0)
  624. // return $this->error(ErrorCode::DREAM_NOT_EXIST);
  625. // $comments_infos = [];
  626. // foreach ($dreams as $dream){
  627. // $comments_info = $dream->DreamInfo;
  628. // if (count($comments_info) > 0) {
  629. // foreach ($comments_info as $k => $value) {
  630. // $value->dream_name = $dream->dream;
  631. // $value->dream_about = $dream->about;
  632. // $value->dream_pic = count($dream->dreamImgsFirst) > 0 ? $dream->dreamImgsFirst->pic : '';
  633. // $value->progress = $dream->money == 0 ? 0 : floor($dream->get_money/$dream->money);
  634. // $value->reviewer = $value->CommentUser->nickname;
  635. // $value->reviewer_pic = $value->CommentUser->pic;
  636. // }
  637. // $comments_infos[] = $comments_info;
  638. // }
  639. // }
  640. //
  641. // return $this->api(compact('comments_infos'));
  642. // }
  643. /**
  644. * @api {get} /api/my/dream 我的梦想
  645. * @apiDescription 我的梦想
  646. * @apiGroup My
  647. * @apiPermission Passport
  648. * @apiVersion 0.1.0
  649. * @apiSuccessExample {json} Success-Response:
  650. * HTTP/1.1 200 OK
  651. {
  652. "status": true,
  653. "status_code": 0,
  654. "message": "",
  655. "data": {
  656. "current_page": 1,
  657. "data": [
  658. {
  659. "id": 32,
  660. "user_id": 1,
  661. "name": "name",
  662. "about": "13880642880",
  663. "coin": 100,
  664. "end_time": "0000-00-00 00:00:00",
  665. "get_coin": 2017,
  666. "mark": 100,
  667. "status": 127,
  668. "video": "0",
  669. "score": 0,
  670. "sign": "158730",
  671. "code": "http://www.miao.com/qrcodes/WECHATPAY_201708191324294255.png",
  672. "parameter": 0,
  673. "created_at": "2017-08-19 05:22:12",
  674. "updated_at": "2017-08-19 05:24:30",
  675. "img": {
  676. "title": "",
  677. "pic": "http://q8.9026.com/upload/dream/20170629/79c11614cc8a9d37f747e3974d055331.jpg"
  678. }
  679. },
  680. ],
  681. "from": 1,
  682. "last_page": 4,
  683. "next_page_url": "http://www.miao.com/api/my/dream?page=2",
  684. "path": "http://www.miao.com/api/my/dream",
  685. "per_page": 10,
  686. "prev_page_url": null,
  687. "to": 10,
  688. "total": 36
  689. }
  690. }
  691. * @apiErrorExample {json} Error-Response:
  692. * HTTP/1.1 400 Bad Request
  693. */
  694. public function dream()
  695. {
  696. $user = $this->getUser();
  697. $dreams = DreamInfoModel::where('user_id',$user->id)->orderBy('created_at','desc')->with('img')->paginate();
  698. return $this->api($dreams);
  699. }
  700. /**
  701. * @api {get} /api/my/collection 我的收藏
  702. * @apiDescription 我的收藏
  703. * @apiGroup My
  704. * @apiPermission Passport
  705. * @apiParam {string} [keyword] 关键字可选
  706. * @apiVersion 0.1.0
  707. * @apiSuccessExample {json} Success-Response:
  708. * HTTP/1.1 200 OK
  709. *{
  710. * "status": true,
  711. * "status_code": 0,
  712. * "message": "",
  713. * "data": {
  714. * "data": [
  715. * { 梦想详情
  716. * "id": 12,
  717. * "user_id": 2,
  718. * "name": "用户2梦想标题166",
  719. * "about": "用户2梦想介绍666",
  720. * "coin": 2500,
  721. * "time": 21,
  722. * "get_coin": 0,
  723. * "status": 0,
  724. * "video": null,
  725. * "sign": "",
  726. * },
  727. * "img": {
  728. * "title": "",
  729. * "pic": "https://f12f.jpg" 梦想封面图片
  730. * }
  731. * ],
  732. * "users": {
  733. * "2": "https://xxx.jpeg" ID号和头像
  734. * }
  735. * }
  736. *}
  737. * keyword存在
  738. *{
  739. * "status": true,
  740. * "status_code": 0,
  741. * "message": "",
  742. * "data": [
  743. * {
  744. * "id": 2,
  745. * "user_id": 1,
  746. * "dream_id": 12,
  747. * "dream_user_id": 2,
  748. * "interaction_number": 0,
  749. * "created_at": "2017-06-25 13:11:45",
  750. * "updated_at": "2017-06-25 13:11:45",
  751. * "dreams": [ 梦想
  752. * {
  753. * "id": 12,
  754. * "user_id": 2,
  755. * "name": "用户2梦想标题166",
  756. * "about": "用户2梦想介绍666",
  757. * "coin": 2500,
  758. * "end_time": 72000,
  759. * "get_coin": 792,
  760. * "mark": 5484,
  761. * "status": 0,
  762. * "video": "e",
  763. * "score": 158730,
  764. * "sign": "梦想达人",
  765. * "created_at": "2017-06-25 13:10:56",
  766. * "updated_at": "2017-06-28 16:53:39"
  767. * "img": { 图片
  768. * "title": "",
  769. * "pic": "https://timgsa.baidu.com/timg9&di2f.jpg"
  770. * },
  771. * "user": {
  772. *
  773. * }
  774. * }
  775. * ]
  776. * }
  777. * ]
  778. *}
  779. * @apiErrorExample {json} Error-Response:
  780. * HTTP/1.1 400 Bad Request
  781. */
  782. public function collection(Request $request)
  783. {
  784. $user = $this->getUser();
  785. if ($request->keyword) {
  786. $keyword ='%'.$request->keyword.'%';
  787. $data = UserCareDream::where('user_id',$user->id)->
  788. whereHas('dreams',function ($query) use($keyword){
  789. $query->where('end_time','>=',time())->where('name','like',$keyword);
  790. })->with('dreams')->get();
  791. foreach ($data as $item) {
  792. foreach ($item->dreams as $dream) {
  793. $dream->img;
  794. }
  795. }
  796. $this->insertSearchTable($user->id,$request->keyword);
  797. return $this->api($data);
  798. }else{
  799. $dreams = $user->collection;
  800. // $users = [];
  801. foreach ($dreams as $item) {
  802. /* if ($item->pivot->interaction_number > 0) {
  803. $user_info = UserInfoModel::find($item->pivot->dream_user_id);
  804. $avatar = $user_info ? $user_info->avatar : '';
  805. if (!array_key_exists($item->pivot->dream_user_id,$users)) {
  806. $users[$item->pivot->dream_user_id] = $avatar;
  807. }
  808. }*/
  809. $item->img;
  810. $item->user;
  811. }
  812. return $this->api(compact('dreams'));
  813. }
  814. }
  815. /**
  816. * @api {get} /api/my/miao 关于喵喵
  817. * @apiDescription 关于喵喵
  818. * @apiGroup My
  819. * @apiPermission Passport
  820. * @apiVersion 0.1.0
  821. * @apiSuccessExample {json} Success-Response:
  822. * HTTP/1.1 200 OK
  823. *{
  824. * "status": true,
  825. * "status_code": 0,
  826. * "message": "",
  827. * "data": {
  828. * "key": "2511789", 电话
  829. * "value": "关于喵喵介绍" 关于喵喵
  830. * }
  831. *}
  832. * @apiErrorExample {json} Error-Response:
  833. * HTTP/1.1 400 Bad Request
  834. */
  835. public function aboutMiao()
  836. {
  837. $data = BaseSettingsModel::where('category','miaomiao')->select('key','value')->first();
  838. return $this->api($data);
  839. }
  840. /**
  841. * @api {get} /api/my/care 我关注的用户
  842. * @apiDescription 我关注的用户
  843. * @apiGroup My
  844. * @apiPermission Passport
  845. * @apiVersion 0.1.0
  846. * @apiSuccessExample {json} Success-Response:
  847. * HTTP/1.1 200 OK
  848. *{
  849. * "status": true,
  850. * "status_code": 0,
  851. * "message": "",
  852. * "data":[] or
  853. * "data": [
  854. * {
  855. * "id": 2,
  856. * "phone": "13880642881",
  857. * "nickname": "name2",
  858. * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
  859. * "birthday": "2000-06-21",
  860. * "sign": 0,
  861. * "money": 0,
  862. * "coin": 800,
  863. * "sex": 1,
  864. * "signture": "我的个性签名2",
  865. * "height": 200,
  866. * "work": "兼职",
  867. * "emotion": 2,
  868. * "address": "370105",
  869. * "city": "成都",
  870. * "detail_address": "",
  871. * "status": 1,
  872. * "wechat": "",
  873. * "weibo": "",
  874. * "remember_token": "",
  875. * "created_at": "2017-06-25 10:42:06",
  876. * "updated_at": "2017-06-30 09:15:04",
  877. * "deleted_at": null,
  878. * }
  879. * ]
  880. *}
  881. * @apiErrorExample {json} Error-Response:
  882. * HTTP/1.1 400 Bad Request
  883. */
  884. public function care()
  885. {
  886. $user = $this->getUser();
  887. $users =$user->UserCareUser;
  888. return $this->api($users);
  889. }
  890. /**
  891. * @api {get} /api/my/careme 关注我的用户
  892. * @apiDescription 关注我的用户
  893. * @apiGroup My
  894. * @apiPermission Passport
  895. * @apiVersion 0.1.0
  896. * @apiSuccessExample {json} Success-Response:
  897. * HTTP/1.1 200 OK
  898. *{
  899. * "status": true,
  900. * "status_code": 0,
  901. * "message": "",
  902. * "data":[] or
  903. * "data": [
  904. * {
  905. * "id": 2,
  906. * "phone": "13880642881",
  907. * "nickname": "name2",
  908. * "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
  909. * "birthday": "2000-06-21",
  910. * "sign": 0,
  911. * "money": 0,
  912. * "coin": 800,
  913. * "sex": 1,
  914. * "signture": "我的个性签名2",
  915. * "height": 200,
  916. * "work": "兼职",
  917. * "emotion": 2,
  918. * "address": "370105",
  919. * "city": "成都",
  920. * "detail_address": "",
  921. * "status": 1,
  922. * "wechat": "",
  923. * "weibo": "",
  924. * "remember_token": "",
  925. * "created_at": "2017-06-25 10:42:06",
  926. * "updated_at": "2017-06-30 09:15:04",
  927. * "deleted_at": null,
  928. * }
  929. * ]
  930. *}
  931. * @apiErrorExample {json} Error-Response:
  932. * HTTP/1.1 400 Bad Request
  933. */
  934. public function careMe()
  935. {
  936. $user = $this->getUser();
  937. $users =$user->UserCareMe;
  938. return $this->api($users);
  939. }
  940. public function insertSearchTable($id,$keyword)
  941. {
  942. $info = SearchInfoModel::where('user_id',$id)->
  943. where('search',trim($keyword))->first();
  944. if (count($info) == 0) {
  945. SearchInfoModel::create(['user_id'=>$id,'search'=>trim($keyword),'times'=>1]);
  946. }else{
  947. $info->times += 1;
  948. $info->save();
  949. }
  950. }
  951. //我的银行账户
  952. /**
  953. * @api {get} /api/my/bank/list 我的银行账户
  954. * @apiDescription 我的银行账户
  955. * @apiGroup My
  956. * @apiPermission Passport
  957. * @apiVersion 0.1.0
  958. * @apiSuccessExample {json} Success-Response:
  959. * HTTP/1.1 200 OK
  960. *{
  961. * "status": true,
  962. * "status_code": 0,
  963. * "message": "",
  964. * "data":[] or
  965. * "data": [
  966. * {
  967. * "id": 1,
  968. * "user_id": 1,
  969. * "bank_name": "1",
  970. * "bank_number": "1", /账号
  971. * "bank_phone": "1",
  972. * "bank_user": "" 用户名/
  973. * "type": 微信, 微信(支付宝)二维码
  974. * "url": wwww.ddf, 二维码地址
  975. * "is_img": 1,
  976. * }
  977. *]
  978. * @apiErrorExample {json} Error-Response:
  979. * HTTP/1.1 400 Bad Request
  980. */
  981. public function bankList()
  982. {
  983. $user = $this->getUser();
  984. $data = UserBank::where('user_id',$user->id)->orderBy('id','desc')->get();
  985. return $this->api($data);
  986. }
  987. /**
  988. * @api {get} /api/my/bank/account 账户余额
  989. * @apiDescription 账户余额
  990. * @apiGroup My
  991. * @apiPermission Passport
  992. * @apiVersion 0.1.0
  993. * @apiSuccessExample {json} Success-Response:
  994. * HTTP/1.1 200 OK
  995. *{
  996. * "status": true,
  997. * "status_code": 0,
  998. * "message": "",
  999. * "data":[] or
  1000. * "data": {
  1001. * "coin": 508, 余额
  1002. * }
  1003. *]
  1004. * @apiErrorExample {json} Error-Response:
  1005. * HTTP/1.1 400 Bad Request
  1006. */
  1007. public function account()
  1008. {
  1009. $user = $this->getUser();
  1010. return $this->api($user);
  1011. }
  1012. // 添加银行卡
  1013. /**
  1014. * @api {post} /api/my/bank/create 添加银行卡
  1015. * @apiDescription 添加银行卡
  1016. * @apiGroup My
  1017. * @apiParam {string} data[bank_name] 银行名称
  1018. * @apiParam {string} data[bank_number] 银行卡号
  1019. * @apiParam {int} data[bank_phone] 银行卡绑定手机号
  1020. * @apiParam {string} data[bank_user] 银行卡用户姓名
  1021. * @apiPermission Passport
  1022. * @apiVersion 0.1.0
  1023. * @apiSuccessExample {json} Success-Response:
  1024. * HTTP/1.1 200 OK
  1025. *{
  1026. * "status": true,
  1027. * "status_code": 0,
  1028. * "message": "",
  1029. * "data": ""
  1030. *}
  1031. * @apiErrorExample {json} Error-Response:
  1032. *{
  1033. * "status": false,
  1034. * "status_code": 700,
  1035. * "message": "操作失败",
  1036. * "data": null
  1037. *}
  1038. */
  1039. public function bankCreate(Request $request)
  1040. {
  1041. $data = $request->data;
  1042. $user = $this->getUser();
  1043. $validator = \Validator::make($request->all(),
  1044. [
  1045. 'data.bank_name' => 'required',
  1046. 'data.bank_number' => 'required',
  1047. 'data.bank_phone' => 'required',
  1048. 'data.bank_user' => 'required',
  1049. ],
  1050. [
  1051. 'data.bank_name.required' => '请选择账号类型',
  1052. 'data.bank_number.required' => '请输入账号',
  1053. 'data.bank_phone.required' => '请输入账号绑定手机号码',
  1054. 'data.bank_user.required' => '请输入账号绑定用户姓名',
  1055. ]
  1056. );
  1057. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1058. $data['user_id'] = $user->id;
  1059. $ok =UserBank::create($data);
  1060. if ($ok) {
  1061. return $this->api('');
  1062. }else{
  1063. return $this->error(ErrorCode::OPERATION_FAILED);
  1064. }
  1065. } /**
  1066. * @api {post} /api/my/bank/qrcode 添加二维码
  1067. * @apiDescription 添加二维码
  1068. * @apiGroup My
  1069. * @apiParam {string} data[type] 类型
  1070. * @apiParam {string} data[qrcode] 二维码图片
  1071. * @apiPermission Passport
  1072. * @apiVersion 0.1.0
  1073. * @apiSuccessExample {json} Success-Response:
  1074. * HTTP/1.1 200 OK
  1075. *{
  1076. * "status": true,
  1077. * "status_code": 0,
  1078. * "message": "",
  1079. * "data": ""
  1080. *}
  1081. * @apiErrorExample {json} Error-Response:
  1082. *{
  1083. * "status": false,
  1084. * "status_code": 700,
  1085. * "message": "操作失败",
  1086. * "data": null
  1087. *}
  1088. */
  1089. public function bankImgCreate(Request $request)
  1090. {
  1091. $data = $request->data;
  1092. $user = $this->getUser();
  1093. $validator = \Validator::make($request->all(),
  1094. [
  1095. 'data.type' => 'required',
  1096. 'data.qrcode' => 'required',
  1097. ],
  1098. [
  1099. 'data.type.required' => '请选择账号类型',
  1100. 'data.qrcode.required' => '请上传二维码图片',
  1101. ]
  1102. );
  1103. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1104. $data['user_id'] = $user->id;
  1105. /* $data['bank_user'] = '';
  1106. $data['bank_phone'] = '';
  1107. $data['bank_number'] = '';
  1108. $data['bank_name'] = '';*/
  1109. $info = UserBank::whereNotNull('qrcode')->where('user_id',$user->id)
  1110. ->where('type',$data['type'])->first(); //定义为二维码
  1111. if (empty($info)) {
  1112. $ok =UserBank::create($data);
  1113. }else{
  1114. $ok = $info->update($data);
  1115. }
  1116. if ($ok) {
  1117. return $this->api('');
  1118. }else{
  1119. return $this->error(ErrorCode::OPERATION_FAILED);
  1120. }
  1121. }
  1122. /**
  1123. * @api {get} /api/my/bank/delete 删除银行卡
  1124. * @apiDescription 删除银行卡
  1125. * @apiGroup My
  1126. * @apiParam {int} id 银行卡id
  1127. * @apiPermission Passport
  1128. * @apiVersion 0.1.0
  1129. * @apiSuccessExample {json} Success-Response:
  1130. * HTTP/1.1 200 OK
  1131. *{
  1132. * "status": true,
  1133. * "status_code": 0,
  1134. * "message": "",
  1135. * "data": ""
  1136. *}
  1137. * @apiErrorExample {json} Error-Response:
  1138. *{
  1139. * "status": false,
  1140. * "status_code": 700,
  1141. * "message": "操作失败",
  1142. * "data": null
  1143. *}
  1144. */
  1145. public function bankDelete(Request $request)
  1146. {
  1147. $id = $request->id;
  1148. $validator = \Validator::make($request->all(),
  1149. [
  1150. 'id' => 'required',
  1151. ],
  1152. [
  1153. 'id.required' => '银行账号不存在',
  1154. ]
  1155. );
  1156. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1157. $ok =UserBank::destroy($id);
  1158. if ($ok) {
  1159. return $this->api('');
  1160. }else{
  1161. return $this->error(ErrorCode::OPERATION_FAILED);
  1162. }
  1163. }
  1164. // 发私信
  1165. /**
  1166. * @api {post} /api/my/letter/store 发送私信
  1167. * @apiDescription 发送私信
  1168. * @apiGroup My
  1169. * @apiParam {string} content 私信内容
  1170. * @apiParam {int} to_user_id 私信对象
  1171. * @apiPermission Passport
  1172. * @apiVersion 0.1.0
  1173. * @apiSuccessExample {json} Success-Response:
  1174. * HTTP/1.1 200 OK
  1175. *{
  1176. * "status": true,
  1177. * "status_code": 0,
  1178. * "message": "",
  1179. * "data": ""
  1180. *}
  1181. * @apiErrorExample {json} Error-Response:
  1182. *{
  1183. * "status": false,
  1184. * "status_code": 700,
  1185. * "message": "操作失败",
  1186. * "data": null
  1187. *}
  1188. */
  1189. public function letterStore(Request $request)
  1190. {
  1191. $validator = \Validator::make($request->all(),
  1192. [
  1193. 'content' => 'required',
  1194. 'to_user_id' => 'required',
  1195. ],
  1196. [
  1197. 'content.required' => '私信内容不存在',
  1198. 'to_user_id.required' => '私信对象不存在',
  1199. ]
  1200. );
  1201. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1202. $user = $this->getUser();
  1203. $user_id = $user->id;
  1204. $info = $request->input('content');
  1205. $to_user_id = $request->input('to_user_id');
  1206. // 链接到最近的一个梦想
  1207. $dream = DreamInfoModel::where('user_id',$user_id)->orderBy('id','desc')->first();
  1208. $dream_id = empty($dream) ? 0 : $dream->id;
  1209. $arr = [
  1210. 'user_id'=>$to_user_id,
  1211. 'info'=>$info,
  1212. 'message'=>$user->nickname.'给你发了个私信哦~点击看看!',
  1213. 'to_user_id'=>$user_id,
  1214. 'dream_id'=>$dream_id,
  1215. 'type_id'=>2,
  1216. 'is_url'=>1,
  1217. 'attr_id'=>9,
  1218. ];
  1219. $ok =SystemInfoModel::create($arr);
  1220. if ($ok) {
  1221. $this->jPush($user->nickname.'给你发了个私信哦~点击看看!','',$to_user_id);
  1222. return $this->api('');
  1223. }else{
  1224. return $this->error(ErrorCode::OPERATION_FAILED);
  1225. }
  1226. } /**
  1227. * @api {get} /api/my/letter/show 查看私信
  1228. * @apiDescription 查看私信
  1229. * @apiGroup My
  1230. * @apiParam {int} id 私信主键id
  1231. * @apiPermission Passport
  1232. * @apiVersion 0.1.0
  1233. * @apiSuccessExample {json} Success-Response:
  1234. * HTTP/1.1 200 OK
  1235. *{
  1236. * "status": true,
  1237. * "status_code": 0,
  1238. * "message": "",
  1239. * "data": ""
  1240. *}
  1241. * @apiErrorExample {json} Error-Response:
  1242. *{
  1243. * "status": false,
  1244. * "status_code": 700,
  1245. * "message": "操作失败",
  1246. * "data": null
  1247. *}
  1248. */
  1249. public function letterShow(Request $request)
  1250. {
  1251. $validator = \Validator::make($request->all(),
  1252. [
  1253. 'id' => 'required',
  1254. ],
  1255. [
  1256. 'id.required' => '私信id不存在',
  1257. ]
  1258. );
  1259. if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
  1260. $user = $this->getUser();
  1261. $user_id = $user->id;
  1262. $id = $request->input('id');
  1263. $data = SystemInfoModel::find($id);
  1264. return $this->api($data);
  1265. }
  1266. }