dyjh 6 jaren geleden
bovenliggende
commit
c38a55dcc3

+ 12 - 0
app/Http/Controllers/Admin/Album/ManufacturerController.php

xqd xqd xqd
@@ -63,6 +63,12 @@ class ManufacturerController extends Controller
         return view('admin.album.manufacturer.edit', compact('data', 'video'));
     }
 
+    public function viewShare(Request $request)
+    {
+        $img = '/base/img/share.jpg';
+        return view('admin.album.poster.view', compact('img'));
+    }
+
     public function platform(Request $request)
     {
         if ($request->method() == 'POST') {
@@ -175,6 +181,9 @@ class ManufacturerController extends Controller
             $data['logo'] = $this->formatImgUrl($data['logo']);
         }
 
+        if (!empty($data['share_image'])) {
+            $data['share'] = $this->formatImgUrl($data['share_image']);
+        }
         if(!empty($data['background_pic']))
             $data['background_pic'] = $this->formatImgUrl($data['background_pic']);
         if(!empty($data['advertising_pic']))
@@ -233,6 +242,9 @@ class ManufacturerController extends Controller
             $data['advertising_pic'] = $this->formatImgUrl($data['advertising_pic']);
            // $this->deleteUrl($saveData->advertising_pic);
         }
+        if (!empty($data['share_image'])) {
+            $data['share'] = $this->formatImgUrl($data['share_image']);
+        }
         if (!empty($data['notice_icon'])) {
             $data['notice_icon'] = $this->formatImgUrl($data['notice_icon']);
            // $this->deleteUrl($saveData->notice_icon);

+ 50 - 34
app/Http/Controllers/Admin/Album/PosterController.php

xqd xqd xqd xqd xqd
@@ -8,6 +8,7 @@
  */
 namespace App\Http\Controllers\Admin\Album;
 use App\Http\Controllers\Admin\Controller;
+use App\Repositories\Album\Criteria\PosterWhere;
 use Illuminate\Http\Request;
 use App\Services\OSS;
 use App\Models\AlbumPosterModel;
@@ -29,7 +30,7 @@ class PosterController extends Controller
     function index(Request $request)
     {
         $search['keyword'] = $request->input('keyword');
-        $query = $this->repository->pushCriteria(new ProductWhere($search, $this->getStoreId()));
+        $query = $this->repository->pushCriteria(new PosterWhere($search, $this->getStoreId()));
 
 
         if (isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
@@ -38,22 +39,50 @@ class PosterController extends Controller
             $query = $query->pushCriteria(new OrderBy('id', 'DESC'));
         }
         $list = $query->paginate();
-        foreach ($list as $key => $item) {
-            $cat = AlbumCatModel::where('id', $item->cat_id)->first();
-            if ($cat) {
-                $catParent = AlbumCatModel::where('id', $cat->parent_id)->first();
+        //dd($list);
+        return view('admin.album.poster.index', compact('list'));
+    }
+
+    /**
+     * 添加
+     *
+     */
+    public function create(Request $request)
+    {
+        if ($request->method() == 'POST') {
+            return $this->_createSave();
+        }
+        return view('admin.album.poster.edit');
+    }
+
+    private function _createSave()
+    {
+        $data = (array) request('data');
+        if (isset($data['video_url'])) {
+            $data['video_url'] = $this->uploadVideo($data['video_url'], '');
+        }
+        if (!empty($data['posters']['url'])) {
+            foreach ($data['posters']['url'] as $key => $val) {
+                $data['posters']['url'][$key] = $this->formatImgUrl($val);
             }
+            $data['posters'] = json_encode($data['posters']['url']);
+        }
 
-            $item->cat_name = ($catParent->name ?? '暂无') . '>' . ($cat->name ?? '暂无');
-            $upload_img = json_decode($item->upload_img);
-            $attr = json_decode($item->attr);
-            $detail = json_decode($item->detail);
-            $list[$key]['install_img'] = $upload_img[0];
-            $list[$key]['specifications_img'] = $attr[0];
-            $list[$key]['detail'] = $detail[0];
+        /*if (empty($data['qrcode'])) {
+            return $this->showMessage('分享海报或者二维码不能为空!');
+        }
+        $data['qrcode'] = $this->formatImgUrl($data['qrcode']);*/
+        if (!empty($data['words'])) {
+            $data['words'] = json_encode($data['words']);
+        }
+
+        $ok = $this->repository->create($data);
+
+        if ($ok) {
+            return $this->showMessage('操作成功');
+        } else {
+            return $this->showMessage('操作失败');
         }
-        //dd($list);
-        return view('admin.album.product.index', compact('list'));
     }
 
     /**
@@ -89,27 +118,18 @@ class PosterController extends Controller
             }
             $data['posters'] = json_encode($data['posters']['url']);
         }
-        if (!empty($data['banner']['url'])) {
-            foreach ($data['banner']['url'] as $key => $val) {
-                $data['banner']['url'][$key] = $this->formatImgUrl($val);
-            }
-            $data['banner'] = json_encode($data['banner']['url']);
-        }
-        if (empty($data['share']) || empty($data['qrcode'])) {
+
+       /* if (empty($data['qrcode'])) {
             return $this->showMessage('分享海报或者二维码不能为空!');
         }
-        $data['share'] = $this->formatImgUrl($data['share']);
-        $data['qrcode'] = $this->formatImgUrl($data['qrcode']);
+        $data['qrcode'] = $this->formatImgUrl($data['qrcode']);*/
         if (!empty($data['words'])) {
             $data['words'] = json_encode($data['words']);
         }
         $id = request('id');
-        if (empty($id)) {
-            $data['store_id'] = $this->getStoreId();
-            $ok = $this->repository->create($data);
-        } else {
-            $ok = $this->repository->update($id, $data);
-        }
+
+        $ok = $this->repository->update($id, $data);
+
         if ($ok) {
             return $this->showMessage('操作成功');
         } else {
@@ -157,9 +177,5 @@ class PosterController extends Controller
         return view('admin.album.poster.view', compact('img'));
     }
 
-    public function viewShare(Request $request)
-    {
-        $img = '/base/img/share.jpg';
-        return view('admin.album.poster.view', compact('img'));
-    }
+
 }

+ 6 - 5
app/Http/Controllers/Api/V1/AlbumPosterController.php

xqd xqd xqd
@@ -76,14 +76,12 @@ class AlbumPosterController extends Controller
         if ($userAuth->is_dealer != 1) {
             if ($userAuth->up_agent_id == 0) {
                 $name = $WeChatApp->name;
-                $phone = $WeChatApp->phone;
             } else {
                 $agent_check = AlbumAgentModel::where([
                     ['store_id',$store_id],
                     ['id',$userAuth->up_agent_id]
                 ])->first();
                 $name = $agent_check->realname;
-                $phone = $agent_check->phone;
             }
         } else {
             $agent_check = AlbumAgentModel::where([
@@ -91,10 +89,11 @@ class AlbumPosterController extends Controller
                 ['user_id',$userAuth->id]
             ])->first();
             $name = $agent_check->realname;
-            $phone = $agent_check->phone;
         }
-        $info['phone'] = $phone;
         $info['username'] = $name;
+        $info['share'] = $WeChatApp->share_image;
+        $info['title'] = $WeChatApp->share_title;
+        $info['qrcode_'] = $this->createPoster($userAuth, $store_id);
         return $this->api(compact('info'));
     }
 
@@ -172,7 +171,9 @@ class AlbumPosterController extends Controller
         } else {
             $agent_id = $userAuth->up_agent_id == 0 ? 0 : $userAuth->up_agent_id;
         }
