Переглянути джерело

Merge branch 'master' of http://git.9026.com/roobe/miao

YanaDH 7 роки тому
батько
коміт
aff4b57e6b

+ 1 - 1
miaomiao/config.xml

xqd
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<widget id="com.miaomiao.app" version="0.0.5" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+<widget id="com.miaomiao.app" version="0.0.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
   <name>瞄喵</name>
   <description>
         An Ionic Framework and Cordova project.

+ 1 - 1
miaomiao/www/js/controllers/home.js

xqd
@@ -732,7 +732,7 @@
                         var file = config.imgServer+response.data.file;
                         //console.log("file:"+file);
                         $scope.video.isOK = true;
-                        $scope.video.file = file;
+                        $scope.video.file = response.data.file;
                         $scope.video.vpic = config.server+'upload/vpic/'+response.data.file+'.jpg';
                         //console.log("vpic:"+$scope.video.vpic);
                     }, function (error) {

+ 85 - 0
server/app/Console/Commands/DreamDJS.php

xqd
@@ -0,0 +1,85 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Models\DreamInfoModel;
+use App\Models\SupportDreamModel;
+use App\Models\SystemInfoModel;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Auth;
+use App\Helper\JpushHelper;
+
+class DreamDJS extends Command
+{
+    use JpushHelper;
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'DreamDJS';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     * @return mixed
+     */
+    public function handle()
+    {
+        //执行逻辑
+        $user = Auth::guard('api')->user();
+        $dream = $user->UserCareDream;
+        foreach ($dream as $item) {
+            if (date('Y-m-d',$item->end_time) == date('Y-m-d',time()+1*24*3600)) {
+                $message = $item->name.'过1天就要结束啦!';
+                $this->jPush($message,'',$user->id);
+            }
+            if ( date('Y-m-d',time()+7*24*3600)== date('Y-m-d',$item->end_time)) {
+                $message = $item->name.'过1周就要结束啦!';
+                $this->jPush($message,'',$user->id);
+            }
+            if ( $item->end_time < date('Y-n-d H:i:s')) {
+                $support_dream = SupportDreamModel::where('dream_id',$item->id)->get();
+                $top = [] ;
+                foreach ($support_dream as $item2) {
+                    if (!array_key_exists($item2->user_id,$top)) {
+                        $top[$item2->user_id] = $item2->score;
+                    }else{
+                        $top[$item2->user_id] += $item2->score;
+                    }
+                }
+                arsort($top);
+                $new_arr = array_values($top);
+                $key = array_search($top[$user->id],$new_arr);
+                $message = $item->name."已经结束啦!谢谢你的支持,你可是他的第".($key+1)."支持者哦!";
+                $this->jPush($message,'',$user->id);
+            }
+           if( isset($message)){
+               $arr = [
+                    'user_id'=>0,
+                    'message'=>$message,
+                    'to_user_id'=>$user->id,
+                    'dream_id'=>$item->id,
+            ];
+               SystemInfoModel::create($arr);
+           }
+        }
+    }
+}

+ 3 - 1
server/app/Console/Kernel.php

xqd xqd
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
      * @var array
      */
     protected $commands = [
-        //
+        \App\Console\Commands\DreamDJS::class,
     ];
 
     /**
@@ -26,6 +26,8 @@ class Kernel extends ConsoleKernel
     {
         // $schedule->command('inspire')
         //          ->hourly();
+        $schedule->command('DreamDJS')
+            ->everyMinute();
     }
 
     /**

+ 16 - 8
server/app/Http/Controllers/Api/V1/AuthController.php

xqd xqd xqd
@@ -15,7 +15,7 @@ class AuthController extends Controller
 {
     use SmsHelper,AuthenticatesUsers,AttachmentHelper,JpushHelper;
 
-    private $expireTime     = 1;
+    private $expireTime     = 5;
     private $keySmsCode     = 'auth:sms:';
     private $keySmsCodeExist     = 'auth:sms:exist';
     private $expireTimeExist     = 24*60;
@@ -298,14 +298,22 @@ class AuthController extends Controller
         \Log::info('verify_code:'.$verify_code);
         $key = $this->keySmsCode . $phone;
         Cache::store('file')->put($key, $verify_code, $this->expireTime);
-        $msg = '【喵喵】您的验证码是:' . $verify_code;
-        /*
+        $msg = '【喵喵】您的验证码是:' . $verify_code.')。5分钟内有效请及时验证';
+
          $result = $this->sendSms($msg, $phone);
-        if (!$result)
-             $this->logger->Error("Send sms failed.");
-        */
+        /*if (!$result)
+             $this->logger->Error("Send sms failed.");*/
+        if ($result!='success') {
+            \Log::error("Send sms failed.");
+        }
 
-        return $this->api(['verify_code' => $verify_code]);
+        if(env("APP_DEBUG")){
+            return $this->error(1);
+        }else{
+            //product
+            return $this->api(['verify_code' => $verify_code]);
+        }
+//        return $this->api(['verify_code' => $verify_code]);
     }
 
 
