|
|
|
@ -34,14 +34,19 @@ class TestingResourceController extends BaseController
|
|
|
|
|
$subConditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @todo 仅有游戏猫
|
|
|
|
|
*/
|
|
|
|
|
$strCondition = 'game_id in (229, 230)';
|
|
|
|
|
|
|
|
|
|
$subSql = M('testing_user', 'tab_')->field(['user_id'])->where($subConditions)->select(false);
|
|
|
|
|
$strCondition = 'user_id in (' . $subSql . ')';
|
|
|
|
|
$strCondition .= ' and user_id in (' . $subSql . ')';
|
|
|
|
|
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
$strCondition .= ' and promote_id in (' . $promoteService->subInSql($loginPromote) . ')';
|
|
|
|
|
|
|
|
|
|
if ($account) {
|
|
|
|
|
$user = M('user', 'tab_')->field(['id'])->where('account like ' . $account . '%')->find();
|
|
|
|
|
$user = M('user', 'tab_')->field(['id'])->where('account like "' . $account . '%"')->find();
|
|
|
|
|
if ($user) {
|
|
|
|
|
$conditions['user_id'] = $user['id'];
|
|
|
|
|
} else {
|
|
|
|
@ -196,8 +201,10 @@ class TestingResourceController extends BaseController
|
|
|
|
|
|
|
|
|
|
public function batches()
|
|
|
|
|
{
|
|
|
|
|
$provideTimeStart = I('provide_time_start', '');
|
|
|
|
|
$provideTimeEnd = I('provide_time_end', '');
|
|
|
|
|
$gameId = I('game_id', 0);
|
|
|
|
|
$serverId = I('server_id', '');
|
|
|
|
|
$createTimeStart = I('create_time_start', '');
|
|
|
|
|
$createTimeEnd = I('create_time_end', '');
|
|
|
|
|
$verifyStatus = I('verify_status', -1);
|
|
|
|
|
$provideStatus = I('provide_status', -1);
|
|
|
|
|
$account = I('account');
|
|
|
|
@ -212,11 +219,11 @@ class TestingResourceController extends BaseController
|
|
|
|
|
$conditions = [
|
|
|
|
|
'_string' => 'exists (' . $subSql . ')'
|
|
|
|
|
];
|
|
|
|
|
if ($provideTimeStart) {
|
|
|
|
|
$conditions['provide_time'] = ['egt', strtotime($provideTimeStart . ' 00:00:00')];
|
|
|
|
|
if ($createTimeStart) {
|
|
|
|
|
$conditions['create_time'] = ['egt', strtotime($createTimeStart . ' 00:00:00')];
|
|
|
|
|
}
|
|
|
|
|
if ($provideTimeEnd) {
|
|
|
|
|
$conditions['provide_time'] = ['elt', strtotime($provideTimeEnd . ' 23:59:59')];
|
|
|
|
|
if ($createTimeEnd) {
|
|
|
|
|
$conditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')];
|
|
|
|
|
}
|
|
|
|
|
if ($verifyStatus != -1) {
|
|
|
|
|
$conditions['verify_status'] = $verifyStatus;
|
|
|
|
@ -224,8 +231,14 @@ class TestingResourceController extends BaseController
|
|
|
|
|
if ($provideStatus != -1) {
|
|
|
|
|
$conditions['provide_status'] = $provideStatus;
|
|
|
|
|
}
|
|
|
|
|
if ($gameId) {
|
|
|
|
|
$conditions['game_id'] = $gameId;
|
|
|
|
|
}
|
|
|
|
|
if ($serverId) {
|
|
|
|
|
$conditions['server_id'] = $serverId;
|
|
|
|
|
}
|
|
|
|
|
if ($account) {
|
|
|
|
|
$user = M('user', 'tab_')->field(['id'])->where('account like ' . $account . '%')->find();
|
|
|
|
|
$user = M('user', 'tab_')->field(['id'])->where('account like "' . $account . '%"')->find();
|
|
|
|
|
if ($user) {
|
|
|
|
|
$conditions['user_id'] = $user['id'];
|
|
|
|
|
} else {
|
|
|
|
@ -360,7 +373,7 @@ class TestingResourceController extends BaseController
|
|
|
|
|
->sum('provide_amount');
|
|
|
|
|
$providingQuota = M('testing_resource_batch', 'tab_')
|
|
|
|
|
->where(['verify_status' => [in, [0, 1]], 'provide_status' => 0, 'game_id' => $gameId, 'role_id' => $testingRoleId])
|
|
|
|
|
->sum('provide_amount');
|
|
|
|
|
->sum('apply_amount');
|
|
|
|
|
return round(floatval($totalQuota) - floatval($providedQuota) - floatval($providingQuota), 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -481,11 +494,17 @@ class TestingResourceController extends BaseController
|
|
|
|
|
} else {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '含有资源内容不存在']);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @todo 游戏猫只能每个资源数量只能为1
|
|
|
|
|
*/
|
|
|
|
|
if ($record['num'] != 1) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '该游戏每次申请单项资源数量只能为1']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$remainQuota = $this->getRemainQuota($bindingRole['game_id'], $bindingRole['role_id'], $role['role_id']);
|
|
|
|
|
if ($amount > $remainQuota) {
|
|
|
|
|
// return $this->ajaxReturn(['status' => 0, 'message' => '额度不足']);
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '额度不足']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$batchNo = date('YmdHis') . substr(md5($loginPromote['id'] . strval(microtime(true)) . rand(0, 9999)), 8, 16);
|
|
|
|
|