-
+        if (file_exists(public_path() . '/download/' . $userAuth->id . '.png')) {
+            unlink(public_path() . '/download/' . $userAuth->id . '.png');
+        }
 
         if ($userAuth->up_agent_id != 0) {
             $add_record['agent_id'] = $userAuth->up_agent_id;

+ 3 - 1
app/Models/AlbumManufacturerModel.php

xqd
@@ -65,7 +65,9 @@ class AlbumManufacturerModel extends BaseModel
         'redirectapp',
         'print_type',
         'getPhone',
-        'getFocus'
+        'getFocus',
+        'share_title',
+        'share_image'
     ];
 
 }

+ 3 - 2
app/Models/AlbumPosterModel.php

xqd
@@ -37,8 +37,9 @@ class AlbumPosterModel extends BaseModel
                            'banners',
                            'introduce',
                            'qrcode',
-                           'title',
-                           'share'
+                           'video_url',
+                           'share_type',
+                           'name'
                           ];
 
 }

+ 33 - 0
database/migrations/2019_05_30_132301_drop_column_in_album_poster.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class DropColumnInAlbumPoster extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_poster', function (Blueprint $table) {
+            //
+            $table->dropColumn(['share', 'title']);
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_poster', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 34 - 0
database/migrations/2019_05_30_132708_add_column_share_to_album_manufacturer.php

