diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt index f2bc7fb38..2d8d3add6 100644 --- a/Application/Admin/Controller/access_data_foldline.txt +++ b/Application/Admin/Controller/access_data_foldline.txt @@ -1 +1 @@ -{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":0,"player":0,"money":0},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]} \ No newline at end of file +{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":21},{"time":"17:00","count":10},{"time":"18:00","count":7},{"time":"19:00","count":11},{"time":"20:00","count":11},{"time":"21:00","count":8},{"time":"22:00","count":11},{"time":"23:00","count":10}],"sum":{"news":89,"active":2506,"player":378,"money":33093},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":851},{"time":"17:00","count":280},{"time":"18:00","count":142},{"time":"19:00","count":105},{"time":"20:00","count":81},{"time":"21:00","count":143},{"time":"22:00","count":420},{"time":"23:00","count":484}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":179},{"time":"17:00","count":54},{"time":"18:00","count":28},{"time":"19:00","count":24},{"time":"20:00","count":14},{"time":"21:00","count":12},{"time":"22:00","count":27},{"time":"23:00","count":40}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":"15639.00"},{"time":"17:00","count":"5328.00"},{"time":"18:00","count":"5490.00"},{"time":"19:00","count":"1178.00"},{"time":"20:00","count":"1274.00"},{"time":"21:00","count":"484.00"},{"time":"22:00","count":"2327.00"},{"time":"23:00","count":"1373.00"}]} \ No newline at end of file diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 4442beb3d..e07dba79c 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -162,63 +162,69 @@ class PromoteService { $coinRecordService = new PromoteCoinRecordService(); $promoteCoinService = new PromoteCoinService(); - $toPromoteId = $task['to_promote_id']; - $fromPromoteId = $task['from_promote_id']; $balanceCoinMode = $task['balance_coin_mode']; - $toPromote = D('promote')->where(['id' => $toPromoteId])->find(); - $fromPromote = D('promote')->where(['id' => $fromPromoteId])->find(); + $toPromote = M('promote', 'tab_')->where(['id' => $task['to_promote_id']])->find(); + $fromPromote = M('promote', 'tab_')->where(['id' => $task['from_promote_id']])->find(); $topPromote = $this->getTopPromote($fromPromote); - - $status = $this->shiftRemoveCoin($fromPromote, $topPromote, $task); - - // 测试 - // $model->rollback(); + $status = $this->shiftRemoveCoin($fromPromote, $task); if (!$status) { $model->rollback(); - return ['status' => false, 'msg' => '系统异常2']; + return ['status' => false, 'msg' => '系统异常, 处理推广员平台币失败']; } - $promote = new PromoteModel(); - $updateData = [ - 'parent_id' => $toPromote['id'] - ]; - $updateData = [ - 'chain' => ['exp', 'replace(chain,\''.$fromPromote['chain'].'\',\''. $toPromote['chain'].'\')'] - ]; - if ($fromPromote['grand_id'] == 0) { - $status = $promote->where('parent_id=' . $fromPromoteId)->save($updateData); - } else { - $status = $promote->where('id=' . $fromPromoteId)->save($updateData); + $firstMap = ['parent_id' => $fromPromote['id']]; + $secondMap = ['chain' => ['like', $fromPromote['chain'] . $fromPromote['id'] . '/%']]; + if ($task['shift_ids'] != '') { + $shiftIds = json_decode($task['shift_ids'], true) ?? []; + $firstMap['id'] = ['in', $shiftIds]; + $secondMap['id'] = ['in', $shiftIds]; + } + + $status = M('promote', 'tab_')->where($firstMap)->save(['parent_id' => $toPromote['id']]); + if (!$status) { + $model->rollback(); + return ['status' => false, 'msg' => '系统异常,修改推广员上级失败']; } + $status = M('promote', 'tab_')->where($secondMap)->save(['chain' => $toPromote['chain'] . $toPromote['id'] . '/']); if (!$status) { $model->rollback(); - return ['status' => false, 'msg' => '系统异常1']; + return ['status' => false, 'msg' => '系统异常,修改推广员CHAIN失败']; } $status1 = M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1]); if (!$status1) { $model->rollback(); - return ['status' => false, 'msg' => '系统异常3']; + return ['status' => false, 'msg' => '系统异常,修改迁移任务状态失败']; } $model->commit(); return ['status' => true, 'msg' => '推广帐号迁移成功']; } - public function shiftRemoveCoin($promote, $topPromote, $task) + public function shiftRemoveCoin($promote, $task) { + $shiftIds = null; + if ($task['shift_ids'] != '') { + $shiftIds = json_decode($task['shift_ids'], true) ?? []; + } + + $topPromote = $this->getTopPromote($promote); $coinRecordService = new PromoteCoinRecordService(); $promoteCoinService = new PromoteCoinService(); $topBalanceCoin = $this->getBalanceCoin($topPromote['id'], 0); $topBalancePlus = 0; - $promotes = D('promote')->field(['id', 'balance_coin'])->where(['parent_id' => $promote['id']])->select(); - $ids = array_column($promotes, 'id'); - + $map = ['chain' => $promote['chain'] . $chain['id'] . '/%']; + if ($shiftIds != null) { + $map['id'] = ['in', $shiftIds]; + } + $subPromotes = M('promote', 'tab_')->field(['id', 'balance_coin'])->where($map)->select(); + $ids = array_column($subPromotes, 'id'); $ids[] = $promote['id']; + $promoteCoins = []; $balances = M('PromoteBalanceCoin', 'tab_')->where(['promote_id' => ['in', $ids]])->select(); @@ -306,9 +312,7 @@ class PromoteService { $toPromote = D('promote')->where(['id' => $toPromoteId])->find(); $fromPromote = D('promote')->where(['id' => $fromPromoteId])->find(); - // $promote = new PromoteModel(); - // $promote->where('parent_id=' . $fromPromoteId)->save(['parent_id' => $toPromoteId]); - + $user1 = new UserModel(); $users = $user1->field(['id', 'account', 'nickname'])->where('promote_id=' . $fromPromoteId)->select(); diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php new file mode 100644 index 000000000..8296697fe --- /dev/null +++ b/Application/Home/Controller/FinanceController.class.php @@ -0,0 +1,17 @@ +paginate($query); $ids = array_column($records, 'id'); - $parentIds = array_column($records, 'parent_id'); $countList = []; $playerList = []; @@ -949,10 +948,10 @@ class PromoteController extends BaseController $playerList = M('user_play', 'tab_')->field(['count(*)' => 'count', 'promote_id' => 'promote_id'])->where(['promote_id' => ['in', $ids]])->group('promote_id')->select(); $shiftList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 1, 'promote_id' => ['in', $ids]])->group('from_promote_id')->select(); $shiftPlayerList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 2, 'promote_id' => ['in', $ids]])->group('from_promote_id')->select(); - $countList = array_column($countList, 'parent_id'); - $playerList = array_column($playerList, 'promote_id'); - $shiftList = array_column($shiftList, 'from_promote_id'); - $shiftPlayerList = array_column($shiftPlayerList, 'from_promote_id'); + $hasChildList = array_column($countList, 'parent_id'); + $hasPlayerList = array_column($playerList, 'promote_id'); + $hasShiftList = array_column($shiftList, 'from_promote_id'); + $hasShiftPlayerList = array_column($shiftPlayerList, 'from_promote_id'); } if ($promoteType == 0) { @@ -964,10 +963,10 @@ class PromoteController extends BaseController } $this->assign('promoteTypeName', $promoteTypeName); - $this->assign('countList', $countList); - $this->assign('playerList', $playerList); - $this->assign('shiftList', $shiftList); - $this->assign('shiftPlayerList', $shiftPlayerList); + $this->assign('hasChildList', $hasChildList); + $this->assign('hasPlayerList', $hasPlayerList); + $this->assign('hasShiftList', $hasShiftList); + $this->assign('hasShiftPlayerList', $hasShiftPlayerList); $this->assign('count', $count); $this->assign('pagination', $pagination); $this->assign('records', $records); @@ -2291,6 +2290,26 @@ class PromoteController extends BaseController $this->display(); } } + + public function getSubPromotes() + { + $level = I('level', 0); + $promoteId = I('promote_id', 0); + $promote = $this->getLoginPromote(); + if ($promoteId > 0) { + $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); + } + $map = ['chain' => ['like', $promote['chain'] . $promote['id'] . '/%']]; + if ($level > 0) { + $map['level'] = $level; + } + $promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name'])->where($map)->select(); + $this->ajaxReturn([ + 'status' => 1, + 'msg' => '成功', + 'data' => ['promotes' => $promotes] + ]); + } } diff --git a/Application/Home/View/default/Promote/children.html b/Application/Home/View/default/Promote/children.html index 6cd7cc6ee..cf08b8e65 100644 --- a/Application/Home/View/default/Promote/children.html +++ b/Application/Home/View/default/Promote/children.html @@ -13,7 +13,8 @@