Merge branch 'hotfix/test_resource_new' of wmtx/platform into release

优化代码
master
廖金灵 4 years ago committed by Gogs
commit 445ce2d976

@ -21,13 +21,24 @@ class GameApiController extends Think {
public function verify()
{
$batch = M('testing_resource_batch', 'tab_')->where(['id' => 3])->find();
$service = new TestingResourceService();
// $service->verify($batch);
$service->provide($batch);
$batches = M('testing_resource_batch', 'tab_')->where(['verify_status' => 0])->select();
foreach ($batches as $batch) {
$service->verify($batch);
}
}
public function provice() {
public function provide()
{
$service = new TestingResourceService();
$batches = M('testing_resource_batch', 'tab_')->where(['verify_status' => 1, 'provide_status' => 0])->select();
foreach ($batches as $batch) {
$service->provide($batch);
}
}
public function send()
{
$role = [
'role_id' => '6810778',
'user_account' => 'liaojl1130',

@ -105,22 +105,6 @@ class TestingResourceService
public function provideFromGameCat($order, $role)
{
var_dump([
'roleId' => $role['role_id'],
'amount' => $order['ref_amount'],
'supportItem' => $order['ref_id'],
'supportType' => '0',
'channelUid' => $role['user_account'],
'applyRemark' => $order['remark'],
'applyId' => $order['order_no'],
'device_type' => $role['sdk_version'] == 1 ? 'andriod' : 'ios',
]);
return [
'status' => true,
'message' => '发送成功',
'code' => 1,
];
$gameCatClient = new GameCatClient();
$result = $gameCatClient->api('provide', [
'roleId' => $role['role_id'],

@ -29,20 +29,22 @@ class TestingResourceController extends BaseController
$loginPromote = $this->getLoginPromote();
$conditions = [];
$subConditions = [];
if ($createTimeStart) {
$subConditions['create_time'] = ['egt', strtotime($createTimeStart . ' 00:00:00')];
}
if ($createTimeEnd) {
$subConditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')];
}
$subConditions = [
'_string' => '1=1'
];
/**
* @todo 仅有游戏猫
*/
$strCondition = 'game_id in (229, 230)';
if ($createTimeStart) {
$strCondition .= ' and create_time >=' . strtotime($createTimeStart . ' 00:00:00');
}
if ($createTimeEnd) {
$strCondition .= ' and create_time <=' . strtotime($createTimeEnd . ' 23:59:59');
}
$subSql = M('testing_user', 'tab_')->field(['user_id'])->where($subConditions)->select(false);
$strCondition .= ' and user_id in (' . $subSql . ')';
@ -275,10 +277,10 @@ class TestingResourceController extends BaseController
'_string' => 'exists (' . $subSql . ')'
];
if ($createTimeStart) {
$conditions['create_time'] = ['egt', strtotime($createTimeStart . ' 00:00:00')];
$conditions['_string'] .= ' and create_time >=' . strtotime($createTimeStart . ' 00:00:00');
}
if ($createTimeEnd) {
$conditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')];
$conditions['_string'] .= ' and create_time <=' . strtotime($createTimeEnd . ' 23:59:59');
}
if ($verifyStatus != -1) {
$conditions['verify_status'] = $verifyStatus;
@ -481,6 +483,10 @@ class TestingResourceController extends BaseController
$records = I('records', []);
$loginPromote = $this->getLoginPromote();
if ($loginPromote['level'] != 1) {
return $this->ajaxReturn(['status' => 0, 'message' => '权限不足']);
}
$resources = [];
/**
* @todo 目前仅限游戏猫
@ -522,6 +528,19 @@ class TestingResourceController extends BaseController
return $this->ajaxReturn(['status' => 0, 'message' => '角色不存在']);
}
$otherRoleBatch = M('testing_resource_batch', 'tab_')
->where([
'user_id' => $user['id'],
'game_id' => $gameId,
'server_id' => $server['server_id'],
'role_id' => ['neq', $roleId],
'verify_status' => ['in', [0, 1]],
])
->find();
if ($otherRoleBatch) {
return $this->ajaxReturn(['status' => 0, 'message' => '每个账号同区服只能申请一个角色']);
}
$testPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $role['promote_id']])->find();
if (is_null($testPromote) || !$promoteService->isSubOrSelf($testPromote, $loginPromote)) {
return $this->ajaxReturn(['status' => 0, 'message' => '测试角色所属推广员异常']);

@ -112,7 +112,7 @@
<?php endif;?>
<a href="{:U('Safe/promoteLogs')}" class="<if condition='CONTROLLER_NAME eq Safe and (ACTION_NAME eq promoteLogs or ACTION_NAME eq promoteLogs or ACTION_NAME eq promoteLogs or ACTION_NAME eq promoteLogs ) '>active</if> ">操作日志</a>
</div>
<?php if($loginer['level'] < 4):?>
<?php if($loginer['level'] == 1):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>测试资源</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('TestingResource/index')}" class="<if condition='CONTROLLER_NAME eq TestingResource and ACTION_NAME eq index '>active</if> ">测试资源申请</a>

@ -26,6 +26,9 @@
.normal_table td .status-2 {
color: #f56c6c;
}
.normal_table tr td {
padding: 10px 5px;
}
</style>
</block>
@ -134,9 +137,9 @@
<tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
<td style="word-wrap:break-word;">{$record.batch_no}</td>
<td>
<?=substr($record['create_time'], 0, 10)?>
<br>
<?=substr($record['create_time'], 10)?>
<?=substr($record['create_time'], 0, 10)?>
<br>
<?=substr($record['create_time'], 10)?>
</td>
<td>{$record.game_name}</td>
<td>{$record.server_name}</td>
@ -152,9 +155,9 @@
<span class="status-{$record.verify_status}">{$record.verify_status_text}</span>
</td>
<td>
<?=substr($record['verify_time'], 0, 10)?>
<br>
<?=substr($record['verify_time'], 10)?>
<?=substr($record['verify_time'], 0, 10)?>
<br>
<?=substr($record['verify_time'], 10)?>
</td>
<td>
<span class="status-{$record.provide_status}">{$record.provide_status_text}</span>

@ -79,6 +79,9 @@
padding: 0 24px 0 6px;
border: none;
}
.normal_table tr td {
padding: 10px 5px;
}
</style>
</block>
@ -108,14 +111,14 @@
<div class="form-group normal_space fr">
<label class="form-title select-title" style="margin-right: 9px;"></label>
<div class="select-time">
<input type="text" id="edate" class="txt" name="end" placeholder="结束时间" value="{:I('end')}" autocomplete="off">
<input type="text" id="edate" class="txt" name="create_time_end" placeholder="结束时间" value="{:I('create_time_end')}" autocomplete="off">
</div>
</div>
<div class="form-group normal_space fr">
<label class="form-title select-title">申请时间:</label>
<label class="form-title select-title">创建时间:</label>
<div class="select-time">
<input type="text" id="sdate" class="txt" name="start" placeholder="开始时间"
value="{:I('start')}" autocomplete="off">
<input type="text" id="sdate" class="txt" name="create_time_start" placeholder="开始时间"
value="{:I('create_time_start')}" autocomplete="off">
</div>
</div>
<div class="form-group normal_space fr">
@ -123,8 +126,8 @@
placeholder="角色名称" value="{:I('role_name')}" onKeyDown="webchat_chkkeysend(event);">
</div>
<div class="form-group normal_space fr">
<input type="text" name="user_account" class="txt normal_txt" id="uid" style="width:128px;"
placeholder="测试账号" value="{:I('user_account')}" onKeyDown="webchat_chkkeysend(event);">
<input type="text" name="account" class="txt normal_txt" id="uid" style="width:128px;"
placeholder="测试账号" value="{:I('account')}" onKeyDown="webchat_chkkeysend(event);">
</div>
<div class="form-group normal_space fr">
<span id="server_js">
@ -222,7 +225,11 @@
<td>{$record.today_amount}</td>
<td>{$record.apply_amount}</td>
<td>{$record.status}</td>
<td>{$record.create_time}</td>
<td>
<?=substr($record['create_time'], 0, 10)?>
<br>
<?=substr($record['create_time'], 10)?>
</td>
</tr>
</volist>
</empty>

@ -90,6 +90,9 @@
.normal_table td .status-2 {
color: #f56c6c;
}
.normal_table tr td {
padding: 10px 5px;
}
</style>
<div class="page-search normal_list promoteCoin-record-search" style="padding: 20px;">
<div class="trunk-content article">

Loading…
Cancel
Save