sunhao 5 years ago
parent
commit
25506d622c

+ 1 - 0
app/Error.php

@@ -13,6 +13,7 @@ class Error
13 13
     public static $errCodes = [
14 14
 
15 15
         0 => "成功",
16
+        1001 => '未分配销售'
16 17
         
17 18
     ];
18 19
     /**

+ 4 - 2
app/Http/Controllers/Admin/TemplateController.php

@@ -515,21 +515,23 @@ class TemplateController extends Controller
515 515
     {
516 516
         $id = (int)$request->input('id');
517 517
         $this->validate($request, [
518
-            't_id' => 'required',           
518
+            //'t_id' => 'required',           
519 519
             'back_img' => 'required',           
520 520
         ], [
521
-            't_id.required' => '模板不能为空',
521
+            //'t_id.required' => '模板不能为空',
522 522
             'back_img.required' => '背景图不能为空',
523 523
             
524 524
         ]);
525 525
 
526 526
         $template = TemplatesSource::findOrFail($id);
527
+        /*
527 528
         $t_id = (int)$request->input('t_id');
528 529
         if( $template->t_id != $t_id ){
529 530
             //模板更改,生成新连接
530 531
             $template->t_id = $t_id;
531 532
             $template->url = $this->createSourceUrl($t_id, $template->id);
532 533
         }
534
+        */
533 535
         $template->note = trim($request->input('note'));
534 536
         $template->back_img = trim($request->input('back_img'));
535 537
         //图片上传 阿里云oss 

+ 3 - 0
app/Http/Controllers/Api/TemplateController.php

@@ -31,6 +31,9 @@ class TemplateController extends Controller {
31 31
         //获取背景图
32 32
         $back_img = TemplatesSource::where('id', $t_id)->pluck('back_img');
33 33
         $result = TemplatesSourceSalers::where('s_id', $t_id)->where('is_del', 0)->where('weight','>',0)->orderBy('weight', 'asc')->lists('weight', 'admin_id');
34
+        if(empty($result)){
35
+            return self::returnValue([],1001);
36
+        }
34 37
         $saler_id = null;
35 38
         $rand = 0;
36 39
         //获取最大随机值

+ 3 - 2
resources/views/template/sourceedit.blade.php

@@ -66,18 +66,19 @@
66 66
             <input type="hidden" name="id" value="{{$id}}" />
67 67
             <div class="row cl">
68 68
                 <label class="form-label col-xs-4 col-sm-2">
69
-                    选模板:</label>
69
+                    选模板:</label>
70 70
                 <div class="formControls col-xs-6 col-sm-7">
71 71
                     @if($templates)
72 72
                     <ul class="templates_ul clear">
73 73
                         @foreach($templates as $item)
74
+                        @if($template['t_id'] == $item['id'])
74 75
                         <li class="templates_li">
75 76
                             <img class="templates_img" src="{{$item['img']}}"/>
76 77
                             <div>
77
-                                <input type="radio" id="templates_{{$item['id']}}" value="{{$item['id']}}" @if($template['t_id'] == $item['id']) checked @endif name="t_id">
78 78
                                 <label for="templates_{{$item['id']}}">{{$item['note']}}</label>
79 79
                             </div>
80 80
                         </li>
81
+                        @endif
81 82
                         @endforeach
82 83
                     </ul>
83 84
                     @endif