sunhao 5 years ago
parent
commit
4bb8dd627b
1 changed files with 10 additions and 1 deletions
  1. 10 1
      app/Http/Controllers/Api/TemplateController.php

+ 10 - 1
app/Http/Controllers/Api/TemplateController.php

@@ -36,8 +36,17 @@ class TemplateController extends Controller {
36 36
         //获取背景图
37 37
         $back_img = TemplatesSource::where('id', $t_id)->pluck('back_img');
38 38
         $new_context = TemplatesSource::where('id', $t_id)->pluck('new_context');
39
+        $new_data = array();
40
+        $title = '';
39 41
         if(!empty($new_context)){
40 42
             $new_context = json_decode($new_context, true);
43
+            $title = $new_context['title'];
44
+            $new_data[0]['text'] = $new_context['text1'];
45
+            $new_data[0]['img'] = [$new_context['img1']];
46
+            $new_data[1]['text'] = $new_context['text2'];
47
+            $new_data[1]['img'] = [$new_context['img2_1'], $new_context['img2_2']];
48
+            $new_data[2]['text'] = $new_context['text3'];
49
+            $new_data[2]['img'] = [$new_context['img3']];
41 50
         }
42 51
         $result = TemplatesSourceSalers::where('s_id', $t_id)->where('is_del', 0)->where('weight','>',0)->whereIn('admin_id', $_open_ids)->orderBy('weight', 'asc')->lists('weight', 'admin_id');
43 52
         if(empty($result)){
@@ -72,7 +81,7 @@ class TemplateController extends Controller {
72 81
 
73 82
         $qrcode = Admin::where('id', $saler_id)->pluck('qrcode');
74 83
         $qrcodes = Admin::whereIn('id', $saler_ids)->lists('qrcode');
75
-        return self::returnValue(['qrcode'=>$qrcode, 'ip'=>$ip, 'saler_id'=>$saler_id, 'qrcodes'=>$qrcodes, 'back_img'=>$back_img, 'new_context'=>$new_context]);
84
+        return self::returnValue(['qrcode'=>$qrcode, 'ip'=>$ip, 'saler_id'=>$saler_id, 'qrcodes'=>$qrcodes, 'back_img'=>$back_img, 'title'=>$title, 'new_context'=>$new_data]);
76 85
     }
77 86
 
78 87
      /**