diff --git a/app/Command/RebateCommand.php b/app/Command/RebateCommand.php index 85483fe..bb785e5 100644 --- a/app/Command/RebateCommand.php +++ b/app/Command/RebateCommand.php @@ -44,7 +44,7 @@ class RebateCommand extends HyperfCommand $this->setDescription('返利'); $this->addOption('timeRange', 'T', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '时间范围', [time()-10*60, time()]); $this->addOption('date', 'D', InputOption::VALUE_OPTIONAL, '日期', date('Y-m-d',strtotime('-1 day'))); - $this->addOption('gameId', 'G', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '游戏', [11]); + $this->addOption('gameId', 'G', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '游戏', [11, 17]); } public function handle() diff --git a/app/Helper/RebateGiftItem/Game12.php b/app/Helper/RebateGiftItem/Game12.php deleted file mode 100644 index 99a074a..0000000 --- a/app/Helper/RebateGiftItem/Game12.php +++ /dev/null @@ -1,105 +0,0 @@ - $this->getAItems(), - 'C' => $this->getCItems(), - 'D' => $this->getDItems(), - 'G' => $this->getGItems(), - 'J' => $this->getJItems(), - ]; - } - - public function getAItems() - { - return [ - ['gift_key' => 'A-28', 'amount' => 28, 'gifts' => [['id' => 587, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '特权月卡*1'], - ['gift_key' => 'A-100', 'amount' => 100, 'gifts' => [['id' => 592, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '100000元宝|200000充值元宝'], - ['gift_key' => 'A-500', 'amount' => 500, 'gifts' => [['id' => 593, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '500000元宝|1000000充值元宝'], - ['gift_key' => 'A-1000', 'amount' => 1000, 'gifts' => [['id' => 594, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '1000000元宝|2000000充值元宝'], - ['gift_key' => 'A-1500', 'amount' => 1500, 'gifts' => [['id' => 595, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '1500000元宝|3000000充值元宝'], - ['gift_key' => 'A-2000', 'amount' => 2000, 'gifts' => [['id' => 596, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '2000000元宝|4000000充值元宝'], - ['gift_key' => 'A-3000', 'amount' => 3000, 'gifts' => [['id' => 597, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '3000000元宝|6000000充值元宝'], - ['gift_key' => 'A-5000', 'amount' => 5000, 'gifts' => [['id' => 598, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '5000000元宝|10000000充值元宝'], - ['gift_key' => 'A-10000', 'amount' => 10000, 'gifts' => [['id' => 599, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '10000000元宝|20000000充值元宝'], - ]; - } - - public function getCItems() - { - return [ - ['gift_key' => 'C-328', 'amount' => 328, 'gifts' => [['id' => 58706, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '328累充豪礼'], - ['gift_key' => 'C-500', 'amount' => 500, 'gifts' => [['id' => 58704, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木充值豪礼·壹'], - ['gift_key' => 'C-1000', 'amount' => 1000, 'gifts' => [['id' => 58705, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木充值豪礼·贰'], - ['gift_key' => 'C-2000', 'amount' => 2000, 'gifts' => [['id' => 29050, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜充值豪礼·壹'], - ['gift_key' => 'C-5000', 'amount' => 5000, 'gifts' => [['id' => 29051, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜充值豪礼·贰'], - ['gift_key' => 'C-10000', 'amount' => 10000, 'gifts' => [['id' => 29052, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜充值豪礼·叁'], - ['gift_key' => 'C-20000', 'amount' => 20000, 'gifts' => [['id' => 29053, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·壹'], - - ['gift_key' => 'C-30000', 'amount' => 30000, 'gifts' => [['id' => 29054, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·贰'], - ['gift_key' => 'C-40000', 'amount' => 40000, 'gifts' => [['id' => 29055, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·叁'], - ['gift_key' => 'C-50000', 'amount' => 50000, 'gifts' => [['id' => 29056, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·肆'], - ['gift_key' => 'C-60000', 'amount' => 60000, 'gifts' => [['id' => 29057, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·壹'], - ['gift_key' => 'C-70000', 'amount' => 70000, 'gifts' => [['id' => 29058, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·贰'], - ['gift_key' => 'C-80000', 'amount' => 80000, 'gifts' => [['id' => 29059, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·叁'], - ['gift_key' => 'C-90000', 'amount' => 90000, 'gifts' => [['id' => 29060, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·肆'], - ['gift_key' => 'C-100000', 'amount' => 100000, 'gifts' => [['id' => 29061, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·伍'], - - ['gift_key' => 'C-120000', 'amount' => 120000, 'gifts' => [['id' => 29063, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金充值豪礼·贰'], - ['gift_key' => 'C-150000', 'amount' => 150000, 'gifts' => [['id' => 29066, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金充值豪礼·伍'], - ['gift_key' => 'C-170000', 'amount' => 170000, 'gifts' => [['id' => 29068, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石充值豪礼·贰'], - ['gift_key' => 'C-200000', 'amount' => 200000, 'gifts' => [['id' => 29071, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石充值豪礼·伍'], - - ['gift_key' => 'C-250000', 'amount' => 250000, 'gifts' => [['id' => 58017, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '荣耀充值豪礼·叁'], - ['gift_key' => 'C-300000', 'amount' => 300000, 'gifts' => [['id' => 58019, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '荣耀充值豪礼·伍'], - - ['gift_key' => 'C-350000', 'amount' => 350000, 'gifts' => [['id' => 58022, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '至尊充值豪礼·叁'], - ['gift_key' => 'C-400000', 'amount' => 400000, 'gifts' => [['id' => 58024, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '至尊充值豪礼·伍'], - ['gift_key' => 'C-450000', 'amount' => 450000, 'gifts' => [['id' => 58027, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '巅峰充值豪礼·叁'], - ['gift_key' => 'C-500000', 'amount' => 500000, 'gifts' => [['id' => 58029, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '巅峰充值豪礼·伍'], - - ['gift_key' => 'C-550000', 'amount' => 550000, 'gifts' => [['id' => 58128, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·壹'], - ['gift_key' => 'C-600000', 'amount' => 600000, 'gifts' => [['id' => 58129, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·贰'], - ['gift_key' => 'C-650000', 'amount' => 650000, 'gifts' => [['id' => 58130, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·叁'], - ['gift_key' => 'C-700000', 'amount' => 700000, 'gifts' => [['id' => 58131, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·肆'], - ['gift_key' => 'C-750000', 'amount' => 750000, 'gifts' => [['id' => 58132, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·伍'], - ['gift_key' => 'C-800000', 'amount' => 800000, 'gifts' => [['id' => 58133, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·陆'], - ['gift_key' => 'C-850000', 'amount' => 850000, 'gifts' => [['id' => 58134, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·柒'], - ['gift_key' => 'C-900000', 'amount' => 900000, 'gifts' => [['id' => 58135, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·捌'], - ['gift_key' => 'C-950000', 'amount' => 950000, 'gifts' => [['id' => 58136, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·玖'], - ['gift_key' => 'C-1000000', 'amount' => 1000000, 'gifts' => [['id' => 58137, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·拾'], - - ]; - } - - public function getDItems() - { - return [ - ['gift_key' => 'D-0', 'amount' => 0, 'gifts' => [['id' => 58688, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '首充礼包'], - ]; - } - - public function getGItems() - { - return [ - ['gift_key' => 'D-0', 'amount' => 0, 'gifts' => [['id' => 58686, 'num' => 1], ['id' => 58687, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '豪华进游福利、仙盟礼包'], - ]; - } - - public function getJItems() - { - return [ - ['gift_key' => 'J-150', 'amount' => 150, 'gifts' => [['id' => 58689, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '150级等级福利礼包'], - ['gift_key' => 'J-220', 'amount' => 220, 'gifts' => [['id' => 58690, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '220级等级福利礼包'], - ['gift_key' => 'J-270', 'amount' => 270, 'gifts' => [['id' => 58691, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '270级等级福利礼包'], - ['gift_key' => 'J-320', 'amount' => 320, 'gifts' => [['id' => 58692, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '320级等级福利礼包'], - ['gift_key' => 'J-370', 'amount' => 370, 'gifts' => [['id' => 58693, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '370级等级福利礼包'], - ]; - } -} \ No newline at end of file diff --git a/app/Helper/RebateGiftItem/Game17.php b/app/Helper/RebateGiftItem/Game17.php new file mode 100644 index 0000000..5eedf50 --- /dev/null +++ b/app/Helper/RebateGiftItem/Game17.php @@ -0,0 +1,178 @@ + $this->getCItems(), + 'D' => $this->getDItems(), + 'E' => $this->getEItems(), + 'G' => $this->getGItems(), + 'L' => $this->getLItems(), + ]; + } + + public function getCItems() + { + return [ + ['gift_key' => 'C-328', 'amount' => 328, 'gifts' => [['id' => 58706, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '328累充豪礼'], + ['gift_key' => 'C-500', 'amount' => 500, 'gifts' => [['id' => 58704, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木充值豪礼·壹'], + ['gift_key' => 'C-1000', 'amount' => 1000, 'gifts' => [['id' => 58705, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木充值豪礼·贰'], + ['gift_key' => 'C-2000', 'amount' => 2000, 'gifts' => [['id' => 29050, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜充值豪礼·壹'], + ['gift_key' => 'C-5000', 'amount' => 5000, 'gifts' => [['id' => 29051, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜充值豪礼·贰'], + ['gift_key' => 'C-10000', 'amount' => 10000, 'gifts' => [['id' => 29052, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜充值豪礼·叁'], + ['gift_key' => 'C-20000', 'amount' => 20000, 'gifts' => [['id' => 29053, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·壹'], + + ['gift_key' => 'C-30000', 'amount' => 30000, 'gifts' => [['id' => 29054, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·贰'], + ['gift_key' => 'C-40000', 'amount' => 40000, 'gifts' => [['id' => 29055, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·叁'], + ['gift_key' => 'C-50000', 'amount' => 50000, 'gifts' => [['id' => 29056, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银充值豪礼·肆'], + ['gift_key' => 'C-60000', 'amount' => 60000, 'gifts' => [['id' => 29057, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·壹'], + ['gift_key' => 'C-70000', 'amount' => 70000, 'gifts' => [['id' => 29058, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·贰'], + ['gift_key' => 'C-80000', 'amount' => 80000, 'gifts' => [['id' => 29059, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·叁'], + ['gift_key' => 'C-90000', 'amount' => 90000, 'gifts' => [['id' => 29060, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·肆'], + ['gift_key' => 'C-100000', 'amount' => 100000, 'gifts' => [['id' => 29061, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金充值豪礼·伍'], + + ['gift_key' => 'C-120000', 'amount' => 120000, 'gifts' => [['id' => 29063, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金充值豪礼·贰'], + ['gift_key' => 'C-150000', 'amount' => 150000, 'gifts' => [['id' => 29066, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金充值豪礼·伍'], + ['gift_key' => 'C-170000', 'amount' => 170000, 'gifts' => [['id' => 29068, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石充值豪礼·贰'], + ['gift_key' => 'C-200000', 'amount' => 200000, 'gifts' => [['id' => 29071, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石充值豪礼·伍'], + + ['gift_key' => 'C-250000', 'amount' => 250000, 'gifts' => [['id' => 58017, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '荣耀充值豪礼·叁'], + ['gift_key' => 'C-300000', 'amount' => 300000, 'gifts' => [['id' => 58019, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '荣耀充值豪礼·伍'], + + ['gift_key' => 'C-350000', 'amount' => 350000, 'gifts' => [['id' => 58022, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '至尊充值豪礼·叁'], + ['gift_key' => 'C-400000', 'amount' => 400000, 'gifts' => [['id' => 58024, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '至尊充值豪礼·伍'], + ['gift_key' => 'C-450000', 'amount' => 450000, 'gifts' => [['id' => 58027, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '巅峰充值豪礼·叁'], + ['gift_key' => 'C-500000', 'amount' => 500000, 'gifts' => [['id' => 58029, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '巅峰充值豪礼·伍'], + + ['gift_key' => 'C-550000', 'amount' => 550000, 'gifts' => [['id' => 58128, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·壹'], + ['gift_key' => 'C-600000', 'amount' => 600000, 'gifts' => [['id' => 58129, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·贰'], + ['gift_key' => 'C-650000', 'amount' => 650000, 'gifts' => [['id' => 58130, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·叁'], + ['gift_key' => 'C-700000', 'amount' => 700000, 'gifts' => [['id' => 58131, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·肆'], + ['gift_key' => 'C-750000', 'amount' => 750000, 'gifts' => [['id' => 58132, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·伍'], + ['gift_key' => 'C-800000', 'amount' => 800000, 'gifts' => [['id' => 58133, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·陆'], + ['gift_key' => 'C-850000', 'amount' => 850000, 'gifts' => [['id' => 58134, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·柒'], + ['gift_key' => 'C-900000', 'amount' => 900000, 'gifts' => [['id' => 58135, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·捌'], + ['gift_key' => 'C-950000', 'amount' => 950000, 'gifts' => [['id' => 58136, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·玖'], + ['gift_key' => 'C-1000000', 'amount' => 1000000, 'gifts' => [['id' => 58137, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '无上充值豪礼·拾'], + + ]; + } + + public function getDItems() + { + return [ + ['gift_key' => 'D-0', 'amount' => 0, 'gifts' => [['id' => 58688, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '首充礼包'], + ]; + } + + public function getEItems() + { + $allItems = []; + foreach ($this->getGroupEItems() as $group => $items) { + foreach ($items as $key => $item) { + $item['group'] = $group; + $items[$key] = $item; + } + $allItems = array_merge($allItems, $items); + } + return $allItems; + } + + public function getGItems() + { + return [ + ['gift_key' => 'D-0', 'amount' => 0, 'gifts' => [['id' => 58686, 'num' => 1], ['id' => 58687, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '豪华进游福利、仙盟礼包'], + ]; + } + + public function getLItems() + { + return [ + ['gift_key' => 'L-150', 'amount' => 150, 'gifts' => [['id' => 58689, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '150级等级福利礼包'], + ['gift_key' => 'L-220', 'amount' => 220, 'gifts' => [['id' => 58690, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '220级等级福利礼包'], + ['gift_key' => 'L-270', 'amount' => 270, 'gifts' => [['id' => 58691, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '270级等级福利礼包'], + ['gift_key' => 'L-320', 'amount' => 320, 'gifts' => [['id' => 58692, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '320级等级福利礼包'], + ['gift_key' => 'L-370', 'amount' => 370, 'gifts' => [['id' => 58693, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '370级等级福利礼包'], + ]; + } + + public function getGroupEItems() { + return [ + 1 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58151, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58165, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 58143, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 58144, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58678, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 58145, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 58146, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 58147, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包'], + ], + 2 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58152, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包·壹'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58166, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包·壹'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 29020, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包·壹'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 29026, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包·壹'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58679, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包·壹'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 29032, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包·壹'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 29038, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包·壹'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 29044, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包·壹'], + ], + 3 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58153, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包·贰'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58167, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包·贰'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 29021, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包·贰'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 29027, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包·贰'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58680, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包·贰'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 29033, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包·贰'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 29039, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包·贰'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 29045, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包·贰'], + ], + 4 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58154, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包·叁'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58168, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包·叁'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 29022, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包·叁'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 29028, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包·叁'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58681, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包·叁'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 29034, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包·叁'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 29040, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包·叁'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 29046, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包·叁'], + ], + 7 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58155, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包·肆'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58169, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包·肆'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 29023, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包·肆'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 29029, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包·肆'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58682, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包·肆'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 29035, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包·肆'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 29041, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包·肆'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 29047, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包·肆'], + ], + 6 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58156, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包·伍'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58170, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包·伍'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 29024, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包·伍'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 29030, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包·伍'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58683, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包·伍'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 29036, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包·伍'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 29042, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包·伍'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 29048, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包·伍'], + ], + 7 => [ + ['gift_key' => 'E-100', 'amount' => 100, 'gifts' => [['id' => 58157, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '檀木单日礼包·陆'], + ['gift_key' => 'E-500', 'amount' => 500, 'gifts' => [['id' => 58171, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '垠石单日礼包·陆'], + ['gift_key' => 'E-1000', 'amount' => 1000, 'gifts' => [['id' => 29025, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '青铜单日礼包·陆'], + ['gift_key' => 'E-2000', 'amount' => 2000, 'gifts' => [['id' => 29031, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '白银单日礼包·陆'], + ['gift_key' => 'E-3000', 'amount' => 3000, 'gifts' => [['id' => 58684, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '翡翠单日礼包·陆'], + ['gift_key' => 'E-5000', 'amount' => 5000, 'gifts' => [['id' => 29037, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '黄金单日礼包·陆'], + ['gift_key' => 'E-10000', 'amount' => 10000, 'gifts' => [['id' => 29043, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '铂金单日礼包·陆'], + ['gift_key' => 'E-20000', 'amount' => 20000, 'gifts' => [['id' => 29049, 'num' => 1]], 'game_currency' => 0, 'gift_content' => '钻石单日礼包·陆'], + ], + ]; + } +} \ No newline at end of file diff --git a/app/Helper/RebateGiftItem/Manager.php b/app/Helper/RebateGiftItem/Manager.php index f324b31..d6c210a 100644 --- a/app/Helper/RebateGiftItem/Manager.php +++ b/app/Helper/RebateGiftItem/Manager.php @@ -10,7 +10,8 @@ class Manager { private function getGameItemClassMap() { return [ - 11 => Game11::class + 11 => Game11::class, + 17 => Game17::class, ]; } diff --git a/app/Model/RebateGift.php b/app/Model/RebateGift.php index e45054e..8094a15 100644 --- a/app/Model/RebateGift.php +++ b/app/Model/RebateGift.php @@ -22,6 +22,6 @@ class RebateGift extends Model 'G' => '首次进游福利', 'H' => '签到福利发放', 'I' => '充值返利发放', - 'J' => '等级福利发放', + 'L' => '等级福利发放', ]; } \ No newline at end of file diff --git a/app/Service/RebateService.php b/app/Service/RebateService.php index 7a5cc4b..dd1d0c7 100644 --- a/app/Service/RebateService.php +++ b/app/Service/RebateService.php @@ -476,12 +476,19 @@ class RebateService extends Service return $item->role_id . '-' . $item->gift_key; }); + $mode = $baseGame->id == 17 ? 'max' : 'all'; $roles = $this->getRolesByRoleIds($baseGame, $roleIds); - + $roleGiftGroupMap = $this->getDayAccumulativeRoleGiftGropMap($baseGame, $gifts, $roles); $records = []; foreach ($items as $roleId => $amount) { + $gifts = $gifts->where('group', $roleGiftGroupMap[$roleId] ?? 0); + $maxGift = null; foreach ($gifts as $gift) { if ($amount >= $gift->amount) { + if ($mode == 'max') { + $maxGift = $gift; + continue; + } $orderKey = $roleId . '-' . $gift->gift_key; if (empty($existItems[$orderKey])) { $role = $roles[$roleId] ?? null; @@ -496,10 +503,55 @@ class RebateService extends Service } } } + if ($mode == 'max' && $maxGift) { + $orderKey = $roleId . '-' . $maxGift->gift_key; + if (empty($existItems[$orderKey])) { + $role = $roles[$roleId] ?? null; + + $record = $this->getCommonRecord($baseGame, $role, $maxGift); + $record = array_merge($record, [ + 'award_date' => $date, + 'pay_amount' => $amount, + 'order_number' => uniqid('total_').rand(100000, 999999) + ]); + $records[] = $record; + } + } } RebateOrder::insert($records); } + public function getDayAccumulativeRoleGiftGropMap($baseGame, $gifts, $roles) { + if ($baseGame->id == 17) { + $roleGiftGroupMap = []; + $serverIds = $roles->pluck('server_id')->toArray(); + $servers = Server::whereIn('server_id', $serverIds)->get(['server_id', 'create_time'])->keyBy('server_id'); + foreach ($roles as $role) { + $serverCreateTime = $servers[$role->server_id] ? $servers[$role->server_id]->create_time : time(); + $serverCreateTime = strtotime(date('Y-m-d 00:00:00', $serverCreateTime)); + $openDayCount = (strtotime(date('Y-m-d 23:59:59')) + 1 - $serverCreateTime) / (24*60*60); + if ($openDayCount >=1 && $openDayCount <= 7) { + $roleGiftGroupMap[$role->role_id] = 1; + } elseif ($openDayCount >=8 && $openDayCount <= 15) { + $roleGiftGroupMap[$role->role_id] = 2; + } elseif ($openDayCount >=16 && $openDayCount <= 30) { + $roleGiftGroupMap[$role->role_id] = 3; + } elseif ($openDayCount >=31 && $openDayCount <= 45) { + $roleGiftGroupMap[$role->role_id] = 4; + } elseif ($openDayCount >=46 && $openDayCount <= 60) { + $roleGiftGroupMap[$role->role_id] = 5; + } elseif ($openDayCount >=61 && $openDayCount <= 90) { + $roleGiftGroupMap[$role->role_id] = 6; + } elseif ($openDayCount >=91 && $openDayCount <= 999) { + $roleGiftGroupMap[$role->role_id] = 7; + } + } + return $roleGiftGroupMap; + } else { + return []; + } + } + /** * 周卡福利(聚宝周卡) * 目前仅适用于玄灵契约(无普遍适用性) @@ -751,7 +803,7 @@ class RebateService extends Service */ public function generateRoleLevel($baseGame, $timeRange) { - $gifts = RebateGift::where('type', 'J') + $gifts = RebateGift::where('type', 'L') ->where('base_game_id', $baseGame->id) ->orderBy('amount', 'asc') ->get(); @@ -766,7 +818,7 @@ class RebateService extends Service ->toArray(); $existItems = RebateOrder::whereIn('role_id', $roleIds) - ->where('type', 'J') + ->where('type', 'L') ->where('base_game_id', $baseGame->id) ->get(['gift_key', 'role_id']) ->keyBy(function($item) { @@ -833,6 +885,7 @@ class RebateService extends Service 'amount' => $gift->amount, 'gift_key' => $gift->gift_key, 'gift_content' => $gift->gift_content, + 'gift_group' => $gift->group, 'create_time' => time(), 'creator_username' => '系统', ]; @@ -875,6 +928,7 @@ class RebateService extends Service $records = []; foreach ($items as $item) { $item['type'] = $type; + $item['group'] = $item['group'] ?? 0; $item['base_game_id'] = $baseGameId; $item['gifts'] = json_encode($item['gifts']); $records[] = $item;