gq hace 8 años
padre
commit
1d97c79fdc

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

xqd
@@ -49,6 +49,7 @@ class IndexController extends Controller
         $dreams = DreamInfoModel::orderBy('created_at')->get();
         foreach ($dreams as $k => $dream) {
             $dream->dream_find_user =  $dream->dreamFindUser;
+            $dream->dream_first_pic =  $dream->dreamImgsFirst;
         }
         return $this->api(compact('banner','other_user','dreams'));
     }

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

xqd xqd
@@ -364,6 +364,7 @@ class MyController extends Controller
      * @api {post} /api/my/add_dream 发布梦想(addDream)
      * @apiDescription 发布梦想(addDream)
        * @apiParam {string}  pic   梦想图片 数组
+       * @apiParam {string}  videos   梦想视频
        * @apiParam {string}  dream   梦想标题
        * @apiParam {string}  about   梦想介绍
        * @apiParam {int}  money   梦想币
@@ -416,7 +417,8 @@ class MyController extends Controller
             $data1['created_at'] = date('Y-m-d H:i:s');
             $data1['updated_at'] = date('Y-m-d H:i:s');
             $arr = $request->pic;
-            if (empty($arr))   return $this->error(ErrorCode::ATTACHMENT_NOT_EXIST);
+            $videos = $request->videos;
+            if (empty($arr) && empty($videos))   return $this->error(ErrorCode::ATTACHMENT_NOT_EXIST);
             $ok = UserDream::create($data1);
             $arr1 = [];
             if ($ok) {

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

xqd
@@ -52,6 +52,8 @@ class UserInfoModel extends Authenticatable
                            'remember_token',
                           ];
 
+    protected $hidden = ['password'];
+
     public function UserCareUser()
     {
         return $this->belongsToMany('App\Models\UserInfoModel','user_care_user','user_id','other_user_id');

+ 32 - 0
server/database/migrations/2017_06_15_082636_add_column_videos_to_dream_info_table.php

xqd
@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddColumnVideosToDreamInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('dream_info', function (Blueprint $table) {
+            $table->string('videos')->comment('梦想视频地址')->default('')->after('about');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('dream_info', function (Blueprint $table) {
+            //
+        });
+    }
+}