diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 79fa51a05..3fe67e73d 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -330,12 +330,20 @@ class PromoteService { $map = []; $map['promote_id'] = $fromPromote['id']; + $spendMap = $map; if (count($shiftIds) > 0) { - $map['id'] = ['in', $shiftIds]; + $spendMap['user_id'] = $map['id'] = ['in', $shiftIds]; } $users = M('user', 'tab_')->field(['id', 'account', 'nickname'])->where($map)->select(); + $spendMap['pay_time'] = ['egt', $orderTime]; + $payAmountRows = M('spend', 'tab_') + ->field(['user_id', 'sum(pay_amount) payAmount']) + ->where($spendMap) + ->select(); + $payAmountRows = index_by_column('user_id', $payAmountRows); + $mends = []; foreach ($users as $item) { $mends[] = [ @@ -349,6 +357,7 @@ class PromoteService { 'remark' => $remark == '' ? ($task['creator_type'] == 0 ? '后台补链' : '玩家迁移') : $remark, 'order_time' => $orderTime, 'create_time' => time(), + 'pay_amount' => isset($payAmountRows[$item['id']]) ? $payAmountRows[$item['id']]['payAmount'] : 0, 'op_id' => $creator ? $creator['id'] : 0, 'op_account' => $opAccount, 'op_type' => $task['creator_type'], diff --git a/Data/update.sql b/Data/update.sql index 68d6fd901..4c9cac958 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -657,6 +657,7 @@ ALTER TABLE tab_game ADD `ios_video_top` tinyint(1) DEFAULT '1' COMMENT 'ios落 -- 新旧IOS打包标识 ALTER TABLE `tab_game_source` add COLUMN `is_new_sdk` tinyint(2) DEFAULT '0' COMMENT '是否新SDK(IOS)'; +ALTER TABLE `tab_mend` ADD COLUMN `pay_amount` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '换绑时归属前推广员的充值金额' AFTER `promote_account_to`; -- 合服游戏区服表 tping CREATE TABLE `tab_server_union` ( @@ -694,4 +695,4 @@ ALTER TABLE `tab_pay_info` ADD COLUMN `server_name` varchar(30) DEFAULT '' COMME ALTER TABLE `tab_pay_info` ADD COLUMN `promote_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广员id'; ALTER TABLE `tab_pay_info` ADD COLUMN `game_player_id` int(11) DEFAULT '0' COMMENT '玩家游戏内id'; ALTER TABLE `tab_pay_info` ADD COLUMN `sdk_version` tinyint(2) DEFAULT '1' COMMENT '区别sdk版本1安卓 2苹果 '; -ALTER TABLE `tab_pay_info` ADD COLUMN `promote_account` varchar(30) DEFAULT '' COMMENT '推广员账号'; \ No newline at end of file +ALTER TABLE `tab_pay_info` ADD COLUMN `promote_account` varchar(30) DEFAULT '' COMMENT '推广员账号';