MyController.php 42 KB

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