Merge branch 'feature/finance_statement_three' of wmtx/platform into release

优化下游公司多比例结算
master
陈志 4 years ago committed by Gogs
commit ce32492445

@ -2,11 +2,11 @@
namespace Admin\Controller;
use Think\Controller;
use Think\Exception;
/**
* 系统任务接口
* @author cz
* TODO: 罚款的游戏没有流水不统计补点为0 无法重算
*/
class CmdTasksController extends Controller {
@ -16,12 +16,11 @@ class CmdTasksController extends Controller {
if(!$params){
echo('暂无任务');
}
$taskid = $params['id'];
$cmd = $params['params'];
$cmd = str_replace('{$taskid}',$taskid,$cmd);
try {
system($cmd);
} catch (\Exception $e) {
exec($params['params'], $resArr, $status);
$result = json_encode($resArr,JSON_UNESCAPED_UNICODE);
D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 2, 'end_time' => time(), 'result' => $result]);
} catch (Exception $e) {
D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]);
}
}

@ -537,16 +537,16 @@ class CompanyStatementSetController extends Controller {
$pc =[];
$Promote = M("Promote","tab_");
foreach ($tmpp as $v) {
//获取会长的支付宝账号
$p_map = [
"company_id"=>$v['id'],
"withdraw_done"=>1
];
$pres = $Promote->field("alipay_account,alipay_real_name")->where($p_map)->find();
if(!empty($pres) && !empty($pres['alipay_account']) && !empty($pres['alipay_real_name'])){
$v['ali_user'] = $pres['alipay_real_name'];
$v['ali_account'] = $pres['alipay_account'];
}
// //获取会长的支付宝账号
// $p_map = [
// "company_id"=>$v['id'],
// "withdraw_done"=>1
// ];
// $pres = $Promote->field("alipay_account,alipay_real_name")->where($p_map)->find();
// if(!empty($pres) && !empty($pres['alipay_account']) && !empty($pres['alipay_real_name'])){
// $v['ali_user'] = $pres['alipay_real_name'];
// $v['ali_account'] = $pres['alipay_account'];
// }
if($v['has_ratio']){
$v['turnover_ratio'] = json_decode($v['turnover_ratio'],true);
}
@ -562,7 +562,9 @@ class CompanyStatementSetController extends Controller {
}
unset($tmpp);
unset($js_id);
$this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
$this->getPromoteCompanySpend($pcList,array_unique(array_keys($pcList)),$begintime,$endtime);
//数据整合
$verify_log=json_encode(["create_user"=>"system","create_time"=>date("Y-m-d H:i:s")]);
$StatementDb = M("CompanyStatement","tab_");
@ -614,43 +616,85 @@ class CompanyStatementSetController extends Controller {
$company_belong = $pc[$add_data['company_id']]['company_belong'];
$add_data['company_belong']=$company_belong;
$add_data['company_type']=$pc[$add_data['company_id']]['company_type'];
if(!isset($v['list'])){continue;}
//游戏统计
foreach($v['list'] as $ke=>$va){
if(!isset($v['game_list'])){continue;}
//获取多段比例
$game_ratio_list = D("CompanyGameRatio")->getPromoteCompanyGameRatio($add_data['company_id'],$v['game_ids'],$begintime,$endtime,$company_belong);
foreach ($game_ratio_list as $t_game_id => $t_game_ratio) {
$game =[];
$game['pay_amount'] =$va['pay_amount'];
$game['game_name'] =$va['game_name'];
//获取比例
$game['relation_game_id']=$va['relation_game_id'];
if($type == 1){
$tratio = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],false,$company_belong);
}else{
//补点
$tratio1 = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong);;
$tratio2 = getGamePromoteCompanyRadio($add_data['company_id'],$va['relation_game_id'],$endtime,$va['pay_amount'],false,$company_belong);
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
}
$tratio = $tratio-0;
if($v['type'] == 2){
$game['increment_ratio']=$tratio;
}else{
$game['ratio']=$tratio;
}
$add_data['pay_amount'] += $va['pay_amount'];
$game['game_name'] =$v['game_list'][$t_game_id]['game_name'];
$game['relation_game_id'] =$v['game_list'][$t_game_id]['relation_game_id'];
$game_all_payment = $v['game_list'][$t_game_id]['pay_amount'];
// dump($tratio);
$game['fax_ratio']=$fax_ratio-0;
$game['statement_type']=0;
$game['sum_money']=round($va['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
$add_data['statement_money'] += $game['sum_money'];
if(count($t_game_ratio) == 1){
$tmp_game_ratio = $t_game_ratio[0];
$game['pay_amount'] =$game_all_payment;
$game['pay_amount'] -=0;
$game['statement_begin_time']=$statement_begin_time;
$game['statement_end_time']=$statement_end_time;
$add_data['pay_amount'] += $game['pay_amount'];
$game['fax_ratio']=$fax_ratio;
if($type == 1){
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $t_game_ratio['ratio'];
}else{
//补点
$tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
}
if($v['type'] == 2){
$game['increment_ratio']=$tratio;
}else{
$game['ratio']=$tratio;
}
$game['statement_begin_time']=$statement_begin_time;
$game['statement_end_time']=$statement_end_time;
$game['statement_type']=0;
$add_data['statement_info'][] = $game;
$game['sum_money']=round($game['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
$add_data['statement_money'] += $game['sum_money'];
$add_data['statement_info'][] = $game;
}else{
// dd($t_game_ratio);
for ($i=0; $i < count($t_game_ratio); $i++) {
$tmp_game_ratio = $t_game_ratio[$i];
$temp_game = $game;
$temp_game['statement_begin_time']=date("Y.m.d",$tmp_game_ratio['begintime']);
$temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']);
// dd($t_game_id);
$temp_game['pay_amount'] =$this->getRelationGameIdSpend($add_data['company_id'],$t_game_id,$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']);
$temp_game['pay_amount'] -=0;
$add_data['pay_amount'] += $temp_game['pay_amount'];
if($type == 1){
$tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = $t_game_ratio['ratio'];
}else{
//补点
$tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']);
$tratio2 =$tmp_game_ratio['ratio'];
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){ continue;}
}
if($v['type'] == 2){
$temp_game['increment_ratio']=$tratio;
}else{
$temp_game['ratio']=$tratio;
}
$temp_game['sum_money']=round($temp_game['pay_amount']*$tratio*(100-$fax_ratio)/(100*100),2);//结算金额=平台总额*(分成比例+补点比例)*(1-税费费率)
$add_data['statement_money'] += $temp_game['sum_money'];
$add_data['statement_info'][] = $temp_game;
}
}
}
$add_data['platform_amount'] = $add_data['pay_amount'];
if($type < 2){
@ -789,9 +833,10 @@ class CompanyStatementSetController extends Controller {
foreach($res as $k=>$v){
$pcList[$k]["pay_amount"] = $v['pay_amount'];
unset($v['pay_amount']);
$pcList[$k]['list'] = $v;
$pcList[$k]['game_list'] = $v;
$pcList[$k]['game_ids'] = implode(",",array_keys($pcList[$k]['game_list']));
}
}
//获取推广公司推广金额
protected function getPuPromoteSpend(&$pcList,$idarr,$begintime,$endtime){
@ -980,7 +1025,6 @@ class CompanyStatementSetController extends Controller {
$pc[$v['id']]['is_payment']=$pcList[$v['id']]['is_payment'];
}
unset($tmpp);
// $this->getPromoteCompanySpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
$this->getPuPromoteSpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
@ -1261,8 +1305,6 @@ class CompanyStatementSetController extends Controller {
}
/**
* 获取公司奖罚
* @param [type] $paymount 支付金额
* @param [type] $turnover_ratio 梯度
*/
protected function getPromoteUserRewardRecord($cpmpamy_id,$begintime,$endtime)
{
@ -1286,7 +1328,60 @@ class CompanyStatementSetController extends Controller {
}else{
$rfres;
}
}
/**
* 获取比例
*
* @param [type] $amount 总额
* @param [type] $ratio 默认比例
* @param [type] $turnover_ratio 比例梯度
* @return void
*/
protected function getTurnoverRatio($amount,$ratio,$turnover_ratio)
{
if(empty($turnover_ratio)){
return $ratio;
}
if(!is_array($turnover_ratio)){
$turnover_ratio = json_decode($turnover_ratio,true);
}
foreach($turnover_ratio as $k=>$v){
if($v['instanceof'] == 1){
if($amount >= $v['turnover']){
$ratio = $v['ratio'];
}
}else{
if($amount > $v['turnover']){
$ratio = $v['ratio'];
}
}
}
return $ratio;
}
protected function getRelationGameIdSpend($company_id,$relation_game_id,$begintime,$endtime)
{
$res = [];
//获取推广员
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
];
$company_id = $company_id;
$pres = $Promote->field("group_concat(id) ids,count(id) count")->where("company_id = '{$company_id}'")->group("company_id")->find();
if($pres['count'] ==0 ){return 0;}
$spenMap['s.promote_id']=["in",$pres['ids']];
//游戏
$game_id = D("Game")->changeRelationGameidToGameid($relation_game_id);
// dd($game_id);
$spenMap['s.game_id'] =['in',$game_id];
//获取支付记录
$pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find();
return $pay_amount['pay_amount'] ?? 0;
}
/**

@ -43,7 +43,7 @@ class FinancialSummaryController extends AdminController
public function updateStatement()
{
$temp = date('Y',time()).'-'.(date('m',time())-1);
$params = "cd ".ROOTTTTT.";php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
$params = "php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
$r = D("CmdTasks")->addTask("FinancialSummary",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);

@ -1,5 +1,6 @@
<?php
namespace Admin\Controller;
use Think\Exception;
/**
* 游戏流水聚合接口
@ -36,12 +37,6 @@ class FinancialSummarySetController extends \Think\Controller
$this->GameSupersignModel = M("GameSupersign",'tab_');
$this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表
$this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入
$taskid = I("taskid");
if(!empty($taskid)){
$this->taskid = $taskid;
}
}
/**
* 更新某月数据
@ -63,9 +58,6 @@ class FinancialSummarySetController extends \Think\Controller
$this->reCount();
$this->setFinancialSummary();
if($this->taskid){
D("CmdTasks")->updateTask(['id'=>$this->taskid,'status'=>2,'end_time' => time(), 'result' =>$this->result]);
}
}
/**
* 强制重新聚合
@ -95,11 +87,7 @@ class FinancialSummarySetController extends \Think\Controller
//判断是否已经聚合
$countRes = $this->FinancialSummaryModel->field("IFNULL(COUNT(*),0) count")->where("count_year = '{$this->year}' and count_month= '{$this->month}'")->find()['count'];
if($countRes > 0){
if($this->taskid){
throw new \Exception("error:Repeated statistics,msg:{$this->date}已经聚合过");
}else{
die("error:Repeated statistics,msg:{$this->date}已经聚合过");
}
die("error:Repeated statistics,msg:{$this->date}已经聚合过");
}
echo "{$this->date}开始统计".PHP_EOL;
echo "--收入类型统计中".PHP_EOL;

@ -40,14 +40,14 @@ class GameApiController extends Think {
public function send()
{
$role = [
'role_id' => '6810778',
'user_account' => 'liaojl1130',
'role_id' => '6819493',
'user_account' => 'qh11102',
'sdk_version' => 1,
];
$order = [
'ref_amount' => 100,
'ref_id' => '10',
'remark' => 'ELF测试资源发放1',
'ref_amount' => '10.00',
'ref_id' => '8',
'remark' => '测试',
'order_no' => date('YmdHis') . rand(1000, 9999) . '_1',
];
$service = new TestingResourceService();

@ -37,19 +37,25 @@ class CmdTasksModel extends Model{
if(empty($task)){
return false;
}else{
return date("Y-d-m H:i:s",$task['end_time']);
return date("Y-m-d H:i:s",$task['end_time']);
}
}
//插入任务
public function addTask($type,$params,$need_tasksid = true)
public function addTask($type,$params,$need_path=true)
{
$task = $this->field("end_time")->where(['status'=>"1",'type'=>$type])->order("id desc")->find();
$task = $this->field("end_time")->where(['status'=>["in","0,1"],'type'=>$type])->order("id desc")->find();
if(!empty($task)){
return false;
}
if($need_tasksid){
$params = rtrim($params,";").'/taskid/{$taskid};';
if($need_path){
if(IS_WIN){
$p = explode(':',ROOTTTTT);
$params = "{$p[0]}:&".'cd "'.$p[1].'"&'.$params;
}else{
$params = "cd ".ROOTTTTT.";".$params;
}
}
$params = rtrim($params,";").' 2>&1';
$save = [
"uid"=>$_SESSION['onethink_admin']['user_auth']['uid'],
"created_time"=>time(),

@ -0,0 +1,109 @@
<?php
namespace Admin\Model;
use Think\Model;
class CompanyGameRatioModel extends Model
{
// 数据表前缀
protected $tablePrefix = 'tab_';
/**
* 按公司获取游戏分成比例
*
* @param [type] $company_id 公司id
* @param [type] $game_ids 游戏关联id
* @param [type] $begintime 开始时间
* @param [type] $endtime 结束时间
* @param boolean $company_belong 公司内外团
* @return void
*/
public function getPromoteCompanyGameRatio($company_id,$game_ids,$begintime,$endtime,$company_belong=false){
//获取默认比例
if($company_belong === false){
$company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id='{$company_id}'")->find()['company_belong'];
}
$mwhere = [
"company_belong"=>$company_belong,
"relation_game_id"=>["in",$game_ids]
];
$m_res = M("GameRatioMould","tab_")->where($mwhere)->select();
$modul_ratio = [];
for ($i=0; $i < count($m_res); $i++) {
$modul_ratio[$m_res[$i]['relation_game_id']] = $m_res[$i];
}
unset($m_res);
//设置默认
$game_ratio = [];
$tmp_g = explode(",",$game_ids);
for ($i=0; $i < count($tmp_g); $i++) {
$game_ratio[$tmp_g[$i]] = [
["begintime"=>$begintime,"endtime"=>$endtime]
];
}
$map = [
"company_id"=>$company_id,
"relation_game_id"=>['in',$game_ids],
"_string"=>"begin_time <={$endtime} AND ( end_time = 0 OR end_time >= {$begintime})"
];
$res = $this->where($map)->order("begin_time asc")->select();
foreach($res as $k=>$v){
//获取最后一个数据
$tgr = &$game_ratio[$v['relation_game_id']];
$last_time_ratio = end($game_ratio[$v['relation_game_id']]);
if($v['end_time'] == 0 || ($v['end_time'] >= $last_time_ratio['endtime'])){
//全段
if($v['begin_time'] <= $last_time_ratio['begintime']){
$tgr[count($tgr)-1]['ratio'] = $v['ratio'];
$tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
continue;
}else{
//上分段
$tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
continue;
}
}
if($v['end_time'] < $last_time_ratio['endtime']){
if($last_time_ratio['begintime'] < $v['begin_time']){
//中段
$tgr[count($tgr)-1]['endtime'] = $v['begin_time']-1;
$tgr[] = ['begintime'=>$v['begin_time'],"endtime"=>$v['end_time'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
continue;
}
if($last_time_ratio['begintime'] > $v['begin_time']){
//下分段
$tgr[count($tgr)-1]['endtime'] = $v['end_time'];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime'],"ratio"=>$v['ratio'],"turnover_ratio"=>$v['turnover_ratio']];
continue;
}
if($last_time_ratio['begintime'] = $v['begin_time']){
$tgr[count($tgr)-1]['endtime'] = $v['end_time'];
$tgr[count($tgr)-1]['ratio'] = $v['ratio'];
$tgr[count($tgr)-1]['turnover_ratio'] = $v['turnover_ratio'];
$tgr[] = ['begintime'=>$v['end_time']-0+1,"endtime"=>$last_time_ratio['endtime']];
}
}
}
//模板填充
foreach($game_ratio as $k=>&$list){
foreach($list as $i => &$ratio){
if(!isset($ratio['ratio'])){
if(isset($modul_ratio[$k]['ratio'])){
$ratio['ratio'] = $modul_ratio[$k]['ratio'];
$ratio['turnover_ratio'] = $modul_ratio[$k]['turnover_ratio'];
}else{
$ratio['ratio'] = 0;
$ratio['turnover_ratio'] =null;
}
}
}
}
return $game_ratio;
}
}

@ -462,7 +462,7 @@ class GameModel extends Model{
*/
public function changeRelationGameidToGameid($ids,$type=false)
{
$rid = $this->field('id')->where(["relation_game_id"=>["in",$ids]])->select();
$rid = $this->field('id')->where("relation_game_id in ({$ids})")->select();
if($type){
return array_column($rid,'id');
}else{
@ -479,7 +479,7 @@ class GameModel extends Model{
*/
public function changeGameidToRelationGameid($ids,$type=false)
{
$rid = $this->field('relation_game_id')->where(["id"=>["in",$ids]])->group("relation_game_id")->select();
$rid = $this->field('relation_game_id')->where("id in ({$ids})")->group("relation_game_id")->select();
if($type){
return array_column($rid,'relation_game_id');
}else{

@ -294,7 +294,7 @@
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看');
}else{
layer.alert('添加任务失败,已有重算任务。请上个重算任务完成');
layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成');
}
},
error:function(){
@ -304,54 +304,7 @@
});
});
})
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
$order_type = '{$userarpu_order}';
if ($order_type == '' || $order_type == '4') {
$(".sortBy").attr('name', 'data_order');
val = '3,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
} else if ($order_type == '3') {
$(".sortBy").attr('name', 'data_order');
val = '4,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
}
});
$('.jssamlllist').click(function () {
var that = $(this), url = that.attr('data-url');
var url =
layer.open({
type: 2,
title: "【" + that.attr('data-account') + "】小号列表",
shadeClose: true,
shade: 0.8,
area: ['1062px', '80%'],
content: url,//iframe的url
});
return false;
});
$(".paixu").click(function () {
var val = $(this).attr('data-order');
if (val == 1) {
val = 2;
} else if (val == 2) {
val = 1;
}
var name = $(this).attr('name');
if (name == 'balance_status') {
$('#key').val(1);
} else {
$('#key').val(2);
}
$("#" + name).val(val);
$("#search").click();
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
@ -359,105 +312,7 @@
}
});
$("#total_status").click(function () {
$("#search").click();
})
$('#time_start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
var promote_id = "{:I('promote_id')}";
var company_id = "{:I('company_id')}";
function getPromotersByCompanyid() {
var company_id = $("#company_id option:selected").val();
if(!company_id){
company_id = -1;
}
$.ajax({
url: "{:U('Ajax/getPromotersByCompanyid')}",
type: "get",
data: { company_id:company_id},
dataType: 'json',
success: function (response) {
str = '<option value="">请选择会长</option>';
if(company_id == 0 || company_id ==-1){
str +='<option value="0"' + (promote_id && 0 == promote_id ? 'selected' : '') + '>{:C(\'OFFICIEL_CHANNEL\')}</option>';
}
data = response.data;
for (var i in data) {
str += "<option value='" + data[i].id + "' " + (promote_id && data[i].id == promote_id ? 'selected' : '') + ">" + data[i].nickname + "</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
}
getPromotersByCompanyid();
$("#company_id").change(function(){
getPromotersByCompanyid();
})
})
function shenhe(status) {
var text = $("input:checkbox[name='ids[]']:checked").map(function (index, elem) {
return $(elem).val();
}).get().join("\n");
var desc = '';
if (status == 0) {
desc = '锁定';
} else {
desc = '开启';
}
layer.prompt({
formType: 2,
value: text,
placeholder: '玩家账号(一个账号一行)',
title: '请输入要' + desc + '的玩家账号(一个账号一行)',
area: ['800px', '350px'] //自定义文本域宽高
}, function (value, index, elem) {
if (value == '') {
layer.msg("请输入账户ID");
return;
}
$.ajax({
cache: true,
type: "POST",
url: "{:U('Member/lock_status')}",
data: { accounts: value, lock_status: status },// 你的formid
async: false,
error: function (data) {
layer.alert("服务器故障,请稍后重试!", { icon: 2 });
},
success: function (data) {
// var obj = JSON.parse(data);
// layer.alert(obj.info,{icon:obj.status})
layer.alert(data.info, { icon: data.status })
window.location.reload()
}
});
layer.close(index);
});
}
</script>
</block>

@ -108,11 +108,11 @@ class TestingResourceService
$gameCatClient = new GameCatClient();
$result = $gameCatClient->api('provide', [
'roleId' => $role['role_id'],
'amount' => $order['ref_amount'],
'amount' => intval($order['ref_amount']),
'supportItem' => $order['ref_id'],
'supportType' => '0',
'channelUid' => $role['user_account'],
'applyRemark' => $order['remark'],
'applyRemark' => $order['remark'] == '' ? '测试资源申请' : $order['remark'],
'applyId' => $order['order_no'],
'device_type' => $role['sdk_version'] == 1 ? 'andriod' : 'ios',
]);

@ -1446,18 +1446,18 @@ class DownloadController extends BaseController {
if (!empty(I('begtime')) && empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['egt', strtotime(I('begtime'))];
$map['tab_spend.spend_time'] = ['egt', strtotime(I('begtime'))];
} elseif (empty(I('begtime')) && !empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['elt', strtotime(I('endtime')) + 86399];
$map['tab_spend.spend_time'] = ['elt', strtotime(I('endtime')) + 86399];
} elseif (!empty(I('begtime')) && !empty(I('endtime'))) {
$map['tab_spend.pay_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]];
$map['tab_spend.spend_time'] = ['between', [strtotime(I('begtime')), strtotime(I('endtime')) + 86399]];
}else {
$nowTime = date('Y-m-d');
$initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime)));
$initEndTime = date('Y-m-d');
$initBegTime = strtotime($initBegTime);
$initEndTime = strtotime($initEndTime);
$map['tab_spend.pay_time'] = ['between',[$initBegTime,$initEndTime]];
$map['tab_spend.spend_time'] = ['between',[$initBegTime,$initEndTime]];
}
empty(I('relation_game_id')) || $map['tab_game.relation_game_id'] = I('relation_game_id');

@ -99,7 +99,7 @@ class QueryController extends BaseController
$map['tab_spend.pay_status'] = $payStatus;
}
}
$map['tab_spend.pay_time'] = ['between', [$begTime, $endTime - 1]];
$map['tab_spend.spend_time'] = ['between', [$begTime, $endTime - 1]];
$data = [];
$count = 0;

@ -167,7 +167,7 @@ class TestingResourceController extends BaseController
'pay_status' => 1,
'_string' => '(' . implode(' or ', $spendOrWhere) . ')',
];
$spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id, game_player_id')->where($spendOrWhere)->group('game_id,game_player_id')->select();
$spendList = M('spend', 'tab_')->field('sum(pay_amount) amount, game_id, game_player_id')->where($spendCondition)->group('game_id,game_player_id')->select();
foreach ($spendList as $item) {
$spendItems[$this->getGameRoleId($item['game_id'], $item['game_player_id'])] = $item['amount'];
}
@ -430,7 +430,7 @@ class TestingResourceController extends BaseController
$totalQuota = $role['testing_other_quota'] + ($this->gameBaseQuota[$role['game_id']] ?? 0);
if (!is_null($bindRole)) {
$totalQuota += M('spend', 'tab_')
->where(['game_id' => $role['game_id'], 'game_player_id' => $bindRole['role_id']])
->where(['game_id' => $role['game_id'], 'game_player_id' => $bindRole['role_id'], 'pay_status' => 1])
->group('game_id,game_player_id')
->sum('pay_amount');
}
@ -489,7 +489,7 @@ class TestingResourceController extends BaseController
$records = I('records', []);
$loginPromote = $this->getLoginPromote();
if ($loginPromote['level'] != 1) {
if ($loginPromote['level'] > 2) {
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'] == 1):?>
<?php if($loginer['level'] <= 2):?>
<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>

@ -2483,7 +2483,7 @@ CREATE TABLE `tab_testing_resource_batch` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
alter table tab_user_play_info add column `game_role_id` varchar(80) DEFAULT '' COMMENT '角色' after role_level;
alter table tab_user_play_info add column `testing_other_quota` decimal(12, 2) DEFAULT '0.00' COMMENT '测试资源额外额度' after promote_account;
alter table tab_user_play_info add column `game_role_id` varchar(80) not null DEFAULT '' COMMENT '游戏角色标识' after role_level;
alter table tab_user_play_info add column `testing_other_quota` decimal(12, 2) not null DEFAULT '0.00' COMMENT '测试资源额外额度' after promote_account;
update tab_user_play_info set game_role_id = concat(game_id, '#', role_id);
ALTER TABLE `tab_user_play_info` ADD INDEX `index_unique_role`(`game_role_id`);
Loading…
Cancel
Save