Explorar el Código

引流,增加配置名称的支持
支持通过关注类型,名称筛选引流配置

liuzejian hace 1 año
padre
commit
d636f3bf91

+ 4 - 3
modules/Tuiguang/Http/Controllers/PromotionController.php

@@ -107,7 +107,7 @@ class PromotionController extends CatchController
             'not_first_charge_template_id' => 'required',
             'yinliu_enabled' => 'required|in:0,1',
             'yinliu_type' => 'required_if:yinliu_enabled,1|in:1',
-            'yinliu_gzhid' => 'required_if:yinliu_enabled,1',
+            'yinliu_id' => 'required_if:yinliu_enabled,1',
             'yinliu_sequence' => 'required_if:yinliu_enabled,1|min:1'
             ]);
 
@@ -119,9 +119,10 @@ class PromotionController extends CatchController
                 'not_first_charge_template_id' => $request->input('not_first_charge_template_id'),
                 'yinliu_enabled' => $request->input('yinliu_enabled'),
                 'yinliu_type' => $request->input('yinliu_type',1),
-                'yinliu_gzhid' => $request->input('yinliu_gzhid', 0),
+                'yinliu_id' => $request->input('yinliu_id', 0),
                 'yinliu_sequence' => $request->input('yinliu_sequence', 0),
-                'updated_at' => date('Y-m-d H:i:s')]);
+                'updated_at' => date('Y-m-d H:i:s')
+            ]);
 
         return 'ok';
     }

+ 9 - 1
modules/Yinliu/Http/Controllers/YinliuManageController.php

@@ -21,6 +21,8 @@ class YinliuManageController extends CatchController
     public function list(Request $request) {
         $gzhId = $request->input('gzh_id');
         $gzhIsEnabled = $request->input('gzh_is_enabled');
+        $name = $request->input('name');
+        $focusType = $request->input('focus_type');
 
         $result = DB::table('yinliu_gzh_config as a')
             ->leftJoin('wechat_authorization_infos as b', 'a.gzh_id','=', 'b.id')
@@ -28,6 +30,10 @@ class YinliuManageController extends CatchController
                 return $query->where('a.gzh_id', $gzhId);
             })->when($gzhIsEnabled, function ($query, $gzhIsEnabled) {
                 return $query->where('b.is_enabled', $gzhIsEnabled);
+            })->when($name, function ($query, $name) {
+                return $query->where('name', 'like', '%'. $name . '%');
+            })->when($focusType, function ($query, $focusType) {
+                return $query->where('focus_type', $focusType);
             })
             ->where([
                 'a.uid' => $this->getLoginUserId(),
@@ -49,6 +55,7 @@ class YinliuManageController extends CatchController
      */
     public function save(Request $request) {
         $this->validate($request, [
+            'name' => 'required|string|max:64',
             'focus_type' => 'required|in:1',
             'gzh_id' => 'required',
             // 播放页弹窗设置:1-强制关注,2-引导关注,3-不关注
@@ -59,7 +66,8 @@ class YinliuManageController extends CatchController
             'link_url' => 'required',
         ]);
 
-        $data = $request->only('focus_type', 'gzh_id', 'pop_type', 'link_type', 'link_url', 'pop_type_sub');
+        $data = $request->only('name' ,'focus_type', 'gzh_id', 'pop_type',
+            'link_type', 'link_url', 'pop_type_sub');
         if(2 != $data['pop_type']) {
             $data['pop_type_sub'] = 0;
         }