Merge pull request '测试资源' (#244) from hotfix/testing_resource_over_bug into release

Reviewed-on: http://8.136.139.249:3000/wmtx/platform/pulls/244
master
廖金灵 4 years ago
commit de83318ee8

@ -24,16 +24,16 @@ class SubCompanyStatementSetController extends Controller {
echo "请先设置请求接口aggregate_cp_settlement_api的值".PHP_EOL;die;
}
$this->cpapihost = $cpapihost['value'];
$this->synGame();
// $this->synGame();
}
//同步游戏表
protected function synGame()
{
$mainGame = M("Game","tab_")->select();
SM()->execute("truncate table tab_game");
M("game","tab_",SUBSITE_DB)->addAll($mainGame);
}
// protected function synGame()
// {
// $mainGame = M("Game","tab_")->select();
// SM()->execute("truncate table tab_game");
// M("game","tab_",SUBSITE_DB)->addAll($mainGame);
// }
/**
* Undocumented function
*
@ -258,7 +258,6 @@ class SubCompanyStatementSetController extends Controller {
$statement_begin_time = date("Y.m.d",$begintime);
$statement_end_time = date("Y.m.d",$endtime);
$MainStatementDb = M("CompanyStatement","tab_"); //主站结算单
// dd($cpList);
foreach($cpList as $k=>$v){
//
$sub_company_id = ($v['first_company_type'] == 1 ? $v['first_company_id'] : $v['second_company_id']);
@ -277,10 +276,13 @@ class SubCompanyStatementSetController extends Controller {
if(isset($v['list'][$igm])){
$add_data['statement_info'][$index]['platform_money'] = $v['list'][$igm]['platform_money'];
$add_data['statement_info'][$index]['aggregate_money'] = $v['list'][$igm]['aggregate_money'];
$add_data['statement_info'][$index]['ratio'] = $add_data['statement_info'][$index][$ratio_str];
$game_pay_amount = $v['list'][$igm]['platform_money']-0+$v['list'][$igm]['aggregate_money'];
$ratio = getGameCpRadio($item['relation_game_id'], $game_pay_amount, true) - 0;
$add_data['statement_info'][$index]['ratio'] = $ratio;
}else{
$add_data['statement_info'][$index]['platform_money'] = 0;
$add_data['statement_info'][$index]['aggregate_money'] = 0;
$add_data['statement_info'][$index]['ratio'] = 0;
}
}
unset($add_data['id'],$add_data['remark'],$add_data['confirm_status'],$add_data['confirm_log']);

@ -13,7 +13,7 @@ use Base\Service\GameService;
class TestingResourceController extends ThinkController
{
public function index()
public function roles()
{
$params = I('get.');
$gameId = $params['game_id'] ?? 0;
@ -458,6 +458,7 @@ class TestingResourceController extends ThinkController
->find();
if ($bindingRole) {
$bindingRole['binding_time'] = $binding['create_time'];
$bindingRole['share_game_ids'] = $gameIds;
}
}
@ -467,7 +468,6 @@ class TestingResourceController extends ThinkController
$hasItf = $gameSetting ? $gameSetting['has_itf'] : 0;
}
$testingResourceService = new TestingResourceService();
$quota = $testingResourceService->getRemainQuota($role, $bindingRole);

@ -692,7 +692,7 @@ body {
success: function(result){
if (result.status == 1) {
layer.msg(result.message, function(){
parent.window.location.href = "{:U('index')}"
parent.window.location.href = "{:U('roles')}"
})
} else {
layer.msg(result.message)

@ -66,7 +66,7 @@
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">测试账号</h3>
<h3 class="page_title">测试账号角色</h3>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
@ -127,7 +127,7 @@
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/index')}">搜索</a>
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/roles')}">搜索</a>
</div>
</div>
</div>
@ -273,7 +273,7 @@
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('TestingResource/index')}");
highlight_subnav("{:U('TestingResource/roles')}");
$(function(){
// 全局变量声明
var base_quota = 0;

@ -412,9 +412,27 @@ class TestingResourceRepository
$spendItems = [];
if (count($bindingRoles) > 0) {
$games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($bindingRoles, 'game_id')]])->select();
$revGameIdMap = [];
$gameIdMap = [];
foreach ($games as $game) {
if ($game['data_share'] == 1) {
$baseGame = $gameRepository->getBaseGameByGameId($game['id'], $baseGames);
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
$gameIdMap[$game['id']] = $gameIds;
foreach ($gameIds as $gameId) {
$revGameIdMap[$gameId] = $game['id'];
}
} else {
$gameIdMap[$game['id']] = [$game['id']];
$revGameIdMap[$game['id']] = $game['id'];
}
}
$spendOrWhere = [];
foreach ($bindingRoles as $bindingRole) {
$spendOrWhere[] = '(game_player_id="' . $bindingRole['role_id'] . '" and game_id=' . $bindingRole['game_id'] . ')';
$gameIds = $gameIdMap[$bindingRole['game_id']];
$spendOrWhere[] = '(game_player_id="' . $bindingRole['role_id'] . '" and game_id in (' . implode(',', $gameIds) . '))';
}
$spendCondition = [
'pay_status' => 1,
@ -440,7 +458,13 @@ class TestingResourceRepository
->group('game_id,game_player_id')
->select();
foreach ($spendList as $item) {
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
$mainGameId = $revGameIdMap[$item['game_id']];
$itemKey = $this->getGameRoleId($mainGameId, $item['game_player_id']);
if (isset($spendItems[$itemKey])) {
$spendItems[$itemKey] += $item['amount'];
} else {
$spendItems[$itemKey] = $item['amount'];
}
}
}
$gameSettings = $this->getGameSettings();

@ -158,9 +158,9 @@ class TestingResourceService
$totalQuota = $role['testing_other_quota'] + ($gameSetting['base_quota'] ?? 0);
if (!is_null($bindRole)) {
$bindTime = $bindRole['binding_time'] ?? 0;
$gameIds = $bindRole['share_game_ids'];
$spendMap = [
'game_id' => $role['game_id'],
'game_id' => ['in', $gameIds],
'game_player_id' => $bindRole['role_id'],
'pay_status' => 1,
'pay_time' => ['egt', strtotime(date('Y-m-d 00:00:00', $bindTime))]
@ -457,6 +457,7 @@ class TestingResourceService
if (is_null($bindingRole)) {
throw new \Exception('绑定玩家角色不存在');
}
$bindingRole['share_game_ids'] = $gameIds;
$bindingRole['binding_time'] = $binding['create_time'];
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindingRole['promote_id']])->find();
if (is_null($bindPromote) || ($permissionPromote && !$promoteService->isSubOrSelf($bindPromote, $permissionPromote))) {

@ -154,6 +154,7 @@ class TestingResourceController extends BaseController
->find();
if ($bindingRole) {
$bindingRole['binding_time'] = $binding['create_time'];
$bindingRole['share_game_ids'] = $gameIds;
}
}

Loading…
Cancel
Save