MyController.php 42 KB

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