MyController.php 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. <?php
  2. namespace App\Http\Controllers\Api\V1;
  3. use Illuminate\Http\Request;
  4. class MyController extends Controller
  5. {
  6. /**
  7. * @api {get} /api/my/index 个人首页(index)
  8. * @apiSuccessExample {json} Success-Response:
  9. * HTTP/1.1 200 OK
  10. {
  11. "status": true,
  12. "status_code": 0,
  13. "message": "",
  14. "data": {
  15. "my_care_num": 4,关注
  16. "my_fens_num": 3,粉丝
  17. "my_collection_num": 2,收藏
  18. "my_dream_num": 1,发帖
  19. "user": {
  20. "id": 1,
  21. "tel": "13880642880",
  22. "password": "",
  23. "nickname": "",
  24. "pic": "",
  25. "sign": 0,
  26. "money": 0,余额
  27. "sex": 1,
  28. "signture": "",个性签名
  29. "tall": "",
  30. "job": "",
  31. "emotion": 1,
  32. "address": "",
  33. "detail_address": "",
  34. "status": 1,
  35. "remember_token": "",
  36. "created_at": "2017-06-02 02:30:12",
  37. "updated_at": "2017-06-02 02:30:12",
  38. "deleted_at": null,
  39. }
  40. */
  41. public function index()
  42. {
  43. $user = $this->getUser();
  44. /*
  45. * 我的关注人数,我的粉丝,收藏
  46. * 点赞?徽章?
  47. * */
  48. $data1 = $user->myCareNum;
  49. $data2 = $user->myFens;
  50. $data3 = $user->myCollection;
  51. $data4 = $user->UserDream;
  52. $my_care_num = count($data1);
  53. $my_fens_num = count($data2);
  54. $my_collection_num = count($data3);
  55. $my_dream_num = count($data4);//发帖数
  56. return $this->api(compact('my_care_num','my_fens_num','my_collection_num','my_dream_num','user'));
  57. }
  58. /**
  59. * @api {get} /api/my/persona 个人信息(persona)
  60. * @apiDescription 个人信息(persona)
  61. * @apiGroup Auth
  62. * @apiPermission Passport
  63. * @apiVersion 0.1.0
  64. * @apiSuccessExample {json} Success-Response:
  65. * HTTP/1.1 200 OK
  66. *{
  67. *"status": true,
  68. *"status_code": 0,
  69. *"message": "",
  70. *"data": {
  71. *"user": {
  72. *"id": 1,
  73. * "tel": "13880642880",手机
  74. *"nickname": "",昵称
  75. *"sex": 1,性别
  76. *"job": "", 职业
  77. *"emotion": 1,情感状态
  78. *"address": "",
  79. *"detail_address": "",
  80. *"status": 1,
  81. *"tall": 1, 身高
  82. *}
  83. * }
  84. *}
  85. * @apiErrorExample {json} Error-Response:
  86. * HTTP/1.1 400 Bad Request
  87. *{
  88. *"status": true,
  89. *"status_code": 0,
  90. *"message": "",
  91. *"data": {
  92. *"user": null
  93. * }
  94. *}
  95. */
  96. public function persona()
  97. {
  98. $user = $this->getUser();
  99. return $this->api(compact('user'));
  100. }
  101. /**
  102. * @api {get} /api/my/recharge 充值(recharge)
  103. * @apiDescription 充值(recharge)
  104. * @apiGroup Auth
  105. * @apiPermission Passport
  106. * @apiVersion 0.1.0
  107. * @apiSuccessExample {json} Success-Response:
  108. * HTTP/1.1 200 OK
  109. * @apiErrorExample {json} Error-Response:
  110. * HTTP/1.1 400 Bad Request
  111. */
  112. public function recharge()
  113. {
  114. $user = $this->getUser();
  115. return $this->api(compact('user'));
  116. }
  117. /**
  118. * @api {get} /api/my/system_info 系统消息(systemInfo)
  119. * @apiDescription 系统消息(systemInfo)
  120. * @apiGroup Auth
  121. * @apiPermission Passport
  122. * @apiVersion 0.1.0
  123. * @apiSuccessExample {json} Success-Response:
  124. * HTTP/1.1 200 OK
  125. *{
  126. *"status": true,
  127. *"status_code": 0,
  128. *"message": "",
  129. * "data": {
  130. *"data": [
  131. *{
  132. *"nickname": "",充值人
  133. *"pivot": {
  134. *"coin": 0 捐赠梦想币数量
  135. *}
  136. * @apiErrorExample {json} Error-Response:
  137. * HTTP/1.1 400 Bad Request
  138. * {
  139. *"status": true,
  140. *"status_code": 0,
  141. *"message": "",
  142. *"data": {
  143. *"data": []
  144. *}
  145. *}
  146. *}
  147. */
  148. public function systemInfo()
  149. {
  150. $user = $this->getUser();
  151. $data = $user->SystemInfo;
  152. return $this->api(compact('data'));
  153. }
  154. /**
  155. * @api {get} /api/my/reply_my 回复我的(replyMy)
  156. * @apiDescription 回复我的(replyMy)
  157. * @apiGroup Auth
  158. * @apiPermission Passport
  159. * @apiVersion 0.1.0
  160. * @apiSuccessExample {json} Success-Response:
  161. * HTTP/1.1 200 OK
  162. * @apiErrorExample {json} Error-Response:
  163. * HTTP/1.1 400 Bad Request
  164. */
  165. public function replyMy()
  166. {
  167. $user = $this->getUser();
  168. return $this->api(compact('user'));
  169. }
  170. /**
  171. * @api {get} /api/my/my_reply 我的回复(myReply)
  172. * @apiDescription 我的回复(recharge)
  173. * @apiGroup Auth
  174. * @apiPermission Passport
  175. * @apiVersion 0.1.0
  176. * @apiSuccessExample {json} Success-Response:
  177. * HTTP/1.1 200 OK
  178. * @apiErrorExample {json} Error-Response:
  179. * HTTP/1.1 400 Bad Request
  180. */
  181. public function myReply()
  182. {
  183. $user = $this->getUser();
  184. return $this->api(compact('user'));
  185. }
  186. /**
  187. * @api {get} /api/my/dream 我的梦想(dream)
  188. * @apiDescription 我的梦想(recharge)
  189. * @apiGroup Auth
  190. * @apiPermission Passport
  191. * @apiVersion 0.1.0
  192. * @apiSuccessExample {json} Success-Response:
  193. * HTTP/1.1 200 OK
  194. * @apiErrorExample {json} Error-Response:
  195. * HTTP/1.1 400 Bad Request
  196. */
  197. public function dream()
  198. {
  199. $user = $this->getUser();
  200. return $this->api(compact('user'));
  201. }
  202. /**
  203. * @api {get} /api/my/collection 我的收藏(collection)
  204. * @apiDescription 我的收藏(recharge)
  205. * @apiGroup Auth
  206. * @apiPermission Passport
  207. * @apiVersion 0.1.0
  208. * @apiSuccessExample {json} Success-Response:
  209. * HTTP/1.1 200 OK
  210. * @apiErrorExample {json} Error-Response:
  211. * HTTP/1.1 400 Bad Request
  212. */
  213. public function collection()
  214. {
  215. $user = $this->getUser();
  216. return $this->api(compact('user'));
  217. }
  218. /**
  219. * @api {get} /api/my/setting 设置(setting)
  220. * @apiDescription 设置(setting)
  221. * @apiGroup Auth
  222. * @apiPermission Passport
  223. * @apiVersion 0.1.0
  224. * @apiSuccessExample {json} Success-Response:
  225. * HTTP/1.1 200 OK
  226. * @apiErrorExample {json} Error-Response:
  227. * HTTP/1.1 400 Bad Request
  228. */
  229. public function setting()
  230. {
  231. $user = $this->getUser();
  232. return $this->api(compact('user'));
  233. }
  234. /**
  235. * @api {get} /api/my/add_dream 发布梦想(addDream)
  236. * @apiDescription 发布梦想(recharge)
  237. * @apiGroup Auth
  238. * @apiPermission Passport
  239. * @apiVersion 0.1.0
  240. * @apiSuccessExample {json} Success-Response:
  241. * HTTP/1.1 200 OK
  242. * @apiErrorExample {json} Error-Response:
  243. * HTTP/1.1 400 Bad Request
  244. */
  245. public function addDream()
  246. {
  247. $user = $this->getUser();
  248. return $this->api(compact('user'));
  249. }
  250. /**
  251. * @api {get} /api/my/dream_about 梦想介绍(dreamAbout)
  252. * @apiDescription 梦想介绍(dreamAbout)
  253. * @apiGroup Auth
  254. * @apiPermission Passport
  255. * @apiVersion 0.1.0
  256. * @apiSuccessExample {json} Success-Response:
  257. * HTTP/1.1 200 OK
  258. * @apiErrorExample {json} Error-Response:
  259. * HTTP/1.1 400 Bad Request
  260. */
  261. public function dreamAbout()
  262. {
  263. $user = $this->getUser();
  264. return $this->api(compact('user'));
  265. }
  266. }