xqd
@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddColumnShareToAlbumManufacturer extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_manufacturer', function (Blueprint $table) {
+            //
+            $table->string('share_title', 50)->nullable()->default(null)->comment('分享标题');
+            $table->string('share_image', 50)->nullable()->default(null)->comment('分享图片');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_manufacturer', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 33 - 0
database/migrations/2019_05_30_141921_add_type_column_in_album_poster.php

xqd
@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class AddTypeColumnInAlbumPoster extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('album_poster', function (Blueprint $table) {
+            //
+            $table->unsignedInteger('share_type')->default(0)->nullable();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('album_poster', function (Blueprint $table) {
+            //
+        });
+    }
+}

+ 19 - 0
resources/views/admin/album/manufacturer/edit.blade.php

xqd
@@ -251,6 +251,25 @@
                                         </div>
 
                                     </div>
+                                    <div class="form-group">
+
+                                        <label class="control-label col-sm-3">分享画面(1080*1080)</label>
+                                        <div class="col-sm-9">
+                                            {{--{!!  widget('Tools.ImgUpload')->single2('/upload/cover_pic','cover_pic',"cover_pic",  isset($data['cover_pic'])? $data['cover_pic'] : '',array("sizex"=>662,"sizey"=>510)) !!}--}}
+                                            {!!  widget('Tools.ImgUpload')->single2('/upload/share_image','share_image',"share_image",  isset($data['share_image'])? $data['share_image'] : '',array("sizex"=>1080,"sizey"=>1080)) !!}
+                                            <button type="button" onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Manufacturer/viewShare')}}'});"  class="btn btn-primary col-sm-offset-3">查看示例</button>
+                                        </div>
+                                    </div>
+                                    <div class="form-group">
+
+                                        <label class="control-label col-sm-3">分享标题</label>
+
+                                        <div class="col-sm-9">
+                                            <input id="data_introduce" name="data[share_title]" class="form-control" value="{{ $data['share_title'] or ''}}" required="" aria-required="true"  placeholder="">
+                                        </div>
+
+                                    </div>
+
                                     <div class="form-group">
                                         <label class="control-label col-sm-3">&nbsp;</label>
                                         <div class="col-sm-9">

+ 24 - 0
resources/views/admin/album/manufacturer/platform-edit.blade.php

xqd
@@ -123,6 +123,30 @@
                                             {!!  widget('Tools.ImgUpload')->multi2('/upload/banner','banner',"data[banner]", isset($data['banner'])? $data['banner'] : '',[]) !!}
                                         </div>
                                     </div>