@@ -320,7 +328,7 @@ class AuthController extends Controller
 
     public function isLogin()
     {
-        $user = Auth::user();
+        $user = Auth::guard('api')->user();
         $res = true;
         if(!$user) $res = false;
         return $this->api([

+ 1 - 1
server/app/Http/Controllers/Api/V1/Controller.php

xqd
@@ -20,8 +20,8 @@ class Controller extends BaseController
 
     public function getUser()
     {
-//        $this->user = UserInfoModel::where('phone','13880642880')->first();
         $this->user = Auth::guard('api')->user();
+//        $this->user = UserInfoModel::where('phone','13880642880')->first();
         return $this->user;
     }
 

+ 17 - 1
server/app/Http/Controllers/Api/V1/DreamController.php

xqd xqd
@@ -28,6 +28,7 @@ class DreamController extends Controller
      * @apiVersion 0.1.0
      * @apiParam {int} [type=home] home interaction paihang  默认all
      * @apiParam {int} id 梦想ID
+     * @apiParam {int} [interaction_id] 动态id
      * @apiParam  [dream_user_id] id 梦想者id
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
@@ -264,11 +265,26 @@ class DreamController extends Controller
         $show_button = $dream->user_id == $user->id ? '0' : '1';
         $dream->show_button = $show_button;
 //        梦想互动
+        $interaction_id = $request->input('interaction_id');
+
         $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
             $query->orderBy('created_at');
         }])->orderBy('created_at','desc')->get();
+        if (!empty($interaction_id)) {
+            $data = InteractionInfo::with(['comments' => function ($query) {
+                $query->orderBy('created_at');
+            }])->find($interaction_id);
+            if (count($data) > 0) {
+                $interactions = $interactions->toArray();
+                foreach ($interactions as $key => $value) {
+                    if ($value['id']==$interaction_id) {
+                        unset($interactions[$key]);
+                    }
+                }
+                array_unshift($interactions,$data);
+            }
+        }
         $dream->interactions = $interactions;
-//        dd($interactions);
         return $this->api($dream);
     }
 

+ 12 - 10
server/app/Http/Controllers/Api/V1/IndexController.php

