测试资源申请审核验证增加区服

master
zhengyongxing 5 years ago
parent d6db0d3789
commit 800680c6c0

@ -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;

@ -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']);
}
}

@ -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));

@ -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;

@ -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']);
}

Loading…
Cancel
Save