+
+
+
+                                    <div class="form-group">
+
+                                        <label class="control-label col-sm-3">分享画面(1080*1080)</label>
+                                        <div class="col-sm-9">
+                                            {{--{!!  widget('Tools.ImgUpload')->single2('/upload/cover_pic','cover_pic',"cover_pic",  isset($data['cover_pic'])? $data['cover_pic'] : '',array("sizex"=>662,"sizey"=>510)) !!}--}}
+                                            {!!  widget('Tools.ImgUpload')->single2('/upload/share_image','share_image',"share_image",  isset($data['share_image'])? $data['share_image'] : '',array("sizex"=>1080,"sizey"=>1080)) !!}
+                                            <button type="button" onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Manufacturer/viewShare')}}'});"  class="btn btn-primary col-sm-offset-3">查看示例</button>
+                                        </div>
+                                    </div>
+                                    <div class="form-group">
+
+                                        <label class="control-label col-sm-3">分享标题</label>
+
+                                        <div class="col-sm-9">
+                                            <input id="data_introduce" name="data[share_title]" class="form-control" value="{{ $data['share_title'] or ''}}" required="" aria-required="true"  placeholder="">
+                                        </div>
+
+                                    </div>
+
+
+
                                     <div class="form-group">
                                         <label class="control-label col-sm-3">&nbsp;</label>
                                         <div class="col-sm-9">

+ 31 - 21
resources/views/admin/album/poster/edit.blade.php

xqd xqd xqd
@@ -1,5 +1,12 @@
 @extends('admin.layout')
+@section('header')
 
+    <link href="/base/css/fileinput.css" media="all" rel="stylesheet" type="text/css" />
+
+    <script src="/base/js/fileinput.js" type="text/javascript"></script>
+    <script src="/base/js/fileinput_locale_zh.js" type="text/javascript"></script>
+
+@endsection
 @section('content')
 
 <?php
@@ -34,19 +41,10 @@
                                     <label class="control-label col-sm-3">海报(440*440)</label>
                                     <div class="col-sm-9">
                                         {!!  widget('Tools.ImgUpload')->multi2('/upload/posters','posters',"data[posters]", isset($data['posters'])? $data['posters'] : '',array("sizex"=>440,"sizey"=>440)) !!}
-                                        <button type="button" onclick="layer.open({type: 2,area: ['80%', '65%'],content: '{{ U('Album/Poster/viewPoster')}}'});"  class="btn btn-primary col-sm-offset-3">查看示例</button>
                                     </div>
 
                                 </div>
 
-                                <div class="form-group">
-
-                                    <label class="control-label col-sm-3">保存(440*440)</label>
-                                    <div class="col-sm-9">
-                                        {!!  widget('Tools.ImgUpload')->multi2('/upload/banners','banners',"data[banners]", isset($data['banners'])? $data['banners'] : '',array("sizex"=>440,"sizey"=>440)) !!}
-                                    </div>
-
-                                </div>
 
                                 <div class="form-group">
 
@@ -85,31 +83,43 @@
 
                                 </div>
                                 <div class="form-group">
-
-                                    <label class="control-label col-sm-3">分享画面(1080*1080)</label>
+                                    <label class="control-label col-sm-3">分享视频</label>
                                     <div class="col-sm-9">
-                                        {{--{!!  widget('Tools.ImgUpload')->single2('/upload/cover_pic','cover_pic',"cover_pic",  isset($data['cover_pic'])? $data['cover_pic'] : '',array("sizex"=>662,"sizey"=>510)) !!}--}}
-                                        {!!  widget('Tools.ImgUpload')->single2('/upload/share','share',"share",  isset($data['share'])? $data['share'] : '',array("sizex"=>1080,"sizey"=>1080)) !!}
-                                        <button type="button" onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Album/Poster/viewShare')}}'});"  class="btn btn-primary col-sm-offset-3">查看示例</button>
+                                        <div style="height: auto;width: 200px;">
+                                            <video controls width="100px" height="100px">
+                                                <source src="{{$data['video_url'] ?? ''}}" type="video/mp4">
+                                            </video>
+                                        </div>
+                                        <input id="file-0b" class="file" type="file" name="data[video_url]" value="">
                                     </div>
                                 </div>
-                                <div class="form-group">
 