xqd xqd xqd
@@ -133,16 +133,18 @@ class IndexController extends Controller
         }*/
         $type = $request->type;
         if ($type == 'trend') {
-            $dreams = DreamInfoModel::orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
+            $banners = $this->getBanner();
+            $dreams = DreamInfoModel::where('end_time','>',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
             $this->dreams($dreams);
-            return $this->api(compact('users','dreams'));
+            return $this->api(compact('banners','users','dreams'));
         } elseif ($type == 'news') {
-            $dreams = DreamInfoModel::orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
+            $banners = $this->getBanner();
+            $dreams = DreamInfoModel::where('end_time','>',date('Y-m-d H:i:s'))->orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
             $this->dreams($dreams);
-            return $this->api(compact('users','dreams'));
+            return $this->api(compact('banners','users','dreams'));
         } else{
             $banners = $this->getBanner();
-            $dreams = DreamInfoModel::orderBy('score','desc')->with('user')->limit(15)->paginate(15);
+            $dreams = DreamInfoModel::where('end_time','>',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->limit(15)->paginate(15);
             $this->dreams($dreams);
             return $this->api(compact('banners','users','dreams'));
         }
@@ -447,9 +449,9 @@ class IndexController extends Controller
             });
         }
         \Log::info($query->toSql());
-        $arr1 =DreamInfoModel::limit(20)->select('id')->get()->toArray();
+        $arr1 =DreamInfoModel::orderBy('id')->limit(20)->select('id')->get()->toArray();
         $id_arr1 = array_column($arr1,'id');
-        $arr2 =DreamInfoModel::orderBy('score','desc')->limit(120)->select('id')->get()->toArray();
+        $arr2 =DreamInfoModel::orderBy('id','desc')->limit(120)->select('id')->get()->toArray();
         $id_arr2 = array_column($arr2,'id');
         $dtusers =UserCareUser::where('user_id',$id)->with('other_user')->
         where('dream_number','>',0)->orderBy('created_at')->get()->toArray();
@@ -465,16 +467,16 @@ class IndexController extends Controller
         }
         $type = $request->type;
         if ($type == 'trend') {
-            $dreams = $query->orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
+            $dreams = $query->where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->whereNotIn('id', $id_arr1)->limit(100)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } elseif ($type == 'news') {
-            $dreams = $query->orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
+            $dreams = $query->where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->orderBy('created_at','desc')->with('user')->whereNotIn('id', $id_arr2)->limit(500)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('users','dreams'));
         } else{
             $banners = $this->getBanner();
-            $dreams = $query->orderBy('score','desc')->with('user')->limit(20)->paginate(20);
+            $dreams = $query->where('end_time','<',date('Y-m-d H:i:s'))->orderBy('score','desc')->with('user')->limit(20)->paginate(20);
             $this->dreams($dreams);
             return $this->api(compact('banners','users','dreams'));
         }

+ 70 - 3
server/app/Http/Controllers/Api/V1/InteractionController.php

xqd xqd xqd xqd xqd xqd
@@ -6,6 +6,7 @@ use App\Models\CommentInfoModel;
 use App\Models\DreamInfoModel;
 use App\Models\InteractionInfo;
 use App\Models\ReplyCommentsInfo;
+use App\Models\SupportDreamModel;
 use App\Models\SystemInfoModel;
 use App\Models\UserCareDream;
 use App\Models\UserCareUser;
@@ -27,7 +28,7 @@ class InteractionController extends Controller
      * @apiParam {int} id                 梦想ID
      * @apiParam {string} title           互动标题
      * @apiParam {string} [video]           视频
