Pārlūkot izejas kodu

Merge branch 'wx-kw' into feature-wechat

zqwang 1 gadu atpakaļ
vecāks
revīzija
ed266f16a3

+ 6 - 3
modules/Video/Http/Controllers/EpisodeController.php

@@ -25,13 +25,16 @@ class EpisodeController extends CatchController
         $video = VideoService::getVideoByIdOrException($request->input('video_id'));
 
         VideoService::updateVideoChargeInfo($video, $this->getUserContext($request->input('operateUserId')));
-
+        $isFee =  $request->input('is_fee',0);
         $videoSeries = DB::table('video_series')
             ->where([
                 'video_id' => $request->integer('video_id'),
                 'is_enabled' => 1
-            ])->select('series_name', 'series_sequence', 'video_key', 'duration', 'id', 'video_id')
-            ->orderBy('series_sequence', 'asc')
+            ])->select('series_name', 'series_sequence', 'video_key', 'duration', 'id', 'video_id');
+        if ($isFee == 1){
+            $videoSeries-where('series_sequence',"<",$video->charge_sequence);
+        }
+        $videoSeries->orderBy('series_sequence', 'asc')
             ->paginate($request->integer('limit', 15));
         /**
          * 增加微信审核状态

+ 1 - 3
modules/WechatPlatform/Http/Controllers/WechatKeywordsController.php

@@ -55,9 +55,7 @@ class WechatKeywordsController extends CatchController
 
     private function wechatKeywordsParam(mixed $param)
     {
-        if (getProp($param,'type') != 'miniprogram'){
-            return $param;
-        }
+
         $info = DB::table('miniprogram')->where('id',$param['miniprogram_id'])->first();
         if(empty($info)){
             throw  new  FailedException("小程序不正确");

+ 8 - 4
modules/WechatPlatform/Http/Controllers/WechatSubscribeController.php

@@ -32,7 +32,11 @@ class WechatSubscribeController extends CatchController
      */
     public function list(Request $request)
     {
-
+        $param  = $request->all();
+        $userContext = $this->getUserContext(null);
+        $param['user_id'] = $userContext['loginUser']->id;
+        $param['puser_id'] = $userContext['loginUser']->pid;
+        return WechatSubscribeService::list($param);
     }
 
     /**
@@ -171,9 +175,9 @@ class WechatSubscribeController extends CatchController
 
     private function handelParam(mixed $param)
     {
-        if (getProp($param, 'type') != 'miniprogram') {
-            return $param;
-        }
+        // if (getProp($param, 'type') != 'miniprogram') {
+        //     return $param;
+        // }
         $info = DB::table('miniprogram')->where('id', $param['miniprogram_id'])->first();
         if (empty($info)) {
             throw  new  FailedException("小程序不正确");

+ 2 - 2
modules/WechatPlatform/Services/WechatKeywordsService.php

@@ -51,7 +51,7 @@ class WechatKeywordsService extends BaseService
         }else{
             $list = $sql->paginate(getProp($param,'limit',10));
         }
-        $list->makeHidden(array_merge(self::$hideField,['content']));
+        $list->makeHidden(self::$hideField);
         return $list;
     }
 
@@ -103,7 +103,7 @@ class WechatKeywordsService extends BaseService
             // 修改关键词,需要查询词关键词是否已配置
             $appIds = WechatAccountKeywordLog::where('weacht_keyworld_id', $info->id)->where('status', 1)->pluck('wechat_authorization_info_id')->toArray();
         }
-        $info->save($param);
+        WechatKeywords::query()->where('id',$id)->update($param);
         if ($appIds){
             WechatAccountKeywordLog::where('weacht_keyworld_id',$info->id)->update(['status' => 0]);
             self::allocation($info->id,$appIds);

+ 39 - 2
modules/WechatPlatform/Services/WechatSubscribeService.php

@@ -19,7 +19,7 @@ class WechatSubscribeService extends BaseService
 {
 
     const KEYWORD_SET_KEY = "miniprogram_wechat_subscribe";
-    protected static array $hideField = ['updated_at', 'is_del', 'del_at', 'user_id', 'puser_id', 'send_content']; // 公用的影藏字段
+    protected static array $hideField = ['updated_at', 'is_del', 'del_at', 'user_id', 'puser_id','send_total', 'send_content']; // 公用的影藏字段
 
 
     /**
@@ -171,7 +171,7 @@ class WechatSubscribeService extends BaseService
 
         DB::beginTransaction();
         try {
-            $info->save($param);
+            WechatSubscribeMsg::query()->where('id',$id)->update($param);
             WechatAccountSubscribeDetail::where('subscribe_id',$info->id)->update(['content' => $param['send_content']]);
             DB::commit();
         }catch (\Exception $exception){
@@ -225,4 +225,41 @@ class WechatSubscribeService extends BaseService
         return $list;
     }
 
+    /**
+     *  关注回复列表
+     * name: list
+     * @param array $param
+     * date 2023/07/10 11:38
+     */
+    public static function list(array $param)
+    {
+        $sql = self::getQuery($param)->orderBy('id','desc');
+        $isAll = getProp($param,'is_all',false);
+        if($isAll){
+            $list = $sql->get();
+        }else{
+            $list = $sql->paginate(getProp($param,'limit',10));
+        }
+        $list->makeHidden(array_merge(self::$hideField));
+        return $list;
+    }
+
+    private static function getQuery(array $param)
+    {
+        $sql = WechatSubscribeMsg::query()->where('is_del',0);
+        if (getProp($param, 'puser_id')) {
+            $sql->where('puser_id', $param['puser_id']);
+        }
+        if (getProp($param, 'user_id')) {
+            $sql->where('user_id', $param['user_id']);
+        }
+        if (getProp($param, 'keyword')) {
+            $sql->where('keyword', "like", "%" . $param['keyword'] . "%");
+        }
+        if(getProp($param,'wechat_authorization_info_id')){
+            $sql->whereJsonContains('wechat_accounts->id',$param['wechat_authorization_info_id']);
+        }
+        return $sql;
+    }
+
 }