gq 8 năm trước cách đây
mục cha
commit
b08b2ab847
1 tập tin đã thay đổi với 0 bổ sung262 xóa
  1. 0 262
      server/app/Http/Controllers/Api/V1/HomeController.php

+ 0 - 262
server/app/Http/Controllers/Api/V1/HomeController.php

xqd
@@ -90,266 +90,4 @@ class HomeController extends Controller
 
     }
 
-    /**
-     * @api {post} /api/user/support 支持梦想
-     * @apiDescription 支持梦想
-     * @apiGroup Home
-     * @apiPermission Passport
-     * @apiVersion 0.1.0
-     * @apiParam {int} coin 支持梦想币数量
-     * @apiParam {int} dream_id 梦想ID
-     * @apiSuccessExample {json} Success-Response:
-     * HTTP/1.1 200 OK
-     *{
-     *      "status": true,
-     *      "status_code": 0,
-     *      "message": "",
-     *      "data": ""
-     *}
-     * @apiErrorExample {json} Error-Response:
-     *HTTP/1.1 400 Bad Request
-     * {
-     *     "state": false,
-     *     "code": 1000,
-     *     "message": "传入参数不正确",
-     *     "data": null or []
-     * }
-     *  可能出现的代码
-     * {
-    *       "status": false,
-    *       "status_code": 1303,
-    *       "message": "商户余额不足",
-    *       "data": null
-    *  }
-     *
-     */
-    public function support(Request $request)
-    {
-        $user = $this->getUser();
-        $dream_id = $request->dream_id;
-        $dream_info = DreamInfoModel::find($dream_id);
-        $validator = \Validator::make($request->all(),
-            [
-                'coin'  => 'required',
-                'dream_id'  => 'required',
-            ],
-            [
-                'coin.required'  => '梦想币不能为空',
-                'dream_id.required'  => '支持对象不能为空',
-            ]
-        );
-
-        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
-
-        $coin = $request->coin;
-
-        if ($user->money < $coin) {
-            return $this->error(ErrorCode::MERCHANT_BALANCE_NOT_ENOUGH);
-        }else{
-            $user->money  =  $user->money - $coin;
-            $user->save();
-            $dream_info->get_money += $coin;
-            $dream_info->save();
-            $data = [
-                'user_id'=>$user->id,
-                'other_id'=>$dream_id,
-                'coin'=>$coin,
-            ];
-
-          $ok =   SystemInfoModel::create($data);
-            if (!$ok) {
-                return $this->error(ErrorCode::MERCHANT_SERVICE_STATUS_INVALID);
-            }
-            return $this->api('');
-        }
-    }
-    /**
-     * @api {get} /api/user/interaction 互动
-     * @apiDescription 互动
-     * @apiGroup Home
-     * @apiPermission Passport
-     * @apiVersion 0.1.0
-     * @apiParam {int} user_id 互动对象ID
-     * @apiSuccessExample {json} Success-Response:
-     * HTTP/1.1 200 OK
-     * {
-     *      "status": true,
-     *      "status_code": 0,
-     *      "message": "",
-     *      "data": {
-     *          评论的梦想
-     *          "dream1": [
-     *              {
-     *                  "dream": "1的梦想",
-     *                  "about": "介绍",
-     *                  "pic": [
-     *                      {
-     *                          "pic": "111",
-     *                      }
-     *          ],
-     *      "user": [
-     *          {
-     *              "pic": "",
-     *       ],
-     *       "comments": [
-     *           {
-     *              "level": 0,
-     *              "content": "EST",
-     *              "created_at": "2017-04-27 12:17:20",
-     *           }
-     *        ],
-     *       回复的梦想
-     *           "dream2": [
-     *               {
-     *                 "level": 0,
-     *                  "content": "EST",
-     *                  "created_at": "2017-04-27 12:17:20",
-     *                  "updated_at": null,
-     *                  "deleted_at": null,
-     *                  "reply_dream": {
-     *                      "dream": "1的梦想",
-     *                      "about": "介绍",
-     *                      "time": 0,
-     *                      "dream_imgs": [
-     *                          {
-     *                              "pic": "111",
-     *                          },
-     *              ]
-     *       },
-     *      "reply_dream_pic": [
-     *          {
-     *              "pic": "111",
-     *          }
-     *       ],
-     *      "reply_created_at": {
-     *           "date": "2017-06-13 02:26:31.000000",
-     *          "timezone_type": 3,
-     *          "timezone": "UTC"
-     *      },
-     *      "reply_content": "haha",
-     *      "reply_level": 0,
-     *      "dream": {
-     *          "dream": "1的梦想",
-     *          "about": "介绍",
-     *          "money": 5000,
-     *          "time": 0,
-     *          "dream_imgs": [
-     *              {
-     *                  "pic": "111",
-     *              },
-     *          ]
-     *       }
-     *   }
-     *  ]
-     *  }
-     * }
-     * @apiErrorExample {json} Error-Response:
-     *HTTP/1.1 400 Bad Request
-     * {
-     *       "status": false,
-     *      "status_code": 1500,
-     *      "message": "会员不存在",
-     *      "data": null
-     * }
-     */
-    public function interaction(Request $request)
-    {
-        $user_id = $request->user_id;
-        $user = UserInfoModel::find($user_id);
-        if (count($user) == 0) return $this->error(ErrorCode::MEMBER_NOT_EXIST);
-//        参与的评论与回复 梦想
-        $dream1 = $user->comDream;
-
-        foreach ($dream1 as $item){
-            $item->pic = $item->dreamImgs;
-            $item->user = $item->dreamUser;
-            $item->comments = $item->DreamInfo;
-            $item->created_at = $item->pivot->created_at;
-            $item->content = $item->pivot->content;
-            $item->level = $item->pivot->level;
-        }
-
-        $dream2 = $user->replyDream;
-
-        foreach ($dream2 as $comment) {
-            $comment->reply_dream = $comment->dream;
-            $comment->reply_dream_pic = $comment->dream->dreamImgs;
-            $comment->reply_created_at = $comment->pivot->created_at;
-            $comment->reply_content = $comment->pivot->content;
-            $comment->reply_level = $comment->pivot->level;
-        }
-
-        return $this->api(compact('dream1','dream2'));
-    }
-    /**
-     * @api {post} /api/user/paihang 排行
-     * @apiDescription 排行
-     * @apiGroup Home
-     * @apiPermission Passport
-     * @apiVersion 0.1.0
-     * @apiParam {int} user_id 用户ID
-     * @apiSuccessExample {json} Success-Response:
-     * HTTP/1.1 200 OK
-     *{
-     *    "status": true,
-     *    "status_code": 0,
-     *   "message": "",
-     *   "data": {
-     *       "arr3": [
-     *          {
-     *              "nickname": "",  昵称
-     *              "pic": "",      头像
-     *              "coin": 23      总支持梦想币
-     *          }
-     *      ]
-     *   }
-     *}
-     *
-     * @apiErrorExample {json} Error-Response:
-     *HTTP/1.1 400 Bad Request
-     *{
-     *  "status": false,
-     *  "status_code": 1105,
-     *  "message": "用户不存在",
-     *  "data": null
-     * }
-     */
-
-    public function paihang(Request $request)
-    {
-//      获取支持过用户的人
-        $user_id = $request->user_id;
-        $user = UserInfoModel::find($user_id);
-        if (count($user) == 0) return $this->error(ErrorCode::MEMBER_NOT_EXIST);
-        $dreams = $user->UserDream;
-        $arr1 = [];
-
-        foreach ($dreams as $dream) {
-            $arr1[] = $dream->systemInfo;
-        }
-
-//      用户总的支持梦想币
-        $arr2 = [];
-
-        foreach ($arr1 as $v) {
-            foreach ($v as $item){
-                if (!array_key_exists($item->user_id,$arr2)) {
-                    $arr2[$item->user_id] = $item->coin;
-                }else{
-                    $arr2[$item->user_id] += $item->coin;
-                }
-            }
-        }
-
-        $arr3 = [] ;
-
-        foreach ($arr2 as $k => $v){
-            $user = UserInfoModel::find($k);
-            $user->coin = $v;
-            $arr3[] = $user;
-        }
-
-        return $this->api(compact('arr3'));
-
-    }
 }