From 800680c6c0ae38770e1e635e777ca7599f108ace Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 3 Mar 2020 17:44:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=B5=84=E6=BA=90=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E5=AE=A1=E6=A0=B8=E9=AA=8C=E8=AF=81=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=8C=BA=E6=9C=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Common/extend.php | 6 +++--- .../Controller/TestResourceController.class.php | 6 +++--- .../Admin/Controller/TimingController.class.php | 12 +++++++----- Application/Home/Common/function.php | 6 +++--- .../Home/Controller/TestResourceController.class.php | 6 +++--- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 59106887a..19de23562 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2322,15 +2322,15 @@ function getrelationGameName($id) { * game_id=>游戏id, */ -function getAvailableBalance($promote_id=0,$game_id=0) { +function getAvailableBalance($promote_id=0,$game_id=0,$server_id=0) { - if (!$promote_id||!$game_id) { + if (!$promote_id||!$game_id||!$server_id) { return 0; } $availableBalanceData = M('promote_game_available_balance','tab_') ->field('available_balance') - ->where(['promote_id'=>$promote_id,'game_id'=>$game_id]) + ->where(['promote_id'=>$promote_id,'game_id'=>$game_id,'server_id'=>$server_id]) ->find(); return $availableBalanceData['available_balance']?$availableBalanceData['available_balance']:0; diff --git a/Application/Admin/Controller/TestResourceController.class.php b/Application/Admin/Controller/TestResourceController.class.php index ff8a89268..6ac905d6a 100644 --- a/Application/Admin/Controller/TestResourceController.class.php +++ b/Application/Admin/Controller/TestResourceController.class.php @@ -432,7 +432,7 @@ class TestResourceController extends ThinkController $data['create_time']=time(); $data['apply_type']=0; - $data = $this->checkAutoVerify($data, $resource, $i); + $data = $this->checkAutoVerify($data, $resource, 0); $model = M('test_resource', 'tab_')->add($data); $resource += $data['apply_resource']; @@ -490,7 +490,7 @@ class TestResourceController extends ThinkController } } else {//非新用户 - $availableBalance = getAvailableBalance($data['promote_id'],$data['game_id']); + $availableBalance = getAvailableBalance($data['promote_id'],$data['game_id'],$data['server_id']); // var_dump($availableBalance);die(); $promoteAllRecharge = sum_promote_total_money($data['promote_id']);//总充值量 @@ -515,7 +515,7 @@ class TestResourceController extends ThinkController $data['is_new'] = 2; M('promote_game_available_balance','tab_') - ->where(['promote_id'=>$data['promote_id'],'game_id'=>$data['game_id']]) + ->where(['promote_id'=>$data['promote_id'],'game_id'=>$data['game_id'],'server_id'=>$data['server_id']]) ->setDec('available_balance',$data['apply_resource']); } } diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 213a2e238..137324bfc 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -286,10 +286,10 @@ class TimingController extends AdminController { // var_dump($starttime);die(); $data = M('spend','tab_') - ->field("sum(`pay_amount`) as pay_amount,promote_id,promote_account,tab_spend.game_id,tab_spend.game_name,CASE WHEN old_value_ratio is NULL THEN 0 ELSE sum(`pay_amount`) * old_value_ratio END as available_balance") + ->field("sum(`pay_amount`) as pay_amount,promote_id,promote_account,tab_spend.game_id,tab_spend.game_name,tab_spend.server_id,tab_spend.server_name,CASE WHEN old_value_ratio is NULL THEN 0 ELSE sum(`pay_amount`) * old_value_ratio END as available_balance") ->join('left join tab_resource_verify_config as config on tab_spend.game_id = config.game_id') ->where(['pay_status'=>1,'pay_way'=>['egt',1],'pay_time'=>['between',[$start,$start+86399]]]) - ->group('promote_id,game_id') + ->group('promote_id,game_id,server_id') ->select(); // var_dump($data);die(); @@ -299,17 +299,19 @@ class TimingController extends AdminController { $insert['promote_account'] = $value['promote_account']; $insert['game_id'] = $value['game_id']; $insert['game_name'] = $value['game_name']; - $insert['available_balance'] = $value['available_balance']; + $insert['available_balance'] = round($value['available_balance'],0); + $insert['server_id'] = $value['server_id']; + $insert['server_name'] = $value['server_name']; $availableBalanceData = M('promote_game_available_balance','tab_') - ->where(['promote_id'=>$value['promote_id'],'game_id'=>$value['game_id']]) + ->where(['promote_id'=>$value['promote_id'],'game_id'=>$value['game_id'],'server_id'=>$value['server_id']]) ->find(); if (round($value['available_balance'],0) > 0 && !$availableBalanceData) { M('promote_game_available_balance','tab_')->add($insert); } else if (round($value['available_balance'],0) > 0 && $availableBalanceData) { M('promote_game_available_balance','tab_') - ->where(['promote_id'=>$value['promote_id'],'game_id'=>$value['game_id']]) + ->where(['promote_id'=>$value['promote_id'],'game_id'=>$value['game_id'],'server_id'=>$value['server_id']]) ->setInc('available_balance',round($value['available_balance'],0)); } // dump(round($value['available_balance'],0)); diff --git a/Application/Home/Common/function.php b/Application/Home/Common/function.php index 7b8f902f9..6a43b98fc 100644 --- a/Application/Home/Common/function.php +++ b/Application/Home/Common/function.php @@ -1308,15 +1308,15 @@ function recordPromoteLogs($module,$action_type) { * game_id=>游戏id, */ -function getAvailableBalance($promote_id=0,$game_id=0) { +function getAvailableBalance($promote_id=0,$game_id=0,$server_id=0) { - if (!$promote_id||!$game_id) { + if (!$promote_id||!$game_id||!$server_id) { return 0; } $availableBalanceData = M('promote_game_available_balance','tab_') ->field('available_balance') - ->where(['promote_id'=>$promote_id,'game_id'=>$game_id]) + ->where(['promote_id'=>$promote_id,'game_id'=>$game_id,'server_id'=>$server_id]) ->find(); return $availableBalanceData['available_balance']?$availableBalanceData['available_balance']:0; diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index 00d56d7b1..cae0bb858 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -428,7 +428,7 @@ class TestResourceController extends BaseController $data['create_time']=time(); $data['apply_type']=0; - $data = $this->checkAutoVerify($data, $resource, $i); + $data = $this->checkAutoVerify($data, $resource, 0); $model = M('test_resource', 'tab_')->add($data); $resource += $data['apply_resource']; if ($model) { @@ -480,7 +480,7 @@ class TestResourceController extends BaseController } } else {//非新用户 - $availableBalance = getAvailableBalance($data['promote_id'],$data['game_id']); + $availableBalance = getAvailableBalance($data['promote_id'],$data['game_id'],$data['server_id']); $promoteAllRecharge = sum_promote_total_money($data['promote_id']);//总充值量 $allVerifyValue = $promoteAllRecharge * $config['old_value_ratio'];//可充值总量 @@ -504,7 +504,7 @@ class TestResourceController extends BaseController $data['is_new'] = 2; M('promote_game_available_balance','tab_') - ->where(['promote_id'=>$data['promote_id'],'game_id'=>$data['game_id']]) + ->where(['promote_id'=>$data['promote_id'],'game_id'=>$data['game_id'],'server_id'=>$data['server_id']]) ->setDec('available_balance',$data['apply_resource']); }