-                                    <label class="control-label col-sm-3">分享标题</label>
+                               {{-- <div class="form-group">
 
+                                    <label class="control-label col-sm-3">海报二维码(140*140)</label>
                                     <div class="col-sm-9">
-                                        <input id="data_introduce" name="data[title]" class="form-control" value="{{ $data['title'] or ''}}" required="" aria-required="true"  placeholder="">
+                                        --}}{{--{!!  widget('Tools.ImgUpload')->single2('/upload/cover_pic','cover_pic',"cover_pic",  isset($data['cover_pic'])? $data['cover_pic'] : '',array("sizex"=>662,"sizey"=>510)) !!}--}}{{--
+                                        {!!  widget('Tools.ImgUpload')->single2('/upload/qrcode','qrcode',"qrcode",  isset($data['qrcode'])? $data['qrcode'] : '',array("sizex"=>140,"sizey"=>140)) !!}
                                     </div>
+                                </div>--}}
 
-                                </div>
                                 <div class="form-group">
 
-                                    <label class="control-label col-sm-3">海报二维码(140*140)</label>
+                                    <label class="control-label col-sm-3">分享类型</label>
+
                                     <div class="col-sm-9">
-                                        {{--{!!  widget('Tools.ImgUpload')->single2('/upload/cover_pic','cover_pic',"cover_pic",  isset($data['cover_pic'])? $data['cover_pic'] : '',array("sizex"=>662,"sizey"=>510)) !!}--}}
-                                        {!!  widget('Tools.ImgUpload')->single2('/upload/qrcode','qrcode',"qrcode",  isset($data['qrcode'])? $data['qrcode'] : '',array("sizex"=>140,"sizey"=>140)) !!}
+                                        <label class="radio-inline">
+                                            <input type="radio" name="data[share_type]" value="1"
+                                                   @if(isset($data['share_type']) && $data['share_type'] == '1')checked="checked" @endif/>视频
+                                        </label>
+                                        <label class="radio-inline">
+                                            <input type="radio" name="data[share_type]" value="0"
+                                                   @if(isset($data['share_type']) && $data['share_type'] == '0')checked="checked" @endif/>九张图
+                                        </label>
                                     </div>
+
                                 </div>
+
                                 <div class="form-group">
                                     <label class="control-label col-sm-3">&nbsp;</label>
                                     <div class="col-sm-9">

+ 7 - 3
resources/views/admin/album/poster/index.blade.php

xqd xqd xqd
@@ -6,7 +6,7 @@
 		<div class="col-sm-12">
 			<div class="ibox float-e-margins">
 				<div class="ibox-title">
-					<h5>产品列表</h5>
+					<h5>画册海报</h5>
 					<div class="ibox-tools">
 						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
 						</a>
@@ -38,7 +38,7 @@
 								
             <th class="sorting" data-sort="id"> ID </th>
             <th class="sorting" data-sort="name"> 名称 </th>
-            <th class="sorting" data-sort="cat_id"> 标题 </th>
+            <th class="sorting" data-sort="share_type"> 视频 </th>
         						<th width="22%">相关操作</th>
         					</tr>
 						</thead>
@@ -48,7 +48,11 @@
 								
             <td>{{ $item->id }}</td>
             <td>{{ $item->name }}</td>
-            <td>{{ $item->title }}</td>
+								@if($item->share_type == 1)
+									<td>视频</td>
+								@else
+									<td>九张图</td>
+								@endid
 								<td>
 									<div class="pull-left">
 										@if(role('Album/Poster/update'))

+ 8 - 8
resources/views/admin/album/product/index.blade.php

xqd
@@ -16,14 +16,14 @@
 				    <div class="row">
 				        <form method="GET" action="" accept-charset="UTF-8">
 
-				        <div class="col-sm-4">
-				            <div class="input-group">
-								<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入ID/商品名" name="keyword" class="input-sm form-control">
-								<span class="input-group-btn">
-									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
-								</span>
-    						</div>
-				        </div>
+							<div class="col-sm-4">
+								<div class="input-group">
+									<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入ID/商品名" name="keyword" class="input-sm form-control">
+									<span class="input-group-btn">
+										<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+									</span>
+								</div>
+							</div>
 				        </form>
 						@if(role('Album/Product/create'))
     					<div class="col-sm-3 pull-right">