Sfoglia il codice sorgente

Merge branch 'liuzj-1001025-dev' into test

liuzejian 1 anno fa
parent
commit
aa7ca20c57

+ 4 - 1
modules/Callback/Http/Controllers/JLEvent/JLEventController.php

@@ -29,7 +29,10 @@ class JLEventController extends CatchController
         $unbind = $request->input('unbind', 0);
 
         $result =  DB::table('jl_event_callback_config as config')
-            ->leftJoin('promotions', 'promotions.callback_config_id', '=', 'config.id')
+            ->leftJoin('promotions', function($join){
+                $join->on('promotions.callback_config_id', '=', 'config.id')
+                    ->where('promotions.callback_type' , CallbackConst::TYPE_JL_EVENT_20);
+            })
             ->where([
                 'user_id' => $this->getLoginUserId(),
             ])->when($id, function ($query, $id){

+ 9 - 7
modules/Statistic/Http/Controllers/VideoStatController.php

@@ -18,12 +18,12 @@ class VideoStatController extends CatchController
     use UserTrait;
     public function __construct(protected readonly VideoStatByCompany $videoStatByCompany)
     {
-        
+
     }
 
     public function index(Request $request)
     {
-        
+
         if(!$this->isCompanyManager()){
             return [];
         }
@@ -32,9 +32,11 @@ class VideoStatController extends CatchController
         $is_export = $request->get('is_export');
         $where = $this->requestParam($request);
         if($is_export){
-            $result = $this->videoStatByCompany->where($where)->select('day','video_name','video_id','amount','charge_count','charge_user_num','play_count')->get();
+            $result = $this->videoStatByCompany->where($where)
+                ->select('day','video_name','video_id','amount','charge_count','charge_user_num','play_count', 'click_uv')->get();
         }else{
-            $result = $this->videoStatByCompany->where($where)->select('day','video_name','video_id','amount','charge_count','charge_user_num','play_count')->paginate($limit);
+            $result = $this->videoStatByCompany->where($where)
+                ->select('day','video_name','video_id','amount','charge_count','charge_user_num','play_count', 'click_uv')->paginate($limit);
         }
         return $result;
     }
@@ -67,7 +69,7 @@ class VideoStatController extends CatchController
         $video_name = $request->get('video_name');
         $start_date = $request->get('start_date');
         $end_date = $request->get('end_date');
-        
+
         if(!$end_date){
             $end_date = $default_end_time;
         }else{
@@ -86,12 +88,12 @@ class VideoStatController extends CatchController
             ['day','>=',$start_date->format('Y-m-d')],
             ['day','<=',$end_date->format('Y-m-d')]
         ];
-        
+
         if(trim($video_name)){
             $where[] = ['video_name','like','%'.trim($video_name).'%'];
         }
         return $where;
     }
 
- 
+
 }

+ 2 - 1
modules/Statistic/Models/VideoStatByCompany.php

@@ -10,7 +10,8 @@ class VideoStatByCompany extends BaseModel
     protected $table = 'video_stat_by_company';
 
     protected $fillable = [
-        'id', 'day', 'user_id', 'video_name', 'video_id', 'amount', 'charge_count', 'charge_user_num', 'play_count', 'is_delete', 'created_at', 'updated_at', 
+        'id', 'day', 'user_id', 'video_name', 'video_id', 'amount', 'charge_count',
+        'charge_user_num', 'play_count', 'is_delete', 'created_at', 'updated_at', 'click_uv',
     ];
 
 }

+ 1 - 1
modules/Tuiguang/Http/Controllers/PromotionController.php

@@ -25,7 +25,7 @@ class PromotionController extends CatchController
             '1' => 'tiktok'
         ];
         $name = $request->input('name');
-        $isConfig = $request->input('is_config', 1);
+        $isConfig = $request->input('is_config', 0);
         $id = $request->input('id');
         $videoName = $request->input('video_name');
         $starTime = $request->input('start_time');

+ 15 - 5
modules/Tuiguang/Http/Controllers/RanseConfigController.php

@@ -22,20 +22,26 @@ class RanseConfigController extends CatchController
         $this->validate($request, [
             'no_charge_user_duration' => 'required|integer|min:0',
             'charge_user_duration' => 'required|integer|gte:no_charge_user_duration',
+            'miniprogram_id' => 'required|min:1',
         ]);
-        $uid = $this->getOptimizerUid();
+        $uid = $this->getLoginUserId();
         if(!$uid) {
             CommonBusinessException::throwError(Errors::NO_OPERATE_PERMISSION);
         }
         $now = date('Y-m-d H:i:s');
-        DB::table('ranse_config')->where('user_id', $uid)
-            ->where('is_enabled', 1)
+        DB::table('ranse_config')
+            ->where([
+                ['user_id', '=', $uid],
+                ['is_enabled', '=', 1],
+                ['miniprogram_id', '=', $request->input('miniprogram_id')]
+            ])
             ->update(['is_enabled' => 0, 'updated_at' => $now]);
         DB::table('ranse_config')
             ->insert([
                 'user_id' => $uid, 'is_enabled' => 1,
                 'no_charge_user_duration' => $request->input('no_charge_user_duration'),
                 'charge_user_duration' => $request->input('charge_user_duration'),
+                'miniprogram_id' => $request->input('miniprogram_id'),
                 'created_at' => $now, 'updated_at' => $now,
             ]);
 
@@ -53,8 +59,12 @@ class RanseConfigController extends CatchController
             CommonBusinessException::throwError(Errors::NO_OPERATE_PERMISSION);
         }
 
-        $config = DB::table('ranse_config')->where('user_id', $uid)
-            ->where('is_enabled', 1)
+        $config = DB::table('ranse_config')
+            ->where([
+                ['user_id', '=', $uid],
+                ['is_enabled', '=', 1],
+                ['miniprogram_id', '=', $request->input('miniprogram_id')]
+            ])
             ->first();
         if(!$config) {
             $config = DB::table('ranse_config')

+ 3 - 1
tests/Callback/Http/Controllers/JLEvent/JLEventControllerTest.php

@@ -52,7 +52,9 @@ class JLEventControllerTest extends UsedTestCase
         $res = $this->withHeaders([
             'Authorization' => 'Bearer '. $this->token,
         ])->json('get','http://localhost/api/callback/jlEvent/list', [
-            'id' => 5,
+            'limit' => 20,
+            'promotion_id' => 6
+//            'id' => 5,
 //            'name' => 'liuzj',
 //        'promotion_id' => 21
         ]);