邹景立 před 3 roky
rodič
revize
3577d77dac

+ 5 - 5
app/wechat/controller/Auto.php

@@ -19,6 +19,7 @@ namespace app\wechat\controller;
 use app\wechat\model\WechatAuto;
 use think\admin\Controller;
 use think\admin\extend\CodeExtend;
+use think\admin\helper\QueryHelper;
 
 /**
  * 关注自动回复
@@ -41,15 +42,14 @@ class Auto extends Controller
      * 关注自动回复
      * @auth true
      * @menu true
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
      */
     public function index()
     {
         $this->title = '关注自动回复';
-        $query = WechatAuto::mQuery()->like('code,type');
-        $query->equal('status')->dateBetween('create_at')->order('time asc')->page();
+        WechatAuto::mQuery(null, function (QueryHelper $query) {
+            $query->like('code,type')->equal('status');
+            $query->dateBetween('create_at')->order('time asc')->page();
+        });
     }
 
     /**

+ 2 - 1
app/wechat/controller/Fans.php

@@ -17,6 +17,7 @@
 namespace app\wechat\controller;
 
 use app\wechat\model\WechatFans;
+use app\wechat\model\WechatFansTags;
 use app\wechat\service\WechatService;
 use think\admin\Controller;
 use think\admin\helper\QueryHelper;
@@ -115,7 +116,7 @@ class Fans extends Controller
     {
         try {
             WechatFans::mQuery()->empty();
-            WechatFans::mQuery()->empty();
+            WechatFansTags::mQuery()->empty();
             $this->success('清空用户数据成功!');
         } catch (HttpResponseException $exception) {
             throw  $exception;

+ 5 - 5
app/wechat/controller/Keys.php

@@ -19,6 +19,7 @@ namespace app\wechat\controller;
 use app\wechat\model\WechatKeys;
 use app\wechat\service\WechatService;
 use think\admin\Controller;
+use think\admin\helper\QueryHelper;
 use think\exception\HttpResponseException;
 
 /**
@@ -41,9 +42,6 @@ class Keys extends Controller
      * 回复规则管理
      * @auth true
      * @menu true
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
      */
     public function index()
     {
@@ -59,8 +57,10 @@ class Keys extends Controller
         }
         // 数据列表分页处理
         $this->title = '回复规则管理';
-        $query = WechatKeys::mQuery()->whereNotIn('keys', ['subscribe', 'default']);
-        $query->equal('status')->like('keys,type')->dateBetween('create_at')->order('sort desc,id desc')->page();
+        WechatKeys::mQuery(null, function (QueryHelper $query) {
+            $query->equal('status')->like('keys,type')->dateBetween('create_at');
+            $query->whereNotIn('keys', ['subscribe', 'default'])->order('sort desc,id desc')->page();
+        });
     }
 
     /**

+ 4 - 7
app/wechat/controller/News.php

@@ -20,6 +20,7 @@ use app\wechat\model\WechatNews;
 use app\wechat\model\WechatNewsArticle;
 use app\wechat\service\MediaService;
 use think\admin\Controller;
+use think\admin\helper\QueryHelper;
 use think\admin\service\AdminService;
 
 /**
@@ -33,14 +34,13 @@ class News extends Controller
      * 微信图文管理
      * @auth true
      * @menu true
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
      */
     public function index()
     {
         $this->title = '微信图文列表';
-        WechatNews::mQuery()->where(['is_deleted' => 0])->order('id desc')->page();
+        WechatNews::mQuery(null, function (QueryHelper $query) {
+            $query->where(['is_deleted' => 0])->order('id desc')->page();
+        });
     }
 
     /**
@@ -60,9 +60,6 @@ class News extends Controller
     /**
      * 图文选择器
      * @auth true
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
      */
     public function select()
     {