-     * @apiParam {array} pics[]           图片数组
+     * @apiParam {array} [pics[]]           图片数组
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
      *{
@@ -48,6 +49,7 @@ class InteractionController extends Controller
      */
     public function store(Request $request)
     {
+        $user = $this->getUser();
         $validator = \Validator::make($request->all(),
             [
                 'id'  => 'required',
@@ -76,6 +78,21 @@ class InteractionController extends Controller
         $data['video'] = $request->video;
         $ok = InteractionInfo::create($data);
         if ($ok) {
+            //        新的互动应该有消息通知《支持者》
+            $support_user = SupportDreamModel::where('dream_id',$dream_id)->get();
+            if (!empty(count($support_user))) {
+                $user_ids = array_column($support_user->toArray(),'user_id');
+                foreach ($user_ids as $user_id) {
+                    $arr['user_id']=$user->id;
+                    $arr['to_user_id']=$user_id;
+                    $arr['message']='您支持的梦想又有新的动态啦';
+                    $arr['interaction_id']=$ok->id;
+                    $arr['dream_id']=$dream_id;
+                    SystemInfoModel::create($arr);
+//            长连接
+                    $this->jPush($arr['message'],'',$user_id);
+                }
+            }
 //            收藏梦想最新动态加一
             UserCareDream::where('dream_id',$dream_id)->increment('interaction_number',1);
             $dream_user_id = DreamInfoModel::find($dream_id)->user_id;
@@ -149,8 +166,8 @@ class InteractionController extends Controller
                 $data['to_user_id'] = $request->input('comment_user_id');
                 $data['to_user_avatar'] = $to_user->avatar;
                 $data['to_user_nickname'] = $to_user->nickname;
-
-                $message = $user->nickname.'在你的互动上留言啦!点击去看看!';
+//点击去看看
+                $message = $user->nickname.'在你的互动上留言啦!';
                 $info = [
                     'user_id' => $data['to_user_id'],
                     'message' => $message,
@@ -298,4 +315,54 @@ class InteractionController extends Controller
             return $this->error(ErrorCode::OPERATION_FAILED);
         }
     }
+
+    /**
+     * @api {get} /api/interaction/destroy 删除动态
+     * @apiDescription 删除动态
+     * @apiGroup Interaction
+     * @apiParam {int} id       动态ID
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * {
+     *  "status": true,
+     *   "status_code": 0,
+     *   "message": "",
+     *   "data": ""
+     *}
+     * HTTP/1.1 200 OK
+     * @apiErrorExample {json} Error-Response:
+     * {
+     *   "status": false,
+     *   "status_code": 700,
+     *   "message": "操作失败",
+     *  "data": null
+     *}
+     * HTTP/1.1 400 Bad Request
+     */
+    public function destroy(Request $request)
+    {
+        $validator = \Validator::make($request->all(),
+            [
+                'id'  => 'required',
+            ],
+            [
+                'id.required'  => '动态ID不存在',
+            ]
+        );
+
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+
+//        $user = $this->getUser();
+
+        $id = $request->input('id');
+        CommentInfoModel::where('interaction_id',$id)->delete();
+        $ok =  InteractionInfo::destroy($id);
+
+        if ($ok) {
+            return $this->api('');
+        }else{
+            return $this->error(ErrorCode::OPERATION_FAILED);
+        }
+    }
 }

+ 156 - 3
server/app/Http/Controllers/Api/V1/MyController.php

xqd xqd xqd xqd
@@ -255,12 +255,13 @@ class MyController extends Controller
     public function reply()
     {
         $user = $this->getUser();
+//        $user = UserInfoModel::find(4);
         $data = CommentInfoModel::where('to_user_id',$user->id)->orderBy('id','desc')->get(); //user_id
         foreach ($data as $item){   //访问接口  标记已读
             $item->update(['is_read'=>0]);
             $info = InteractionInfo::find($item->interaction_id);
             $dream_id =empty($info) ? 0 : $info->dream_id;
-            $item->dream_id = $dream_id;
+            $item->dreamid = $dream_id;
         }
         return $this->api($data);
     }
@@ -287,12 +288,13 @@ class MyController extends Controller
     public function letter()
     {
         $user = $this->getUser();
-        $data  =  SystemInfoModel::where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
+        $data  =  SystemInfoModel::with('touser')->where('user_id',$user->id)->whereNotNull('to_user_id')->orderBy('id','desc')->get();
         foreach ($data as $item){   //访问接口  标记已读
             $item->update(['is_read'=>1]);
         }
         return $this->api($data);
-    } /**
+    }
+    /**
      * @api {get} /api/my/system_info 系统消息
      * @apiDescription 系统消息
      * @apiGroup My
@@ -860,6 +862,57 @@ class MyController extends Controller
         $users =$user->UserCareUser;
         return $this->api($users);
 
+    }
+    /**
+     * @api {get} /api/my/careme 关注我的用户
+     * @apiDescription 关注我的用户
+     * @apiGroup My
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     *{
+     *   "status": true,
+     *   "status_code": 0,
+     *  "message": "",
+     *   "data":[] or
+     *   "data": [
+     *      {
+     *           "id": 2,
+     *           "phone": "13880642881",
+     *          "nickname": "name2",
+     *          "avatar": "http://www.miao.com/upload/user/20170630/08e235d7211944e9b6482965b4d7c42e.jpg",
+     *          "birthday": "2000-06-21",
+     *          "sign": 0,
+     *          "money": 0,
+     *          "coin": 800,
+     *          "sex": 1,
+     *          "signture": "我的个性签名2",
+     *          "height": 200,
+     *          "work": "兼职",
+     *          "emotion": 2,
+     *          "address": "370105",
+     *          "city": "成都",
+     *          "detail_address": "",
+     *          "status": 1,
+     *          "wechat": "",
+     *          "weibo": "",
+     *          "remember_token": "",
+     *          "created_at": "2017-06-25 10:42:06",
+     *          "updated_at": "2017-06-30 09:15:04",
+     *          "deleted_at": null,
+     *      }
+     *  ]
+     *}
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     */
+    public function careMe()
+    {
+        $user = $this->getUser();
+        $users =$user->UserCareMe;
+        return $this->api($users);
+
     }
 
     public function insertSearchTable($id,$keyword)
@@ -1095,5 +1148,105 @@ class MyController extends Controller
             return $this->error(ErrorCode::OPERATION_FAILED);
         }
     }
+//    发私信
+    /**
+     * @api {post} /api/my/letter/store 发送私信
+     * @apiDescription 发送私信
+     * @apiGroup My
+     *    @apiParam {string} content         私信内容
+     *    @apiParam {int} to_user_id         私信对象
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     *{
+     *  "status": true,
+     *  "status_code": 0,
+     *  "message": "",
+     *  "data": ""
+     *}
+     * @apiErrorExample {json} Error-Response:
+     *{
+     *  "status": false,
+     *  "status_code": 700,
+     *  "message": "操作失败",
+     *  "data": null
+     *}
+     */
+    public function letterStore(Request $request)
+    {
+        $validator = \Validator::make($request->all(),
+            [
+                'content'  => 'required',
+                'to_user_id'  => 'required',
+            ],
+            [
+                'content.required'  => '私信内容不存在',
+                'to_user_id.required'  => '私信对象不存在',
+            ]
+        );
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+        $user = $this->getUser();
+        $user_id = $user->id;
+        $message = $request->input('content');
+        $to_user_id = $request->input('to_user_id');
+//        链接到最近的一个梦想
+        $dream = DreamInfoModel::where('user_id',$user_id)->orderBy('id','desc')->first();
+        $dream_id = empty($dream) ? 0 : $dream->id;
+        $arr = [
+            'user_id'=>$to_user_id,
+            'message'=>$message,
+            'to_user_id'=>$user_id,
+            'dream_id'=>$dream_id,
+        ];
+
+        $ok =SystemInfoModel::create($arr);
+        if ($ok) {
+            $this->jPush($user->nickname.'给你发了个私信哦~点击看看!','',$to_user_id);
+            return $this->api('');
+        }else{
+            return $this->error(ErrorCode::OPERATION_FAILED);
+        }
+    }  /**
+     * @api {get} /api/my/letter/show 查看私信
+     * @apiDescription 查看私信
+     * @apiGroup My
+     *    @apiParam {int} id         私信主键id
+     * @apiPermission Passport
+     * @apiVersion 0.1.0
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     *{
+     *  "status": true,
+     *  "status_code": 0,
+     *  "message": "",
+     *  "data": ""
+     *}
+     * @apiErrorExample {json} Error-Response:
+     *{
+     *  "status": false,
+     *  "status_code": 700,
+     *  "message": "操作失败",
+     *  "data": null
+     *}
+     */
+    public function letterShow(Request $request)
+    {
+        $validator = \Validator::make($request->all(),
+            [
+                'id'  => 'required',
+            ],
+            [
+                'id.required'  => '私信id不存在',
+            ]
+        );
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+        $user = $this->getUser();
+        $user_id = $user->id;
+        $id = $request->input('id');
+
+        $data = SystemInfoModel::find($id);
+      return $this->api($data);
+    }
 
 }

