liuzejian 1 рік тому
батько
коміт
90ea2c8bd3

+ 5 - 0
app/Console/Commands/Callback/JuliangAccountRateConfigRefresh.php

@@ -70,6 +70,11 @@ class JuliangAccountRateConfigRefresh extends Command
             DB::table('juliang_account_rate_config_log')
                 ->where(['company_uid' => $item->company_uid, 'account_id' => $item->account_id, 'is_enabled' => 1])
                 ->update(['is_enabled' => 0, 'updated_at' => $now]);
+            DB::table('juliang_account_promotion_protect_record')
+                ->where('optimizer_uid', $item->company_uid)
+                ->whereIn('advertiser_id', $item->account_id)
+                ->where('is_enabled', 1)
+                ->update(['is_enabled' => 0, 'updated_at' => $now]);
             DB::table('juliang_account_rate_config_log')
                 ->insert([
                     'company_uid' => $item->company_uid,

+ 5 - 0
modules/Callback/Http/Controllers/JuliangAccountController.php

@@ -117,6 +117,11 @@ class JuliangAccountController extends CatchController
                 ->whereIn('account_id', $advAccountIds)
                 ->where('is_enabled', 1)
                 ->update(['is_enabled' => 0, 'updated_at' => $now]);
+            DB::table('juliang_account_promotion_protect_record')
+                ->where('optimizer_uid', $this->getOptimizerUid())
+                ->whereIn('advertiser_id', $advAccountIds)
+                ->where('is_enabled', 1)
+                ->update(['is_enabled' => 0, 'updated_at' => $now]);
             foreach ($advAccountIds as $accountId) {
                 DB::table('juliang_account_rate_config_log')
                     ->insert([

+ 4 - 4
tests/Callback/Http/Controllers/JuliangAccountControllerTest.php

@@ -36,11 +36,11 @@ class JuliangAccountControllerTest extends UsedTestCase
         ])->json('post','http://localhost/api/callback/juliangAccount/updateCallbackConfig', [
             'ids' => [4],
             'state' => 0,
-            'protect_num' => 3,
-            'default_rate' => 44,
+            'protect_num' => 2,
+            'default_rate' => 30,
             'rate_time_config' => [
-                ['start_time' => '15:00', 'end_time' => '15:10', 'config_per' => 40],
-                ['start_time' => '15:20', 'end_time' => '15:30', 'config_per' => 56],
+                ['start_time' => '15:00', 'end_time' => '16:10', 'config_per' => 20],
+                ['start_time' => '16:20', 'end_time' => '19:30', 'config_per' => 50],
             ],
             'min_money' => 40,
             'max_money' => 60,

+ 2 - 2
tests/UsedTestCase.php

@@ -13,11 +13,11 @@ abstract class UsedTestCase extends BaseTestCase
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $tokenInfo = $this->post('http://localhost/api/login', [
-            'email' => 'catch@admin.com',
+//            'email' => 'catch@admin.com',
             'remember' => false,
 //            'email' => 'xiaoli@qq.com',
             'password' => 'catchadmin',
-//            'email' => 'aa@test.com',
+            'email' => 'aa@test.com',
         ])->json();
         $this->token = $tokenInfo['data']['token'];
     }