gq 7 年之前
父节点
当前提交
3819c5db5e

+ 1 - 1
server/app/Http/Controllers/Admin/System/InfoController.php

xqd
@@ -28,7 +28,7 @@ class InfoController extends Controller
         $query = $this->repository->pushCriteria(new MultiWhere($search));
         $request = $reqeust->all();
         if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
-        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
+            $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
         }else{
             $query = $query->pushCriteria(new OrderBy('id','desc'));
         }

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

xqd xqd xqd xqd xqd
@@ -1224,6 +1224,8 @@ class MyController extends Controller
      * @apiDescription 发送私信
      * @apiGroup My
      *    @apiParam {string} content         私信内容
+     *    @apiParam {string} [image]         图片
+     *    @apiParam {string} [video]         视频
      *    @apiParam {int} to_user_id         私信对象
      * @apiPermission Passport
      * @apiVersion 0.1.0
@@ -1259,6 +1261,8 @@ class MyController extends Controller
         $user = $this->getUser();
         $user_id = $user->id;
         $info = $request->input('content');
+        $video = $request->input('video');
+        $image = $request->input('image');
         $to_user_id = $request->input('to_user_id');
 //        链接到最近的一个梦想
         $dream = DreamInfoModel::where('user_id',$user_id)->orderBy('id','desc')->first();
@@ -1269,6 +1273,8 @@ class MyController extends Controller
             'message'=>$user->nickname.'给你发了个私信哦~点击看看!',
             'to_user_id'=>$user_id,
             'dream_id'=>$dream_id,
+            'video'=>$video,
+            'image'=>$image,
             'type_id'=>2,
             'is_url'=>1,
             'attr_id'=>9,
@@ -1281,7 +1287,8 @@ class MyController extends Controller
         }else{
             return $this->error(ErrorCode::OPERATION_FAILED);
         }
-    }  /**
+    }
+    /**
      * @api {get} /api/my/letter/show 查看私信
      * @apiDescription 查看私信
      * @apiGroup My
@@ -1323,4 +1330,55 @@ class MyController extends Controller
       return $this->api($data);
     }
 
+//    梦想结束时梦想者是否同意见面
+    /**
+     * @api {get} /api/my/system/dream_isok 是否同意见面
+     * @apiDescription 梦想结束时梦想者是否同意见面
+     * @apiGroup My
+     *    @apiParam {int} dream_id         梦想id
+     *    @apiParam {int} value         0取消1确定
+     * @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 isOk(Request $request)
+    {
+        $validator = \Validator::make($request->all(),
+            [
+                'value'  => 'required',
+                'dream_id'  => 'required',
+            ],
+            [
+                'value.required'  => '参数错误',
+                'dream_id.required'  => '梦想不存在',
+            ]
+        );
+        if($validator->fails()) return $this->validatorError($validator->messages()->all(),ErrorCode::CLIENT_WRONG_PARAMS);
+        $dream_id = $request->input('dream_id');
+        $value = $request->input('value');
+        $dream = DreamInfoModel::find($dream_id);
+        if (empty($dream)) return $this->error(ErrorCode::DREAM_NOT_EXIST);
+        if (empty($value)) {
+
+        }else{
+//            同意见面
+            $dream->is_ok = 1;
+            $dream->save();
+        }
+    }
+
 }

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

xqd
@@ -45,6 +45,8 @@ class SystemInfoModel extends BaseModel
                            'is_end',
                            'is_ok',
                            'attr_id',
+                           'image',
+                           'video',
                           ];
 
     public function user()

+ 33 - 0
server/database/migrations/2017_11_01_101227_add_imagevideo_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 AddImagevideoToSystemInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('system_info', function (Blueprint $table) {
+            $table->string('image')->nullable()->after('message');
+            $table->string('video')->nullable()->after('message');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('system_info', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 1 - 1
server/resources/views/admin/system/info/index.blade.php

xqd
@@ -26,7 +26,7 @@
 				        </div>
 				        </form>
 						<div class="col-sm-3 pull-right">
-							<a href="{{ U('System/Info/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+							<a href="{{ U('System/Info/create')}}" class="btn btn-sm btn-primary pull-right">发送系统消息</a>
 						</div>
 					</div>