+ 1 - 1
server/app/Http/Controllers/Api/V1/PayController.php

xqd
@@ -265,7 +265,7 @@ class PayController extends Controller
             return $this->validatorError($validator->messages()->all(), ErrorCode::CLIENT_WRONG_PARAMS);
         }
 
-        $user = Auth::user();
+        $user = Auth::guard('api')->user();
         $data['goods_id'] = 1;
         if (!isset($data['goods'])) {//默认充余额
             $data['goods'] = OrderInfoModel::GOODS_TYPE_COIN;

+ 7 - 0
server/app/Models/SystemInfoModel.php

xqd
@@ -35,10 +35,17 @@ class SystemInfoModel extends BaseModel
                            'message',
                            'to_user_id',
                            'is_read',
+                           'interaction_id',
+                           'dream_id',
                           ];
 
     public function user()
     {
         return $this->hasOne('App\Models\UserInfoModel','id','user_id');
     }
+
+    public function touser()
+    {
+        return $this->hasOne('App\Models\UserInfoModel','id','to_user_id');
+    }
 }

+ 6 - 0
server/app/Models/UserInfoModel.php

xqd
@@ -63,6 +63,12 @@ class UserInfoModel extends Authenticatable
     {
         return $this->belongsToMany('App\Models\UserInfoModel','user_care_user','user_id','other_user_id');
     }
