From a7c80b84c27895c35d265f1632b8ab0c51f42fc2 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 2 Dec 2019 17:08:27 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=9A=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E6=8E=A8=E5=B9=BF=E5=91=98=E6=95=B0=E6=8D=AE=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AutoController.class.php | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php index a3a75f42a..4ccc0022e 100644 --- a/Application/Admin/Controller/AutoController.class.php +++ b/Application/Admin/Controller/AutoController.class.php @@ -955,4 +955,82 @@ public function auto_rrdae(){ } } } + + //用户推广员数据刷新 + public function updateUserPromoteAccount() + { + $map['promote_id'] = ['gt', 0]; + $map['_string'] = "promote_account = '' or promote_account = '自然注册' or promote_account = '官方渠道' or promote_account is NULL"; + $userData = M('user', 'tab_')->field('id,promote_id')->where($map)->select(); + $userPlayData = M('user_play', 'tab_')->field('id,promote_id')->where($map)->select(); + $userPlayInfoData = M('user_play_info', 'tab_')->field('id,promote_id')->where($map)->select(); + $promoteData = []; + + $userModel = 'tab_user'; + $userRet = $this->updateUserPromoteAccountSql($userModel, $userData, $promoteData); + $userSuccess = $userRet['success']; + $userError = $userRet['error']; + $userErrorData = empty($userRet['error_data']) ? '' : implode(',', $userRet['error_data']); + $promoteData = $userRet['promote_data']; + $userAll = count($userData); + unset($userData); + + $userPlayModel = 'tab_user_play'; + $userPlayRet = $this->updateUserPromoteAccountSql($userPlayModel, $userPlayData, $promoteData); + $userPlaySuccess = $userPlayRet['success']; + $userPlayError = $userPlayRet['error']; + $userPlayErrorData = empty($userPlayRet['error_data']) ? '' : implode(',', $userPlayRet['error_data']); + $promoteData = $userPlayRet['promote_data']; + $userPlayAll = count($userPlayData); + unset($userPlayData); + + $userPlayInfoModel = 'tab_user_play_info'; + $userPlayInfoRet = $this->updateUserPromoteAccountSql($userPlayInfoModel, $userPlayInfoData, $promoteData); + $userPlayInfoSuccess = $userPlayInfoRet['success']; + $userPlayInfoError = $userPlayInfoRet['error']; + $userPlayInfoErrorData = empty($userPlayInfoRet['error_data']) ? '' : implode(',', $userPlayInfoRet['error_data']); + $promoteData = $userPlayInfoRet['promote_data']; + $userPlayInfoAll = count($userPlayInfoData); + unset($userPlayInfoData); + + echo $userModel . ":all--{$userAll} success--{$userSuccess} error--{$userError} error_ids--{$userErrorData}"; + echo '
'; + echo $userPlayModel . ":all--{$userPlayAll} success--{$userPlaySuccess} error--{$userPlayError} error_ids--{$userPlayErrorData}"; + echo '
'; + echo $userPlayInfoModel . ":all--{$userPlayInfoAll} success--{$userPlayInfoSuccess} error--{$userPlayInfoError} error_ids--{$userPlayInfoErrorData}"; + echo '
'; + } + + private function updateUserPromoteAccountSql($model, $data = [], $promoteData = []) + { + $success = 0; + $error = 0; + $errorData = []; + foreach ($data as &$list) { + if (isset($promoteData[$list['promote_id']])) { + $promoteAccount = $promoteData[$list['promote_id']]; + } else { + $promoteAccount = M('promote', 'tab_')->where(array('id' => $list['promote_id']))->getField('account'); + $promoteAccount = empty($promoteAccount) ? '未知推广员' : $promoteAccount; + $promoteData[$list['promote_id']] = $promoteAccount; + } + + $res = M()->query("update `$model` set promote_account = '{$promoteAccount}' where id = {$list['id']}"); + if ($res === false) { + $error++; + $errorData = $list['id']; + } else { + $success++; + } + unset($list); + } + + $ret = [ + 'success' => $success, + 'error' => $error, + 'error_data' => $errorData, + 'promote_data' => $promoteData, + ]; + return $ret; + } } From eb8afe99ff2e1280940ad9903dd34f720413b65e Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 2 Dec 2019 17:11:30 +0800 Subject: [PATCH 2/3] =?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->=E8=B4=A2=E5=8A=A1?= =?UTF-8?q?=E7=AE=A1=E7=90=86-=E7=BB=93=E7=AE=97=E6=98=8E=E7=BB=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/settlementDtl.html | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Application/Home/View/default/Finance/settlementDtl.html b/Application/Home/View/default/Finance/settlementDtl.html index 70b0f92af..f8aecb696 100644 --- a/Application/Home/View/default/Finance/settlementDtl.html +++ b/Application/Home/View/default/Finance/settlementDtl.html @@ -182,13 +182,8 @@ -- -- {$total.pay_amount} - - 0.00 - {$total.pay_amount} - - {$total.pay_amount} - 0.00 - + {$total.direct_pay_amount} + {$total.inner_pay_amount} -- {$total.income} -- From 04920395d5a18bf772945701358c4dd363b9ef22 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Mon, 2 Dec 2019 17:13:31 +0800 Subject: [PATCH 3/3] =?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->=E5=85=85=E5=80=BC?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6--=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Home/Controller/QueryController.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Home/Controller/QueryController.class.php b/Application/Home/Controller/QueryController.class.php index f7e04a452..2c2a84c8b 100644 --- a/Application/Home/Controller/QueryController.class.php +++ b/Application/Home/Controller/QueryController.class.php @@ -1828,7 +1828,7 @@ class QueryController extends BaseController $field = $fieldUC . ',' . $fieldUI; $subQuery = M('user_play_data_count', 'tab_')->alias('uc') ->field($field) - ->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') + ->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') ->where($map) ->group('uc.role_id,uc.server_id,uc.game_id') ->buildSql(); @@ -1837,7 +1837,7 @@ class QueryController extends BaseController ->order($orderBy); $total = M('user_play_data_count', 'tab_')->alias('uc') ->field($fieldUC) - ->join('tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') + ->join('left join tab_user_play_info as ui on ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id') ->where($map) ->find();