diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 9573b6724..f805affa4 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2316,4 +2316,40 @@ function getrelationGameName($id) { } +/** + * 操作日志 + * uid=>用户id, + * radio=>游戏比例, + */ + +function getAvailableBalance($uid,$radio=0) { + + if (!$uid) { + return 0; + } + + $promoteId = M('user','tab_')->field('promote_id')->where(['id'=>$uid])->find()['promote_id']; + +// $spendData = M('spend','tab_') +// ->field("date_format(FROM_UNIXTIME( pay_time),'%Y-%m-%d') AS time,sum(`pay_amount`)*{$radio} as pay_amount") +// ->where(['promote_id'=>$promoteId,'pay_status'=>1,'pay_way'=>['egt',1]]) +// ->group('time') +// ->select(); + + $spend = M('spend','tab_') + ->field("sum(`pay_amount`)*{$radio} as pay_amount") + ->where(['promote_id'=>$promoteId,'pay_status'=>1,'pay_way'=>['egt',1]]) + ->find()['pay_amount']; + + $applyResource = M('test_resource','tab_') + ->field('sum(`apply_resource`) as apply_resource') + ->where(['promote_id'=>$promoteId,'apply_status'=>2]) + ->find()['apply_resource']; + + + return ($spend?$spend:0)-($applyResource?$applyResource:0); + +} + + ?> diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index fdc499589..2c71e7f53 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -14,6 +14,8 @@ class MemberController extends ThinkController *玩家列表信息 */ public function user_info($p=0){ + + getAvailableBalance(34,0.5); //设定默认时间 // if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){ // $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d'))); @@ -134,7 +136,7 @@ class MemberController extends ThinkController $data = M("user","tab_") ->field("tab_user.id,`device_number`,count(`device_number`) as device_count,`age_status`,`account`,`balance`,`gold_coin`,`alipay`,tab_user.promote_id,`register_type`,tab_user.promote_account,`register_time`,`lock_status`,lock_remark,`register_way`,`register_ip`,`login_time`,`check_status`,IFNULL(sum(ss.pay_amount), 0) AS recharge_total") ->where($map) - ->group("tab_user.id,device_number,tab_user.promote_id") + ->group("tab_user.id,device_number,tab_user.promote_id,tab_user.login_ip") // ->page($page, $row) ->order($order); @@ -172,7 +174,7 @@ class MemberController extends ThinkController $userRepeat = M("user","tab_") ->field("count(`device_number`) as device_count") ->where($map) - ->group("tab_user.id,device_number,tab_user.promote_id") + ->group("tab_user.id,device_number,tab_user.promote_id,tab_user.login_ip") // ->page($page, $row) ->order($order); diff --git a/Application/Home/Controller/TestResourceController.class.php b/Application/Home/Controller/TestResourceController.class.php index e6dc2f37f..23888a063 100644 --- a/Application/Home/Controller/TestResourceController.class.php +++ b/Application/Home/Controller/TestResourceController.class.php @@ -479,6 +479,9 @@ class TestResourceController extends BaseController $data['is_new'] = 1; } } else {//非新用户 + + $availableBalance = getAvailableBalance($data['user_id'],$config['old_value_ratio']); + $promoteAllRecharge = sum_promote_total_money($data['promote_id']);//总充值量 $allVerifyValue = $promoteAllRecharge * $config['old_value_ratio'];//可充值总量 //已用资源(申请通过的) @@ -493,7 +496,7 @@ class TestResourceController extends BaseController $used_resource = $used_resource ?: 0; $usable_resource = $allVerifyValue - $used_resource;//小于等于这个值自动审核 $usable_resource -= $resource; - if ($data['apply_resource'] <= $usable_resource) { + if ($data['apply_resource'] <= $usable_resource&&$data['apply_resource']<$availableBalance) { $data['verify_remark'] = '自动审核'; $data['verify_resource']= $data['apply_resource']; $data['verify_time'] = time();