瀏覽代碼

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

Mike 7 年之前
父節點
當前提交
a8e60d1bf9

+ 19 - 5
server/app/Console/Commands/DreamDJS.php

xqd xqd xqd
@@ -49,11 +49,25 @@ class DreamDJS extends Command
     public function handle()
     {
         //执行逻辑
-        Log::info('------------通知消息begin-----------');
+        Log::info('------------定时任务begin-----------');
         $end_dream_info = DreamInfoModel::with('user')->where('end_time','<',date('Y-m-d H:i:s'))->get();
         if (count($end_dream_info)>0) {
             foreach ($end_dream_info as $item){
-//                (1)给梦想者发消息   梦想结束记录日志account_logs
+//                (1)给梦想者发消息   梦想结束记录日志account_logs  梦想结束创建二维码
+                if (empty($item->code)) {
+                    //        生成二维码
+                    $info = [];
+                    $info['transaction_id'] = date('YmdHis') . mt_rand(1000, 9999);
+                    $info['code'] = 'WECHATPAY_' . $info['transaction_id'];
+                    $code_url = env('APP_URL').'/api/user/meet?dream_id='.$item->id;
+                    $code_path = public_path('qrcodes/'.$info['code'].'.png');
+                    \QrCode::format('png')->size(500)->generate($code_url,$code_path);
+                    $code =  env('APP_URL').'/qrcodes/'.$info['code'].'.png';
+                    $item->code = $code;
+                    $item->save();
+                }
+
+
                 $dream_user = $item->user;
                 if (!empty($dream_user)) {
                     $img = $item->img;  //梦想图片
@@ -109,7 +123,7 @@ class DreamDJS extends Command
                     if (!empty($top)) {
                         foreach ($top as $k => $v) {
                             $key = array_search($v,$new_arr);  //排名
-                            $message = $item->name."已经结束啦!谢谢你的支持,你可是他的第".($key+1)."支持者哦!";
+                            $message = '《'.$item->name."已经结束啦!谢谢你的支持,你可是他的第".($key+1)."支持者哦!";
                             if (empty($key)) { //最大支持者
                                 $message = "恭喜你成为《".$item->name."》的《梦主》! ";
                                 $info =  $dream_user->nickname."会以你提供的微信/电话联系你约好时间地点亲自感谢你给予的支持和鼓励。如果你不希望见面或不想要梦想者拥有你的联系方式,请按《不需要见面》的按钮或联系客服。";
@@ -149,9 +163,9 @@ class DreamDJS extends Command
         if (count($dreams) > 0) {
             foreach ($dreams as $item) {
                 if (date('Y-m-d',strtotime($item->end_time)) == date('Y-m-d',time()+1*24*3600)) {
-                    $message = $item->name.'过1天就要结束啦!';
+                    $message = "《".$item->name.'过1天就要结束啦!';
                 }elseif(date('Y-m-d H:i',strtotime($item->end_time)) == date('Y-m-d H:i',time()+3600)){
-                    $message = $item->name.'过1小时就要结束啦!';
+                    $message = "《".$item->name.'过1小时就要结束啦!';
                 }else{
                     $message = '';
                 }

+ 0 - 44
server/app/Console/Commands/refurbish.php

xqd
@@ -1,44 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use Illuminate\Console\Command;
-use Illuminate\Support\Facades\Log;
-
-class refurbish extends Command
-{
-    /**
-     * The name and signature of the console command.
-     *
-     * @var string
-     */
-//    自动加载页面数据
-    protected $signature = 'refurbish';
-
-    /**
-     * The console command description.
-     *
-     * @var string
-     */
-    protected $description = '自动刷新';
-
-    /**
-     * Create a new command instance.
-     *
-     * @return void
-     */
-    public function __construct()
-    {
-        parent::__construct();
-    }
-
-    /**
-     * Execute the console command.
-     *
-     * @return mixed
-     */
-    public function handle()
-    {
-        Log::info('i miss you ');
-    }
-}

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

xqd xqd
@@ -14,7 +14,6 @@ class Kernel extends ConsoleKernel
      */
     protected $commands = [
         \App\Console\Commands\DreamDJS::class,
-        \App\Console\Commands\refurbish::class,
     ];
 
     /**
@@ -29,8 +28,6 @@ class Kernel extends ConsoleKernel
         //          ->hourly();
         $schedule->command('DreamDJS')
             ->everyMinute();
-        $schedule->command('refurbish')
-            ->everyMinute();
     }
 
     /**

+ 33 - 29
server/app/Http/Controllers/Admin/Dream/InfoController.php

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -8,6 +8,7 @@
  */
 namespace App\Http\Controllers\Admin\Dream;
 use App\Http\Controllers\Admin\Controller;
+use App\Models\Attachment;
 use App\Models\BaseAttachmentModel;
 use App\Models\BaseSettingsModel;
 use App\Models\DreamImages;
@@ -113,8 +114,8 @@ class InfoController extends Controller
             $data['sign'] = join(',',$data['sign']);
         }
         $pics = (array) request('pic');
-        if (request("file")) {
-            $file = request("file");
+        if (!empty(request("video"))) {
+            $file = request("video");
             $fileSize = $file->getSize();
             $size =  200 * 1024 * 1024;
             if ($fileSize > $size) {
@@ -127,7 +128,7 @@ class InfoController extends Controller
             if (!empty($mimeType) && !in_array($fileMimeType, $mimeType)) {
                 return back()->with('error','File type allow MP4!');
             }
-            if (!$file = VideoUpload::mvFile('file')) return back()->with('error','上传失败');
+            if (!$file = VideoUpload::mvFile('video')) return back()->with('error','上传失败');
             $data["video"] = $file;
         }
         $data['created_at'] = date('Y-m-d H:i:s');
@@ -146,7 +147,7 @@ class InfoController extends Controller
             if (!empty($pics)) {
                 foreach ($pics['url'] as $pic) {
                     $arr[] = [
-                        'pic'=>getenv('APP_URL').$pic,
+                        'pic'=>$pic,
                         'dream_id'=>$id,
                         'created_at'=>date("Y-m-d H:i:s"),
                         'updated_at'=>date("Y-m-d H:i:s"),
@@ -187,6 +188,7 @@ class InfoController extends Controller
         $data->imgs = $arr;
         $data['sign'] = explode(',',$data['sign']);
         $signs = BaseSettingsModel::where('category','sign')->orderBy('id')->get();
+//        dd($data);
         return view('admin.dream.info.edit',compact('data','signs'));
     }
 
@@ -229,8 +231,13 @@ class InfoController extends Controller
             $data['score'] = (log($care_num,$x) + ($a/$t) + $b)*100000000000000 ;
         }
         $pics = (array) request('pic');
-        if (request("file")) {
-            $file = request("file");
+        if (!empty(request("video"))) {
+            $md5 = $this->getarea($dream->video);
+            if (!empty($md5)) {
+                $attache = new \App\Services\Base\Attachment();
+                $attache->deleteAttachment($md5);
+            }
+            $file = request("video");
             $fileSize = $file->getSize();
             $size =  200 * 1024 * 1024;
             if ($fileSize > $size) {
@@ -243,45 +250,32 @@ class InfoController extends Controller
             if (!empty($mimeType) && !in_array($fileMimeType, $mimeType)) {
                 return back()->with('error','File type allow MP4!');
             }
-            if (!$file = VideoUpload::mvFile('file')) return back()->with('error','上传失败');
+            if (!$file = VideoUpload::mvFile('video')) return back()->with('error','上传失败');
             $data["video"] = $file;
-        }else{
-//            更新是视频不存在则删除
-            $dream = $this->repository->find(request('id'));
-            if (is_file('.'.str_replace(getenv('APP_URL'),'',$dream->video))) {
-                unlink('.'.str_replace(getenv('APP_URL'),'',$dream->video));
-            }
-            $dream->video = '';
-            $dream->save();
         }
         if (!empty($pics)) {
 //            图片不为空
             $old_data_pics =  $this->repository->find(request('id'))->imgs->toArray();
             $old_pics = array_column($old_data_pics,'pic');
-            $a = array_diff($pics['url'],$old_pics);
-            $b = array_diff($old_pics,$pics['url']);
-            if (!empty($a) || !empty($b)) {       //有图片变化执行
-                //        删除以前图片 重新插入
-                if (!empty($b)) {
-                    foreach ($b as $old_pic){
-                        if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
-                            unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
-                        }
-                        BaseAttachmentModel::where('url',$old_pic)->delete();
-                        DreamImages::where('pic',$old_pic)->delete();
+            //操作成功,删除原来的图片
+                foreach ($old_pics as $pic) {
+                    if (!in_array($pic, $pics['url'])) {
+                        $md5 = $this->getarea($pic);
+                        $attache = new \App\Services\Base\Attachment();
+                        $attache->deleteAttachment($md5);
                     }
                 }
+            DreamImages::where('dream_id',request('id'))->delete();
                 $arr = [];                         //插入新的图片
-                foreach ($a as $pic) {
+                foreach ($pics['url'] as $pic) {
                     $arr[] = [
-                        'pic'=>getenv('APP_URL').$pic,
+                        'pic'=>$pic,
                         'dream_id'=>request('id'),
                         'created_at'=>date('Y-m-d H:i:s'),
                         'updated_at'=>date('Y-m-d H:i:s'),
                     ];
                 }
                 DreamImages::insert($arr);
-            }
         }
         $ok = $this->repository->update(request('id'),$data);
         if ($data['status'] == 1) {   //审核通过
@@ -371,4 +365,14 @@ class InfoController extends Controller
         $list = $query->with('user')->where('dream_id',$dream_id)->paginate();
         return view('admin.dream.support_dream.index',compact('list'));
     }
+
+//    获取视频图片后缀码
+    public function getarea($str)
+    {
+        $start = strripos($str, '/');
+        $first = substr($str, $start + 1);
+        $end = strripos($first, '.');
+        $last = substr($first, 0, $end);
+        return $last;
+    }
 }

+ 30 - 40
server/app/Http/Controllers/Admin/Interaction/InfoController.php

xqd xqd xqd xqd xqd
@@ -59,12 +59,12 @@ class InfoController extends Controller
         $pics = (array) request('pic');
         if($pics){
             foreach ($pics['url'] as $key => $pic) {
-                $data['pic'.($key+1)] = getenv('APP_URL').$pic;
+                $data['pic'.($key+1)] = $pic;
             }
         }
 
-        if (request("file")) {
-            $file = request("file");
+        if (request("video")) {
+            $file = request("video");
             $fileSize = $file->getSize();
             $size =  200 * 1024 * 1024;
             if ($fileSize > $size) {
@@ -77,7 +77,7 @@ class InfoController extends Controller
             if (!empty($mimeType) && !in_array($fileMimeType, $mimeType)) {
                 return back()->with('error','File type allow MP4!');
             }
-            if (!$file = VideoUpload::mvFile('file')) return back()->with('error','上传失败');
+            if (!$file = VideoUpload::mvFile('video')) return back()->with('error','上传失败');
             $data["video"] = $file;
         }
         $id = InteractionInfo::create($data);
@@ -119,43 +119,32 @@ class InfoController extends Controller
         $data = (array) request('data');
         $interaction_id = request('id');
         $interaction = InteractionInfo::find($interaction_id)->toArray();
+        $interaction['title'] = $data['title'];
         $old_pics = [];
         for ($i = 1; $i <=9; $i++) {
             if (!empty($interaction['pic'.($i)])) {
-                $old_pics[] = $interaction['pic'.($i)];
+                $old_pics[$i] = $interaction['pic'.($i)];
             }
         }
+
         $new_pics = (array) request('pic');
-        $a = array_diff($new_pics['url'],$old_pics);
-        $b = array_diff($old_pics,$new_pics['url']);
-        if (!empty($a) || !empty($b)) {       //有图片变化执行
-            //        删除以前图片 重新插入
-            if (!empty($b)) {
-                foreach ($b as $old_pic){
-                    $key = array_search($old_pic,$interaction);
-                    $interaction[$key] = '';
-                    if (is_file('.'.str_replace(getenv('APP_URL'),'',$old_pic))) {
-                        unlink('.'.str_replace(getenv('APP_URL'),'',$old_pic));
-                    }
-                    BaseAttachmentModel::where('url',$old_pic)->delete();
-                    InteractionInfo::find(request('id'))->update($interaction);
-                }
+        if (!empty($new_pics)) {
+//            图片不为空
+            //操作成功,删除原来的图片
+            foreach ($new_pics['url'] as $key => $pic) {
+                $interaction['pic'.($key+1)] = $pic;
             }
-
-            $a = array_values($a);
-            $c = -1;
-            for ($i = 1; $i <=9; $i++) {
-                if (empty($interaction['pic'.($i)])) {
-                    $c++;
-                    if (array_key_exists($c,$a)) {
-                        $interaction['pic'.($i)] = getenv('APP_URL').$a[$c];
-                    }
-
+            foreach ($old_pics as $k => $pic) {
+                if (!in_array($pic, $new_pics['url'])) {
+                    $md5 = $this->getarea($pic);
+                    $attache = new \App\Services\Base\Attachment();
+                    $attache->deleteAttachment($md5);
+                    $interaction['pic'.($k+1)] = '';
                 }
             }
         }
-        if (!empty(request("file"))) {
-            $file = request("file");
+        if (!empty(request("video"))) {
+            $file = request("video");
             $fileSize = $file->getSize();
             $size =  200 * 1024 * 1024;
             if ($fileSize > $size) {
@@ -168,16 +157,8 @@ class InfoController extends Controller
             if (!empty($mimeType) && !in_array($fileMimeType, $mimeType)) {
                 return back()->with('error','File type allow MP4!');
             }
-            if (!$file = VideoUpload::mvFile('file')) return back()->with('error','上传失败');
+            if (!$file = VideoUpload::mvFile('video')) return back()->with('error','上传失败');
             $interaction["video"] = $file;
-        }else{
-//            更新是视频不存在则删除
-            $info = InteractionInfo::find(request('id'));
-            if (is_file('.'.str_replace(getenv('APP_URL'),'',$info->video))) {
-                unlink('.'.str_replace(getenv('APP_URL'),'',$info->video));
-            }
-            $info->video = null;
-            $info->save();
         }
         $ok = InteractionInfo::find(request('id'))->update($interaction);
         if($ok) {
@@ -270,4 +251,13 @@ class InfoController extends Controller
         }
      return view('admin.comment.edit',compact('interaction_id'));
     }
+    //    获取视频图片后缀码
+    public function getarea($str)
+    {
+        $start = strripos($str, '/');
+        $first = substr($str, $start + 1);
+        $end = strripos($first, '.');
+        $last = substr($first, 0, $end);
+        return $last;
+    }
 }

+ 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);
+        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) $v->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'));
     }
 }

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

xqd xqd xqd xqd
@@ -521,7 +521,9 @@ class DreamController extends Controller
             if (!$ok) {
                 return $this->error(ErrorCode::MERCHANT_SERVICE_STATUS_INVALID);
             }
-            $message = UserInfoModel::find($user->id)->nickname.'为你的梦想支持了'.$coin.'梦想币';
+//            ""."<span style='color: #00c3da'>[UserInfoModel::find($user->id)->nickname]</span> 为你《"
+            $nickname = UserInfoModel::find($user->id)->nickname;
+            $message =""."<span style='color: #00c3da'>[$nickname]</span> 为你《".$dream->name.'》支持了'.$coin.'梦想币';
             $info = [
                 'to_user_id' => $user_id,
                 'user_id'=>$user->id,
@@ -584,7 +586,7 @@ class DreamController extends Controller
         if ($top_user_id != $old_top_user_id) {   //新的最大支持者不是以前的最大支持者时
             $arr = [
                 'user_id'=>0,
-                'message'=>"你已不是《".$dream->name."》的《梦主》啦!".$user->nickname."以$new_arr[0]分刚取代你的位置",
+                'message'=>"你已不是《".$dream->name."》的《梦主》啦!"."<span style='color: #00c3da'>[$user->nickname]</span> "."以$new_arr[0]分刚取代你的位置",
                 'to_user_id'=>$old_top_user_id,
                 'dream_id'=>$dream_id,
                 'is_url'=>1,
@@ -658,7 +660,7 @@ class DreamController extends Controller
             }
             //                关注成功发送私信
             $message = BaseSettingsModel::where('category','message')->first();
-            $message = empty($message) ? $user->nickname.'收藏了你的梦想' : $message->value;
+            $message = empty($message) ? ""."<span style='color: #00c3da'>[$user->nickname]</span> 收藏了你的梦想《".$dream->name.'》' : $message->value;
             $info2 = [
                 'to_user_id' => $dream->user_id,
                 'message' => $message,
@@ -847,13 +849,14 @@ class DreamController extends Controller
         $data['created_at'] = date('Y-m-d H:i:s');
         $data['updated_at'] = date('Y-m-d H:i:s');
         $data['status'] = 1;  //默认审核通过
+        $video = $request->video;
+        if (!empty($video))  $data['video'] =env('APP_URL').'/attachment/'. $request->video;
         $dream_id = DreamInfoModel::insertGetId($data);
 
         if ($dream_id) {
 //            梦想创建成功 关联关系中最新动态+1
 //            UserCareUser::where('other_user_id',$user->id)->increment('dream_number',1);
             $pics = $request->pics;
-            $video = $request->video;
             if (!is_array($pics) && empty($pics) && empty($video)) {
                 DreamInfoModel::destroy($dream_id);
                 return $this->error(ErrorCode::ATTACHMENT_NOT_EXIST);

+ 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();

+ 39 - 4
server/app/Http/Controllers/Api/V1/InteractionController.php

xqd xqd xqd xqd 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;
@@ -72,10 +73,12 @@ class InteractionController extends Controller
             }
         }
         $dream_id = $request->id;
+        $dream_name = DreamInfoModel::find($dream_id)->name;
         $title = $request->title;
         $data['dream_id'] = $dream_id;
         $data['title'] = $title;
-        $data['video'] = $request->video;
+        $video = $request->video;
+        if (!empty($video))  $data['video'] =env('APP_URL').'/attachment/'. $request->video;
         $ok = InteractionInfo::create($data);
         if ($ok) {
             //        新的互动应该有消息通知《支持者》
@@ -85,7 +88,7 @@ class InteractionController extends Controller
                 foreach ($user_ids as $user_id) {
                     $arr['user_id']=$user->id;
                     $arr['to_user_id']=$user_id;
-                    $arr['message']='您支持的梦想又有新的动态啦';
+                    $arr['message']='您支持的梦想《'.$dream_name.'》又有新的动态啦';
                     $arr['interaction_id']=$ok->id;
                     $arr['dream_id']=$dream_id;
                     SystemInfoModel::create($arr);
@@ -169,7 +172,7 @@ class InteractionController extends Controller
                 $data['to_user_avatar'] = $to_user->avatar;
                 $data['to_user_nickname'] = $to_user->nickname;
 //点击去看看
-                $message = $user->nickname.'在你的互动上留言啦!点击去看看';
+                $message = ""."<span style='color: #00c3da'>[$user->nickname]</span> ".'在你的互动上留言啦!点击去看看';
                 $info = [
                     'to_user_id' => $data['to_user_id'],
                     'message' => $message,
@@ -186,7 +189,7 @@ class InteractionController extends Controller
             }
         }
         if (!empty($request->input('u_id'))) {
-            $message = $user->nickname.'提起了你哦~点击看看!';
+            $message = ""."<span style='color: #00c3da'>[$user->nickname]</span> ".'提起了你哦~点击看看!';
             $info = [
                 'to_user_id' => $request->input('u_id'),
                 'message' => $message,
@@ -211,7 +214,9 @@ class InteractionController extends Controller
         if ($ok) {
 //            评论动态也会出现在首页用户
             UserCareDream::where('dream_id',$dream_id)->increment('interaction_number',1);
+            $this->autoCareDream($user->id,$user->nickname,$dream_id);
             return $this->api('');
+//            评论成功自动收藏梦想
         }else{
             return $this->error(ErrorCode::OPERATION_FAILED);
         }
@@ -283,6 +288,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);
@@ -387,4 +395,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) ? ""."<span style='color: #00c3da'>[$nickname]</span> 收藏了你的梦想《".$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);
+        }
+    }
 }

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

xqd
@@ -1459,8 +1459,10 @@ class MyController extends Controller
 //            同意见面
             $dream->is_ok = 1;
             $dream->save();
-            $message = "你支持的梦想者已经同意见面啦";
+            $message = "你支持的《".$dream->name."》梦想者已经同意见面啦";
         }else{
+            $dream->is_ok = 0;
+            $dream->save();
             $message = "你支持的梦想者拒绝了本次见面,你支持的梦想资金将会退还给您";
 //            退款逻辑
         }

+ 1 - 1
server/app/Services/Base/Attachment.php

xqd
@@ -187,7 +187,7 @@ class Attachment
             $attachment->size = $fileSize;
             $attachment->file_type = $fileMimeType;
             if ($attachment->save()) {
-                return $this->_jsonMessage(200,  ['message' => "上传成功", 'fileurl' => $url_path,'name'=>$md5_filename]);
+                return $this->_jsonMessage(200,  ['message' => "上传成功", 'fileurl' => env('APP_URL').'/attachment/'.$md5,'name'=>$md5_filename]);
 
             } else {
                 @unlink($real_path);

+ 1 - 2
server/app/Widget/Tools/ImgUpload.php

xqd xqd
@@ -312,7 +312,6 @@ EOF;
         $option['max'] = $option['max']-count($imgs);
         $option['watermark'] = isset($option['watermark']) ? $option['watermark'] : "";
         if(!$option['callback'] && !empty($imgs)) {
-//                       dd($imgs);
             foreach($imgs as $key=>$val) {
                 if(is_string($val)) {
                     $img['url'] = $val;
@@ -329,7 +328,7 @@ EOF;
                         <input type=\"hidden\" name=\"{$name}[url][]\" value=\"{$img['url']}\">
                     </li>";*/
                 //echo  in_array(fileExt($img['url']), ['jpg', 'png']) ? "<div class='icon'><i class='fa fa-file'></i></div>" :" <div class='image'><img src= alt= /></div>";
-                $iconImage = in_array(fileExt($img['url']), ['jpg', 'png' , 'gif' , 'jpeg' , 'bmp']) ? " <div class='image'><img src=\"{$img['url']}\" alt= /></div>" : "<div class='icon'><i class='fa fa-file'></i></div>";
+                $iconImage = " <div class='image'><img src=\"{$img['url']}\" alt= /></div>" ;
 
                 $imgHtml .="<li >
                         <div class=\"file\">

+ 32 - 36
server/app/Widget/Tools/VideoUpload.php

xqd xqd xqd
@@ -2,8 +2,11 @@
 
 namespace App\Widget\Tools;
 
+use App\Models\BaseAttachmentModel;
 use Illuminate\Support\Facades\Request;
 use Intervention\Image\Facades\Image;
+use Symfony\Component\HttpFoundation\File\Exception\FileException;
+
 //use FFMpeg;
 /**
  * Created by PhpStorm.
@@ -18,9 +21,7 @@ class VideoUpload
     {
 
         if (!is_readable($path)) {
-
             mkdir($path, 0700, true);
-
         }
 
     }
@@ -31,50 +32,45 @@ class VideoUpload
      *
      */
 
-    public static function mvFile($fileName, $sizex = 150, $sizey = 200,$isImage = false, $dir = 'dream/video')//200 270
+    public static function mvFile($fileName)
     {
-
+        $rel_path =  '/upload/video/' . date('Ymd');
+        $path = public_path() . $rel_path;
         if (!Request::hasFile($fileName)) return false;
 
         $file = Request::file($fileName);
 
-        VideoUpload::mkFolder(public_path('upload/'));
-
-        if(Request::get('article_id'))$dir=Request::get('article_id');
-        $filePath = public_path('upload/'.$dir.'/');
-        VideoUpload::mkFolder($filePath);
+        $fileSize = $file->getSize();
 
-        $fileName = time() . '.' . $file->getClientOriginalExtension();
 
-//        $fileName = $clientName . '.' . $file->getClientOriginalExtension();
-
-        \Log::info($filePath. $fileName);
-        if($isImage){
-            if (!Image::make($file)->resize($sizex, $sizey)->save($filePath. $fileName)) return false;
-
-        }else{
-            $file->move($filePath, $fileName);
+        $clientName = $file->getClientOriginalName();
+        $md5 = md5($clientName . time());
+        $md5_filename = $md5 . '.' . $file->getClientOriginalExtension();
+        $fileMimeType = $file->getMimeType();
+        try {
+            if(!$file->move($path, $md5_filename)){
+                return  false;
+            }
 
-         /*   //正常缩略图
-            $ffmpeg = FFMpeg\FFMpeg::create(array(
-                'ffmpeg.binaries'  => '/usr/bin/ffmpeg',
-                'ffprobe.binaries' => '/usr/bin/ffprobe'
-            ));
-            $video = $ffmpeg->open($filePath. $fileName);
-            $vpath = $filePath;
-            if (!file_exists($vpath)) {
-                if (!@mkdir($vpath, 0755, true)) {
-                    return ErrorCode::ATTACHMENT_MKDIR_FAILED;
-                }
+            $real_path = $path . '/' . $md5_filename;
+            $url_path = $rel_path . '/' . $md5_filename;
+
+            $attachment = new BaseAttachmentModel();
+            $attachment->name = $clientName;
+            $attachment->md5 = $md5;
+            $attachment->path = $real_path;
+            $attachment->url = $url_path;
+            $attachment->size = $fileSize;
+            $attachment->file_type = $fileMimeType;
+            if ($attachment->save()) {
+                return env('APP_URL').'/attachment/'.$md5;
+            } else {
+                @unlink($real_path);
+                return  false;
             }
-            $pic = $vpath. $fileName.'.jpg';
-            \Log::info($pic);
-            $video
-                ->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(1))
-                ->save( $pic );*/
+        } catch (FileException $e) {
+            return  false;
         }
-
-        return '/upload/' .$dir.'/'. $fileName;
     }
 
 }

+ 2 - 1
server/public/base/plugins/imguploader/uploader.js

xqd xqd
@@ -13,7 +13,7 @@ var uploadlist = "";
 var uploadObj = [];
 function upload(obj){    
     this.upobj = {
-        UploaderUrl : obj.UploaderUrl ? obj.UploaderUrl : "http://cdn.staticfile.org/webuploader/0.1.0/webuploader.js",
+        UploaderUrl : obj.UploaderUrl ? obj.UploaderUrl : "https://cdn.bootcss.com/webuploader/0.1.1/webuploader.min.js",
         UploaderServer : obj.UploaderServer ? obj.UploaderServer :"/api/attachment/webupload?elementid=&watermark=" + obj.UploadWatermark + "&_time=" + Math.random() ,
         UploaderPick : obj.UploaderPick ? obj.UploaderPick : "#upload01" ,
         UploaderMax  : obj.UploaderMax ? obj.UploaderMax : 100,
@@ -67,6 +67,7 @@ upload.prototype.loadCom = function() {
         div.layout_upload ul.ullit li small.text-danger{  color:#ed5565;  }\
         div.layout_upload ul.ullit li .file-name{ height:48px; padding:5px;}\
         div.layout_upload ul.ullit li .file-name p{ height:20px;  margin:0; overflow: hidden;}\
+        div.layout_upload ul.ullit li .webuploader-element-invisible { position: absolute; clip: rect(1px 1px 1px 1px);}\
         </style>")
     if(typeof WebUploader != 'undefined'){
         _this.upLoader();

+ 18 - 2
server/resources/views/admin/dream/info/edit.blade.php

xqd xqd
@@ -79,14 +79,14 @@
                                 <div  id="is_video" style="display: none">
                     <div class="form-group">
                         <label class="control-label col-sm-3" >视频(mp4格式,200MB内)</label>
-                        <input type="file" name="file" >
+                        <input type="file" name="video" >
                     </div>
                     <div class="form-group" @if(empty($data))
                     style="display: none"
                             @endif>
                         <label class="control-label col-sm-3" >&nbsp;</label>
                         <div class="col-sm-9" style="width: 50%;height: 50%">
-                            <video style="width: 300px" src="{{ $data['video'] or ''}}" controls >
+                            <video style="width: 300px;height:200px;" src="{{ $data['video'] or ''}}" controls >
                             </video>
                         </div>
                     </div>
@@ -149,6 +149,22 @@
                         @endforeach
                     </div>
 
+                </div>
+                <div class="form-group">
+                    <label class="control-label col-sm-3">见面情况</label>
+
+                    <div class="col-sm-9">
+                        <label class="radio-inline">
+                            <input type="radio" name="data[is_ok]" value="" />待定
+                        </label>
+                        <label class="radio-inline">
+                                <input type="radio" name="data[is_ok]" value="1" @if(isset($data['is_ok']) && $data['is_ok'] == 1)checked="checked" @endif/>同意
+                            </label>
+                        <label class="radio-inline">
+                                <input type="radio" name="data[is_ok]" value="0" @if(isset($data['is_ok']) && $data['is_ok'] === 0)checked="checked" @endif/>拒绝
+                            </label>
+                    </div>
+
                 </div>
                 <div class="form-group">
                                     

+ 2 - 2
server/resources/views/admin/interaction/info/edit.blade.php

xqd xqd
@@ -57,7 +57,7 @@
                                 <div  id="is_video" style="display: none">
                                     <div class="form-group">
                                         <label class="control-label col-sm-3" >视频(mp4格式,200MB内)</label>
-                                        <input type="file" name="file" >
+                                        <input type="file" name="video" >
                                     </div>
                                     <div class="form-group" @if(empty($data))
                                     style="display: none"
@@ -95,7 +95,7 @@
                                     <div class="col-sm-9">
                                         <input type="hidden" name="_referer" value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
                                         <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
-                                        <input type="hidden" name="data[dream_id]" value="@if(isset($dream_id)) {{$dream_id or ''}} @elseif(isset($data['dream_id']))) {{ $data['video'] or ''}} @endif">
+                                        <input type="hidden" name="data[dream_id]" value="@if(isset($dream_id)) {{$dream_id or ''}}  @endif">
                                         <input type="submit" class="btn btn-success" style="margin-right:20px;">
                                         <input type="reset" class="btn btn-default" >
                                     </div>

+ 0 - 93
server/resources/views/admin/share.blade.php

xqd
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>{{empty($dream->user) ? '' : $dream->user->nickname}}的梦想</title>
-    <script src="/base/js/jquery-2.1.1.min.js"></script>
-    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
-    <style>
-        body{
-            padding: 0;
-            margin: 0;
-        }
-        p{
-            -webkit-margin-before: 0.1em;
-            -webkit-margin-after: 0.1em;
-        }
-    </style>
-</head>
-<body style="overflow-x: hidden">
-<div style="height: 50px">
-    <a href="https://fir.im/jt4h">
-        <div style="float: left;color: #666;line-height: 50px;padding-left: 5px">支持({{empty($dream->user) ? '' : $dream->user->nickname}})的梦想!现在就下载喵喵</div>
-        <div style="float: right;padding: 5px">
-            <img style="width: 40px;height: 40px;" src="http://firicon.fir.im/396004d5e7b572efbefdfee976338331a457282b" alt="">
-        </div>
-    </a>
-
-</div>
-<img style="width: 100%; height: 100%;" src="{{!empty($dream->img) ? $dream->img->pic : ''}}
-
-">
-<p style="font-size: 17px; padding: 0 10px">{{$dream->name}}</p>
-<div style="border-bottom: 1px solid #DEDEDE">
-    <p id="about" style="font-size: 13px; padding: 0 10px; color: #919191;white-space: nowrap;overflow:hidden;text-overflow:ellipsis">
-        {{$dream->about}}
-    </p>
-    <p style="text-align: center">
-        <img src="/base/img/down.svg" alt="" id="down">
-        <img src="/base/img/up.svg" alt="" id="up">
-    </p>
-</div>
-<div style="border-bottom: 1px solid #DEDEDE; height: 50px; padding: 5px 10px;">
-    <div style="float:left;">
-        <p>{{$days}}</p>
-        <p style="font-size: 13px; color: #919191">剩余时间</p>
-    </div>
-    {{--判断显示--}}
-    @if( $dream->user_id == $user_id)
-        <div style="float:right;">
-            <p style="text-align: right">{{$dream->mark}}</p>
-            <p style="font-size: 13px;; color: #919191">当前获得梦想分数</p>
-        </div>
-    @endif
-</div>
-<div style="clear:both; height: 50px; padding: 5px 10px;">
-    <div style="text-align: left; float:left;">
-        <p style="">{{$dream->coin}}</p>
-        <p style="font-size: 13px; color: #919191">我要求的梦想币</p>
-    </div>
-    {{--判断显示--}}
-    @if( $dream->user_id == $user_id)
-        <div style="text-align: right;float: right">
-            <p style="color: #FF6600">{{$dream->get_coin}}</p>
-            <p style="font-size: 13px; color: #919191">目前已获梦想币</p>
-        </div>
-    @endif
-</div>
-<div style="padding: 0 10px 20px  10px">
-    <div style="background-color:#E6E6E6; width: 100%;">
-        <div style="width: {{($dream->get_coin / $dream->coin)*100}}%; background: #FF6600; height: 5px">
-        </div>
-    </div>
-</div>
-</body>
-</html>
-<script>
-    $(function () {
-        $('#up').hide();
-        var str = $('#about').html();
-        new_str = str.replace(/\n/g,"<br/>");
-        $('#about').html(new_str);
-        $('#up').click(function () {
-            $(this).hide();
-            $('#down').show();
-            $('#about').css('white-space','nowrap');
-        });
-        $('#down').click(function () {
-            $(this).hide();
-            $('#up').show();
-            $('#about').css('white-space','normal');
-        });
-    });
-</script>

+ 8 - 5
server/resources/views/admin/share1.blade.php

xqd xqd xqd xqd xqd
@@ -89,7 +89,7 @@
             font-size: 16px; }
 
         .hdcontent {
-            padding-top:49px;
+            padding-top:8px;
         }
         .hdcontent .item {
             padding:0;
@@ -275,7 +275,7 @@
 
     </style>
 </head>
-<body style="overflow-x: hidden" >
+<body>
 <div style="height: 50px">
     <a href="https://fir.im/jt4h" style="height: 50px; background: #00c3da; position: fixed; z-index: 99; width: 100%">
         <div style="float: left;color: #fff;line-height: 50px;padding-left: 5px">支持({{empty($dream->user) ? '' : $dream->user->nickname}})的梦想!现在就下载喵喵</div>
@@ -284,7 +284,7 @@
         </div>
     </a>
 </div>
-<div id="sidebar-tab">
+<div style="overflow-x: hidden"  id="sidebar-tab">
     <div id="tab-title">
         <h3><span class="selected">主页</span><span>互动</span><span>排行榜</span></h3>
     </div>
@@ -295,7 +295,8 @@
                 <div class="swiper-wrapper">
                     @if($dream['video'])
                         <div class="swiper-slide" style="width: 320px;height: 200px;">
-                            <video style="width: 100%;height:200px;" src="{{ $dream['video']}}" controls >
+                            {{--poster="{{$dream->poster}}"--}}
+                            <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
@@ -428,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>