From e4daff1be8fbc92f5e0bdbeaeb19f721a5a13d02 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 09:52:37 +0800 Subject: [PATCH 01/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Tool/TaskClient.class.php | 38 ++++++++++++++++ .../Common/Controller/SmsController.class.php | 1 + .../Controller/CommonController.class.php | 38 ++++++++-------- .../Mobile/Controller/SsgController.class.php | 43 ++++++++----------- .../Controller/UserController.class.php | 30 ++++++------- 5 files changed, 89 insertions(+), 61 deletions(-) create mode 100644 Application/Base/Tool/TaskClient.class.php diff --git a/Application/Base/Tool/TaskClient.class.php b/Application/Base/Tool/TaskClient.class.php new file mode 100644 index 000000000..b60fc4f45 --- /dev/null +++ b/Application/Base/Tool/TaskClient.class.php @@ -0,0 +1,38 @@ +client = new Client([ + 'base_uri' => C('TASK_URL'), + 'timeout' => 10.0, + ]); + } + + protected function post($uri, $data) + { + $response = $this->client->post($uri, [ + 'verify' => false, + 'form_params' => $data + ]); + $result = (string)$response->getBody(); + return json_decode($result, true); + } + + public function sendSms($mobile, $type = 'common') + { + $result = $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type]); + } + + public function checkSms($mobile, $code) + { + $result = $this->post('/message/sms-check', ['mobile' => $mobile, 'code' => $code]); + } +} \ No newline at end of file diff --git a/Application/Common/Controller/SmsController.class.php b/Application/Common/Controller/SmsController.class.php index 79f544a24..65fc2ca03 100644 --- a/Application/Common/Controller/SmsController.class.php +++ b/Application/Common/Controller/SmsController.class.php @@ -1,5 +1,6 @@ setData($result['data'])->respondSuccess('发送成功'); + $phone = I('phone'); + $taskClient = new TaskClient(); + $result = $taskClient->sendSms($phone); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { + $this->respondSuccess('发送成功'); } else { $this->respondError('发送失败'); } } - public function smsVerify($phone="" , $code="", $type=2){ - - $result = R('Common/Sms/verify_sms_code', [$phone, $code, false]); - if($result['code'] == 200) { - if($type==1){ + public function smsVerify($phone = '' , $code = '', $type = 2){ + $taskClient = new TaskClient(); + $result = $taskClient->checkSms($phone, $code); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { + if($type == 1){ $this->respondSuccess('正确'); - }else{ + } else { return true; } } else { - switch ($result['code']) { - case 1021:{ - $this->respondError('验证码已失效,请重新获取'); - };break; - case 1022:{ - $this->respondError('验证码不正确,请重新输入'); - };break; - default: - $this->respondError($result['msg']); + if($type == 1){ + $this->respondError($result['message']); + } else { + return false; } } } diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 73731885a..d1c80bccb 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -3,6 +3,7 @@ namespace Mobile\Controller; use Org\Ipa365SDK\Ipa365; use Org\WeixinSDK\Weixin; use User\Api\MemberApi; +use Base\Tool\TaskClient; use Think\Log; class SsgController extends BaseController { @@ -398,24 +399,24 @@ class SsgController extends BaseController { session("user_auth",null); redirect(U("ssg/login")); } + //发送验证码 public function sendPhoneCode() { - $phone = I("phone"); - $result = R('Common/Sms/send_sms_code', array($phone, 10, false)); - - if ($result['code'] == 200) { + $phone = I('phone'); + $taskClient = new TaskClient(); + $result = $taskClient->sendSms($phone); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { $data['status'] = 1; - $data['data'] = $result['data']; } else { $data['status'] = 0; } - - $data['msg'] = $result['msg']; - + $data['msg'] = $result['message']; echo json_encode($data); exit; } + public function timediffs($begin_time, $end_time) { if ($begin_time < $end_time) { $starttime = $begin_time; @@ -439,29 +440,23 @@ class SsgController extends BaseController { $res = array("day" => $days, "hour" => $hours, "min" => $mins, "sec" => $secs); return $res; } - public function sms_verify($phone="" ,$code="",$type=2){ - $result = R('Common/Sms/verify_sms_code',array($phone,$code,false)); + public function sms_verify($phone = '' ,$code = '', $type = 2){ - if($result['code']==200) { - if($type==1){ - $this->set_message(200,"success","正确"); - }else{ + $taskClient = new TaskClient(); + $result = $taskClient->checkSms($phone, $vcode); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { + if ($type == 2) { return true; } + $this->set_message(200, "success", "验证成功"); } else { - switch ($result['code']) { - case 1021:{ - $this->set_message(1010,"fail","验证码已失效,请重新获取"); - };break; - case 1022:{ - $this->set_message(1022,"fail","验证码不正确,请重新输入"); - };break; - default: - $this->set_message($result['code'],"fail",$result['msg']); + if ($type == 2) { + return false; } + $this->set_message(1000, "fail", $result['message']); } - } /** diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index dd57e2159..a1f2fec42 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -8,6 +8,7 @@ use Org\UcenterSDK\Ucservice; use User\Api\MemberApi; use Admin\Model\PointTypeModel; use Think\Log; +use Base\Tool\TaskClient; class UserController extends BaseController { @@ -577,17 +578,15 @@ class UserController extends BaseController */ public function telsafecode($phone = '', $delay = 10, $flag = true) { - $result = R('Common/Sms/send_sms_code', array($phone, $delay, false)); - - if ($result['code'] == 200) { + $taskClient = new TaskClient(); + $result = $taskClient->sendSms($phone); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { $data['status'] = 1; - $data['data'] = $result['data']; } else { $data['status'] = 0; } - - $data['msg'] = $result['msg']; - + $data['msg'] = $result['message']; echo json_encode($data); exit; } @@ -619,20 +618,17 @@ class UserController extends BaseController */ public function checksafecode($phone, $vcode, $flag = true) { - $result = R('Common/Sms/verify_sms_code', array($phone, $vcode, false)); - - if ($result['code'] == 200) { + $taskClient = new TaskClient(); + $result = $taskClient->checkSms($phone, $vcode); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { $data['status'] = 1; - if ($flag) { - echo json_encode($data); - exit; - } } else { $data['status'] = 0; - $data['msg'] = $result['msg']; - echo json_encode($data); - exit; } + $data['msg'] = $result['message']; + echo json_encode($data); + exit; } /** From 2e1742c7598b39f3c6242623b835ff3803e99be4 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 14:15:47 +0800 Subject: [PATCH 02/50] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E6=8F=90=E7=8E=B0--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Data/update.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Data/update.sql b/Data/update.sql index df2614a60..8247cb1d9 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1073,3 +1073,11 @@ CREATE TABLE `sys_document_pop_rules` ( `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + +-- 2020-01-14 +-- cxj +ALTER TABLE `tab_promote_game_ratio` +MODIFY COLUMN `turnover_ratio` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '流水分成比例' AFTER `last_ratio_status`, +MODIFY COLUMN `last_turnover_ratio` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '上次流水分成比例'; + +UPDATE tab_spend SET selle_ratio = 0.00 where selle_ratio is null \ No newline at end of file From f0acbc1c242de7465a8cca15e715e33c4af346c7 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 14:15:48 +0800 Subject: [PATCH 03/50] =?UTF-8?q?=E5=85=85=E5=80=BC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E4=BC=9A=E9=95=BF=E6=9D=83=E9=99=90=E6=98=BE?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/BaseController.class.php | 43 +++++++++- .../Controller/CoinOrderController.class.php | 9 +- .../Controller/DownloadController.class.php | 86 +++++++++++-------- .../Controller/PromoteController.class.php | 11 +++ .../Home/Controller/QueryController.class.php | 52 ++++++----- .../Home/View/default/Promote/index.html | 8 ++ .../View/default/Public/promote_base.html | 13 ++- .../Home/View/default/Query/achievement.html | 4 + Data/update.sql | 4 + 9 files changed, 161 insertions(+), 69 deletions(-) diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index 31c126422..eda6e7e41 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -7,6 +7,14 @@ use Think\Controller; class BaseController extends HomeController { protected $loginPromote = null; + protected $canViewUserRecharge = true; + + protected $permControlUrls = [ + 'Home/Query/recharge', + 'Home/Players/playAction', + 'Home/Query/userRecharges', + 'Home/Query/arpu', + ]; protected function _initialize() { @@ -15,7 +23,7 @@ class BaseController extends HomeController $this->login(); $loginer = $this->getLoginPromote(); - $this->certifiCation(); + // $this->certifiCation(); $pid = is_login_promote(); define('PLEVEL', $loginer['parent_id']); define('PID', $pid); @@ -33,9 +41,13 @@ class BaseController extends HomeController define('G_SETTLEMENT_GRADE', 'sub_status,third_status'); } + $this->canViewUserRecharge = $this->promoteCan('view-user-recharge'); + $this->checkUrlPermission(); + $this->assign('loginer', $loginer); $this->assign("parent_id", $loginer['parent_id']); $this->assign("grand_id", $loginer['grand_id']); + $this->assign('canViewUserRecharge', $this->canViewUserRecharge); $result = M('site_apply', 'tab_')->where("promote_id=$pid")->getField('status'); if ($result['status'] == 1) { @@ -342,4 +354,33 @@ class BaseController extends HomeController break; } } + + public function checkUrlPermission() + { + $currentUrl = MODULE_NAME . '/' . CONTROLLER_NAME . '/' . ACTION_NAME; + if (!$this->canViewUserRecharge) { + foreach ($this->permControlUrls as $url) { + if (strtolower($currentUrl) == strtolower($url)) { + $this->error('无权限查看'); + } + } + } + } + + public function promoteCan($permission) + { + $promote = $this->getLoginPromote(); + if (!$promote) { + return false; + } + if ($permission == 'recharge') { + if ($promote['level'] == 1) { + return true; + } + } + if ($permission == 'view-user-recharge') { + return false; + } + return false; + } } diff --git a/Application/Home/Controller/CoinOrderController.class.php b/Application/Home/Controller/CoinOrderController.class.php index 652bb5556..1cd7cca4c 100644 --- a/Application/Home/Controller/CoinOrderController.class.php +++ b/Application/Home/Controller/CoinOrderController.class.php @@ -90,14 +90,7 @@ class CoinOrderController extends BaseController //创建订单 public function order_add(){ - - $status = promoteCan(session('promote_auth.pid'), function($level) { - if ($level == 1) { - return true; - } else { - return false; - } - }); + $status = $this->promoteCan('recharge'); if (!$status) { if (IS_POST) { $this->ajaxReturn(array('status' => 0, 'msg'=>'无权限操作')); diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 6d36d1428..09c430336 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -3016,22 +3016,22 @@ class DownloadController extends BaseController { public function achievementExcelInfo($tid,$map) { $xlsName = "推广员业绩"; $xlsCell = array( - array('account','账号'), - array('real_name','姓名'), - array('create_role_count','创角数'), - array('create_role_user_count','创角用户'), - array('new_create_role_user_count','新创角用户'), - array('new_create_role_ip_count','新创角ip'), - array('login_user_count','登陆用户数'), - array('recharge_user_count','充值人数'), - array('recharge_count','充值次数'), - array('recharge_amount','充值总额'), - array('recharge_by_ban_coin','绑定币充值'), - array('recharge_by_coin','通用币充值'), - array('recharge_by_cash','现金充值'), - - - ); + array('account','账号'), + array('real_name','姓名'), + array('create_role_count','创角数'), + array('create_role_user_count','创角用户'), + array('new_create_role_user_count','新创角用户'), + array('new_create_role_ip_count','新创角ip'), + array('login_user_count','登陆用户数'), + ); + if ($this->canViewUserRecharge) { + $xlsCell[] = array('recharge_user_count','充值人数'); + $xlsCell[] = array('recharge_count','充值次数'); + $xlsCell[] = array('recharge_amount','充值总额'); + $xlsCell[] = array('recharge_by_ban_coin','绑定币充值'); + $xlsCell[] = array('recharge_by_coin','通用币充值'); + $xlsCell[] = array('recharge_by_cash','现金充值'); + } $params['isContainSubs'] = $map['isContainSubs']; $params['basicPromotes'] = json_decode($map['basicPromotes'],TRUE); $ids = $map['ids']; @@ -3067,9 +3067,16 @@ class DownloadController extends BaseController { $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params); $newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params); $loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params); - $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); - $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); - $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + + $rechargeCountList = []; + $rechargeUserCountList = []; + $rechargeAmountList = []; + if ($this->canViewUserRecharge) { + $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); + $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); + $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + } + $records = []; if (I('p', 1) == 1) { $selfParams = $params; @@ -3079,12 +3086,8 @@ class DownloadController extends BaseController { $selfNewCreateRoleUserCountList = $promoteRepository->getNewCreateRoleUserCountByIds([$parent['id']], $selfParams); // $selfNewCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds([$parent['id']], $selfParams); $selfNewCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds([$parent['id']], $selfParams); - $selfLoginUserCountList = $promoteRepository->getLoginUserCountByIds([$parent['id']], $selfParams); - $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); - $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); - $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); - $records[] = [ + $record = [ 'id' => $parent['id'], 'account' => $parent['account'], 'real_name' => $parent['real_name'], @@ -3095,18 +3098,24 @@ class DownloadController extends BaseController { // 'new_create_role_device_count' => $selfNewCreateRoleDeviceCountList[$parent['id']], 'new_create_role_ip_count' => $selfNewCreateRoleIpCountList[$parent['id']], 'login_user_count' => $selfLoginUserCountList[$parent['id']], - 'recharge_count' => $selfRechargeCountList[$parent['id']], - 'recharge_user_count' => $selfRechargeUserCountList[$parent['id']], - 'recharge_amount' => $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash'], - 'recharge_by_ban_coin' => $selfRechargeAmountList[$parent['id']]['ban_coin'], - 'recharge_by_coin' => $selfRechargeAmountList[$parent['id']]['coin'], - 'recharge_by_cash' => $selfRechargeAmountList[$parent['id']]['cash'], 'current_display' => $currentDisplay, ]; + if ($this->canViewUserRecharge) { + $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); + $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); + $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); + $record['recharge_count'] = $selfRechargeCountList[$parent['id']]; + $record['recharge_user_count'] = $selfRechargeUserCountList[$parent['id']]; + $record['recharge_amount'] = $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash']; + $record['recharge_by_ban_coin'] = $selfRechargeAmountList[$parent['id']]['ban_coin']; + $record['recharge_by_coin'] = $selfRechargeAmountList[$parent['id']]['coin']; + $record['recharge_by_cash'] = $selfRechargeAmountList[$parent['id']]['cash']; + } + $records[] = $record; } foreach ($promotes as $promote) { $id = $promote['id']; - $records[] = [ + $record = [ 'id' => $id, 'account' => $promote['account'], 'real_name' => $promote['real_name'], @@ -3117,14 +3126,17 @@ class DownloadController extends BaseController { 'new_create_role_device_count' => $newCreateRoleDeviceCountList[$id], 'new_create_role_ip_count' => $newCreateRoleIpCountList[$id], 'login_user_count' => $loginUserCountList[$id], - 'recharge_count' => $rechargeCountList[$id], - 'recharge_user_count' => $rechargeUserCountList[$id], - 'recharge_amount' => $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash'], - 'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'], - 'recharge_by_coin' => $rechargeAmountList[$id]['coin'], - 'recharge_by_cash' => $rechargeAmountList[$id]['cash'], 'current_display' => '', ]; + if ($this->canViewUserRecharge) { + $record['recharge_count'] = $rechargeCountList[$id]; + $record['recharge_user_count'] = $rechargeUserCountList[$id]; + $record['recharge_amount'] = $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash']; + $record['recharge_by_ban_coin'] = $rechargeAmountList[$id]['ban_coin']; + $record['recharge_by_coin'] = $rechargeAmountList[$id]['coin']; + $record['recharge_by_cash'] = $rechargeAmountList[$id]['cash']; + } + $records[] = $record; } $xlsData = []; foreach ($records as $key1 => $value1) { diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 36055ccf8..d52dbba71 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -557,6 +557,17 @@ class PromoteController extends BaseController ->where("qmn.status=0") ->order("qmn.id asc") ->select(); + + if (!$this->canViewUserRecharge) { + foreach ($data_list as $key => $item) { + foreach ($this->permControlUrls as $url) { + if (stripos($item['url'], $url) !== false) { + unset($data_list[$key]); + } + } + } + } + $this->assign("data_list", $data_list); $this->meta_title = "快捷菜单"; $this->display(); diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 660ccec8a..b36ad80ae 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2093,9 +2093,15 @@ class QueryController extends BaseController // $newCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds($ids, $params); $newCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds($ids, $params); $loginUserCountList = $promoteRepository->getLoginUserCountByIds($ids, $params); - $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); - $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); - $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + + $rechargeCountList = []; + $rechargeUserCountList = []; + $rechargeAmountList = []; + if ($this->canViewUserRecharge) { + $rechargeCountList = $promoteRepository->getRechargeCountByIds($ids, $params); + $rechargeUserCountList = $promoteRepository->getRechargeUserCountByIds($ids, $params); + $rechargeAmountList = $promoteRepository->getRechargeAmountByIds($ids, $params); + } if (I('p', 1) == 1) { $selfParams = $params; @@ -2106,10 +2112,7 @@ class QueryController extends BaseController // $selfNewCreateRoleDeviceCountList = $promoteRepository->getNewCreateRoleDeviceCountByIds([$parent['id']], $selfParams); $selfNewCreateRoleIpCountList = $promoteRepository->getNewCreateRoleIpCountByIds([$parent['id']], $selfParams); $selfLoginUserCountList = $promoteRepository->getLoginUserCountByIds([$parent['id']], $selfParams); - $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); - $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); - $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); - $records[] = [ + $record = [ 'id' => $parent['id'], 'account' => $parent['account'], 'real_name' => $parent['real_name'], @@ -2120,18 +2123,24 @@ class QueryController extends BaseController // 'new_create_role_device_count' => $selfNewCreateRoleDeviceCountList[$parent['id']], 'new_create_role_ip_count' => $selfNewCreateRoleIpCountList[$parent['id']], 'login_user_count' => $selfLoginUserCountList[$parent['id']], - 'recharge_count' => $selfRechargeCountList[$parent['id']], - 'recharge_user_count' => $selfRechargeUserCountList[$parent['id']], - 'recharge_amount' => $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash'], - 'recharge_by_ban_coin' => $selfRechargeAmountList[$parent['id']]['ban_coin'], - 'recharge_by_coin' => $selfRechargeAmountList[$parent['id']]['coin'], - 'recharge_by_cash' => $selfRechargeAmountList[$parent['id']]['cash'], 'current_display' => $currentDisplay, ]; + if ($this->canViewUserRecharge) { + $selfRechargeCountList = $promoteRepository->getRechargeCountByIds([$parent['id']], $selfParams); + $selfRechargeUserCountList = $promoteRepository->getRechargeUserCountByIds([$parent['id']], $selfParams); + $selfRechargeAmountList = $promoteRepository->getRechargeAmountByIds([$parent['id']], $selfParams); + $record['recharge_count'] = $selfRechargeCountList[$parent['id']]; + $record['recharge_user_count'] = $selfRechargeUserCountList[$parent['id']]; + $record['recharge_amount'] = $selfRechargeAmountList[$parent['id']]['ban_coin'] + $selfRechargeAmountList[$parent['id']]['coin'] + $selfRechargeAmountList[$parent['id']]['cash']; + $record['recharge_by_ban_coin'] = $selfRechargeAmountList[$parent['id']]['ban_coin']; + $record['recharge_by_coin'] = $selfRechargeAmountList[$parent['id']]['coin']; + $record['recharge_by_cash'] = $selfRechargeAmountList[$parent['id']]['cash']; + } + $records[] = $record; } foreach ($promotes as $promote) { $id = $promote['id']; - $records[] = [ + $record = [ 'id' => $id, 'account' => $promote['account'], 'real_name' => $promote['real_name'], @@ -2142,14 +2151,17 @@ class QueryController extends BaseController // 'new_create_role_device_count' => $newCreateRoleDeviceCountList[$id], 'new_create_role_ip_count' => $newCreateRoleIpCountList[$id], 'login_user_count' => $loginUserCountList[$id], - 'recharge_count' => $rechargeCountList[$id], - 'recharge_user_count' => $rechargeUserCountList[$id], - 'recharge_amount' => $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash'], - 'recharge_by_ban_coin' => $rechargeAmountList[$id]['ban_coin'], - 'recharge_by_coin' => $rechargeAmountList[$id]['coin'], - 'recharge_by_cash' => $rechargeAmountList[$id]['cash'], 'current_display' => '', ]; + if ($this->canViewUserRecharge) { + $record['recharge_count'] = $rechargeCountList[$id]; + $record['recharge_user_count'] = $rechargeUserCountList[$id]; + $record['recharge_amount'] = $rechargeAmountList[$id]['ban_coin'] + $rechargeAmountList[$id]['coin'] + $rechargeAmountList[$id]['cash']; + $record['recharge_by_ban_coin'] = $rechargeAmountList[$id]['ban_coin']; + $record['recharge_by_coin'] = $rechargeAmountList[$id]['coin']; + $record['recharge_by_cash'] = $rechargeAmountList[$id]['cash']; + } + $records[] = $record; } } else { $timeout = 1; diff --git a/Application/Home/View/default/Promote/index.html b/Application/Home/View/default/Promote/index.html index 406f23825..aa8c3c342 100644 --- a/Application/Home/View/default/Promote/index.html +++ b/Application/Home/View/default/Promote/index.html @@ -4,6 +4,7 @@
+ + + +
+ $isOpenQuery = true; + ?> - @@ -128,10 +133,12 @@ + + diff --git a/Application/Home/View/default/Query/achievement.html b/Application/Home/View/default/Query/achievement.html index 06106905f..24f66ec0e 100644 --- a/Application/Home/View/default/Query/achievement.html +++ b/Application/Home/View/default/Query/achievement.html @@ -83,12 +83,14 @@ 新创角IP 登录用户数 + 充值人数 充值次数 充值总额 现金充值 通用币充值 绑定币充值 + 操作 @@ -109,12 +111,14 @@ {$record.new_create_role_ip_count} {$record.login_user_count} + {$record.recharge_user_count} {$record.recharge_count} {$record.recharge_amount} {$record.recharge_by_cash} {$record.recharge_by_coin} {$record.recharge_by_ban_coin} + diff --git a/Data/update.sql b/Data/update.sql index df2614a60..6c924bd21 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1073,3 +1073,7 @@ CREATE TABLE `sys_document_pop_rules` ( `operater_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '操作者ID', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; + + +ALTER TABLE `tab_promote` +ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据'; From f86265d38ccd5247334df1707d365c97ed73aebd Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 14:36:28 +0800 Subject: [PATCH 04/50] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/QueryController.class.php | 8 +++++--- Application/Admin/View/Query/marketList.html | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index 0b3f21d51..c09df411f 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1470,14 +1470,16 @@ class QueryController extends ThinkController } if ($_REQUEST['device']) { - $map['game_name'] = ['like','%'.$_REQUEST['device'].'%']; - } +// $map['tab_spend.sdk_version'] = $_REQUEST['device']; + $spendMap['tab_spend.sdk_version'] = $_REQUEST['device']; + } + $spendMap['pay_status'] = 1; //获取spend表中的数据,同时根据会长id进行group分类 $data = M('Spend','tab_') ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,game_name,SUBSTRING_INDEX(`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id ") ->join("left join tab_promote on promote_id = tab_promote.id") - ->where(['pay_status'=>1]) + ->where($spendMap) ->group("my_time,game_names,root_id") ->order("my_time Desc") ->select(false); diff --git a/Application/Admin/View/Query/marketList.html b/Application/Admin/View/Query/marketList.html index 61ab31b83..0f240b493 100644 --- a/Application/Admin/View/Query/marketList.html +++ b/Application/Admin/View/Query/marketList.html @@ -111,8 +111,8 @@
From 7a1cd5bc945f3e8169b77e5af02edbdc6214907b Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 14:41:33 +0800 Subject: [PATCH 05/50] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AE=8C=E6=95=B4?= =?UTF-8?q?=E7=9A=84=E6=9D=83=E9=99=90=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/BaseController.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Application/Home/Controller/BaseController.class.php b/Application/Home/Controller/BaseController.class.php index eda6e7e41..9af51d297 100644 --- a/Application/Home/Controller/BaseController.class.php +++ b/Application/Home/Controller/BaseController.class.php @@ -3,9 +3,11 @@ namespace Home\Controller; use Think\Controller; +use Base\Service\PromoteService; class BaseController extends HomeController { + protected $promotePermissions; protected $loginPromote = null; protected $canViewUserRecharge = true; @@ -379,7 +381,11 @@ class BaseController extends HomeController } } if ($permission == 'view-user-recharge') { - return false; + $promoteService = new PromoteService(); + $topPromote = $promoteService->getTopPromote($promote); + if ($topPromote['can_view_recharge'] == 1) { + return true; + } } return false; } From 23f2334e451e51a438d83f9fd95efabcbce77f7d Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Tue, 14 Jan 2020 14:58:05 +0800 Subject: [PATCH 06/50] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=85=85=E5=80=BC?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=9F=A5=E7=9C=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 9 ++++++--- Application/Admin/View/Promote/belong.html | 17 +++++++++++++++- .../Admin/View/Promote/belong_add.html | 16 +++++++++++++++ .../Admin/View/Promote/belong_edit.html | 20 +++++++++++++++++++ Data/update.sql | 6 +++++- 5 files changed, 63 insertions(+), 5 deletions(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 1a8e4f3d8..c72ec9cd4 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -1235,7 +1235,7 @@ class PromoteController extends ThinkController $this->display(); } - public function belong_add($promote_id=null, $company_belong = null, $company_relation = null, $remark = null) + public function belong_add($promote_id=null, $company_belong = null, $company_relation = null, $remark = null, $can_view_recharge = null) { if (IS_POST) { if (empty($promote_id)) { @@ -1245,6 +1245,7 @@ class PromoteController extends ThinkController 'promote_id' => $promote_id, 'company_belong' => $company_belong, 'company_relation' => $company_relation, + 'can_view_recharge' => $can_view_recharge, 'verify_status' => 0, 'remark' => $remark, 'applicant_id' => getAdmin(), @@ -1271,7 +1272,7 @@ class PromoteController extends ThinkController } } - public function belong_edit($promote_id=null, $company_belong = null, $company_relation = null, $remark = null) + public function belong_edit($promote_id=null, $company_belong = null, $company_relation = null, $remark = null, $can_view_recharge = null) { if (IS_POST) { if (empty($promote_id)) { @@ -1281,6 +1282,7 @@ class PromoteController extends ThinkController 'promote_id' => $promote_id, 'company_belong' => $company_belong, 'company_relation' => $company_relation, + 'can_view_recharge' => $can_view_recharge, 'verify_status' => 0, 'remark' => $remark, 'applicant_id' => getAdmin(), @@ -1320,7 +1322,8 @@ class PromoteController extends ThinkController foreach ($promote_belongs as $promote_belong) { $update = [ 'company_belong' => $promote_belong['company_belong'], - 'company_relation' => $promote_belong['company_relation'] + 'company_relation' => $promote_belong['company_relation'], + 'can_view_recharge' => $promote_belong['can_view_recharge'], ]; $res = M("promote", "tab_") ->where("chain like '%/{$promote_belong['promote_id']}/%' or id={$promote_belong['promote_id']} ") diff --git a/Application/Admin/View/Promote/belong.html b/Application/Admin/View/Promote/belong.html index ae7200bee..14a1128cc 100644 --- a/Application/Admin/View/Promote/belong.html +++ b/Application/Admin/View/Promote/belong.html @@ -73,7 +73,13 @@ - +
+ +
@@ -100,6 +106,7 @@ 身份状态 内外团 归属状态 + 充值信息权限 申请时间 备注 审核 @@ -181,6 +188,14 @@ 只维护 + + + 禁止 + + + 开放 + + {:set_show_time($data['applicant_time'])} {$data['remark']} diff --git a/Application/Admin/View/Promote/belong_add.html b/Application/Admin/View/Promote/belong_add.html index 2f6e6b177..b8cc5467a 100644 --- a/Application/Admin/View/Promote/belong_add.html +++ b/Application/Admin/View/Promote/belong_add.html @@ -89,6 +89,22 @@ + + + 充值信息查看权限: + + + + + + + + + 备注: diff --git a/Application/Admin/View/Promote/belong_edit.html b/Application/Admin/View/Promote/belong_edit.html index d3eade694..f39d3750a 100644 --- a/Application/Admin/View/Promote/belong_edit.html +++ b/Application/Admin/View/Promote/belong_edit.html @@ -100,6 +100,26 @@ + + 充值信息查看权限: + + + + + + + + + 备注: diff --git a/Data/update.sql b/Data/update.sql index 6c924bd21..6c6158704 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1075,5 +1075,9 @@ CREATE TABLE `sys_document_pop_rules` ( ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; +-- 是否需要修复旧数据 ALTER TABLE `tab_promote` -ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据'; +ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据 0否 1是'; + +ALTER TABLE `tab_promote_belong` +ADD COLUMN `can_view_recharge` tinyint(1) NOT NULL default 0 COMMENT '是否显示充值数据 0否 1是'; From 4f63f4537429de04df7c598acef0511f867ff20e Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 14:58:17 +0800 Subject: [PATCH 07/50] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=B9=B3=E5=8F=B0>?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=AE=A1=E7=90=86>=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E6=A6=82=E5=86=B5|=E6=95=B0=E6=8D=AE=E6=B1=87=E6=80=BB--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/QueryController.class.php | 151 ++++++++++-------- .../Home/View/default/Query/dailySummary.html | 10 ++ .../Home/View/default/Query/summary.html | 6 + 3 files changed, 101 insertions(+), 66 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index b36ad80ae..9be211d91 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1128,15 +1128,17 @@ class QueryController extends BaseController $newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByDay($params);//新创角设备 $newIpNumList = $userRepository->getNewCreateRoleIpCountByDay($params);//新创角IP $loginUserNumList = $userRepository->getLoginCountGroupByDayNew($params);//登录用户数 - $spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params);//充值人数 - $spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数 - $spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额 - $params['pay_way'] = ['in', '1,2,3,4,5,6']; - $spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值 - $params['pay_way'] = 0; - $spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值 - $params['pay_way'] = -1; - $spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值 + if ($this->canViewUserRecharge) { + $spendUserNumList = $spendRepository->getPayUserCountGroupByDayNew($params);//充值人数 + $spendNumList = $spendRepository->getPayCountGroupByDay($params);//充值次数 + $spendAllAmountList = $spendRepository->getPayAmountGroupByDayAndType($params);//充值总额 + $params['pay_way'] = ['in', '1,2,3,4,5,6']; + $spendCashList = $spendRepository->getPayAmountGroupByDayAndType($params);//现金充值 + $params['pay_way'] = 0; + $spendGenericList = $spendRepository->getPayAmountGroupByDayAndType($params);//通用币充值 + $params['pay_way'] = -1; + $spendBindingList = $spendRepository->getPayAmountGroupByDayAndType($params);//绑定币充值 + } $allData['role_num'] = 0; $allData['user_num'] = 0; @@ -1144,17 +1146,19 @@ class QueryController extends BaseController $allData['new_device_num'] = 0; $allData['new_ip_num'] = 0; $allData['login_user_num'] = 0; - $allData['spend_user_num'] = 0; - $allData['spend_num'] = 0; - $allData['spend_all_amount'] = 0; - $allData['spend_cash'] = 0; - $allData['spend_generic'] = 0; - $allData['spend_binding'] = 0; - $allData['spend_discount'] = 0; - $allData['spend_voucher'] = 0; + if ($this->canViewUserRecharge) { + $allData['spend_user_num'] = 0; + $allData['spend_num'] = 0; + $allData['spend_all_amount'] = 0; + $allData['spend_cash'] = 0; + $allData['spend_generic'] = 0; + $allData['spend_binding'] = 0; + $allData['spend_discount'] = 0; + $allData['spend_voucher'] = 0; + } foreach ($dayList as $day) { $date = date('Ymd', strtotime($day)); - $records[] = [ + $record = [ 'day' => $date, 'role_num' => $roleNumList[$day], 'user_num' => $userNumList[$day], @@ -1162,14 +1166,6 @@ class QueryController extends BaseController 'new_device_num' => $newDeviceNumList[$day], 'new_ip_num' => $newIpNumList[$day], 'login_user_num' => $loginUserNumList[$day], - 'spend_user_num' => $spendUserNumList[$day], - 'spend_num' => $spendNumList[$day], - 'spend_all_amount' => $spendAllAmountList[$day], - 'spend_cash' => $spendCashList[$day], - 'spend_generic' => $spendGenericList[$day], - 'spend_binding' => $spendBindingList[$day], - 'spend_discount' => 0, - 'spend_voucher' => 0, ]; $allData['role_num'] += $roleNumList[$day]; @@ -1178,14 +1174,27 @@ class QueryController extends BaseController $allData['new_device_num'] += $newDeviceNumList[$day]; $allData['new_ip_num'] += $newIpNumList[$day]; $allData['login_user_num'] += $loginUserNumList[$day]; - $allData['spend_user_num'] += $spendUserNumList[$day]; - $allData['spend_num'] += $spendNumList[$day]; - $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2); - $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2); - $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2); - $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2); - $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2); - $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2); + + if ($this->canViewUserRecharge) { + $record['spend_user_num'] = $spendUserNumList[$day]; + $record['spend_num'] = $spendNumList[$day]; + $record['spend_all_amount'] = $spendAllAmountList[$day]; + $record['spend_cash'] = $spendCashList[$day]; + $record['spend_generic'] = $spendGenericList[$day]; + $record['spend_binding'] = $spendBindingList[$day]; + $record['spend_discount'] = 0; + $record['spend_voucher'] = 0; + + $allData['spend_user_num'] += $spendUserNumList[$day]; + $allData['spend_num'] += $spendNumList[$day]; + $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2); + $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2); + $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2); + $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2); + $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2); + $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2); + } + $records[] = $record; } foreach ($dayListReverse as $day) { $date = date('Ymd', strtotime($day)); @@ -1194,8 +1203,10 @@ class QueryController extends BaseController $summaryData['user_num'][] = $userNumList[$day]; $summaryData['new_user_num'][] = $newUserNumList[$day]; $summaryData['new_device_num'][] = $newDeviceNumList[$day]; - $summaryData['spend_user_num'][] = $spendUserNumList[$day]; - $summaryData['spend_all_amount'][] = $spendAllAmountList[$day]; + if ($this->canViewUserRecharge) { + $summaryData['spend_user_num'][] = $spendUserNumList[$day]; + $summaryData['spend_all_amount'][] = $spendAllAmountList[$day]; + } } } @@ -1314,18 +1325,20 @@ class QueryController extends BaseController $newDeviceNumList = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备 $newIpNumList = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP $loginUserNumList = $userRepository->getLoginCountGroupByGame($params);//登录用户数 - $spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数 - $spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数 - $spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额 - $params['pay_way'] = ['in', '1,2,3,4,5,6']; - $spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值 - $params['pay_way'] = 0; - $spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值 - $params['pay_way'] = -1; - $spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值 + if ($this->canViewUserRecharge) { + $spendUserNumList = $spendRepository->getPayUserCountGroupByGame($params);//充值人数 + $spendNumList = $spendRepository->getPayCountGroupByGame($params);//充值次数 + $spendAllAmountList = $spendRepository->getPayAmountGroupByGameAndType($params);//充值总额 + $params['pay_way'] = ['in', '1,2,3,4,5,6']; + $spendCashList = $spendRepository->getPayAmountGroupByGameAndType($params);//现金充值 + $params['pay_way'] = 0; + $spendGenericList = $spendRepository->getPayAmountGroupByGameAndType($params);//通用币充值 + $params['pay_way'] = -1; + $spendBindingList = $spendRepository->getPayAmountGroupByGameAndType($params);//绑定币充值 + } foreach ($data as &$list) { $gameId = $list['game_id']; - $records[] = [ + $record = [ 'game_id' => $gameId, 'game_name' => $list['game_name'], 'sdk_version' => $list['sdk_version'], @@ -1335,15 +1348,19 @@ class QueryController extends BaseController 'new_device_num' => $newDeviceNumList[$gameId], 'new_ip_num' => $newIpNumList[$gameId], 'login_user_num' => $loginUserNumList[$gameId], - 'spend_user_num' => $spendUserNumList[$gameId], - 'spend_num' => $spendNumList[$gameId], - 'spend_all_amount' => $spendAllAmountList[$gameId], - 'spend_cash' => $spendCashList[$gameId], - 'spend_generic' => $spendGenericList[$gameId], - 'spend_binding' => $spendBindingList[$gameId], - 'spend_discount' => 0, - 'spend_voucher' => 0, ]; + if ($this->canViewUserRecharge) { + $record['spend_user_num'] = $spendUserNumList[$gameId]; + $record['spend_num'] = $spendNumList[$gameId]; + $record['spend_all_amount'] = $spendAllAmountList[$gameId]; + $record['spend_cash'] = $spendCashList[$gameId]; + $record['spend_generic'] = $spendGenericList[$gameId]; + $record['spend_binding'] = $spendBindingList[$gameId]; + $record['spend_discount'] = 0; + $record['spend_voucher'] = 0; + } + + $records[] = $record; } $params['all_data'] = 1; $params['game_ids'] = $allGameIs; @@ -1353,18 +1370,20 @@ class QueryController extends BaseController $allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备 $allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP $allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数 - $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数 - $allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数 - unset($params['pay_way']); - $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额 - $params['pay_way'] = ['in', '1,2,3,4,5,6']; - $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值 - $params['pay_way'] = 0; - $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值 - $params['pay_way'] = -1; - $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值 - $allData['spend_discount'] = '0.00'; - $allData['spend_voucher'] = '0.00'; + if ($this->canViewUserRecharge) { + $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数 + $allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数 + unset($params['pay_way']); + $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额 + $params['pay_way'] = ['in', '1,2,3,4,5,6']; + $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值 + $params['pay_way'] = 0; + $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值 + $params['pay_way'] = -1; + $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值 + $allData['spend_discount'] = '0.00'; + $allData['spend_voucher'] = '0.00'; + } } } diff --git a/Application/Home/View/default/Query/dailySummary.html b/Application/Home/View/default/Query/dailySummary.html index 4558669a4..5d5076ba7 100644 --- a/Application/Home/View/default/Query/dailySummary.html +++ b/Application/Home/View/default/Query/dailySummary.html @@ -158,9 +158,11 @@

新创角用户|设备

+

充值人数|充值总额

+ @@ -179,6 +181,7 @@ 新增创角IP 登录用户数 + 充值人数 充值次数 充值总额 代金劵使用 + @@ -208,6 +212,7 @@ {$allData.new_user_num}|{$allData.new_device_num} {$allData.new_ip_num} {$allData.login_user_num} + {$allData.spend_user_num} {$allData.spend_num} {$allData.spend_all_amount} @@ -216,6 +221,7 @@ {$allData.spend_binding} {$allData.spend_discount} {$allData.spend_voucher} + @@ -225,6 +231,7 @@ {$vo.new_user_num}|{$vo.new_device_num} {$vo.new_ip_num} {$vo.login_user_num} + {$vo.spend_user_num} {$vo.spend_num} {$vo.spend_all_amount} @@ -233,6 +240,7 @@ {$vo.spend_binding} {$vo.spend_discount} {$vo.spend_voucher} + @@ -323,10 +331,12 @@ dataName2 = '新创角设备'; break; case 3: + data1 = spendUserNum; data2 = spendAllAmount; dataName1 = '充值人数'; dataName2 = '充值总额'; + break; } diff --git a/Application/Home/View/default/Query/summary.html b/Application/Home/View/default/Query/summary.html index 45dd0de9a..2ffba8ee6 100644 --- a/Application/Home/View/default/Query/summary.html +++ b/Application/Home/View/default/Query/summary.html @@ -146,6 +146,7 @@ 新增创角IP 登录用户数 + 充值人数 充值次数 充值总额 代金劵使用 + @@ -177,6 +179,7 @@ {$vo.new_user_num}|{$vo.new_device_num} {$vo.new_ip_num} {$vo.login_user_num} + {$vo.spend_user_num} {$vo.spend_num} {$vo.spend_all_amount|default=0} @@ -185,6 +188,7 @@ {$vo.spend_binding|default=0} {$vo.spend_discount|default=0} {$vo.spend_voucher|default=0} + @@ -195,6 +199,7 @@ {$allData.new_user_num}|{$allData.new_device_num} {$allData.new_ip_num} {$allData.login_user_num} + {$allData.spend_user_num} {$allData.spend_num} {$allData.spend_all_amount} @@ -203,6 +208,7 @@ {$allData.spend_binding} {$allData.spend_discount} {$allData.spend_voucher} + From 136f565f9f3e100519a9a8b290a606e05bbf2945 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 15:03:52 +0800 Subject: [PATCH 08/50] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/StatementMangement/lists.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/View/StatementMangement/lists.html b/Application/Admin/View/StatementMangement/lists.html index b63d1f763..59a5b90fd 100644 --- a/Application/Admin/View/StatementMangement/lists.html +++ b/Application/Admin/View/StatementMangement/lists.html @@ -139,7 +139,7 @@ - 合计公司对账金额合计:{$sum[0]}     cp对账金额合计:{$sum[1]} + 合计公司对账金额合计:{$sum[1]}     cp对账金额合计:{$sum[0]} From 4793665896bf5fa09f36f45799beef20ad51c624 Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 14 Jan 2020 15:19:46 +0800 Subject: [PATCH 09/50] =?UTF-8?q?=E5=85=85=E5=80=BC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E4=BC=9A=E9=95=BF=E6=9D=83=E9=99=90=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E5=AF=BC=E5=87=BA=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/DownloadController.class.php | 163 +++++++++++------- 1 file changed, 96 insertions(+), 67 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 09c430336..76e259dc0 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -2023,24 +2023,25 @@ class DownloadController extends BaseController { public function summaryExcelInfo($id,$map) { $xlsName = "数据汇总"; $xlsCell = array( - array('game_name','游戏名称'), - array('sdk_version','平台'), - array('role_num','创角数'), - array('user_num','创建用户'), - array('new_user_num','新创角用户'), - array('new_device_num','新创角设备'), - array('new_ip_num','新增创角ip'), - array('login_user_num','登陆用户数'), - array('spend_user_num','充值人数'), - array('spend_num','充值次数'), - array('spend_all_amount','充值总额'), - array('spend_cash','现金充值'), - array('spend_generic','通用币充值'), - array('spend_binding','绑定币充值'), - array('spend_discount','折扣币充值'), - array('spend_voucher','代金券使用'), - - ); + array('game_name','游戏名称'), + array('sdk_version','平台'), + array('role_num','创角数'), + array('user_num','创建用户'), + array('new_user_num','新创角用户'), + array('new_device_num','新创角设备'), + array('new_ip_num','新增创角ip'), + array('login_user_num','登陆用户数'), + ); + if($this->canViewUserRecharge) { + $xlsCell[] = array('spend_user_num','充值人数'); + $xlsCell[] = array('spend_num','充值次数'); + $xlsCell[] = array('spend_all_amount','充值总额'); + $xlsCell[] = array('spend_cash','现金充值'); + $xlsCell[] = array('spend_generic','通用币充值'); + $xlsCell[] = array('spend_binding','绑定币充值'); + $xlsCell[] = array('spend_discount','折扣币充值'); + $xlsCell[] = array('spend_voucher','代金券使用'); + } if(!empty($map['tab_apply.promote_id'][1])) { $params['promote_ids'] = $map['tab_apply.promote_id'][1]; } @@ -2135,20 +2136,33 @@ class DownloadController extends BaseController { $allData['new_user_num'] = $userRepository->getNewCreateRoleUserCountByGame($params);//新创角用户 $allData['new_device_num'] = $userRepository->getNewCreateRoleDeviceCountByGame($params);//新创角设备 $allData['new_ip_num'] = $userRepository->getNewCreateRoleIpCountByGame($params);//新创角IP - $allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数 - $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数 - $allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数 - unset($params['pay_way']); - $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额 - $params['pay_way'] = ['in', '1,2,3,4,5,6']; - $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值 - $params['pay_way'] = 0; - $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值 - $params['pay_way'] = -1; - $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值 - $allData['spend_discount'] = '0.00'; - $allData['spend_voucher'] = '0.00'; - $records[] = $allData; + $allData['login_user_num'] = $userRepository->getLoginCountGroupByGame($params);//登录用户数 + + if($this->canViewUserRecharge) { + $record['spend_user_num'] = $spendUserNumList[$gameId]; + $record['spend_num'] = $spendNumList[$gameId]; + $record['spend_all_amount'] = $spendAllAmountList[$gameId]; + $record['spend_cash'] = $spendCashList[$gameId]; + $record['spend_generic'] = $spendGenericList[$gameId]; + $record['spend_binding'] = $spendBindingList[$gameId]; + $record['spend_discount'] = 0; + $record['spend_voucher'] = 0; + $allData['spend_user_num'] = $spendRepository->getPayUserCountByGame($params);//充值人数 + $allData['spend_num'] = $spendRepository->getPayCountByGame($params);//充值次数 + unset($params['pay_way']); + $allData['spend_all_amount'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//充值总额 + $params['pay_way'] = ['in', '1,2,3,4,5,6']; + $allData['spend_cash'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//现金充值 + $params['pay_way'] = 0; + $allData['spend_generic'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//通用币充值 + $params['pay_way'] = -1; + $allData['spend_binding'] = null_to_0($spendRepository->getPayAmountByGameAndType($params));//绑定币充值 + $allData['spend_discount'] = '0.00'; + $allData['spend_voucher'] = '0.00'; + + } + $records[] = $record; + $records[] = $allData; } } @@ -2887,23 +2901,26 @@ class DownloadController extends BaseController { public function dailysummaryExcelInfo($id,$map) { $xlsName = "每日概况"; $xlsCell = array( - array('day','日期'), - array('role_num','创角数'), - array('user_num','创角用户'), - array('new_user_num','新创角用户'), - array('new_device_num','新创角设备'), - array('new_ip_num','新增创角IP'), - array('login_user_num','登陆用户数'), - array('spend_user_num','充值人数'), - array('spend_num','充值次数'), - array('spend_all_amount','充值总额'), - array('spend_cash','现金充值'), - array('spend_generic','通用币充值'), - array('spend_binding','绑定币充值'), - array('spend_discount','折扣币充值'), - array('spend_voucher','代金劵使用'), - - ); + array('day','日期'), + array('role_num','创角数'), + array('user_num','创角用户'), + array('new_user_num','新创角用户'), + array('new_device_num','新创角设备'), + array('new_ip_num','新增创角IP'), + array('login_user_num','登陆用户数'), + + ); + + if ($this->canViewUserRecharge) { + $xlsCell[] = array('spend_user_num','充值人数'); + $xlsCell[] = array('spend_num','充值次数'); + $xlsCell[] = array('spend_all_amount','充值总额'); + $xlsCell[] = array('spend_cash','现金充值'); + $xlsCell[] = array('spend_generic','通用币充值'); + $xlsCell[] = array('spend_binding','绑定币充值'); + $xlsCell[] = array('spend_discount','折扣币充值'); + $xlsCell[] = array('spend_voucher','代金劵使用'); + } $nowTime = date('Y-m-d'); $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); $initBegTime = empty(I('begtime')) ? $initBegTime : I('begtime'); @@ -2932,7 +2949,6 @@ class DownloadController extends BaseController { } $params['dayList'] = $map["dayList"]; $summaryData = []; - $records = []; if (intval($endTime - $begTime) / (24 * 3600) <= 30) { $userRepository = new UserRepository(); $spendRepository = new SpendRepository(); @@ -2957,14 +2973,16 @@ class DownloadController extends BaseController { $allData['new_device_num'] = 0; $allData['new_ip_num'] = 0; $allData['login_user_num'] = 0; - $allData['spend_user_num'] = 0; - $allData['spend_num'] = 0; - $allData['spend_all_amount'] = 0; - $allData['spend_cash'] = 0; - $allData['spend_generic'] = 0; - $allData['spend_binding'] = 0; - $allData['spend_discount'] = 0; - $allData['spend_voucher'] = 0; + if($this->canViewUserRecharge) { + $allData['spend_user_num'] = 0; + $allData['spend_num'] = 0; + $allData['spend_all_amount'] = 0; + $allData['spend_cash'] = 0; + $allData['spend_generic'] = 0; + $allData['spend_binding'] = 0; + $allData['spend_discount'] = 0; + $allData['spend_voucher'] = 0; + } foreach ($params['dayList'] as $day) { $date = date('Ymd', strtotime($day)); $records[] = [ @@ -2990,15 +3008,26 @@ class DownloadController extends BaseController { $allData['new_device_num'] += $newDeviceNumList[$day]; $allData['new_ip_num'] += $newIpNumList[$day]; $allData['login_user_num'] += $loginUserNumList[$day]; - $allData['spend_user_num'] += $spendUserNumList[$day]; - $allData['spend_num'] += $spendNumList[$day]; - $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2); - $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2); - $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2); - $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2); - $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2); - $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2); - + if ($this->canViewUserRecharge) { + $record['spend_user_num'] = $spendUserNumList[$day]; + $record['spend_num'] = $spendNumList[$day]; + $record['spend_all_amount'] = $$spendAllAmountList[$day]; + $record['spend_cash'] = $spendCashList[$day]; + $record['spend_generic'] = $spendGenericList[$day]; + $record['spend_binding'] = $spendBindingList[$day]; + $record['spend_discount'] = 0; + $record['spend_voucher'] = 0; + $allData['spend_user_num'] += $spendUserNumList[$day]; + $allData['spend_num'] += $spendNumList[$day]; + $allData['spend_all_amount'] = bcadd($allData['spend_all_amount'], $spendAllAmountList[$day], 2); + $allData['spend_cash'] = bcadd($allData['spend_cash'], $spendCashList[$day], 2); + $allData['spend_generic'] = bcadd($allData['spend_generic'], $spendGenericList[$day], 2); + $allData['spend_binding'] = bcadd($allData['spend_binding'], $spendBindingList[$day], 2); + $allData['spend_discount'] = bcadd($allData['spend_discount'], 0, 2); + $allData['spend_voucher'] = bcadd($allData['spend_voucher'], 0, 2); + } + $records[] = $record; + } $allData['day'] = '合计'; $records[] = $allData; From 4c42ee90e3e3a6d81e576bd7d16b881d02a521c9 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 16:13:02 +0800 Subject: [PATCH 10/50] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=8B=E6=B8=B8=E5=AF=B9=E8=B4=A6=E5=8D=95?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/AjaxController.class.php | 3 +++ Application/Admin/Controller/QueryController.class.php | 10 +++++----- .../View/StatementMangement/createDownstreamOrder.html | 4 +++- Application/Admin/View/StatementMangement/edit.html | 4 ++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index d837eafe7..79ff49961 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -295,11 +295,14 @@ class AjaxController extends ThinkController{ $data['game_ratio'] = $handleStatementData; $data['company_name'] = $second_party_info['partner']; $data['mobile_phone'] = $second_party_info['link_phone']; + $data['bank_card'] = $second_party_info['bank_account']; + $data['account_openin'] = $second_party_info['opening_bank']; $data['settlement_type'] = $second_party_info['settlement_type']; $data['address'] = $second_party_info['address']; $data['real_name'] = $second_party_info['link_man']; $data['bank_account_name'] = $second_party_info['bank_account_name']; $data['settlement_type_value'] = $getStatementData['settlement_type']; + $data['settlement_type_value'] = $getStatementData['settlement_type']; $data['invoice_item'] = $second_party_info['invoice_item']; $data['invoice_type'] = $second_party_info['invoice_type']; diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index c09df411f..ad5393707 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1474,11 +1474,12 @@ class QueryController extends ThinkController $spendMap['tab_spend.sdk_version'] = $_REQUEST['device']; } - $spendMap['pay_status'] = 1; + $spendMap['tab_spend.pay_status'] = 1; //获取spend表中的数据,同时根据会长id进行group分类 $data = M('Spend','tab_') - ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,game_name,SUBSTRING_INDEX(`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id ") + ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,tab_spend.game_name,SUBSTRING_INDEX(tab_spend.`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id,tab_game.ratio ") ->join("left join tab_promote on promote_id = tab_promote.id") + ->join("left join tab_game on tab_game.id=tab_spend.game_id") ->where($spendMap) ->group("my_time,game_names,root_id") ->order("my_time Desc") @@ -1495,7 +1496,7 @@ class QueryController extends ThinkController //关联表获取会长账号名 $data = M()->table('('.$data.') as a') - ->field("my_time,pay_amount,a.game_id,game_name,game_names,a.promote_id,a.promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account,tab_ratio.ratio as ratio,turnover_ratio") + ->field("my_time,pay_amount,a.game_id,game_name,game_names,a.promote_id,a.promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account,tab_ratio.ratio as ratio,turnover_ratio,a.ratio as game_ratio") ->join("left join tab_promote on root_id = tab_promote.id") ->join("left join tab_promote_game_ratio as tab_ratio on tab_ratio.game_id = a.game_id and tab_ratio.promote_id=root_id") // ->join("left join tab_cp_game_ratio as game_ratio on game_ratio.game_id = a.game_id") @@ -1522,10 +1523,9 @@ class QueryController extends ThinkController if ($value['ratio']) { $data[$key]['downstream'] = $value['pay_amount'] * ($value['ratio']*0.01); } else { - $data[$key]['downstream'] = $value['pay_amount'] * 0; + $data[$key]['downstream'] = $value['pay_amount'] * ($value['game_ratio']*0.01); } - $value['turnover_ratio'] = json_decode($value['turnover_ratio'],true); // dd($value); diff --git a/Application/Admin/View/StatementMangement/createDownstreamOrder.html b/Application/Admin/View/StatementMangement/createDownstreamOrder.html index 359783339..8bc59c8a6 100644 --- a/Application/Admin/View/StatementMangement/createDownstreamOrder.html +++ b/Application/Admin/View/StatementMangement/createDownstreamOrder.html @@ -211,6 +211,7 @@ //搜索功能 $("#ext_field").change(function(){ + key = 0; var ext_field = $("#ext_field").val(); console.log(ext_field); $("tbody").empty(); @@ -259,7 +260,7 @@ console.log(data) for (var i in data){ if (data[i].company_id) { - add += "" + add += "" } } $("#company_name").empty(); @@ -334,6 +335,7 @@ //搜索功能 $("#company_name").change(function(){ + key = 0; var ext_field = $("#company_name option:selected").attr('company_id'); console.log(ext_field); $("tbody").empty(); diff --git a/Application/Admin/View/StatementMangement/edit.html b/Application/Admin/View/StatementMangement/edit.html index 320dd2449..d3367b8a6 100644 --- a/Application/Admin/View/StatementMangement/edit.html +++ b/Application/Admin/View/StatementMangement/edit.html @@ -52,7 +52,7 @@
银行账号: - +
@@ -204,7 +204,7 @@ success:function(data){ console.log($("#company_name option:selected").attr('company-type')) - $("#company_name").val(data.data.company_name); + $("#company_name").append(""); $("#settlement_type").text(data.data.settlement_type); $("#bank_card").val(data.data.bank_card); $("#account_openin").val(data.data.account_openin); From 258e10c9d1f26efaa4ed740f2423e82836a869fc Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 16:14:36 +0800 Subject: [PATCH 11/50] =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/function.php | 2 +- .../PromoteGameRatioController.class.php | 11 +- .../Admin/Model/WithdrawModel.class.php | 202 ++++++++++-------- .../View/PromoteGameRatio/applyRatio.html | 4 +- Application/Common/Common/extend.php | 4 + 5 files changed, 125 insertions(+), 98 deletions(-) diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index d34964caf..59f7e8482 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -724,7 +724,7 @@ function getAllGameList($groupByRelation = false) { $field = 'id, game_name, relation_game_id, relation_game_name'; if ($groupByRelation) { - $games = M('game', 'tab_')->field($field)->group('relation_game_id')->select(); + $games = M('game', 'tab_')->field($field)->where('id = relation_game_id')->group('relation_game_id')->select(); } else { $games = M('game', 'tab_')->field($field)->select(); } diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index 0d08c400c..ca672fba3 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -64,7 +64,7 @@ class PromoteGameRatioController extends ThinkController $promoteIds = array_column($promoteGameRatios, 'promote_id'); $gameIds = array_column($promoteGameRatios, 'game_id'); $promoteFiled = 'id, account, mobile_phone, create_time, status, ver_status'; - $gameFiled = 'id, game_name, ratio'; + $gameFiled = 'id, relation_game_name, ratio'; $promotes = M('promote', 'tab_')->where(array('id' => ['in', $promoteIds]))->getField($promoteFiled, true); $games = M('game', 'tab_')->where(array('id' => ['in', $gameIds]))->getField($gameFiled, true); @@ -103,7 +103,7 @@ class PromoteGameRatioController extends ThinkController $thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['ver_status'], 2); } if ($issetGame) { - $thisGameName = $games[$thisGameId]['game_name']; + $thisGameName = $games[$thisGameId]['relation_game_name']; $thisGameRatio = $games[$thisGameId]['ratio']; $thisGameRatio = ($thisGameRatio ?? '0.00') . '%'; } @@ -326,7 +326,7 @@ class PromoteGameRatioController extends ThinkController $this->assign('lastRatio', $lastRatio); } - $this->assign('gameList', getAllGameList()); + $this->assign('gameList', getAllGameList(true)); $this->assign('promoteList', getPromoteByLevel(1)); $this->meta_title = $metaTitle; $this->display(); @@ -389,8 +389,11 @@ class PromoteGameRatioController extends ThinkController $promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true); $promoteIds[] = $promoteId; + $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); + $gameIds = $gameIds ?? [-1]; + $spendMap['promote_id'] = ['in', $promoteIds]; - $spendMap['game_id'] = $promoteGameRatio['game_id']; + $spendMap['game_id'] = ['in', $gameIds]; if ($promoteGameRatio['end_time'] > 0) { $spendMap['pay_time'] = ['between', [$promoteGameRatio['begin_time'], $promoteGameRatio['end_time'] + 3600 * 24 - 1]]; } else { diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php index ea73951c1..e01e83bc1 100644 --- a/Application/Admin/Model/WithdrawModel.class.php +++ b/Application/Admin/Model/WithdrawModel.class.php @@ -268,37 +268,42 @@ class WithdrawModel extends Model{ $balance = 0; $notInGameIds = [-1]; foreach ($promoteGameRatios as $promoteGameRatio) { - $spendWhere['game_id'] = $promoteGameRatio['game_id']; if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { - $notInGameIds[] = $promoteGameRatio['game_id']; - $ratio = $promoteGameRatio['ratio']; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendWhere) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; + $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); + if (!empty($gameIds)) { + foreach ($gameIds as $gameId) { + $spendWhere['game_id'] = $gameId; + $notInGameIds[] = $gameId; + $ratio = $promoteGameRatio['ratio']; + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendWhere) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; + } + } + + $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") + ->where($spendWhere) + ->find()['balance']; + $thisBalance = $thisBalance ?? 0; + $balance = bcadd($balance, $thisBalance, 2); + + $gameRatios[$gameId] = []; + $gameRatios[$gameId][] = [ + 'selle_ratio' => $ratio, + 'default_ratio' => $promoteGameRatio['ratio'], + 'sum_amount' => $sumAmount, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + ]; } } - - $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") - ->where($spendWhere) - ->find()['balance']; - $thisBalance = $thisBalance ?? 0; - $balance = bcadd($balance, $thisBalance, 2); - - $gameRatios[$promoteGameRatio['game_id']] = []; - $gameRatios[$promoteGameRatio['game_id']][] = [ - 'selle_ratio' => $ratio, - 'default_ratio' => $promoteGameRatio['ratio'], - 'sum_amount' => $sumAmount, - 'begin_time' => $beginTime, - 'end_time' => $endTime, - ]; } } @@ -391,33 +396,38 @@ class WithdrawModel extends Model{ $gameRatios = []; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { - $spendMap['game_id'] = $promoteGameRatio['game_id']; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendMap) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - $ratio = 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; - } - } + $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); + if (!empty($gameIds)) { + foreach ($gameIds as $gameId) { + $spendWhere['game_id'] = $gameId; + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendMap) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + $ratio = 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; + } + } - if ($ratio > 0) { - $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); - $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); - $balance = bcadd($balance, $thisBalance, 2); - - $gameRatios[$promoteGameRatio['game_id']][] = [ - 'selle_ratio' => $ratio, - 'default_ratio' => $promoteGameRatio['ratio'], - 'sum_amount' => $sumAmount, - 'begin_time' => date('Y-m-d', $settlementBeginTime), - 'end_time' => date('Y-m-d', $settlementEndTime), - ]; + if ($ratio > 0) { + $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); + $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); + $balance = bcadd($balance, $thisBalance, 2); + + $gameRatios[$gameId][] = [ + 'selle_ratio' => $ratio, + 'default_ratio' => $promoteGameRatio['ratio'], + 'sum_amount' => $sumAmount, + 'begin_time' => date('Y-m-d', $settlementBeginTime), + 'end_time' => date('Y-m-d', $settlementEndTime), + ]; + } + } } } } @@ -477,25 +487,30 @@ class WithdrawModel extends Model{ $balance = 0; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { - $spendMap['game_id'] = $promoteGameRatio['game_id']; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendMap) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - $ratio = 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; - } - } + $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); + if (!empty($gameIds)) { + foreach ($gameIds as $gameId) { + $spendMap['game_id'] = $gameId; + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendMap) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + $ratio = 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; + } + } - if ($ratio > 0) { - $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); - $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); - $balance = bcadd($balance, $thisBalance, 2); + if ($ratio > 0) { + $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); + $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); + $balance = bcadd($balance, $thisBalance, 2); + } + } } } } @@ -532,28 +547,33 @@ class WithdrawModel extends Model{ $balance = 0; $notInGameIds = [-1]; foreach ($promoteGameRatios as $promoteGameRatio) { - $spendWhere['game_id'] = $promoteGameRatio['game_id']; if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { - $notInGameIds[] = $promoteGameRatio['game_id']; - $ratio = $promoteGameRatio['ratio']; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendWhere) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; + $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); + if (!empty($gameIds)) { + foreach ($gameIds as $gameId) { + $spendWhere['game_id'] = $gameId; + $notInGameIds[] = $gameId; + $ratio = $promoteGameRatio['ratio']; + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendWhere) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; + } + } + + $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") + ->where($spendWhere) + ->find()['balance']; + $thisBalance = $thisBalance ?? 0; + $balance = bcadd($balance, $thisBalance, 2); } } - - $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") - ->where($spendWhere) - ->find()['balance']; - $thisBalance = $thisBalance ?? 0; - $balance = bcadd($balance, $thisBalance, 2); } } diff --git a/Application/Admin/View/PromoteGameRatio/applyRatio.html b/Application/Admin/View/PromoteGameRatio/applyRatio.html index 7d14a96be..a75a45d7a 100644 --- a/Application/Admin/View/PromoteGameRatio/applyRatio.html +++ b/Application/Admin/View/PromoteGameRatio/applyRatio.html @@ -105,11 +105,11 @@ - + - + diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index e774ef468..fd93d3863 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -1106,6 +1106,10 @@ function getGameSelleRatioByPromote($promoteId = null, $gameId = null) $promoteId = intval($promoteId); $gameId = intval($gameId); $promote = M('promote', 'tab_')->find($promoteId); + $gameId = M('game', 'tab_')->where(array('id' => $gameId))->getField('relation_game_id'); + if (empty($gameId)) { + return false; + } if (empty($promote)) { return false; From f6eb5d80080cdb7ac429f326586716d82298a40f Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 16:29:36 +0800 Subject: [PATCH 12/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Tool/TaskClient.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Application/Base/Tool/TaskClient.class.php b/Application/Base/Tool/TaskClient.class.php index b60fc4f45..59659a739 100644 --- a/Application/Base/Tool/TaskClient.class.php +++ b/Application/Base/Tool/TaskClient.class.php @@ -2,6 +2,8 @@ namespace Base\Tool; +use GuzzleHttp\Client; + class TaskClient { const SUCCESS = '0000'; From afa7aa8988fd24d017a9362a64cb99d943c22145 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 16:32:56 +0800 Subject: [PATCH 13/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Base/Tool/TaskClient.class.php | 4 ++-- Application/Mobile/Controller/UserController.class.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Application/Base/Tool/TaskClient.class.php b/Application/Base/Tool/TaskClient.class.php index 59659a739..711593418 100644 --- a/Application/Base/Tool/TaskClient.class.php +++ b/Application/Base/Tool/TaskClient.class.php @@ -30,11 +30,11 @@ class TaskClient public function sendSms($mobile, $type = 'common') { - $result = $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type]); + return $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type]); } public function checkSms($mobile, $code) { - $result = $this->post('/message/sms-check', ['mobile' => $mobile, 'code' => $code]); + return $this->post('/message/sms-check', ['mobile' => $mobile, 'code' => $code]); } } \ No newline at end of file diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index a1f2fec42..4e9498243 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -696,7 +696,6 @@ class UserController extends BaseController exit; } $result = $this->telsafecode($account); - } /** From 71e02a4add2826f6430a5996513519b5ceee2ec0 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 17:03:09 +0800 Subject: [PATCH 14/50] =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Model/WithdrawModel.class.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php index e01e83bc1..dbd374981 100644 --- a/Application/Admin/Model/WithdrawModel.class.php +++ b/Application/Admin/Model/WithdrawModel.class.php @@ -269,14 +269,14 @@ class WithdrawModel extends Model{ $notInGameIds = [-1]; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $ratio = $promoteGameRatio['ratio']; + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); if (!empty($gameIds)) { foreach ($gameIds as $gameId) { $spendWhere['game_id'] = $gameId; $notInGameIds[] = $gameId; - $ratio = $promoteGameRatio['ratio']; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") ->where($spendWhere) ->find()['sum_amount']; @@ -396,12 +396,12 @@ class WithdrawModel extends Model{ $gameRatios = []; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); if (!empty($gameIds)) { foreach ($gameIds as $gameId) { - $spendWhere['game_id'] = $gameId; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); + $spendMap['game_id'] = $gameId; $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") ->where($spendMap) ->find()['sum_amount']; @@ -487,12 +487,12 @@ class WithdrawModel extends Model{ $balance = 0; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); if (!empty($gameIds)) { foreach ($gameIds as $gameId) { $spendMap['game_id'] = $gameId; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") ->where($spendMap) ->find()['sum_amount']; @@ -548,14 +548,14 @@ class WithdrawModel extends Model{ $notInGameIds = [-1]; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $ratio = $promoteGameRatio['ratio']; + $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); + $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); if (!empty($gameIds)) { foreach ($gameIds as $gameId) { $spendWhere['game_id'] = $gameId; $notInGameIds[] = $gameId; - $ratio = $promoteGameRatio['ratio']; - $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); - $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") ->where($spendWhere) ->find()['sum_amount']; From 7ac22521ddeb3fd141768092f953df196f65fcea Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 14 Jan 2020 17:09:05 +0800 Subject: [PATCH 15/50] =?UTF-8?q?=E5=A7=93=E5=90=8D=E5=8F=AA=E7=95=99?= =?UTF-8?q?=E5=A7=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Home/Controller/DownloadController.class.php | 11 ++++++----- .../Home/Controller/PromoteController.class.php | 2 ++ Application/Home/Controller/QueryController.class.php | 4 ++-- Application/Home/Controller/SafeController.class.php | 7 +++++-- Application/Home/View/default/Safe/editModify.html | 4 ++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 6d36d1428..9d549976e 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -2199,10 +2199,11 @@ class DownloadController extends BaseController { if($value1['status'] == 2) { $value1['promotestatus'] = "冻结中"; } - $value1['account'] = substr_replace($value1['account'],'****',2); + $realname = mb_strlen($value1['real_name'],'utf-8') == 2 ? mb_substr($value1['real_name'],0,1,'utf-8').'*':mb_substr($value1['real_name'],0,1,'utf-8').'**'; + $value1['real_name'] = $realname; $value1['idcard'] = substr_replace($value1['idcard'],'************',3,12); - $value1['create_time'] = date('Y-m-d H:i:s',$value1['create_time']); - $xlsData[] = $value1; + $value1['create_time'] = date('Y-m-d H:i:s',$value1['create_time']); + $xlsData[] = $value1; } $this->exportExcel($xlsName, $xlsCell, $xlsData,$id); } @@ -3087,7 +3088,7 @@ class DownloadController extends BaseController { $records[] = [ 'id' => $parent['id'], 'account' => $parent['account'], - 'real_name' => $parent['real_name'], + 'real_name' => mb_strlen($parent['real_name'],'utf-8') == 2 ? mb_substr($parent['real_name'],0,1,'utf-8').'*':mb_substr($parent['real_name'],0,1,'utf-8').'**', 'level' => $parent['level'], 'create_role_count' => $selfCreateRoleCountList[$parent['id']], 'create_role_user_count' => $selfCreateRoleUserCountList[$parent['id']], @@ -3109,7 +3110,7 @@ class DownloadController extends BaseController { $records[] = [ 'id' => $id, 'account' => $promote['account'], - 'real_name' => $promote['real_name'], + 'real_name' => mb_strlen($promote['real_name'],'utf-8') == 2 ? mb_substr($promote['real_name'],0,1,'utf-8').'*':mb_substr($promote['real_name'],0,1,'utf-8').'**', 'level' => $promote['level'], 'create_role_count' => $createRoleCountList[$id], 'create_role_user_count' => $createRoleUserCountList[$id], diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 36055ccf8..e08f08cdb 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -972,6 +972,8 @@ class PromoteController extends BaseController list($records, $pagination, $count) = $this->paginate($query); foreach ($records as $key => $value) { + $realname = mb_strlen($value['real_name'],'utf-8') == 2 ? mb_substr($value['real_name'],0,1,'utf-8').'*':mb_substr($value['real_name'],0,1,'utf-8').'**'; + $records[$key]['real_name'] = $realname; $records[$key]['idcard'] = encryption($value['idcard']); $records[$key]['mobile_phone'] = encryption($value['mobile_phone']); } diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index 660ccec8a..b51415efc 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -2112,7 +2112,7 @@ class QueryController extends BaseController $records[] = [ 'id' => $parent['id'], 'account' => $parent['account'], - 'real_name' => $parent['real_name'], + 'real_name' => mb_strlen($parent['real_name'],'utf-8') == 2 ? mb_substr($parent['real_name'],0,1,'utf-8').'*':mb_substr($parent['real_name'],0,1,'utf-8').'**', 'level' => $parent['level'], 'create_role_count' => $selfCreateRoleCountList[$parent['id']], 'create_role_user_count' => $selfCreateRoleUserCountList[$parent['id']], @@ -2134,7 +2134,7 @@ class QueryController extends BaseController $records[] = [ 'id' => $id, 'account' => $promote['account'], - 'real_name' => $promote['real_name'], + 'real_name' => mb_strlen($promote['real_name'],'utf-8') == 2 ? mb_substr($promote['real_name'],0,1,'utf-8').'*':mb_substr($promote['real_name'],0,1,'utf-8').'**', 'level' => $promote['level'], 'create_role_count' => $createRoleCountList[$id], 'create_role_user_count' => $createRoleUserCountList[$id], diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php index 90d4ba04b..5a26463f4 100644 --- a/Application/Home/Controller/SafeController.class.php +++ b/Application/Home/Controller/SafeController.class.php @@ -352,13 +352,16 @@ class SafeController extends BaseController{ } */ $promoteInfo = ""; $address = json_decode($rs['address'],false)[1]; + $realname = mb_strlen($rs['real_name'],'utf-8') == 2 ? mb_substr($rs['real_name'],0,1,'utf-8').'*':mb_substr($rs['real_name'],0,1,'utf-8').'**'; $this->assign('addr',$address); $this->assign('ver_status',$rs['ver_status']); $this->assign('rs',$rs); + $this->assign('idcard',encryption($rs['idcard'])); + $this->assign('real_name',$realname); $this->assign('promoteInfo',$promoteInfo); - $this->assign('tel',$rs['mobile_phone']); + $this->assign('tel',encryption($rs['mobile_phone'])); $this->display(); - } + } public function edit() { $id = get_pid(); diff --git a/Application/Home/View/default/Safe/editModify.html b/Application/Home/View/default/Safe/editModify.html index 96ab1b25d..34fd06d37 100644 --- a/Application/Home/View/default/Safe/editModify.html +++ b/Application/Home/View/default/Safe/editModify.html @@ -121,10 +121,10 @@
资质认证
- 真实姓名: {$rs['real_name']} + 真实姓名: {$real_name}
- 身份证号码: {$rs['idcard']} + 身份证号码: {$idcard}
身份证扫描: 已认证 From 828252cee9bee5a071ce604a53d0aeb3bf4b728a Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 17:21:35 +0800 Subject: [PATCH 16/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/CommonController.class.php | 23 ++++++------- .../Mobile/Controller/SsgController.class.php | 22 ++++++------ .../Controller/UserController.class.php | 34 +++++++++++-------- Application/Mobile/View/User/forget.html | 2 +- 4 files changed, 41 insertions(+), 40 deletions(-) diff --git a/Application/Mobile/Controller/CommonController.class.php b/Application/Mobile/Controller/CommonController.class.php index bbece6e95..2422f594c 100644 --- a/Application/Mobile/Controller/CommonController.class.php +++ b/Application/Mobile/Controller/CommonController.class.php @@ -106,7 +106,9 @@ class CommonController extends BaseController { $gameId = $params['game_id'] ?? 0; #验证短信验证码 - $this->smsVerify($params['account'], $params['verify_code']); + if (!$this->smsVerify($params['account'], $params['verify_code'])) { + $this->respondError('验证失败'); + } $res = $this->doRegister($params['account'], $params['password'], $params['account'], $promoteId, 4, 2, $gameId); if(empty($res)){ @@ -127,7 +129,9 @@ class CommonController extends BaseController { if (empty($params)) { $this->respondError('基础信息不能为空'); } - $this->smsVerify($params['account'], $params['verify_code']); + if (!$this->smsVerify($params['account'], $params['verify_code'])) { + $this->respondError('验证失败'); + } //更新密码 $userApi = new MemberApi(); $userInfo = M("user", "tab_")->where("account = '".$params['account']."'")->find(); @@ -225,22 +229,15 @@ class CommonController extends BaseController { } } - public function smsVerify($phone = '' , $code = '', $type = 2){ + public function smsVerify($phone = '' , $code = '') + { $taskClient = new TaskClient(); $result = $taskClient->checkSms($phone, $code); $data = []; if ($result['code'] == TaskClient::SUCCESS) { - if($type == 1){ - $this->respondSuccess('正确'); - } else { - return true; - } + return true; } else { - if($type == 1){ - $this->respondError($result['message']); - } else { - return false; - } + return false; } } } diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index d1c80bccb..3f83552de 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -181,7 +181,9 @@ class SsgController extends BaseController { $this -> set_message(1001, "fail", "注册数据不能为空"); } #验证短信验证码 - $this -> sms_verify($user['account'], $user['code']); + if (!$this->sms_verify($user['account'], $user['code'])) { + $this->set_message(1000, "fail", '验证失败'); + } $res = $this -> doRegister($user['account'],$user['password'],$user['account'],$promoteId,4,2, $game_id); if(empty($res)){ @@ -201,7 +203,9 @@ class SsgController extends BaseController { if (empty($user)) { $this -> set_message(1001, "fail", "基础信息不能为空"); } - $this -> sms_verify($user['account'], $user['code']); + if (!$this->sms_verify($user['account'], $user['code'])) { + $this->set_message(1000, "fail", '验证失败'); + } //更新密码 $userApi = new MemberApi(); $userInfo = M("user","tab_")->where("account = '".$user['account']."'")->find(); @@ -441,21 +445,15 @@ class SsgController extends BaseController { return $res; } - public function sms_verify($phone = '' ,$code = '', $type = 2){ - + public function sms_verify($phone , $code) + { $taskClient = new TaskClient(); $result = $taskClient->checkSms($phone, $vcode); $data = []; if ($result['code'] == TaskClient::SUCCESS) { - if ($type == 2) { - return true; - } - $this->set_message(200, "success", "验证成功"); + return true; } else { - if ($type == 2) { - return false; - } - $this->set_message(1000, "fail", $result['message']); + return false; } } diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index 4e9498243..2a3a42acf 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -338,7 +338,9 @@ class UserController extends BaseController $password = $safeinfo['password']; $sex = $safeinfo['sex']; - $this->checksafecode($phone, $safecode, false); + if (!$this->checksafecode($phone, $safecode)) { + return $this->ajaxReturn(array('status' => 0, 'msg' => '验证失败')); + } /**是否开启ucenter**/ @@ -613,22 +615,17 @@ class UserController extends BaseController /** * 手机安全码验证 - * @param bool $flag true 用于直接异步请求 false 用于方法调用 - * @param [type] $vcode [description] */ - public function checksafecode($phone, $vcode, $flag = true) + public function checksafecode($phone, $code) { $taskClient = new TaskClient(); - $result = $taskClient->checkSms($phone, $vcode); + $result = $taskClient->checkSms($phone, $code); $data = []; - if ($result['code'] == TaskClient::SUCCESS) { - $data['status'] = 1; + if ($result && $result['code'] == TaskClient::SUCCESS) { + return true; } else { - $data['status'] = 0; + return false; } - $data['msg'] = $result['message']; - echo json_encode($data); - exit; } /** @@ -641,8 +638,11 @@ class UserController extends BaseController if (IS_POST) { $phone = $_POST['phone']; + $code = $_REQUEST['code']; - $this->checksafecode($phone, $_REQUEST['code'], false); + if (!$this->checksafecode($phone, $code)) { + return $this->ajaxReturn(array('status' => 0, 'msg' => '验证失败')); + } $this->success('验证成功', U('User/forget1', array('phone' => $phone))); @@ -658,8 +658,11 @@ class UserController extends BaseController if (IS_POST) { $new_pwd = $_REQUEST['new_pwd']; $u_uid['phone'] = $_REQUEST['phone']; + $code = $_REQUEST['code']; //验证短信验证码 - $this->checksafecode($u_uid['phone'], $_REQUEST['code'], false); + if (!$this->checksafecode($u_uid['phone'], $code)) { + $this->error("验证失败"); + } $result = M('user', 'tab_')->where($u_uid)->setField('password', think_ucenter_md5($new_pwd, UC_AUTH_KEY)); if ($result != false) { $this->success("修改成功", U('User/login')); @@ -875,7 +878,10 @@ class UserController extends BaseController if (IS_POST) { $code = I("post.scode"); $phone = I("post.phone"); - $this->checksafecode($phone, $code, false); + if (!$this->checksafecode($phone, $code)) { + echo json_encode(array('status' => 0, 'msg' => '验证失败')); + exit(); + } if (!$user['phone']) { $where['account'] = $phone; $where['phone'] = $phone; diff --git a/Application/Mobile/View/User/forget.html b/Application/Mobile/View/User/forget.html index 96be5cbae..401171c11 100644 --- a/Application/Mobile/View/User/forget.html +++ b/Application/Mobile/View/User/forget.html @@ -124,7 +124,7 @@ code:$("#code").val(), new_pwd:new_pwd }, - success:function(result){ + success:function(result) { if(result.status == 1){ pmsg.msg("修改成功"); setTimeout(function () { From 9d5b87722088bdb135e6c71cf2031341b4a2b211 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 17:21:54 +0800 Subject: [PATCH 17/50] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=94=9F=E6=88=90=E4=B8=8B=E6=B8=B8=E4=BB=A3=E7=A0=81=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/QueryController.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index ad5393707..9cb5fb796 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1477,7 +1477,7 @@ class QueryController extends ThinkController $spendMap['tab_spend.pay_status'] = 1; //获取spend表中的数据,同时根据会长id进行group分类 $data = M('Spend','tab_') - ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,tab_spend.game_name,SUBSTRING_INDEX(tab_spend.`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id,tab_game.ratio ") + ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,tab_spend.game_name,SUBSTRING_INDEX(tab_spend.`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id,tab_game.ratio,tab_game.relation_game_id ") ->join("left join tab_promote on promote_id = tab_promote.id") ->join("left join tab_game on tab_game.id=tab_spend.game_id") ->where($spendMap) @@ -1498,7 +1498,7 @@ class QueryController extends ThinkController $data = M()->table('('.$data.') as a') ->field("my_time,pay_amount,a.game_id,game_name,game_names,a.promote_id,a.promote_account,a.company_relation,a.company_belong,CASE WHEN root_id is null THEN 0 ELSE root_id END as root_id,CASE WHEN account is null THEN '官方渠道' ELSE account END as account,tab_ratio.ratio as ratio,turnover_ratio,a.ratio as game_ratio") ->join("left join tab_promote on root_id = tab_promote.id") - ->join("left join tab_promote_game_ratio as tab_ratio on tab_ratio.game_id = a.game_id and tab_ratio.promote_id=root_id") + ->join("left join tab_promote_game_ratio as tab_ratio on tab_ratio.game_id = a.relation_game_id and tab_ratio.promote_id=root_id") // ->join("left join tab_cp_game_ratio as game_ratio on game_ratio.game_id = a.game_id") ->page($page,$row) ->where($map) @@ -1522,8 +1522,10 @@ class QueryController extends ThinkController if ($value['ratio']) { $data[$key]['downstream'] = $value['pay_amount'] * ($value['ratio']*0.01); + var_dump($value['ratio']); } else { $data[$key]['downstream'] = $value['pay_amount'] * ($value['game_ratio']*0.01); + var_dump($value['ratio']); } $value['turnover_ratio'] = json_decode($value['turnover_ratio'],true); From 1ba566a02c104364e20c7d5fd008786a391b1be5 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 17:31:16 +0800 Subject: [PATCH 18/50] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Controller/QueryController.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index 9cb5fb796..a3d5ee4b3 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1522,10 +1522,8 @@ class QueryController extends ThinkController if ($value['ratio']) { $data[$key]['downstream'] = $value['pay_amount'] * ($value['ratio']*0.01); - var_dump($value['ratio']); } else { $data[$key]['downstream'] = $value['pay_amount'] * ($value['game_ratio']*0.01); - var_dump($value['ratio']); } $value['turnover_ratio'] = json_decode($value['turnover_ratio'],true); From 14e65c8314ebdb04368c04ee425573918435007b Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 17:31:47 +0800 Subject: [PATCH 19/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8F=91=E9=80=81bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Mobile/Controller/UserController.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Application/Mobile/Controller/UserController.class.php b/Application/Mobile/Controller/UserController.class.php index 2a3a42acf..bb06322fa 100644 --- a/Application/Mobile/Controller/UserController.class.php +++ b/Application/Mobile/Controller/UserController.class.php @@ -663,6 +663,11 @@ class UserController extends BaseController if (!$this->checksafecode($u_uid['phone'], $code)) { $this->error("验证失败"); } + $user = M('user', 'tab_')->where($u_uid)->find(); + if (!$user) { + $this->error("账号不存在"); + } + $result = M('user', 'tab_')->where($u_uid)->setField('password', think_ucenter_md5($new_pwd, UC_AUTH_KEY)); if ($result != false) { $this->success("修改成功", U('User/login')); From 9b3f105e5a4696695aad170c0bc67ad119c7a1d4 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Tue, 14 Jan 2020 18:04:54 +0800 Subject: [PATCH 20/50] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Mobile/Controller/SsgController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php index 3f83552de..b870df024 100644 --- a/Application/Mobile/Controller/SsgController.class.php +++ b/Application/Mobile/Controller/SsgController.class.php @@ -448,7 +448,7 @@ class SsgController extends BaseController { public function sms_verify($phone , $code) { $taskClient = new TaskClient(); - $result = $taskClient->checkSms($phone, $vcode); + $result = $taskClient->checkSms($phone, $code); $data = []; if ($result['code'] == TaskClient::SUCCESS) { return true; From 66a238dfd43bb68057d937485135acf1c19f5383 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 18:39:54 +0800 Subject: [PATCH 21/50] =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteGameRatioController.class.php | 129 ++++++++---- .../Admin/Model/WithdrawModel.class.php | 184 ++++++++---------- Application/Common/Common/extend.php | 4 - Data/update.sql | 7 +- 4 files changed, 176 insertions(+), 148 deletions(-) diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index ca672fba3..3d1c7d0ca 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -28,7 +28,7 @@ class PromoteGameRatioController extends ThinkController $page = $params['p'] ? intval($params['p']) : 1; $row = $params['row'] ? intval($params['row']) : 10; - $map['_string'] = '1 = 1'; + $map['_string'] = 'game_id = relation_game_id'; if ($promoteId) { $map['promote_id'] = intval($promoteId); } @@ -43,11 +43,13 @@ class PromoteGameRatioController extends ThinkController if ($group == 1) { $query = D(self::MODEL_NAME)->field($field, true) ->where($map) + ->group('relation_game_id') ->order('update_time desc, id desc'); $metaTitle = $csvTitle = '公会分成管理'; } else { $query = M(self::MODEL_NAME . '_log', 'tab_')->field($field, true) ->where($map) + ->group('relation_game_id') ->order('create_time desc, id desc'); $metaTitle = $csvTitle = '公会分成申请记录'; } @@ -161,7 +163,7 @@ class PromoteGameRatioController extends ThinkController $this->assign('group', $group); $this->assign('records', $records); $this->assign('count', $count); - $this->assign('gameList', getAllGameList()); + $this->assign('gameList', getAllGameList(true)); $this->assign('promoteList', getPromoteByLevel(1)); $this->assign('statusList', self::$statusList); $this->assign('reviewRule', $reviewRule); @@ -232,6 +234,7 @@ class PromoteGameRatioController extends ThinkController $save['remark'] = $params['remark'] ?? ''; $save['status'] = 0; $save['update_time'] = $time; + $model = new PromoteGameRatioModel(); if (!empty($params['id'])) {//修改 $promoteGameRatio = D(self::MODEL_NAME)->find($params['id']); if (empty($promoteGameRatio)) { @@ -245,13 +248,25 @@ class PromoteGameRatioController extends ThinkController $save['last_ratio'] = $promoteGameRatio['ratio']; $save['last_ratio_status'] = 1; } - $save['id'] = intval($params['id']); - $result = D(self::MODEL_NAME)->save($save); + $saveMap['relation_game_id'] = $promoteGameRatio['relation_game_id']; + $result = D(self::MODEL_NAME)->where($saveMap)->save($save); $logResult = $result; } else { $result = true; $logResult = false; } + + if ($result === false) { + $this->error('保存失败'); + } + if ($logResult) { + $promoteGameRatioIds = D(self::MODEL_NAME)->where(array('relation_game_id' => $promoteGameRatio['relation_game_id']))->getField('id', true); + if (!empty($promoteGameRatioIds)) { + foreach ($promoteGameRatioIds as $promoteGameRatioId) { + $model->addLog($promoteGameRatioId); + } + } + } } else {//新增 if (empty($params['promote_id'])) { $this->error('请选择会长账号'); @@ -261,6 +276,14 @@ class PromoteGameRatioController extends ThinkController } $promoteId = intval($params['promote_id']); $gameId = intval($params['game_id']); + $relationGameId = D('game')->where(array('id' => $gameId))->getField('relation_game_id'); + if (empty($relationGameId)) { + $this->error('数据异常'); + } + $gameIds = D('game')->where(array('relation_game_id' => $relationGameId))->getField('id', true); + if (empty($gameIds)) { + $this->error('数据异常'); + } $promote = M('promote', 'tab_')->find($promoteId); if (empty($promote) || $promote['level'] != 1) { @@ -270,36 +293,35 @@ class PromoteGameRatioController extends ThinkController $this->isWithdraw($promoteId, $save['begin_time']); $map['promote_id'] = $promoteId; - $map['game_id'] = $gameId; - $promoteGameRatio = D(self::MODEL_NAME)->where($map)->find(); - if ($promoteGameRatio) { - $this->error('网络异常'); - } $save['promote_id'] = $promoteId; - $save['game_id'] = $gameId; $save['last_turnover_ratio'] = ''; $save['applicant_id'] = is_login(); $save['create_time'] = $time; - $result = D(self::MODEL_NAME)->add($save); - $logResult = $result; - } - - if ($result === false) { - $this->error('保存失败'); - } else { - if ($logResult) { - if (empty($params['id'])) { - $promoteGameRatioId = $result; - } else { - $promoteGameRatioId = $params['id']; + M()->startTrans(); + foreach ($gameIds as $gameId) { + $map['game_id'] = $gameId; + $promoteGameRatio = D(self::MODEL_NAME)->where($map)->find(); + if ($promoteGameRatio) { + $this->error('网络异常'); } - $model = new PromoteGameRatioModel(); - $model->addLog($promoteGameRatioId); - } + $save['game_id'] = $gameId; + $save['relation_game_id'] = $relationGameId; + $result = D(self::MODEL_NAME)->add($save); + $logResult = $result; - $this->success('保存成功', U('lists')); + if ($result === false) { + M()->rollback(); + $this->error('保存失败'); + } + if ($logResult) { + $model->addLog($result); + } + } + M()->commit(); } + + $this->success('保存成功', U('lists')); } else { $params = I('get.'); $id = $params['id'] ?? 0; @@ -365,8 +387,11 @@ class PromoteGameRatioController extends ThinkController $this->error('操作失败'); } + $promoteGameRatioMap['id'] = ['in', $ids]; + $relationGameIds = D(self::MODEL_NAME)->where($promoteGameRatioMap)->getField('relation_game_id', true); + $time = time(); - $map['id'] = ['in', $ids]; + $map['relation_game_id'] = ['in', $relationGameIds]; $map['status'] = 0; $save['status'] = $status; $save['reviewer_id'] = is_login(); @@ -378,22 +403,18 @@ class PromoteGameRatioController extends ThinkController $result = D(self::MODEL_NAME)->where($map)->save($save); if ($result) { $model = new PromoteGameRatioModel(); - foreach ($ids as $id) { - $model->addLog($id); - if ($status == 1) { - $promoteGameRatio = D(self::MODEL_NAME)->find($id); - if (!empty($promoteGameRatio)) { + $promoteGameRatios = D(self::MODEL_NAME)->where(array('relation_game_id' => ['in', $relationGameIds]))->select(); + if (!empty($promoteGameRatios)) { + foreach ($promoteGameRatios as $promoteGameRatio) { + $promoteId = $promoteGameRatio['promote_id']; + $promoteMap['chain'] = ['like', "/{$promoteId}/%"]; + $promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true); + $promoteIds[] = $promoteId; + $model->addLog($promoteGameRatio['id']); + if ($status == 1) { if ($promoteGameRatio['begin_time'] <= strtotime(date('Y-m-d', time()))) { - $promoteId = $promoteGameRatio['promote_id']; - $promoteMap['chain'] = ['like', "/{$promoteId}/%"]; - $promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true); - $promoteIds[] = $promoteId; - - $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); - $gameIds = $gameIds ?? [-1]; - $spendMap['promote_id'] = ['in', $promoteIds]; - $spendMap['game_id'] = ['in', $gameIds]; + $spendMap['game_id'] = $promoteGameRatio['game_id']; if ($promoteGameRatio['end_time'] > 0) { $spendMap['pay_time'] = ['between', [$promoteGameRatio['begin_time'], $promoteGameRatio['end_time'] + 3600 * 24 - 1]]; } else { @@ -408,6 +429,32 @@ class PromoteGameRatioController extends ThinkController } } } + + foreach ($ids as $id) { + $thisPromoteGameRatio = D(self::MODEL_NAME)->find($id); + if (!empty($thisPromoteGameRatio)) { + $promoteGameRatios = D(self::MODEL_NAME)->where(array('relation_game_id' => $thisPromoteGameRatio['relation_game_id']))->select(); + foreach ($promoteGameRatios as $promoteGameRatio) { + $model->addLog($promoteGameRatio['id']); + if ($status == 1) { + if ($promoteGameRatio['begin_time'] <= strtotime(date('Y-m-d', time()))) { + $spendMap['promote_id'] = ['in', $promoteIds]; + $spendMap['game_id'] = $promoteGameRatio['relation_game_id']; + if ($promoteGameRatio['end_time'] > 0) { + $spendMap['pay_time'] = ['between', [$promoteGameRatio['begin_time'], $promoteGameRatio['end_time'] + 3600 * 24 - 1]]; + } else { + $spendMap['pay_time'] = ['egt', $promoteGameRatio['begin_time']]; + } + $spendMap['pay_status'] = 1; + $spendMap['selle_status'] = 0; + + $spendSave['selle_ratio'] = $promoteGameRatio['ratio']; + M('spend', 'tab_')->where($spendMap)->save($spendSave); + } + } + } + } + } $this->success('操作成功'); } else { $this->error('操作失败'); diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php index dbd374981..d4efe6dd4 100644 --- a/Application/Admin/Model/WithdrawModel.class.php +++ b/Application/Admin/Model/WithdrawModel.class.php @@ -226,7 +226,7 @@ class WithdrawModel extends Model{ return 1; } - //月结 +//月结 public function promoteWithdrawPerMonthByPromote($promote, $initial = false, $data = []) { $promoteIds = $this->getPromoteChildren($promote); @@ -268,42 +268,37 @@ class WithdrawModel extends Model{ $balance = 0; $notInGameIds = [-1]; foreach ($promoteGameRatios as $promoteGameRatio) { + $spendWhere['game_id'] = $promoteGameRatio['game_id']; if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $notInGameIds[] = $promoteGameRatio['game_id']; $ratio = $promoteGameRatio['ratio']; $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); - if (!empty($gameIds)) { - foreach ($gameIds as $gameId) { - $spendWhere['game_id'] = $gameId; - $notInGameIds[] = $gameId; - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendWhere) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; - } - } - - $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") - ->where($spendWhere) - ->find()['balance']; - $thisBalance = $thisBalance ?? 0; - $balance = bcadd($balance, $thisBalance, 2); - - $gameRatios[$gameId] = []; - $gameRatios[$gameId][] = [ - 'selle_ratio' => $ratio, - 'default_ratio' => $promoteGameRatio['ratio'], - 'sum_amount' => $sumAmount, - 'begin_time' => $beginTime, - 'end_time' => $endTime, - ]; + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendWhere) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; } } + + $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") + ->where($spendWhere) + ->find()['balance']; + $thisBalance = $thisBalance ?? 0; + $balance = bcadd($balance, $thisBalance, 2); + + $gameRatios[$promoteGameRatio['game_id']] = []; + $gameRatios[$promoteGameRatio['game_id']][] = [ + 'selle_ratio' => $ratio, + 'default_ratio' => $promoteGameRatio['ratio'], + 'sum_amount' => $sumAmount, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + ]; } } @@ -396,39 +391,34 @@ class WithdrawModel extends Model{ $gameRatios = []; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $spendMap['game_id'] = $promoteGameRatio['game_id']; $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); - if (!empty($gameIds)) { - foreach ($gameIds as $gameId) { - $spendMap['game_id'] = $gameId; - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendMap) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - $ratio = 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; - } - } - - if ($ratio > 0) { - $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); - $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); - $balance = bcadd($balance, $thisBalance, 2); - - $gameRatios[$gameId][] = [ - 'selle_ratio' => $ratio, - 'default_ratio' => $promoteGameRatio['ratio'], - 'sum_amount' => $sumAmount, - 'begin_time' => date('Y-m-d', $settlementBeginTime), - 'end_time' => date('Y-m-d', $settlementEndTime), - ]; - } + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendMap) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + $ratio = 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; } } + + if ($ratio > 0) { + $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); + $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); + $balance = bcadd($balance, $thisBalance, 2); + + $gameRatios[$promoteGameRatio['game_id']][] = [ + 'selle_ratio' => $ratio, + 'default_ratio' => $promoteGameRatio['ratio'], + 'sum_amount' => $sumAmount, + 'begin_time' => date('Y-m-d', $settlementBeginTime), + 'end_time' => date('Y-m-d', $settlementEndTime), + ]; + } } } @@ -487,31 +477,26 @@ class WithdrawModel extends Model{ $balance = 0; foreach ($promoteGameRatios as $promoteGameRatio) { if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $spendMap['game_id'] = $promoteGameRatio['game_id']; $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); - if (!empty($gameIds)) { - foreach ($gameIds as $gameId) { - $spendMap['game_id'] = $gameId; - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendMap) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - $ratio = 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; - } - } - - if ($ratio > 0) { - $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); - $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); - $balance = bcadd($balance, $thisBalance, 2); - } + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendMap) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + $ratio = 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; } } + + if ($ratio > 0) { + $ratio = bcsub($ratio, $promoteGameRatio['ratio'], 2); + $thisBalance = bcdiv(bcmul($sumAmount, $ratio, 2), 100, 2); + $balance = bcadd($balance, $thisBalance, 2); + } } } @@ -547,33 +532,28 @@ class WithdrawModel extends Model{ $balance = 0; $notInGameIds = [-1]; foreach ($promoteGameRatios as $promoteGameRatio) { + $spendWhere['game_id'] = $promoteGameRatio['game_id']; if (!empty($promoteGameRatio['turnover_ratio']) && $promoteGameRatio['begin_time'] <= $settlementBeginTime && (empty($promoteGameRatio['end_time']) || $promoteGameRatio['end_time'] >= $settlementEndTime)) { + $notInGameIds[] = $promoteGameRatio['game_id']; $ratio = $promoteGameRatio['ratio']; $promoteGameRatio['turnover_ratio'] = json_decode($promoteGameRatio['turnover_ratio'], true); $turnoverRatios = array_reverse($promoteGameRatio['turnover_ratio']); - $gameIds = D('game')->where(array('relation_game_id' => $promoteGameRatio['game_id']))->getField('id', true); - if (!empty($gameIds)) { - foreach ($gameIds as $gameId) { - $spendWhere['game_id'] = $gameId; - $notInGameIds[] = $gameId; - $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") - ->where($spendWhere) - ->find()['sum_amount']; - $sumAmount = $sumAmount ?? 0; - foreach ($turnoverRatios as $turnoverRatio) { - if ($sumAmount >= $turnoverRatio['turnover']) { - $ratio = $turnoverRatio['ratio']; - break; - } - } - - $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") - ->where($spendWhere) - ->find()['balance']; - $thisBalance = $thisBalance ?? 0; - $balance = bcadd($balance, $thisBalance, 2); + $sumAmount = $spendModel->field("sum(pay_amount) as sum_amount") + ->where($spendWhere) + ->find()['sum_amount']; + $sumAmount = $sumAmount ?? 0; + foreach ($turnoverRatios as $turnoverRatio) { + if ($sumAmount >= $turnoverRatio['turnover']) { + $ratio = $turnoverRatio['ratio']; + break; } } + + $thisBalance = $spendModel->field("sum(pay_amount * {$ratio}) as balance") + ->where($spendWhere) + ->find()['balance']; + $thisBalance = $thisBalance ?? 0; + $balance = bcadd($balance, $thisBalance, 2); } } diff --git a/Application/Common/Common/extend.php b/Application/Common/Common/extend.php index fd93d3863..e774ef468 100644 --- a/Application/Common/Common/extend.php +++ b/Application/Common/Common/extend.php @@ -1106,10 +1106,6 @@ function getGameSelleRatioByPromote($promoteId = null, $gameId = null) $promoteId = intval($promoteId); $gameId = intval($gameId); $promote = M('promote', 'tab_')->find($promoteId); - $gameId = M('game', 'tab_')->where(array('id' => $gameId))->getField('relation_game_id'); - if (empty($gameId)) { - return false; - } if (empty($promote)) { return false; diff --git a/Data/update.sql b/Data/update.sql index 8247cb1d9..4ebe26755 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1080,4 +1080,9 @@ ALTER TABLE `tab_promote_game_ratio` MODIFY COLUMN `turnover_ratio` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '流水分成比例' AFTER `last_ratio_status`, MODIFY COLUMN `last_turnover_ratio` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '上次流水分成比例'; -UPDATE tab_spend SET selle_ratio = 0.00 where selle_ratio is null \ No newline at end of file +UPDATE tab_spend SET selle_ratio = 0.00 where selle_ratio is null + +ALTER TABLE `tab_promote_game_ratio` +ADD COLUMN `relation_game_id` int(11) NOT NULL DEFAULT 0 COMMENT '关联游戏id' AFTER `game_id`; +ALTER TABLE `tab_promote_game_ratio_log` +ADD COLUMN `relation_game_id` int(11) NOT NULL DEFAULT 0 COMMENT '关联游戏id' AFTER `game_id`; \ No newline at end of file From 42e07d0f2f2195dc6f6c9860d2c4e44edb85a19f Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 18:51:12 +0800 Subject: [PATCH 22/50] =?UTF-8?q?=E7=BB=93=E7=AE=97=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PromoteGameRatioController.class.php | 35 ++++--------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index 3d1c7d0ca..0f6701687 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -43,13 +43,13 @@ class PromoteGameRatioController extends ThinkController if ($group == 1) { $query = D(self::MODEL_NAME)->field($field, true) ->where($map) - ->group('relation_game_id') + ->group('promote_id, relation_game_id') ->order('update_time desc, id desc'); $metaTitle = $csvTitle = '公会分成管理'; } else { $query = M(self::MODEL_NAME . '_log', 'tab_')->field($field, true) ->where($map) - ->group('relation_game_id') + ->group('promote_id, relation_game_id, create_time') ->order('create_time desc, id desc'); $metaTitle = $csvTitle = '公会分成申请记录'; } @@ -58,7 +58,10 @@ class PromoteGameRatioController extends ThinkController } $promoteGameRatios = $query->select(); if (I('export', 0) != 1) { - $count = D(self::MODEL_NAME)->where($map)->count(); + $count = count(D(self::MODEL_NAME)->where($map) + ->group('promote_id, relation_game_id') + ->order('update_time desc, id desc') + ->select()); } $records = []; @@ -429,32 +432,6 @@ class PromoteGameRatioController extends ThinkController } } } - - foreach ($ids as $id) { - $thisPromoteGameRatio = D(self::MODEL_NAME)->find($id); - if (!empty($thisPromoteGameRatio)) { - $promoteGameRatios = D(self::MODEL_NAME)->where(array('relation_game_id' => $thisPromoteGameRatio['relation_game_id']))->select(); - foreach ($promoteGameRatios as $promoteGameRatio) { - $model->addLog($promoteGameRatio['id']); - if ($status == 1) { - if ($promoteGameRatio['begin_time'] <= strtotime(date('Y-m-d', time()))) { - $spendMap['promote_id'] = ['in', $promoteIds]; - $spendMap['game_id'] = $promoteGameRatio['relation_game_id']; - if ($promoteGameRatio['end_time'] > 0) { - $spendMap['pay_time'] = ['between', [$promoteGameRatio['begin_time'], $promoteGameRatio['end_time'] + 3600 * 24 - 1]]; - } else { - $spendMap['pay_time'] = ['egt', $promoteGameRatio['begin_time']]; - } - $spendMap['pay_status'] = 1; - $spendMap['selle_status'] = 0; - - $spendSave['selle_ratio'] = $promoteGameRatio['ratio']; - M('spend', 'tab_')->where($spendMap)->save($spendSave); - } - } - } - } - } $this->success('操作成功'); } else { $this->error('操作失败'); From 3741b0d27f6ec739245cd0f6918aaddc3cc66e67 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 19:40:51 +0800 Subject: [PATCH 23/50] =?UTF-8?q?=E5=B8=82=E5=9C=BA=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/QueryController.class.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index a3d5ee4b3..a346f441f 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -1577,14 +1577,22 @@ class QueryController extends ThinkController $map['my_time'] = $_REQUEST['count_date']; } +// if ($_REQUEST['device']) { +// $map['game_name'] = ['like','%'.$_REQUEST['device'].'%']; +// } + if ($_REQUEST['device']) { - $map['game_name'] = ['like','%'.$_REQUEST['device'].'%']; +// $map['tab_spend.sdk_version'] = $_REQUEST['device']; + $spendMap['tab_spend.sdk_version'] = $_REQUEST['device']; + } + $spendMap['tab_spend.pay_status'] = 1; + //获取spend表中的数据,同时根据会长id进行group分类 $data = M('Spend','tab_') ->field("FROM_UNIXTIME(pay_time,'%Y-%m') as my_time,sum(pay_amount) as pay_amount,game_id,game_name,SUBSTRING_INDEX(`game_name`,\"(\",1) as game_names,promote_id,promote_account,company_relation,company_belong,CASE WHEN SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1)='' THEN promote_id ELSE SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,\"/\",2),\"/\",-1) END as root_id,pay_way ") ->join("left join tab_promote on promote_id = tab_promote.id") - ->where(['pay_status'=>1]) + ->where($spendMap) ->group("my_time,game_names,root_id,pay_way") ->order("my_time Desc") ->select(false); From 693f8c9991b9ccb43c6d6c504b67fc48d962930c Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 20:12:37 +0800 Subject: [PATCH 24/50] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/FinanceController.class.php | 41 ++++++++++++++++--- .../Controller/PromoteController.class.php | 28 ++++++------- .../View/default/Finance/settlementOrder.html | 12 +++--- .../View/default/Finance/withdrawDtl.html | 12 +++--- 4 files changed, 62 insertions(+), 31 deletions(-) diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index bb447967d..8ecbce4d2 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -529,7 +529,7 @@ class FinanceController extends BaseController if ($withdrawId == 0) { $this->error('参数异常'); } - $withdraw = $model->field('promote_id,status')->where(array('id' => $withdrawId))->find(); + $withdraw = $model->where(array('id' => $withdrawId))->find(); if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) { $this->error('参数异常'); } @@ -544,7 +544,18 @@ class FinanceController extends BaseController $parameter['user_account'] = $userAccount; $parameter['pay_order_number'] = $payOrderNumber; - $map['withdraw_id'] = $withdrawId; + if ($withdraw['settlement_type'] == 3) { + if (empty($withdraw['game_ratio'])) { + $map['_string'] = '1 = 2'; + } else { + $gameRatios = json_decode($withdraw['game_ratio'], true); + $gameIds = array_keys($gameRatios); + $map['game_id'] = ['in', $gameIds]; + $map['pay_time'] = ['between', [$withdraw['settlement_begin_time'], $withdraw['settlement_end_time']]]; + } + } else { + $map['withdraw_id'] = $withdrawId; + } if (!empty($gameId)) { $map['game_id'] = $gameId; } @@ -613,20 +624,40 @@ class FinanceController extends BaseController if (empty($withdraw) || $withdraw['promote_id'] != $this->loginPromote['id']) { $this->error('参数异常'); } + + $settlementBeginTime = $withdraw['settlement_begin_time']; + $settlementEndTime = $withdraw['settlement_end_time']; $withdraw['create_time'] = date('Y-m-d H:i:s', $withdraw['create_time']); $withdraw['settlement_end_time'] = date('Y-m-d H:i:s', $withdraw['settlement_end_time']); $withdraw['status'] = FinanceController::$withdrawStatus[$withdraw['status']]; - $map['withdraw_id'] = $withdrawId; + if (empty($withdraw['game_ratio'])) { + $map['_string'] = '1 = 2'; + } else { + $gameRatios = json_decode($withdraw['game_ratio'], true); + $gameIds = array_keys($gameRatios); + $map['game_id'] = ['in', $gameIds]; + $map['pay_time'] = ['between', [$settlementBeginTime, $settlementEndTime]]; + } + if ($withdraw['settlement_type'] != 3) { + $map['withdraw_id'] = $withdrawId; + } + $data = M('spend', 'tab_') - ->field('game_name,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_way,sum(pay_amount) as pay_amount_all,sum(if(selle_ratio > 0,pay_amount * selle_ratio,0)) as income') + ->field('game_id,game_name,if(selle_ratio >= 0,selle_ratio,0) as selle_ratio,pay_way,sum(pay_amount) as pay_amount_all,sum(if(selle_ratio > 0,pay_amount * selle_ratio,0)) as income') ->where($map) ->group('game_id') ->order('game_id') ->select(); if (!empty($data)) { foreach ($data as &$list) { - $list['income'] = bcdiv($list['income'], 100, 2); + $list['income'] = '0.00'; + if (isset($gameRatios[$list['game_id']])) { + foreach ($gameRatios[$list['game_id']] as $gameIncome) { + $income = bcdiv(bcmul($gameIncome['sum_amount'], $gameIncome['selle_ratio'], 2), 100, 2); + $list['income'] = bcadd($list['income'], $income, 2); + } + } } } diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index e08f08cdb..4fe8c80d9 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -232,20 +232,20 @@ class PromoteController extends BaseController $this->assign("rules", $rules); $this->assign("rules_count", count($rules)); - $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); - $cacheKey = "pop:rule:set"; - if (!$redis->sIsMember($cacheKey, get_pid())) { - $currentTime = strtotime(date('Y-m-d')); - $weekArray = [7,1,2,3,4,5,6]; - $week = $weekArray[date("w")]; - $match_rules = M("document_pop_rules") - ->field('id') - ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") - ->order("sort asc, id desc") - ->select(); - } else { - $match_rules = []; - } +// $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); +// $cacheKey = "pop:rule:set"; +// if (!$redis->sIsMember($cacheKey, get_pid())) { +// $currentTime = strtotime(date('Y-m-d')); +// $weekArray = [7,1,2,3,4,5,6]; +// $week = $weekArray[date("w")]; +// $match_rules = M("document_pop_rules") +// ->field('id') +// ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") +// ->order("sort asc, id desc") +// ->select(); +// } else { +// $match_rules = []; +// } $this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null'); diff --git a/Application/Home/View/default/Finance/settlementOrder.html b/Application/Home/View/default/Finance/settlementOrder.html index d05184dc1..0f57aa709 100644 --- a/Application/Home/View/default/Finance/settlementOrder.html +++ b/Application/Home/View/default/Finance/settlementOrder.html @@ -141,11 +141,11 @@ 游戏名称 流水 现金分成基数 - 现金分成比例 + 平台币分成基数 - 平台币分成比例 + 绑定币分成基数 - 绑定币分成比例 + 合作方分成金额 @@ -165,19 +165,19 @@ 0 - {$vo.selle_ratio}% + {$vo.pay_amount_all} 0 - {$vo.selle_ratio}% + {$vo.pay_amount_all} 0 - {$vo.selle_ratio}% + {$vo.income} diff --git a/Application/Home/View/default/Finance/withdrawDtl.html b/Application/Home/View/default/Finance/withdrawDtl.html index 7b67dbfb3..d06f14696 100644 --- a/Application/Home/View/default/Finance/withdrawDtl.html +++ b/Application/Home/View/default/Finance/withdrawDtl.html @@ -134,11 +134,11 @@ 玩家账号 订单总额 现金分成基数 - 现金分成比例 + 平台币分成基数 - 平台币分成比例 + 绑定币分成基数 - 绑定币分成比例 + 现金支付通道 收益 订单状态 @@ -164,19 +164,19 @@ 0 - {$vo.selle_ratio}% + {$vo.pay_amount} 0 - {$vo.selle_ratio}% + {$vo.pay_amount} 0 - {$vo.selle_ratio}% + {$vo.pay_way_name} {$vo.income} {$status} From 126c7755db634fafe9418881ea4a6c21b77220cb Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 14 Jan 2020 20:20:08 +0800 Subject: [PATCH 25/50] =?UTF-8?q?=E8=B5=84=E6=96=99=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E9=BB=98=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/SafeController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Home/Controller/SafeController.class.php b/Application/Home/Controller/SafeController.class.php index 5a26463f4..930fd5843 100644 --- a/Application/Home/Controller/SafeController.class.php +++ b/Application/Home/Controller/SafeController.class.php @@ -325,7 +325,7 @@ class SafeController extends BaseController{ $promoteInfo['personalstatus'] = true; $promoteInfo['complanystatus'] = false; } - if(!empty(json_decode($address))) { + if(!empty(json_decode($address)) && count(json_decode($address)) >= 2) { $addressArr = explode(',', json_decode($address)[0]); $promoteInfo['addressdata'] = $addressArr; $this->assign('addr',json_decode($address)[1]); From df97ff401adb36622402634456b303320e8ad08c Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 20:32:46 +0800 Subject: [PATCH 26/50] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Finance/withdrawDtl.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Home/View/default/Finance/withdrawDtl.html b/Application/Home/View/default/Finance/withdrawDtl.html index d06f14696..5de714e83 100644 --- a/Application/Home/View/default/Finance/withdrawDtl.html +++ b/Application/Home/View/default/Finance/withdrawDtl.html @@ -140,7 +140,7 @@ 绑定币分成基数 现金支付通道 - 收益 + 订单状态 充值时间 @@ -178,7 +178,7 @@ {$vo.pay_way_name} - {$vo.income} + {$status} {$vo.pay_time} From 3fca3c89add0a5c44b4e2ca31b74bea4745a4f4e Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 14 Jan 2020 20:44:30 +0800 Subject: [PATCH 27/50] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PublicController.class.php | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/Application/Admin/Controller/PublicController.class.php b/Application/Admin/Controller/PublicController.class.php index 25274d90a..453d2fbbc 100644 --- a/Application/Admin/Controller/PublicController.class.php +++ b/Application/Admin/Controller/PublicController.class.php @@ -4,6 +4,7 @@ namespace Admin\Controller; use User\Api\UserApi; use Com\Wechat; use Com\WechatAuth; +use Base\Tool\TaskClient; /** * 后台首页控制器 @@ -78,7 +79,9 @@ class PublicController extends \Think\Controller if (IS_POST) { /* 检测验证码 TODO: */ - $this->checksafecode($mobile, $verify, false); + if (!$this->checksafecode($mobile, $verify)) { + $this->error('验证码错误'); + } $promote = M('promote', 'tab_')->where([ 'mobile_phone' => $mobile, 'level' => 1, @@ -341,41 +344,31 @@ class PublicController extends \Think\Controller */ public function telsafecode($phone = '', $delay = 10, $flag = true) { - $result = R('Common/Sms/send_sms_code', array($phone, $delay, false)); - - if ($result['code'] == 200) { + $taskClient = new TaskClient(); + $result = $taskClient->sendSms($phone); + $data = []; + if ($result['code'] == TaskClient::SUCCESS) { $data['status'] = 1; - $data['data'] = $result['data']; } else { $data['status'] = 0; } - - $data['msg'] = $result['msg']; - + $data['msg'] = $result['message']; echo json_encode($data); exit; } /** * 手机安全码验证 - * @param bool $flag true 用于直接异步请求 false 用于方法调用 - * @param [type] $vcode [description] */ - public function checksafecode($phone, $vcode, $flag = true) + public function checksafecode($phone, $code) { - $result = R('Common/Sms/verify_sms_code', array($phone, $vcode, false)); - - if ($result['code'] == 200) { - $data['status'] = 1; - if ($flag) { - echo json_encode($data); - exit; - } + $taskClient = new TaskClient(); + $result = $taskClient->checkSms($phone, $code); + $data = []; + if ($result && $result['code'] == TaskClient::SUCCESS) { + return true; } else { - $data['status'] = 0; - $data['msg'] = $result['msg']; - echo json_encode($data); - exit; + return false; } } From dbf04c25c5665468ffaa4ebfaf2742353ac18ddb Mon Sep 17 00:00:00 2001 From: sunke <18850253506@163.com> Date: Tue, 14 Jan 2020 20:48:55 +0800 Subject: [PATCH 28/50] =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Application/Home/Controller/PromoteController.class.php b/Application/Home/Controller/PromoteController.class.php index 4fe8c80d9..e08f08cdb 100644 --- a/Application/Home/Controller/PromoteController.class.php +++ b/Application/Home/Controller/PromoteController.class.php @@ -232,20 +232,20 @@ class PromoteController extends BaseController $this->assign("rules", $rules); $this->assign("rules_count", count($rules)); -// $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); -// $cacheKey = "pop:rule:set"; -// if (!$redis->sIsMember($cacheKey, get_pid())) { -// $currentTime = strtotime(date('Y-m-d')); -// $weekArray = [7,1,2,3,4,5,6]; -// $week = $weekArray[date("w")]; -// $match_rules = M("document_pop_rules") -// ->field('id') -// ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") -// ->order("sort asc, id desc") -// ->select(); -// } else { -// $match_rules = []; -// } + $redis = new \Org\RedisSDK\Redis(['host'=>'127.0.0.1','port'=>6379],[]); + $cacheKey = "pop:rule:set"; + if (!$redis->sIsMember($cacheKey, get_pid())) { + $currentTime = strtotime(date('Y-m-d')); + $weekArray = [7,1,2,3,4,5,6]; + $week = $weekArray[date("w")]; + $match_rules = M("document_pop_rules") + ->field('id') + ->where("(type = 1 and pop_time = {$currentTime}) or (type = 2 and pop_time = {$week})") + ->order("sort asc, id desc") + ->select(); + } else { + $match_rules = []; + } $this->assign("match_rules_id", $match_rules ? json_encode(array_column($match_rules, 'id')) : 'null'); From b7dd9c5b45866242fad7ab595573e611700fe761 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 14 Jan 2020 20:56:20 +0800 Subject: [PATCH 29/50] =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/View/default/Finance/withdrawRecord.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Home/View/default/Finance/withdrawRecord.html b/Application/Home/View/default/Finance/withdrawRecord.html index 88b4d3225..d604fb0bf 100644 --- a/Application/Home/View/default/Finance/withdrawRecord.html +++ b/Application/Home/View/default/Finance/withdrawRecord.html @@ -237,7 +237,7 @@