|
|
|
@ -426,7 +426,7 @@ class TestResourceController extends BaseController
|
|
|
|
|
|
|
|
|
|
$data['create_time']=time();
|
|
|
|
|
$data['apply_type']=0;
|
|
|
|
|
|
|
|
|
|
$data = $this->checkAutoVerify($data);
|
|
|
|
|
$model = M('test_resource', 'tab_')->add($data);
|
|
|
|
|
if ($model) {
|
|
|
|
|
session('apply_status', 1);
|
|
|
|
@ -449,6 +449,39 @@ class TestResourceController extends BaseController
|
|
|
|
|
$this->display();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*判断申请资源是否自动审核
|
|
|
|
|
*/
|
|
|
|
|
private function checkAutoVerify($data)
|
|
|
|
|
{
|
|
|
|
|
$config = M('resource_verify_config', 'tab_')
|
|
|
|
|
->where(['game_id' => $data['game_id']])
|
|
|
|
|
->find();
|
|
|
|
|
if ($config) {//已存在该游戏的资源审核配置
|
|
|
|
|
$isOldUser = M('test_resource', 'tab_')
|
|
|
|
|
->where(['user_id' => $data['user_id']])
|
|
|
|
|
->count();
|
|
|
|
|
if (!$isOldUser) {//未申请过测试资源的新用户
|
|
|
|
|
//申请资源数量在最低额度和最高额度之间,自动审核
|
|
|
|
|
if ($data['apply_resource'] >= $config['new_low_value'] && $data['apply_resource'] <= $config['new_high_value']) {
|
|
|
|
|
$data['verify_remark'] = '自动审核';
|
|
|
|
|
$data['verify_time'] = time();
|
|
|
|
|
$data['apply_status'] = 2;
|
|
|
|
|
}
|
|
|
|
|
} else {//已申请过测试资源(非新用户)
|
|
|
|
|
$promoteAllRecharge = sum_promote_total_money($data['promote_id']);//总充值量
|
|
|
|
|
$autoVerifyValue = $promoteAllRecharge * $config['old_value_ratio'];
|
|
|
|
|
if ($data['apply_resource'] <= $autoVerifyValue) {
|
|
|
|
|
$data['verify_remark'] = '自动审核';
|
|
|
|
|
$data['verify_time'] = time();
|
|
|
|
|
$data['apply_status'] = 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改申请
|
|
|
|
|
public function apply_edit(){
|
|
|
|
|
$user=M('user','tab_')->field('password')->where(['account'=>I('user_account')])->find();
|
|
|
|
|