+
+    public function UserCareMe()
+    {
+        return $this->belongsToMany('App\Models\UserInfoModel','user_care_user','other_user_id','user_id');
+    }
+
     public function UserCareDream()
     {
         return $this->belongsToMany('App\Models\DreamInfoModel','user_care_dream','user_id','dream_id')->with(['user'])->withPivot('interaction_number','dream_user_id')->orderBy('updated_at');

+ 33 - 0
server/database/migrations/2017_10_25_102420_add_dream_id_and_interaction_id_to_system_info_table.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddDreamIdAndInteractionIdToSystemInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('system_info', function (Blueprint $table) {
+            $table->integer('dream_id')->nullable()->after('is_read');
+            $table->integer('interaction_id')->nullable()->after('is_read');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('system_info', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 16 - 0
server/routes/api.php

xqd xqd
@@ -150,10 +150,22 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'my.dream',
         'uses' => 'MyController@dream',
     ]);
+    $api->post('/my/letter/store', [
+        'as' => 'my.letterstore',
+        'uses' => 'MyController@letterStore',
+    ]);
+    $api->get('/my/letter/show', [
+        'as' => 'my.lettershow',
+        'uses' => 'MyController@letterShow',
+    ]);
     $api->get('my/care', [
         'as' => 'my.care',
         'uses' => 'MyController@care',
     ]);
+    $api->get('my/careme', [
+        'as' => 'my.careme',
+        'uses' => 'MyController@careMe',
+    ]);
 //    我的收藏
     $api->get('my/collection', [
         'as' => 'my.collection',
@@ -268,6 +280,10 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'interaction.delete',
         'uses' => 'InteractionController@delete',
     ]);
+    $api->get('/interaction/destroy', [  //删除动态
+        'as' => 'interaction.destroy',
+        'uses' => 'InteractionController@destroy',
+    ]);
 
     //支付宝支付回调
     $api->post('pay/alipay/notify', [