|
|
@@ -47,7 +47,7 @@ namespace {
|
|
|
'bot_user_login' => 'id INTEGER PRIMARY KEY,user_id TEXT,status INTEGER,platform TEXT',
|
|
|
'bot_balance_logs' => 'id INTEGER PRIMARY KEY,member_id TEXT,type INTEGER,change_type TEXT,amount TEXT,created_at TEXT,updated_at TEXT,remark TEXT,before_balance TEXT,after_balance TEXT,related_id INTEGER,frozen_status INTEGER',
|
|
|
'bot_recharge_channel_group' => 'id INTEGER PRIMARY KEY,activity_type TEXT',
|
|
|
- 'bot_activity_rewards' => 'id INTEGER PRIMARY KEY,title TEXT,sub_title TEXT,start_time INTEGER,end_time INTEGER,detail_image TEXT,type INTEGER,lang TEXT,pc_image TEXT,detail_banner TEXT,pc_banner TEXT,publish_platforms TEXT,budget TEXT,budget_used TEXT DEFAULT "0",quota_enabled INTEGER DEFAULT 0,reward_quota INTEGER,rewarded_count INTEGER DEFAULT 0,sort INTEGER DEFAULT 0,register_time_limited INTEGER,register_start_time TEXT,register_end_time TEXT,register_platforms TEXT,deposit_limited INTEGER,deposit_min TEXT,deposit_max TEXT,show_ineligible INTEGER DEFAULT 1,status INTEGER,params TEXT,created_at TEXT,updated_at TEXT',
|
|
|
+ 'bot_activity_rewards' => 'id INTEGER PRIMARY KEY,title TEXT,sub_title TEXT,start_time INTEGER,end_time INTEGER,detail_image TEXT,type INTEGER,lang TEXT,game_category TEXT,pc_image TEXT,detail_banner TEXT,pc_banner TEXT,publish_platforms TEXT,budget TEXT,budget_used TEXT DEFAULT "0",quota_enabled INTEGER DEFAULT 0,reward_quota INTEGER,rewarded_count INTEGER DEFAULT 0,sort INTEGER DEFAULT 0,register_time_limited INTEGER,register_start_time TEXT,register_end_time TEXT,register_platforms TEXT,deposit_limited INTEGER,deposit_min TEXT,deposit_max TEXT,show_ineligible INTEGER DEFAULT 1,status INTEGER,params TEXT,created_at TEXT,updated_at TEXT',
|
|
|
'bot_activity_reward_recipients' => 'id INTEGER PRIMARY KEY,activity_id INTEGER NOT NULL,member_id TEXT NOT NULL,created_at TEXT,UNIQUE(activity_id,member_id)',
|
|
|
'bot_wallets' => 'id INTEGER PRIMARY KEY,member_id TEXT,available_balance TEXT,frozen_balance TEXT,yuebao TEXT,yuebao_invest TEXT',
|
|
|
'bot_yuebao_item' => 'id INTEGER PRIMARY KEY,user_id TEXT,activity_id INTEGER,principal TEXT,surplus_principal TEXT,status INTEGER DEFAULT 1,daily_interest_rate TEXT,expire_time INTEGER,create_time INTEGER DEFAULT 0,update_time INTEGER',
|
|
|
@@ -81,7 +81,7 @@ namespace {
|
|
|
activity(1, ['sort' => 4, 'deposit_limited' => 1, 'deposit_min' => '199.99', 'deposit_max' => '199.99', 'register_platforms' => '["APP"]']);
|
|
|
activity(2, ['sort' => 9, 'publish_platforms' => '["H5"]']);
|
|
|
activity(3, ['sort' => 8, 'show_ineligible' => 0, 'deposit_limited' => 1, 'deposit_min' => '300', 'deposit_max' => '400']);
|
|
|
- activity(4, ['sort' => 7, 'show_ineligible' => 1, 'register_platforms' => '["PC"]']);
|
|
|
+ activity(4, ['sort' => 7, 'show_ineligible' => 1, 'register_platforms' => '["PC"]', 'game_category' => 'third:2']);
|
|
|
activity(5, ['sort' => 10, 'status' => 0]);
|
|
|
activity(6, ['type' => 2, 'sort' => 100, 'publish_platforms' => '["H5"]', 'show_ineligible' => 0, 'register_platforms' => '["PC"]']);
|
|
|
request()->query = ['platform' => 'PC'];
|
|
|
@@ -99,6 +99,43 @@ namespace {
|
|
|
foreach ([2, 3, 5] as $id) { request()->query['id'] = $id; check($controller->activityInfo()['code'] === 0, 'Hidden ID detail must be denied: ' . $id); }
|
|
|
request()->query['id'] = 4;
|
|
|
check($controller->activityInfo()['data']['is_eligible'] === false, 'Visible ineligible detail exposes eligibility flag');
|
|
|
+ $gameNames = ['third:1' => '真人', 'third:2' => '电子', 'third:3' => '彩票', 'third:4' => '体育',
|
|
|
+ 'third:5' => '电竞', 'third:6' => '捕鱼', 'third:7' => '棋牌', 'self:sport' => 'F1体育', 'self:lottery' => 'F1彩票', 'other' => '其他'];
|
|
|
+ $originalActivity = \think\facade\Db::table('bot_activity_rewards')->where('id', 4)->find();
|
|
|
+ $fundsBefore = \think\facade\Db::table('bot_balance_logs')->order('id')->select()->toArray();
|
|
|
+ foreach ($gameNames as $category => $name) {
|
|
|
+ \think\facade\Db::table('bot_activity_rewards')->where('id', 4)->update(['game_category' => $category]);
|
|
|
+ $catalogList = new \app\api\lists\ActivityRewardsLists(1001);
|
|
|
+ $catalogList->limitLength = 100;
|
|
|
+ $listed = array_column($catalogList->lists(), null, 'id')[4];
|
|
|
+ $detail = $controller->activityInfo();
|
|
|
+ check($detail['code'] === 1, 'Visible catalog detail succeeds: ' . $category);
|
|
|
+ foreach ([$listed, $detail['data']] as $item) {
|
|
|
+ check($item['type'] === 5 && $item['type_name'] === 'USDT使用教学', 'Activity type value and name are returned together');
|
|
|
+ check($item['game_category'] === $category && $item['game_category_name'] === $name, 'Category value/name are returned on list and detail: ' . $category);
|
|
|
+ check($item['is_eligible'] === false, 'Catalog enrichment preserves member eligibility');
|
|
|
+ }
|
|
|
+ check($catalogList->count() === 3, 'Category names do not change visibility or pagination totals');
|
|
|
+ }
|
|
|
+ \think\facade\Db::table('bot_activity_rewards')->where('id', 4)->update(['game_category' => null]);
|
|
|
+ $uncategorized = $controller->activityInfo()['data'];
|
|
|
+ check($uncategorized['game_category'] === null && $uncategorized['game_category_name'] === null, 'Unassigned category remains null, not other');
|
|
|
+ $defaultList = new \app\api\lists\ActivityRewardsLists(1001);
|
|
|
+ $defaultList->limitLength = 100;
|
|
|
+ $defaultRows = array_column($defaultList->lists(), null, 'id');
|
|
|
+ check($defaultRows[4]['game_category'] === null && $defaultRows[4]['game_category_name'] === null, 'Unassigned list category is explicit null');
|
|
|
+ check($defaultRows[6]['type'] === 2 && $defaultRows[6]['type_name'] === '普通活动', 'Former football type displays the normal activity name without changing its ID');
|
|
|
+ foreach ([2 => '普通活动', 3 => '即充即送', 4 => '老用户召集令', 5 => 'USDT使用教学', 6 => '余额宝'] as $type => $name) {
|
|
|
+ $named = \app\common\service\ActivityCatalog::decorate(['type' => $type, 'game_category' => 'other']);
|
|
|
+ check($named['type'] === $type && $named['type_name'] === $name && $named['game_category_name'] === '其他', 'Canonical activity label: ' . $type);
|
|
|
+ }
|
|
|
+ $legacyType = \app\common\service\ActivityCatalog::decorate(['type' => 1]);
|
|
|
+ check($legacyType['type'] === 1 && $legacyType['type_name'] === null && $legacyType['game_category'] === null, 'Legacy type one is preserved without inventing a name');
|
|
|
+ $unknownType = \app\common\service\ActivityCatalog::decorate(['type' => 99, 'game_category' => 'legacy:unknown']);
|
|
|
+ check($unknownType['type'] === 99 && $unknownType['type_name'] === null && $unknownType['game_category'] === 'legacy:unknown' && $unknownType['game_category_name'] === null, 'Unknown values remain unchanged without guessing another category');
|
|
|
+ \think\facade\Db::table('bot_activity_rewards')->where('id', 4)->update(['game_category' => 'third:2']);
|
|
|
+ check(\think\facade\Db::table('bot_activity_rewards')->where('id', 4)->find() === $originalActivity, 'List/detail metadata reads do not modify the activity');
|
|
|
+ check(\think\facade\Db::table('bot_balance_logs')->order('id')->select()->toArray() === $fundsBefore, 'List/detail metadata reads never create financial entries');
|
|
|
activity(7, ['type' => 4]);
|
|
|
request()->query['id'] = 7;
|
|
|
check($controller->activityInfo()['code'] === 0, 'Detail enforces recharge group without type query');
|