gq %!s(int64=7) %!d(string=hai) anos
pai
achega
1b2d38d909

+ 11 - 6
server/app/Http/Controllers/Admin/Share/InfoController.php

xqd xqd xqd
@@ -12,6 +12,13 @@ use App\Http\Controllers\Controller;
 
 class InfoController extends Controller
 {
+    public function getMd5($str)
+    {
+        $start = strripos($str, '/');
+        $last = substr($str, $start+1);
+        return $last;
+    }
+
     public function view(Request $request){
         $id = $request->id;
         $dream = DreamInfoModel::with('img')->find($id);
@@ -52,7 +59,9 @@ class InfoController extends Controller
         $interactions = InteractionInfo::where('dream_id',$id)->with(['comments' => function ($query) {
             $query->orderBy('created_at');
         }])->orderBy('id','desc')->get();
-        
+        foreach ($interactions as $k => $v){
+            if ($v->video) $interactions->interaction_md5 = $this->getMd5($v->video);
+        }
 //        梦想
         $dream = DreamInfoModel::find($id);
         $setting = BaseSettingsModel::where('category','score')->select('key','value','sort')->first();
@@ -71,11 +80,7 @@ class InfoController extends Controller
         $dream->number = $number;
         $dream->a = $a;
         $dream->c = $c;
-//        dd($topuser);
-//        foreach ($topuser as $key => $cal) {
-//            dump($key);
-//        }
-//        dd();
+        $dream->dream_md5 = $this->getMd5($dream->video);
         return view('admin.share1',compact('dream','days','user_id','topuser','top3user','interactions'));
     }
 }

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

xqd
@@ -521,7 +521,7 @@ class DreamController extends Controller
             if (!$ok) {
                 return $this->error(ErrorCode::MERCHANT_SERVICE_STATUS_INVALID);
             }
-            $message = UserInfoModel::find($user->id)->nickname.'为你的梦想支持了'.$coin.'梦想币';
+            $message ="<span style='color: #00c3da '>[". UserInfoModel::find($user->id)->nickname."]</span>".'为你《'.$dream->name.'》支持了'.$coin.'梦想币';
             $info = [
                 'to_user_id' => $user_id,
                 'user_id'=>$user->id,

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

xqd
@@ -219,7 +219,7 @@ class HomeController extends Controller
         $dream = DreamInfoModel::find($dream_id);
         if (empty($dream)) return $this->error(ErrorCode::DREAM_NOT_EXIST);
         $dream_user_id = $dream->user_id;
-        if ($dream->get_coin < $dream->coin)  return $this->error(ErrorCode::DREAM_STATUS);
+//        if ($dream->get_coin < $dream->coin)  return $this->error(ErrorCode::DREAM_STATUS);
 //        找到最大支持者
         $arr = [] ;//支持者 和支持分数
         $sups = SupportDreamModel::where('dream_id',$dream_id)->get()->groupBy('user_id')->toArray();

+ 33 - 0
server/app/Http/Controllers/Api/V1/InteractionController.php

xqd xqd xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers\Api\V1;
 
+use App\Models\BaseSettingsModel;
 use App\Models\CommentInfoModel;
 use App\Models\DreamInfoModel;
 use App\Models\InteractionInfo;
@@ -213,6 +214,8 @@ class InteractionController extends Controller
 //            评论动态也会出现在首页用户
             UserCareDream::where('dream_id',$dream_id)->increment('interaction_number',1);
             return $this->api('');
+//            评论成功自动收藏梦想
+            $this->autoCareDream($user->id,$user->nickname,$dream_id);
         }else{
             return $this->error(ErrorCode::OPERATION_FAILED);
         }
@@ -284,6 +287,9 @@ class InteractionController extends Controller
         $ok =  CommentInfoModel::create($data);
 
         if ($ok) {
+            //            评论成功自动收藏梦想
+            $dream_id = InteractionInfo::find($request->id)->dream_id;
+            $this->autoCareDream($user->id,$user->nickname,$dream_id);
             return $this->api('');
         }else{
             return $this->error(ErrorCode::OPERATION_FAILED);
@@ -388,4 +394,31 @@ class InteractionController extends Controller
             return $this->error(ErrorCode::OPERATION_FAILED);
         }
     }
+
+    public function autoCareDream($user_id,$nickname,$dream_id)
+    {
+        $user_care_dream = UserCareDream::where('user_id',$user_id)->where('dream_id',$dream_id)->first();
+        if (empty($user_care_dream)) {
+            $dream = DreamInfoModel::find($dream_id);
+            $data_info = [
+                'user_id' =>$user_id,
+                'dream_id' =>$dream_id,
+                'dream_user_id' =>$dream->user_id,
+            ];
+            UserCareDream::create($data_info);
+            //                关注成功发送私信
+            $message = BaseSettingsModel::where('category','message')->first();
+            $message = empty($message) ? $nickname.'收藏了你的梦想《'.$dream->name.'》' : $message->value;
+            $info2 = [
+                'to_user_id' => $dream->user_id,
+                'message' => $message,
+                'dream_id' => $dream_id,
+                'user_id' => $user_id,
+                'is_reply' => 1,
+                'type_id' => 1,
+                'attr_id' => 2,
+            ];
+            SystemInfoModel::firstOrCreate($info2);
+        }
+    }
 }

+ 4 - 2
server/resources/views/admin/share1.blade.php

xqd xqd
@@ -296,7 +296,7 @@
                     @if($dream['video'])
                         <div class="swiper-slide" style="width: 320px;height: 200px;">
                             {{--poster="{{$dream->poster}}"--}}
-                            <video  style="width: 100%;height:200px;" src="{{(mb_substr( $dream['video'], 0, 4 )=='http') ? $dream['video']:env('APP_URL').'/attachment/'.$dream['video']}}" controls >
+                            <video poster="{{env('APP_URL').'/upload/vpic/'.$dream->dream_md5.'jpg'}}"  style="width: 100%;height:200px;" src="{{(mb_substr( $dream['video'], 0, 4 )=='http') ? $dream['video']:env('APP_URL').'/attachment/'.$dream['video']}}" controls >
                             </video>
                         </div>
                     @endif
@@ -429,7 +429,9 @@
                     @if($interaction['video'])
 
                     <div class="box banner" >
-                        <video src="{{ $interaction['video'] }}" width="100%" style="max-height: 400px;" class="centerme" controls="controls"></video>
+                        {{--<video src="{{ $interaction['video'] }}" width="100%" style="max-height: 400px;" class="centerme" controls="controls"></video>--}}
+                        <video  width="100%" poster="{{env('APP_URL').'/upload/vpic/'.$interaction->interaction_md5.'jpg'}}" style="max-height: 400px;" class="centerme" src="{{(mb_substr( $interaction['video'], 0, 4 )=='http') ? $interaction['video']:env('APP_URL').'/attachment/'.$interaction['video']}}" controls >
+                        </video>
                     </div>
                     @endif
                 </div>