Merge branches 'feature/add_item' and 'release' of 8.136.139.249:wmtx/platform into feature/add_item_new

 Conflicts:
	Application/Admin/Controller/GameController.class.php
master
zhengyongxing 4 years ago
commit f474095a24

@ -129,5 +129,9 @@ return array(
"tab_reward_detail",
"tab_reward_record",
"tab_new_company_statement_info",
"tab_game",
"tab_spend",
"tab_promote",
"tab_promote_company",
]
);

@ -229,6 +229,13 @@ class CompanyStatementController extends ThinkController
}
$this->assign("IS_SUBSITE",IS_SUBSITE);
if(IS_SUBSITE){
$SubKvModel = M("Kv","sub_",SUBSITE_DB);//指定子库
$LastSynTime = $SubKvModel->where("`key` = 'sub_spend_syn_time'")->getField("value");
$LastStatementTime = $SubKvModel->where("`key` = 'sub_company_statement'")->getField("value");
$this->assign('lastSynTime',date('Y-m-d',$LastSynTime));
$this->assign('lastStatementTime',date('Y-m-d',$LastStatementTime));
}
$this->assign('data',$data);
$this->assign('count',$count);
@ -1769,6 +1776,24 @@ class CompanyStatementController extends ThinkController
$this->ajaxReturn(array("success"=>"ok","data"=>[]));
}
//子站新增结算
public function subAddStatement(){
if(!isset($_REQUEST['statement_time'])) $this->error("参数错误");
$statement_time = $_REQUEST['statement_time'];
$end = date("Y-m-d",strtotime($statement_time)+ 86400);
$utime = strtotime($statement_time)+86399;
$LastStatementTime = M("Kv","sub_",SUBSITE_DB)->where("`key` = 'sub_company_statement'")->getField("value");
$begin = date("Y-m-d",$LastStatementTime-0+1);
$params = "php ".SUBSITE_INDEX." SubCompanyStatementSet/setFreeDateCount/begin/{$begin}/end/{$end}/utime/{$utime}";
$r = D("CmdTasks")->addTask("SubCompanyStatementSet",$params);
if($r){
$this->ajaxReturn(["status"=>1,"info"=>"任务登记成功,请等待五分分钟后查看结果"]);
}else{
$this->ajaxReturn(["status"=>0,"info"=>"任务登记错误"]);
}
}
public function viewSpecialComplement() {
@ -2483,6 +2508,13 @@ class CompanyStatementController extends ThinkController
"viewSpecialComplement"=>"<a class='butn' id='viewSpecialComplement'>特殊补点</a>",
"delStatement"=>"<a class='butn' id='delStatement' style='background-color: red;'>批量删除</a>"
];
if(IS_SUBSITE){
unset($mentBtn['updateNewStatement']);
$is_can_add = D("CmdTasks")->isCanAddTask("SubCompanyStatementSet");
if($is_can_add){
$mentBtn['subAddStatement'] = "<a class='butn' id='subAddStatement' style='background-color: green;'>新增结算</a>";
}
}
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){

@ -1087,6 +1087,12 @@ class ExportController extends Controller
$startTime = strtotime($startDate);
$endTime = strtotime($endDate) + 86399;
$map['pay_time'] = array('BETWEEN', array($startTime, $endTime));
$is_sub_data = I("issubdata",0);
if($is_sub_data == 1){
$SpendModel = M("spend","tab_",SUBSITE_DB);
}else{
$SpendModel = M("spend","tab_");
}
unset($_REQUEST['timestart']);
unset($_REQUEST['timeend']);
@ -1201,7 +1207,7 @@ class ExportController extends Controller
D("Spend")->addSubsiteWhere($map);
$map1 = $map;
$map1['pay_status'] = 1;
$total = M('Spend','tab_')->where($map1)->sum('pay_amount');
$total = $SpendModel->where($map1)->sum('pay_amount');
// var_dump($total);die();
$total=$total?$total:0;
@ -1277,7 +1283,7 @@ class ExportController extends Controller
mb_convert_variables('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = M('Spend',"tab_")
$accessNum = $SpendModel
->where($map)
->count();
@ -1286,7 +1292,7 @@ class ExportController extends Controller
// var_dump($count);die();
for($i = 1; $i <= $pages; $i++) {
$xlsData = M('Spend',"tab_")
$xlsData = $SpendModel
->field($fields)
->where($map)
->limit(($i-1)*$perSize ,$perSize)

@ -294,13 +294,12 @@ class FinancePromoteController extends AdminController
}
$map['s.pay_status']=1;
$map['s.is_check']=2;
D("Spend")->addSubsiteWhere($map,"s");
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = M()
$query = SM()
->table("tab_spend s use index(promote_time)")
->field($field)
->where($map)
@ -379,13 +378,12 @@ class FinancePromoteController extends AdminController
}
$map['s.pay_status']=1;
// $map['s.is_check']=1;
D("Spend")->addSubsiteWhere($map,"s");
$field= "SUM(CASE WHEN pay_way > 0 and s.is_check=1 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 and s.is_check=1 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 and s.is_check=1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = M()
$query = SM()
->table("tab_spend s use index(promote_time)")
->field($field)
->where($map)
@ -610,13 +608,12 @@ class FinancePromoteController extends AdminController
}
$map['s.pay_status']=1;
$map['s.is_check']=1;
D("Spend")->addSubsiteWhere($map,"s");
// dd($map);
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,develop_type,IFNULL(promote.company_belong,0) company_belong";
$query = M()
$query = SM()
->table("tab_spend s use index(promote_time)")
->field($field)
->where($map)
@ -895,9 +892,9 @@ class FinancePromoteController extends AdminController
$group = "";
$order = "pay_time DESC";
if(isset($_REQUEST['export'])){
$data = D('spend')->getSpendData($map,$field,$group,$order);
$data = D('spend')->getSubSpendData($map,$field,$group,$order);
}else {
$data = D('spend')->getSpendData($map,$field,$group,$order,$page,$row);
$data = D('spend')->getSubSpendData($map,$field,$group,$order,$page,$row);
}
$marketAdmins = [];
@ -965,7 +962,7 @@ class FinancePromoteController extends AdminController
$this->assign('sumInside', $sumInside);
$this->assign('sumAll', null_to_0($sumAll));
$count = D("spend")->getSpendData($map,$field,$group,$order);
$count = D("spend")->getSubSpendData($map,$field,$group,$order);
$count = count($count);
$page = set_pagination($count,$row);
@ -996,7 +993,7 @@ class FinancePromoteController extends AdminController
$map['s.pay_status']=1;
$map['s.is_check']=1;
$query = M("spend","tab_")->alias("s")
$query = SM("spend","tab_")->alias("s")
->field("s.game_id,s.game_name,s.sdk_version,p.partner as partner_name,
SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
@ -1039,7 +1036,7 @@ class FinancePromoteController extends AdminController
$map['s.market_admin_id'] = $adminId;
}
$query = M("spend","tab_")->alias("s")
$query = SM("spend","tab_")->alias("s")
->field("SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count");
@ -1099,7 +1096,7 @@ class FinancePromoteController extends AdminController
$row = 10;
}
$map['pay_status'] = 1;
$map['is_check'] = 1;
$map['tab_spend.is_check'] = 1;
if (!empty(I('user_account'))) {
$map['tab_spend.user_account'] = array('like','%'.I("user_account").'%');
@ -1107,7 +1104,7 @@ class FinancePromoteController extends AdminController
if (!empty(I('user_nickname'))) {
$map['tab_spend.game_player_name'] = array('like',I("user_nickname").'%');
}
D("Spend")->addSubsiteWhere($map,"s");
D("Spend")->addSubsiteWhere($map,"tab_spend");
$field = "pay_order_number,FROM_UNIXTIME(payed_time) as pay_time,tab_spend.user_account,
tab_spend.user_nickname,tab_spend.game_name,tab_spend.promote_account,spend_ip,tab_spend.server_name,tab_spend.sdk_version,
game_player_name,pay_amount,cost,pay_way";

@ -29,13 +29,7 @@ class FinancialSummaryController extends AdminController
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth());
$lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary");
if(!$lastRecount){
$lastRecount = "无";
}
$this->assign('lastRecount',$lastRecount);
$this->assign('menubtn',$this->menuAuth());
$this->getYearList();
$this->getYearData();
$this->display();
@ -43,9 +37,10 @@ class FinancialSummaryController extends AdminController
}
public function updateStatement()
{
$temp = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01'));
$params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
if(!isset($_REQUEST['time'])) $this->error("参数错误");
$time = $_REQUEST['time'];
$params = "php ".SUBSITE_INDEX." FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$time}";
$r = D("CmdTasks")->addTask("FinancialSummary",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);

@ -266,12 +266,13 @@ class FinancialSummarySetController extends \Think\Controller
*/
public function setPromoteMoney()
{
$SpendModel = SM("spend",'tab_');
$map = array(
"payed_time"=> array('BETWEEN',array($this->beginThismonth, $this->endThismonth)),
"pay_status"=>1,
);
D("Spend")->addSubsiteWhere($map,"s");
$res = $this->SpendModel
$res = $SpendModel
->alias('s')
->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,
IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count,
@ -358,7 +359,7 @@ class FinancialSummarySetController extends \Think\Controller
$unmap = $map;
$unmap['is_check'] = 2;
$unSettlementRes = $this->SpendModel
$unSettlementRes = $SpendModel
->alias('s')
->field("IFNULL(SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END),0) as cash_count,
IFNULL(SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END),0) as balance_coin_count,

@ -484,7 +484,8 @@ ADD COLUMN `kefu_qq` varchar(255) NULL DEFAULT '' COMMENT 'kefu_qq_type为2 时
$otherData['data_share'] = I('post.data.share');
$otherData['game_belong_id'] = I('post.game_belong_id');
$otherData['game_belong_name'] = $realname;
$otherData['data_share'] = I('post.data_share');
M('Game', 'tab_')->data($otherData)->where(array('id' => $another['id']))->save();
//同时修改代充游戏折扣
$set_fidel['status'] = 1;

@ -255,8 +255,7 @@ class PlatformController extends ThinkController
"pay_time"=>["between",$yearMap],
"pay_status"=>1
];
D("Spend")->addSubsiteWhere($map);
$Payamount = M("Spend","tab_")->field("sum(IF(is_check=1,pay_amount,0)) pay_amount,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
$Payamount = SM("Spend","tab_")->field("sum(IF(is_check=1,pay_amount,0)) pay_amount,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
if(empty($Payamount)) return ;
foreach ($Payamount as $v) {
$list[$v['paytime']]['payamount'] = $v['pay_amount'];
@ -271,7 +270,7 @@ class PlatformController extends ThinkController
"pay_time"=>["between",$yearMap],
"pay_status"=>1
];
$Payamount = M("Spend","tab_")->field("sum(IF(is_check=2,pay_amount,0)) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
$Payamount = SM("Spend","tab_")->field("sum(IF(is_check=2,pay_amount,0)) pay_amount,FROM_UNIXTIME(`pay_time`, '%Y-%m') paytime")->where($map)->group("paytime")->select();
if(empty($Payamount)) return ;
foreach ($Payamount as $v) {
$list[$v['paytime']]['unpayamount'] = $v['pay_amount'];
@ -1174,7 +1173,7 @@ class PlatformController extends ThinkController
}
D("Spend")->addSubsiteWhere($map,"s");
$data = M('promote', 'tab_')->alias('tp1')
$data = SM('promote', 'tab_')->alias('tp1')
->field('tp1.account as promote_account,tp1.id,g.relation_game_id,g.relation_game_name,
floor(sum(IF(is_check=1,pay_amount,0))*100) as count,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_count')
->join("tab_promote AS tp2 ON tp2.`chain` LIKE CONCAT('%/', tp1.id, '/%') OR tp2.id = tp1.id", 'left')
@ -1190,7 +1189,7 @@ class PlatformController extends ThinkController
if(isset($map['pay_time'])){
$tmap['pay_time'] = ['between', array($tmin,$tmonth[1][1])];
}
$tdata = M('promote', 'tab_')->alias('tp1')
$tdata = SM('promote', 'tab_')->alias('tp1')
->field('tp1.account as promote_account,tp1.id,g.relation_game_id,g.relation_game_name,
floor(sum(IF(s.pay_time ' . $today . ' and is_check=1,pay_amount,0))*100) as today,
floor(sum(IF(s.pay_time ' . $week . ' and is_check=1,pay_amount,0))*100) as week,
@ -1248,11 +1247,11 @@ class PlatformController extends ThinkController
$user_auth_promote_ids = session('user_auth_promote_ids');
if ($user_auth_promote_ids == 'all' || in_array('0', explode(",", $user_auth_promote_ids))) {
//官方渠道数据添加
$authorityData = M('spend', 'tab_')->alias('s')
$authorityData = SM('spend', 'tab_')->alias('s')
->field('floor(sum(IF(is_check=1,pay_amount,0))*100) as count,IFNULL(sum(IF(is_check=2,pay_amount,0)),0) unpay_count')
->where($map)
->find();
$tauthorityData = M('spend', 'tab_')->alias('s')
$tauthorityData = SM('spend', 'tab_')->alias('s')
->field('
floor(sum(IF(s.pay_time ' . $today . ' and is_check=1,pay_amount,0))*100) as today,
floor(sum(IF(s.pay_time ' . $week . ' and is_check=1,pay_amount,0))*100) as week,

@ -24,7 +24,16 @@ class SubCompanyStatementSetController extends Controller {
echo "请先设置请求接口aggregate_cp_settlement_api的值".PHP_EOL;die;
}
$this->cpapihost = $cpapihost['value'];
// $this->synGame();
}
//同步游戏表
// protected function synGame()
// {
// $mainGame = M("Game","tab_")->select();
// SM()->execute("truncate table tab_game");
// M("game","tab_",SUBSITE_DB)->addAll($mainGame);
// }
/**
* Undocumented function
*
@ -33,7 +42,7 @@ class SubCompanyStatementSetController extends Controller {
* @param string $company all/pc/cp/pu 全部 下游公司 上游 下游个人
* @return void
*/
public function setFreeDateCount($begin,$end='',$company='all')
public function setFreeDateCount($begin,$end='',$utime=false,$company='all')
{
if($end == '') $end = $begin;
//判断日期格式
@ -58,6 +67,9 @@ class SubCompanyStatementSetController extends Controller {
for($i=0;$i<$countdate;$i++){
$this->setDailyCount($datelist[$i],$company);
}
if($utime){
M("Kv","sub_",SUBSITE_DB)->where("`key` = 'sub_company_statement'")->save(["value"=>$utime]);
}
}
public function setDailyCount($stime="now",$company='all')
{
@ -74,14 +86,14 @@ class SubCompanyStatementSetController extends Controller {
$w = (int)date("w",$stime);
if($w == 1){
if($company == "all"){
echo $nowdate.":".PHP_EOL;
echo "--周结begin".PHP_EOL;
// echo $nowdate.":".PHP_EOL;
// echo "--周结begin".PHP_EOL;
$this->cpStatement(0,$stime);
echo "∟----CP周结统计ok".PHP_EOL;
// echo "∟----CP周结统计ok".PHP_EOL;
$this->promoteCompanyStatement(0,$stime);
echo "∟----推广公司周结统计ok".PHP_EOL;
// echo "∟----推广公司周结统计ok".PHP_EOL;
}
if($company == "cp"){
$this->cpStatement(0,$stime);
@ -94,19 +106,18 @@ class SubCompanyStatementSetController extends Controller {
}
if($d == 1){
if($company == "all"){
echo $nowdate.":".PHP_EOL;
echo "--月结&补点begin".PHP_EOL;
// echo $nowdate.":".PHP_EOL;
// echo "--月结&补点begin".PHP_EOL;
$this->cpStatement(1,$stime);
echo "∟----CP月结&补点统计ok".PHP_EOL;
// echo "∟----CP月结&补点统计ok".PHP_EOL;
$this->promoteCompanyStatement(1,$stime);
$this->officeCompanyStatement($stime); //官方结算
echo "∟----官方/推广公司月结统计ok".PHP_EOL;
// echo "∟----官方/推广公司月结统计ok".PHP_EOL;
$this->promoteUserPool(1,$stime);
echo "∟----推广个人月结统计ok".PHP_EOL;
// echo "∟----推广个人月结统计ok".PHP_EOL;
}
if($company == "cp"){
$this->cpStatement(1,$stime);
@ -122,9 +133,9 @@ class SubCompanyStatementSetController extends Controller {
echo "∟----推广个人月结&补点统计ok".PHP_EOL;
}
}
if($w != 1 && $d != 1){
echo $nowdate."非月初,无需任何处理".PHP_EOL;
}
// if($w != 1 && $d != 1){
// echo $nowdate."非月初,无需任何处理".PHP_EOL;
// }
}
/**
* 上游结算
@ -247,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']);
@ -266,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']);
@ -396,7 +409,7 @@ class SubCompanyStatementSetController extends Controller {
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$Spend = SM("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
@ -614,7 +627,7 @@ class SubCompanyStatementSetController extends Controller {
//获取推广员
if(count($idarr) == 0){return $res;}
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$Spend = SM("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
@ -994,7 +1007,7 @@ class SubCompanyStatementSetController extends Controller {
$res = [];
//获取推广员
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$Spend = SM("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
@ -1021,7 +1034,7 @@ class SubCompanyStatementSetController extends Controller {
$res = [];
//获取推广员
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$Spend = SM("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],

@ -0,0 +1,647 @@
<?php
namespace Admin\Controller;
/**
* 后台首页控制器
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
*/
class SubSpendController extends ThinkController
{
const model_name = 'Spend';
public $OpAuthList;
public function lists()
{
list($is_sub_data, $startTime, $endTime) = $this->setSelectDate();
// dump($is_sub_data);
// dump($startTime);
// dump($endTime);
// dd(1);
$map['pay_time'] = array('BETWEEN', array($startTime, $endTime));
if (isset($_REQUEST['is_check'])) {
$map['is_check'] = (int)($_REQUEST['is_check']);
}
if (isset($_REQUEST['user_account'])) {
$map['user_account'] = array('like', trim($_REQUEST['user_account']));
unset($_REQUEST['user_account']);
}
if (isset($_REQUEST['spend_ip'])) {
$map['spend_ip'] = array('like', trim($_REQUEST['spend_ip']) . '%');
unset($_REQUEST['spend_ip']);
}
if (isset($_REQUEST['game_name'])) {
if ($_REQUEST['game_name'] == '全部') {
unset($_REQUEST['game_name']);
} else {
$map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
unset($_REQUEST['game_name']);
}
}
if (isset($_REQUEST['game_type']) && $_REQUEST['game_type']) {
$map['sdk_version'] = $_REQUEST['game_type'];
}
if (isset($_REQUEST['server_id'])) {
$map['server_id'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
if (isset($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number']));
unset($_REQUEST['pay_order_number']);
}
if (isset($_REQUEST['extend'])) {
$map['extend'] = array('like', trim($_REQUEST['extend']));
unset($_REQUEST['extend']);
}
if (isset($_REQUEST['pay_status'])) {
$map['pay_status'] = $_REQUEST['pay_status'];
unset($_REQUEST['pay_status']);
}
if (isset($_REQUEST['pay_way'])) {
if ($_REQUEST['pay_way'] == 2) {
$map['pay_way'] = ['in', '2,3,4'];
} else {
$map['pay_way'] = $_REQUEST['pay_way'];
}
unset($_REQUEST['pay_way']);
}
if (isset($_REQUEST['pay_game_status'])) {
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
unset($_REQUEST['pay_game_status']);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id'])) {
$promoteId = I('promote_id',-1);
$companyId = I('company_id',-1);
if ($promoteId == 0 || $companyId == 0) {
$map['promote_id'] = 0;
} else {
if($companyId != -1){
$promoteMap['company_id'] = $companyId;
}
if($promoteId != -1){
$promoteMap['chain'] = ['like', "%/$promoteId/%"];
}
$promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true);
$promoteIds[] = $promoteId;
$map['promote_id'] = ['in', $promoteIds];
}
}
if ($_REQUEST['data_order'] != '') {
$data_order = reset(explode(',', $_REQUEST['data_order']));
$data_order_type = end(explode(',', $_REQUEST['data_order']));
$this->assign('userarpu_order', $data_order);
$this->assign('userarpu_order_type', $data_order_type);
$sort = $data_order == 3 ? 'desc' : 'asc';
$order = $data_order_type . ' ' . $sort;
} else {
$order = ' pay_time desc ';
}
if (I('platform_type', 0) != 0) {
$sy = I('platform_type', 0) == 1 ? '=' : '<>';
$game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true);
$map['game_id'] = ['in',$game_id];
}
D("Spend")->addSubsiteWhere($map);
$this->meta_title = $this->m_title = '游戏充值';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find());
$data = $this->getSpendList($_GET["p"], $map, $order,$is_sub_data);
if (!empty($data['data'])) {
$adminUsernameList = getAdminUsernameList(array_column($data['data'], 'market_admin_id'));
foreach ($data['data'] as $key=>&$value) {
($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
$value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
$value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']];
//拆分游戏名称和设备类型
$game_arr = explode("(", rtrim($value['game_name'], ")"));
$value['game_name'] = $game_arr[0];
$value['sdk_version_name'] = $game_arr[1];
}
}
$promoteCompany = M('promote_company','tab_')->field('id, company_name as name')->where(['status' => 1])->select();
array_unshift($promoteCompany,['id'=>0,'name'=>C('OFFICIEL_CHANNEL')]);
$this->assign('promoteCompany', $promoteCompany);
$this->assign('showMarketAdmin', session('user_auth')['show_market_admin']);
$this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('isMarketAdmin', $isMarketAdmin);
$this->assign('marketAdmins', getMarketAdmins());
$this->assign('list_data', $data['data']);
$this->assign('_page', $data['page']);
$show_data_power = (is_administrator()|| session('user_auth')['show_data']);
$this->assign('show_data_power', $show_data_power);
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth($is_sub_data));
$this->display();
}
public function exportList()
{
$xlsName = $_REQUEST['xlsname'];
$startDate = empty($_REQUEST['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timestart'];
$endDate = empty($_REQUEST['timeend']) ? date('Y-m-d') : $_REQUEST['timeend'];
$startTime = strtotime($startDate);
$endTime = strtotime($endDate) + 86399;
$map['pay_time'] = array('BETWEEN', array($startTime, $endTime));
$is_sub_data = I("issubdata",0);
if($is_sub_data == 1){
$SpendModel = M("spend","tab_",SUBSITE_DB);
}else{
$SpendModel = M("spend","tab_");
}
unset($_REQUEST['timestart']);
unset($_REQUEST['timeend']);
if (isset($_REQUEST['user_account'])) {
$map['user_account'] = array('like', trim($_REQUEST['user_account']));
unset($_REQUEST['user_account']);
}
if (isset($_REQUEST['spend_ip'])) {
$map['spend_ip'] = array('like', trim($_REQUEST['spend_ip']) . '%');
unset($_REQUEST['spend_ip']);
}
if (isset($_REQUEST['game_name'])) {
if ($_REQUEST['game_name'] == '全部') {
unset($_REQUEST['game_name']);
} else {
$map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
unset($_REQUEST['game_name']);
}
}
if (isset($_REQUEST['game_type']) && $_REQUEST['game_type']) {
$map['sdk_version'] = $_REQUEST['game_type'];
}
if (isset($_REQUEST['server_id'])) {
$map['server_id'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
if (isset($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number']));
unset($_REQUEST['pay_order_number']);
}
if (isset($_REQUEST['extend'])) {
$map['extend'] = array('like', trim($_REQUEST['extend']));
unset($_REQUEST['extend']);
}
if (isset($_REQUEST['pay_status'])) {
$map['pay_status'] = $_REQUEST['pay_status'];
unset($_REQUEST['pay_status']);
}
if (isset($_REQUEST['pay_way'])) {
if ($_REQUEST['pay_way'] == 2) {
$map['pay_way'] = ['in', '2,3,4'];
} else {
$map['pay_way'] = $_REQUEST['pay_way'];
}
unset($_REQUEST['pay_way']);
}
if (isset($_REQUEST['is_check'])) {
$map['is_check'] = (int)($_REQUEST['is_check']);
unset($_REQUEST['is_check']);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
if (isset($_REQUEST['pay_game_status'])) {
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
unset($_REQUEST['pay_game_status']);
}
if (isset($_REQUEST['promote_id']) || isset($_REQUEST['company_id'])) {
$promoteId = I('promote_id',-1);
$companyId = I('company_id',-1);
if ($promoteId == 0 || $companyId == 0) {
$map['promote_id'] = 0;
} else {
if($companyId != -1){
$promoteMap['company_id'] = $companyId;
}
if($promoteId != -1){
$promoteMap['chain'] = ['like', "%/$promoteId/%"];
}
$promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true);
$promoteIds[] = $promoteId;
$map['promote_id'] = ['in', $promoteIds];
}
}
if ($_REQUEST['data_order'] != '') {
$data_order = reset(explode(',', $_REQUEST['data_order']));
$data_order_type = end(explode(',', $_REQUEST['data_order']));
$this->assign('userarpu_order', $data_order);
$this->assign('userarpu_order_type', $data_order_type);
$sort = $data_order == 3 ? 'desc' : 'asc';
$order = $data_order_type . ' ' . $sort;
} else {
$order = ' pay_time desc ';
}
if (I('platform_type', 0) != 0) {
$sy = I('platform_type', 0) == 1 ? '=' : '<>';
$game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true);
$map['game_id'] = ['in',$game_id];
}
// if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {
// $map1 = $map;
// $map1['pay_status'] = 1;
// } else {
// $map = '1 = 2';
// $map1 = $map;
// }
D("Spend")->addSubsiteWhere($map);
$map1 = $map;
$map1['pay_status'] = 1;
$total = $SpendModel->where($map1)->sum('pay_amount');
// var_dump($total);die();
$total=$total?$total:0;
$headers = [
'pay_order_number' => '支付订单号',
'extend' => 'CP订单号',
'pay_time' => '充值时间',
'payed_time' => '支付时间',
'user_account' => '玩家账号',
'game_name' => '游戏名称',
'sdk_version' => '设备类型',
'game_id' => '所属CP',
'promote_account' => L('Subordinate_channel'),
'0 as company_name' => '所属推广公司',
'market_admin_id' => '所属市场专员',
'merchant_id' => '所属商户',
'spend_ip' => '充值ip',
'server_id' => '区服ID',
'server_name' => '游戏区服',
'game_player_id' => '角色ID',
'game_player_name' => '角色名称',
'cost' => '订单金额',
'pay_amount' => '实付金额',
'pay_way' => '充值方式',
'pay_status' => L('Order_status'),
'pay_game_status' => '游戏通知状态',
'is_check' => '是否参与结算',
'promote_id' => "消费"."{$total}",
];
$xlsCell = array_values($headers);
$fields = array_keys($headers);
// ----获取游戏的基本信息begin
//获取游戏公司
$cpCompanyDb = M("partner","tab_")->field("id,partner")->order("id asc")->select();
$cpCompany = [];
foreach ($cpCompanyDb as $index => $cp) {
$cpCompany[$cp['id']]=$cp['partner'];
}
unset($cpCompanyDb);
//获取所有游戏
$gameDb = M("Game","tab_")->field("id,relation_game_name,partner_id")->order("id asc")->select();
$gameInfo = [];
foreach ($gameDb as $index => $g) {
$partner_name = $cpCompany[$g['partner_id']];
$g['partner_name'] = $partner_name;
$gameInfo[$g['id']]=$g;
}
unset($cpCompany);
unset($gameDb);
// ----获取游戏的基本信息end
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="'. $csvFileName .'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
$fp = fopen('php://output', 'a');//打开output流
mb_convert_variables('GBK', 'UTF-8', $xlsCell);
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = $SpendModel
->where($map)
->count();
$perSize = 10000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
// var_dump($count);die();
for($i = 1; $i <= $pages; $i++) {
$xlsData = $SpendModel
->field($fields)
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->order($order ? $order : 'pay_time desc')
->select();
if ($showMarketAdmin == 1) {
$adminUsernameList = getAdminUsernameList(array_column($xlsData, 'market_admin_id'));
}
$promoters = D('Promote')->where(['id'=>['in', array_unique(array_column($xlsData, 'promote_id'))]])->field('id, company_id')->select();
$promoters = $promoters ? array_column($promoters, 'company_id', 'id') : [];
$companys = $promoters ? M('promote_company', 'tab_')->where(['id'=>['in', array_unique(array_values($promoters))]])->field('id, company_name')->select() : [];
$companys = $companys ? array_column($companys, 'company_name', 'id') : [];
foreach($xlsData as $value) {
//游戏信息匹配
$thisGameInfo = $gameInfo[$value["game_id"]];
$value['game_name'] =$thisGameInfo['relation_game_name'];
$value['sdk_version'] = $value['sdk_version'] == 1 ? "安卓" : "苹果";
$value['game_id'] = $thisGameInfo['partner_name'];
$value['is_check'] = D("Spend")::IsCheckStr[$value['is_check']];
$value['company_name'] = $promoters[$value['promote_id']] == 0 ? C('OFFICIEL_CHANNEL') : ($companys[$promoters[$value['promote_id']]] ?? '');
unset($value['promote_id']);
$value['pay_time'] = date('Y-m-d H:i:s',$value['pay_time']);
if($value['pay_status'] == 1) {
$value['payed_time'] = date('Y-m-d H:i:s',$value['payed_time']);
}else {
$value['payed_time'] = "------";
}
$value['merchant_id'] = getMerchantName($value['merchant_id']);
checkEncryptionAuth($value['user_account'],'spend_lists');
($value['promote_account']=='官方渠道'||$value['promote_account']=='自然注册')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
$value['extend'] = $value['extend'].'`';
$value['pay_way'] = get_pay_way($value['pay_way']);
$value['pay_status'] = get_info_status($value['pay_status'],9);
$value['pay_game_status'] = get_info_status($value['pay_game_status'],14);
$value['market_admin_id'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
}
unset($xlsData);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
fclose($fp);
//操作日志
$GetData = $_GET;
unset($GetData['xlsname']);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U('Spend/lists',$GetData),'menu'=>'充值-游戏订单-游戏充值-导出']);
}
protected function menuAuth($is_sub_data = false)
{
$is_can_add = D("CmdTasks")->isCanAddTask("SubSpendSet");
if($is_can_add){
$mentBtn = [
"addSubSpendSet"=>"<a class='butn' id='addSubSpendSet'>固定订单</a>",
"updateSubSpend"=>"<a class='butn' id='updateSubSpend'>重固订单</a>"
];
}else{
$mentBtn = [];
}
if($is_sub_data){
$mentBtn['changeSubSpend'] = "<a class='butn' id='changeSubSpend'>订单换绑</a>";
$mentBtn['addStatement'] = "<a class='butn' id='addStatement'>参与结算</a>";
$mentBtn['removeStatement'] = "<a class='butn' id='removeStatement' style='background-color: red;'>移出结算</a>";
}
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){
$resarr[] = $v;
}else{
if(in_array($k,$this->OpAuthList)){
$resarr[] = $v;
}
}
}
return $resarr;
}
public function addSubSpendSet(){
if(!isset($_REQUEST['time'])) $this->error("参数错误");
$time = $_REQUEST['time'];
$params = "php ".SUBSITE_INDEX." SubSpendSet/setSubSpend/time/{$time}";
$r = D("CmdTasks")->addTask("SubSpendSet",$params);
if($r){
$this->ajaxReturn(["status"=>1,"info"=>"固化数据任务登记成功,请等待两三分钟后查看结果"]);
}else{
$this->ajaxReturn(["status"=>0,"info"=>"固化数据任务登记错误"]);
}
}
public function changeSubSpend(){
if (IS_POST) {
$this->editSubSpend();
}else{
$this->showChooseSubSpendCount();
}
}
public function updateSubSpend(){
if(!isset($_REQUEST['begin']) || !isset($_REQUEST['end'])) $this->error("参数错误");
$begin = $_REQUEST['begin'];
$end = $_REQUEST['end'];
$params = "php ".SUBSITE_INDEX." SubSpendSet/recountSubSpend/begin/{$begin}/end/{$end}";
$r = D("CmdTasks")->addTask("SubSpendSet",$params);
if($r){
$this->ajaxReturn(["status"=>1,"info"=>"重算任务登记成功,请等待两三分钟后查看结果"]);
}else{
$this->ajaxReturn(["status"=>0,"info"=>"重算任务登记错误"]);
}
}
public function addStatement()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$this->editOrderIscheck($ids,2,1);
$this->ajaxReturn(array(
'status' => 1,
"info"=>"操作成功"
));
}
public function removeStatement()
{
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$this->editOrderIscheck($ids,1,2);
$this->ajaxReturn(array(
'status' => 1,
"info"=>"操作成功"
));
}
protected function editSubSpend(){
if(!isset($_REQUEST['ids']) || !isset($_REQUEST['company_id']) ) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$company_id = $_REQUEST['company_id'];
if($company_id == 0){
$saveData = [
"promote_id"=>0,
"promote_account"=>'官方渠道',
"market_admin_id"=>0,
];
}else{
//获取会长及adminid
$promote = M("promote","tab_")->field("id,account,admin_id")->where("company_id = '{$company_id}' and level = '1' and status = '1'")->find();
$saveData = [
"promote_id"=>$promote['id'],
"promote_account"=>$promote['account'],
"market_admin_id"=>$promote['admin_id'],
];
}
$where = [
"id"=>['in',$ids]
];
M("spend","tab_",SUBSITE_DB)->where($where)->save($saveData);
$this->ajaxReturn([
'status' => 1,
"info"=>"换绑成功"
]);
}
protected function showChooseSubSpendCount(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
$ids = $_REQUEST['ids'];
$dbres = M("spend","tab_",SUBSITE_DB)->where("id in ({$ids})")->group("promote_id")->getField("promote_id,SUM(pay_amount) pay_amount");
//获取公司
$promoteIds = implode(",",array_keys($dbres));
$company = M("promote","tab_")
->alias('p')
->where("p.id in ({$promoteIds})")
->join("tab_promote_company c on p.company_id = c.id","left")
->group("p.company_id")
->getField("company_id,group_concat(p.id) promote_ids,c.company_name");
$sendData = [
"count" => 0,
"list"=>[]
];
foreach ($company as $k => $v) {
$v['promote_ids'] = explode(",",$v['promote_ids']);
$v['pay_amount'] = 0;
foreach($v['promote_ids'] as $promote_id){
$v['pay_amount'] += ($dbres[$promote_id]-0);
unset($dbres[$promote_id]);
}
unset($v['promote_ids'],$v['company_id']);
$sendData['count'] += $v['pay_amount'];
$sendData['list'][] = $v;
}
if(count($dbres) > 0){
$office_pay_amount = 0;
foreach ($dbres as $value) {
$office_pay_amount += ($value-0);
}
$sendData['list'][]= ["company_name"=>C('OFFICIEL_CHANNEL'),"pay_amount"=>$office_pay_amount];
$sendData['count'] += $office_pay_amount;
}
//获取所有公司
$promoteCompany = M('promote_company','tab_')->field('id, company_name as name')->where(['status' => 1])->select();
array_unshift($promoteCompany,['id'=>0,'name'=>C('OFFICIEL_CHANNEL')]);
$this->assign('promoteCompany', $promoteCompany);
$this->assign('data', $sendData);
$this->assign('ids', $ids);
$this->display("showChooseSubSpendCount");
}
protected function editOrderIscheck($ids,$oldval,$newval){
$dbres = M("spend","tab_",SUBSITE_DB)->where("id in ({$ids}) and is_check = '{$oldval}'")->select();
if(empty($dbres)) return false;
$changeIds = implode(",",array_column($dbres,"id"));
//执行操作
$res = D(self::model_name)->where("id in ({$changeIds}) and is_check = '{$oldval}'")->save(['is_check'=>$newval]);
if(empty($res)) return false;
//日志
if($newval == 1){
$op_name = "加入结算";
$key = "addStatement";
}else{
$op_name = "移出结算";
$key = "removeStatement";
}
addOperationLog(['op_type'=>1,'key'=>$key,"op_name"=>$op_name,"content"=>json_encode(["ids"=>$_REQUEST['ids'],"is_check"=>$newval])]);
return true;
}
protected function setSelectDate()
{
$startDate = empty($_REQUEST['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timestart'];
$endDate = empty($_REQUEST['timeend']) ? date('Y-m-d') : $_REQUEST['timeend'];
unset($_REQUEST['timestart']);
unset($_REQUEST['timeend']);
$startTime = strtotime($startDate);
$endTime = strtotime($endDate) + 86399;
$is_sub_data = false;
$lastSynTime = M("Kv","sub_",SUBSITE_DB)->where("`key` = 'sub_spend_syn_time'")->getField("value");
if($lastSynTime >= $startTime && $lastSynTime < $endTime){
$this->redirect(ACTION_NAME, array('timestart' => $startDate,"timeend"=>date('Y-m-d',$lastSynTime)));
}
if($lastSynTime >= $startTime && $lastSynTime <= $endTime){
$is_sub_data = true;
$endTime = $lastSynTime;
}
if($lastSynTime > $endTime){
$is_sub_data = true;
}
$this->assign('startDate', date('Y-m-d',$startTime));
$this->assign('endDate', date('Y-m-d',$endTime));
$this->assign('isSubData', $is_sub_data ? 1 : 0);
$this->assign('lastSynTime', date('Y-m-d',$lastSynTime));
return [$is_sub_data,$startTime,$endTime];
}
protected function getSpendList($p = 1, $map = array(), $order, $is_sub_data)
{
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
if (isset($_REQUEST['row'])) {
$row = $_REQUEST['row'];
} else {
$row = 10;
}
if($is_sub_data){
$SpendModel = M("spend","tab_",SUBSITE_DB);
}else{
$SpendModel = M("spend","tab_");
}
$list = $SpendModel
->where($map)
->page($page, $row)
->order($order ? $order : 'pay_time desc')
->select();
$count = $SpendModel->where($map)->count();
if($count < 20000){
$page = set_pagination_all($count, $row);
}else{
$page = set_pagination($count, $row);
}
$data['data'] = $list;
if ($page) {
$data['page'] = $page;
}
$total = null_to_0($SpendModel->where($map)->where("pay_status = 1")->sum('pay_amount'));
$this->assign('total', $total);
return $data;
}
}

@ -0,0 +1,107 @@
<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 子站同步支付信息
* @example 按日期同步: php wm.php SubSpendSet/setSubSpend/time/2019-09-31
* @example 重算更新: php wm.php SubSpendSet/recountSubSpend/begin/2019-01-01/end/2019-09-31
* @author cz
*/
class SubSpendSetController extends Controller
{
const LIMIT = 100;
public $SubSpendModel;
public $MainSpendModel;
public $SubKvModel;
public $LastSynTime;
public $SynTime;
public $SynWhere = [
"pay_status"=>1,
"partner_type"=>["in",[0,PARTNER_TYPE]]
];
public function _initialize()
{
$this->SubSpendModel = M("spend","tab_",SUBSITE_DB);//指定子库
$this->MainSpendModel = M("spend","tab_");//指定子库
$this->SubKvModel = M("Kv","sub_",SUBSITE_DB);//指定子库
$this->LastSynTime = $this->SubKvModel->where("`key` = 'sub_spend_syn_time'")->getField("value");
}
public function setSubSpend($time)
{
if($time == '') die("时间不能为空");
//判断日期格式
$patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/";
if (!preg_match($patten, $time)) {
die("时间格式错误");
}
if(strtotime($time)+86399-24*3600 > time()){
die("时间不能大于当前");
}
$this->SynTime = strtotime($time)+86399;
if($this->SynTime <= $this->LastSynTime){
die("时间不能小于最后同步时间");
}
$this->SynWhere['payed_time'] = ['between', [$this->LastSynTime-0+1,$this->SynTime]];
if($this->pageSetSpend()){
$this->updateLastSynTime();
};
echo "sub_spend syn ok".PHP_EOL;
}
public function recountSubSpend($begin,$end)
{
$patten = "/^\d{4}[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])$/";
if (!preg_match($patten, $begin)) {
die("开始时间格式错误");
}
if (!preg_match($patten, $end)) {
die("结束时间格式错误");
}
if(strtotime($end) < strtotime($begin)){
die("结束时间不能比开始时间小");
}
if(strtotime($end)+86399 > $this->LastSynTime){
die("结束时间不能大于最后同步时间");
}
$end = strtotime($end)+86399;
$begin = strtotime($begin);
$this->SynWhere['payed_time'] = ['between', [$begin,$end]];
if($this->delSubSpend() !== false){
echo "delete sub_spend ok".PHP_EOL;
$this->pageSetSpend();
}
echo "sub_spend update and syn ok".PHP_EOL;
}
//分页插入同步数据
protected function pageSetSpend()
{
$count = $this->getSynCount();
if(empty($count)) return true;
$pageCount = ceil($count/self::LIMIT);
for ($i=1; $i <= $pageCount; $i++) {
$tres = $this->MainSpendModel->where($this->SynWhere)->page($i,self::LIMIT)->select();
$addRes = $this->SubSpendModel->addAll($tres);
echo "[{$i}/{$pageCount}] {$addRes}".PHP_EOL;
}
return true;
}
//删除本地已同步数据
protected function delSubSpend()
{
return $this->SubSpendModel->where($this->SynWhere)->delete();
}
//获取需要同步的数量
protected function getSynCount()
{
return $this->MainSpendModel->where($this->SynWhere)->count();
}
//更新最后同步时间
protected function updateLastSynTime()
{
return $this->SubKvModel->where("`key` = 'sub_spend_syn_time'")->save(['value'=>$this->SynTime]);
}
}

@ -0,0 +1,73 @@
<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 子站同步表
* @example 按日期同步: php wm.php SubSpendSet/setSubSpend/time/2019-09-31
* @example 重算更新: php wm.php SubSpendSet/recountSubSpend/begin/2019-01-01/end/2019-09-31
* @author cz
*/
class SubSynTableController extends Controller
{
const CHECK_SUM_SQL = "checksum table ";
const TRUNCATE_SQL = "truncate table ";
const LIMIT = 100;
public $SubSynTableModel;
public function _initialize()
{
if(!IS_SUBSITE) die("仅能在子站脚本下运行");
$this->SubSynTableModel = M("syn_table","sub_",SUBSITE_DB);//指定子库
}
public function run(){
$synList = $this->SubSynTableModel->field("id,table_name,table_prefix,check_sum")->select();
foreach ($synList as $k => $v) {
$this->doSyn($v);
}
}
public function synOneTable($table_prefix,$tab_name)
{
$synInfo = $this->SubSynTableModel->where("table_name = '{$tab_name}' and table_prefix = '{$table_prefix}'")->field("id,table_name,table_prefix,check_sum")->find();
$this->doSyn($synInfo);
}
protected function doSyn($dbarr)
{
//获取最新check_sum
$table_prefix = $dbarr['table_prefix'];
$table_name = $dbarr['table_name'];
$res = M()->query(self::CHECK_SUM_SQL.$table_prefix.$table_name);
$now = time();
$check_sum = $res[0]['checksum'];
if($check_sum !== $dbarr['check_sum']){
$this->clearTable($table_prefix,$table_name);
$this->synTable($table_prefix,$table_name);
$dbarr['syn_time'] = $now;
$dbarr['check_sum'] = $check_sum;
}
$dbarr['update_time'] = $now;
$this->SubSynTableModel->save($dbarr);
echo $table_prefix.$table_name." success".PHP_EOL;
}
protected function clearTable($table_prefix,$table_name)
{
return SM()->query(self::TRUNCATE_SQL.$table_prefix.$table_name);
}
protected function synTable($table_prefix,$table_name)
{
$count = M($table_name,$table_prefix)->count();
if(empty($count)) return true;
$pageCount = ceil($count/self::LIMIT);
for ($i=1; $i <= $pageCount; $i++) {
$tres = M($table_name,$table_prefix)->page($i,self::LIMIT)->select();
$addRes = M($table_name,$table_prefix,SUBSITE_DB)->addAll($tres);
echo "[{$i}/{$pageCount}] {$addRes}".PHP_EOL;
}
return true;
}
}

@ -9,10 +9,11 @@ use Base\Service\TestingResourceService;
use Base\Service\PartnerService;
use Base\Repository\TestingResourceRepository;
use Base\Repository\GameRepository;
use Base\Service\GameService;
class TestingResourceController extends ThinkController
{
public function index()
public function roles()
{
$params = I('get.');
$gameId = $params['game_id'] ?? 0;
@ -439,14 +440,25 @@ class TestingResourceController extends ThinkController
$bindingRole = null;
if ($role) {
$servers = M('server', 'tab_')->field('id,server_name,server_id')->where(['game_id' => $role['game_id']])->order('server_id asc')->select();
$game = M('game', 'tab_')->where(['id' => $role['game_id']])->find(['id', 'data_share']);
$binding = M('testing_binding', 'tab_')->where(['game_id' => $role['game_id'], 'role_id' => $role['role_id']])->find();
if ($binding) {
$gameIds = [$role['game_id']];
if ($game['data_share'] == 1) {
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
$bindingRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])
->where(['game_id' => $binding['game_id'], 'role_id' => $binding['bind_role_id']])
->where(['game_id' => ['in', $gameIds], 'role_id' => $binding['bind_role_id']])
->find();
if ($bindingRole) {
$bindingRole['binding_time'] = $binding['create_time'];
$bindingRole['share_game_ids'] = $gameIds;
}
}
@ -456,7 +468,6 @@ class TestingResourceController extends ThinkController
$hasItf = $gameSetting ? $gameSetting['has_itf'] : 0;
}
$testingResourceService = new TestingResourceService();
$quota = $testingResourceService->getRemainQuota($role, $bindingRole);
@ -574,34 +585,17 @@ class TestingResourceController extends ThinkController
$otherQuota = I('other_quota', 0);
$otherQuotaRemark = I('otherQuotaRemark', '');
M('user_play_info', 'tab_')->where(['id' => $id])->save(['testing_other_quota' => $otherQuota,'testing_other_quota_remark' => $otherQuotaRemark]);
$admin_account = $_SESSION['onethink_admin']['user_auth']['username'];
$otherQuotaRemark = !empty($otherQuotaRemark) ? $otherQuotaRemark : '无';
addOperationLog(array(
"op_type"=>1,
'op_name'=>'修改额外额度记录',
"key"=>'/'.$admin_account.'修改了额外额度'.$otherQuota.',备注信息为'.$otherQuotaRemark.'/',
"url"=>U("TestingResource/index")
));
return $this->ajaxReturn(['status' => 1, 'message' => '设置成功']);
}
public function getUserRoles()
{
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$userAccount = I('user_account', '');
$server = M('server', 'tab_')->field(['id', 'server_name', 'server_id'])->where(['id' => $serverId])->find();
if (is_null($server)) {
return $this->ajaxReturn(['status' => 0, 'message' => '区服不存在']);
}
$user = M('user', 'tab_')->field(['id', 'promote_id'])->where(['account' => $userAccount])->find();
if (is_null($user)) {
return $this->ajaxReturn(['status' => 0, 'message' => '账号不存在']);
}
$testingUser = M('testing_user', 'tab_')->where(['user_account' => $userAccount])->find();
$isTestingAccount = is_null($testingUser) ? false : true;
$roles = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'role_name'])
->where(['user_account' => $userAccount, 'game_id' => $gameId, 'server_id' => $server['server_id']])
->select();
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles, 'is_testing_account' => $isTestingAccount]]);
}
public function getResourceTypes()
{
$gameId = I('game_id', 0);
@ -759,4 +753,33 @@ class TestingResourceController extends ThinkController
return $this->ajaxReturn(['status' => 0, 'message' => $e->getMessage()]);
}
}
public function getUserRoles()
{
$gameId = I('game_id', 0);
$roleId = I('role_id', 0);
$game = M('game', 'tab_')->where(['id' => $gameId])->find();
if (is_null($game)) {
return $this->ajaxReturn(['status' => 0, 'message' => '游戏不存在']);
}
$gameIds = [$gameId];
if ($game['data_share'] == 1) {
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$baseGame = $gameRepository->getBaseGameByGameId($gameId, $baseGames);
if (is_null($baseGame)) {
return $this->ajaxReturn(['status' => 0, 'message' => '游戏不存在']);
}
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
$roles = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'role_name'])
->where(['role_id' => $roleId, 'game_id' => ['in', $gameIds]])
->select();
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles]]);
}
}

@ -843,6 +843,19 @@ class SpendModel extends Model
}
return $data;
}
public function getSubSpendData($map = [], $field = '', $group = '', $order = '', $page = 0, $row = 0, $join = false)
{
$query = SM('spend',"tab_")->field($field)->where($map)->group($group)->order($order);
if ($join) {
$query = $query->join($join);
}
if ($row == 0) {
$data = $query->select();
} else {
$data = $query->page($page, $row)->select();
}
return $data;
}
public function sumSpend($map = [], $field = '')
{
@ -850,6 +863,12 @@ class SpendModel extends Model
return $sum;
}
public function sumSubSpend($map = [], $field = '')
{
$sum = SM('spend',"tab_")->where($map)->sum($field);
return $sum;
}
private function getGameMapByGameStatMap($map)
{

@ -289,6 +289,28 @@
<span class="layui-layer-setwin"></span>
</div>
</div>
<script type="text/html" id="addSubStatementTpl">
<div style="padding:10px 40px 30px;">
<spend style="font-size:14px;color:#666;">
最后结算时间:【{$lastStatementTime|default=''}】/ 订单最后固定时间:【{$lastSynTime|default=''}】<br/>
结算数据仅在周一及月初有结算所以结算日期应选择比需要结算的日期多一日。例需要结算2019-10-01~2019-10-31的数据需要选择结算日期为2019-11-01
</spend>
<input id="lastStatementTime" type="hidden" name="lastStatementTime" value="{$lastStatementTime|default=''}">
<input id="lastSynTime" type="hidden" name="lastSynTime" value="{$lastSynTime|default=''}">
<table border="0" cellspacing="0" cellpadding="0" style="margin-top:30px;">
<tr>
<td class="l noticeinfo" style="width:80px;">结算日期:</td>
<td class="r table_radio">
<input type="text" id="addSubStatementTime" name="addSubStatementTime" autocomplete="off" class="date" placeholder="结算日期" />
</td>
</tr>
</table>
<button class="submit_btn mlspacing" id="addSubStatementSubmit" type="submit" style="margin-top:30px;">
保存
</button>
</div>
</script>
</block>
<block name="script">
@ -743,6 +765,74 @@
}
});
})
//子站新增结算单
$("#subAddStatement").click(function(){
var html = $("#addSubStatementTpl").html();
layer.open({
type: 1,
title: "新增结算单",
maxWidth:720,
closeBtn: 1,
shadeClose: false,
content: html,
success:function(){
$("#addSubStatementSubmit").off("click");
$("#addSubStatementTime").datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
});
$("#addSubStatementSubmit").on("click",function(){
var subtime= $("#addSubStatementTime").val();
if(subtime == '') {
layer.msg('请先选择要结算的时间');
return false;
}
var lastSynTime = Date.parse($("#lastSynTime").val())+86400000;
var lastStatementTime = Date.parse($("#lastStatementTime").val());
var subtimenum = Date.parse(subtime);
if(subtimenum > lastSynTime) {
layer.msg('新增结算时间必须小于固定订单时间');
return false;
}
if(subtimenum <= lastStatementTime) {
layer.msg('所选时间已结算');
return false;
}
$.ajax({
type: "POST",
url: "{:U('subAddStatement')}",
dataType: 'json',
async: true,
data: {statement_time:subtime},
success:function(data){
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.alert(data.info)
}
}
});
})
}
});
})
//查看批注
$(".viewRemark").click(function () {
var remark = $(this).data("remark");

@ -85,7 +85,7 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">公会统计</h3>
<p class="description_text">说明:公会相关统计</p>
<p class="description_text">说明:公会相关统计<if condition="IS_SUBSITE">/ <span style="color: red;">支付信息仅统计已固定的订单数据</span></if></p>
<div class="question" style="float: right;margin-right: 20px;">
<i class="question_mark">?</i>
<ul class="question_content" style="right: -20px;left: auto;">
@ -241,7 +241,9 @@
<th class="tooltip">渠道游戏内充值合计 <span class="tooltiptext">游戏现金金额(游戏现金流水+平台币支出+公会内充支出=总流水)</span>
<th class="tooltip">渠道游戏内不结算充值合计 <span class="tooltiptext">游戏现金金额(游戏不结算现金流水)</span>
</th>
<th>操作</th>
<if condition="!IS_SUBSITE">
<th>操作</th>
</if>
</tr>
</thead>
<!-- 列表 -->
@ -257,21 +259,33 @@
<td>{$data['company_belong']}</td>
<td>{$data['develop_type_text']}</td>
<td>{$data.cash_count}</td>
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.balance_coin_count}
</td>
<td class="coin-detail" data-pay_type="-1" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>-1,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.bind_coin_count}
</td>
<td class="coin-detail" data-pay_type="-2" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/insideCoinDetail',array_merge(I('get.'),['promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.inside_cash_count}
</td>
<if condition="!IS_SUBSITE">
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.balance_coin_count}
</td>
<td class="coin-detail" data-pay_type="-1" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>-1,'promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.bind_coin_count}
</td>
<td class="coin-detail" data-pay_type="-2" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/insideCoinDetail',array_merge(I('get.'),['promote_type'=>1,'promote_id'=>$data['p_id'],p=>1,row=>10]))}">
{$data.inside_cash_count}
</td>
<else />
<td>
{$data.balance_coin_count}
</td>
<td>
{$data.bind_coin_count}
</td>
<td>
{$data.inside_cash_count}
</td>
</if>
<!-- <td><span class='ljzc'
data-value="{$data['id']}"><a>{$data.inside_cash_count}</a></span></td> -->
<td>{$data.allcount}</td>
<td style="color: red;">{$data.unallcount}</td>
<if condition="!IS_SUBSITE">
<td>
<a
href="{:U('FinancePromote/gameStatistics',array_merge(['promote_id'=>$data['p_id'],'company_id'=>$data['company_id'],'promote_type'=>1],I('get.'),['p'=>1]))}">游戏查看</a>
@ -284,6 +298,7 @@
<a href="{:U('FinancePromote/promoteUser',array_merge(['promote_id'=>$data['p_id'],'company_id'=>$data['company_id']],I('get.'),['p'=>1]))}">渠道查看</a>
</if> -->
</td>
</if>
</tr>
</volist>
</empty>
@ -295,11 +310,13 @@
<td style="text-align: center;">{$all_count['inside_cash_count']}</td>
<td style="text-align: center;">{$all_count['all_count']}</td>
<td style="text-align: center;color: red;">{$all_count['unallcount']}</td>
<td style="text-align: center;">
<a
href="{:U('FinancePromote/gameStatistics',array_merge(I('get.'),['promote_type'=>1,'p'=>1]))}">游戏查看</a>
<a href="{:U('FinancePromote/promoteUser',array_merge(I('get.'),['p'=>1]))}">渠道查看</a>
</td>
<if condition="!IS_SUBSITE">
<td style="text-align: center;">
<a
href="{:U('FinancePromote/gameStatistics',array_merge(I('get.'),['promote_type'=>1,'p'=>1]))}">游戏查看</a>
<a href="{:U('FinancePromote/promoteUser',array_merge(I('get.'),['p'=>1]))}">渠道查看</a>
</td>
</if>
</tr>
<tr class="data_summary">
<td style="text-align: center;">内外团占比:</td>

@ -225,6 +225,24 @@
</table>
<div style="width: 100%;height: 50px;"></div>
</div>
<script type="text/html" id="updateStatementTpl">
<div style="padding:10px 40px 30px;">
<spend style="font-size:14px;color:#666;">
按月份对汇总数据进行重算任务提交成功后大约需等待3-5分钟才会完成重算
</spend>
<table border="0" cellspacing="0" cellpadding="0" style="margin-top:30px;">
<tr>
<td class="l noticeinfo" style="width:80px;">重算月份:</td>
<td class="r table_radio">
<input type="text" id="updateStatementTime" name="updateStatementTime" autocomplete="off" class="date" placeholder="重算月份" />
</td>
</tr>
</table>
<button class="submit_btn mlspacing" id="updateStatementSubmit" type="submit" style="margin-top:30px;">
保存
</button>
</div>
</script>
</block>
@ -285,26 +303,70 @@
window.location.href = url;
});
$("#updateStatement").on("click",function(){
layer.confirm("重算需要花费2分钟左右时间,并且只统计上个月信息,无需重算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){
$.ajax({
type: 'post',
url: "{:U('updateStatement')}",
data:{},
success: function(data) {
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看',function(){
window.location.reload();
});
}else{
layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成');
var html = $("#updateStatementTpl").html();
layer.open({
type: 1,
title: "汇总重算",
maxWidth:720,
closeBtn: 1,
shadeClose: true,
content: html,
success:function(){
$("#updateStatementSubmit").off("click");
$("#updateStatementTime").datetimepicker({
format: 'yyyy-mm',
language: "zh-CN",
showMeridian:true,
pickDate:true,
startView: 3,
minView: 3,
autoclose: true,
pickTime:true
});
$("#updateStatementSubmit").on("click",function() {
var subtime= $("#updateStatementTime").val();
if(subtime == ''){
layer.msg('请先选择要重算的月份');
return false;
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
var subtimeArr = subtime.split("-");
var today = new Date();
today.setTime(today.getTime());
var year = today.getFullYear();
var month = today.getMonth()+1;
if(subtimeArr[0] > year){
layer.msg('要重算的月份必须小于当前时间');
return false;
}
if(subtimeArr[0] == year && subtimeArr[1] >= month){
layer.msg('要重算的月份必须小于当前时间');
return false;
}
$.ajax({
type: 'post',
url: "{:U('updateStatement')}",
data:{time:subtime},
success: function(data) {
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看',function(){
window.location.reload();
});
}else{
layer.alert('添加任务失败,已有重算任务。请等待上个重算任务完成');
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
}
});
})
//回车自动提交

@ -40,7 +40,7 @@
<a class="" href="{:U('Platform/promotepay_statistics')}">推广员充值统计</a>
</div>
<h3 class="page_title">推广员汇总</h3>
<p class="description_text">说明:统计各工会每月注册及充值总额(注册数:以玩家最后归属的公会为准,非去重)</p>
<p class="description_text">说明:统计各工会每月注册及充值总额(注册数:以玩家最后归属的公会为准,非去重)<if condition="IS_SUBSITE">/ <span style="color: red;">支付信息仅统计已固定的订单数据</span></if></p>
</div>
<div class="cf top_nav_list">

@ -36,7 +36,7 @@
</div>
<h3 class="page_title">推广员充值统计</h3>
<p class="description_text">说明:针对所有推广员下的充值金额,进行充值排行统计:游戏、平台币、绑币的现金充值总额</p>
<p class="description_text">说明:针对所有推广员下的充值金额,进行充值排行统计:游戏、平台币、绑币的现金充值总额<if condition="IS_SUBSITE">/ <span style="color: red;">支付信息仅统计已固定的订单数据</span></if></p>
</div>
<div class="cf top_nav_list">

@ -0,0 +1,982 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css"/>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
tr td:nth-child(3){
max-width: 200px;
word-wrap:break-word;
line-height: 1.5;
padding:5px;
}
.search_list{
margin-bottom: 15px;
}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
.data_list table td{
line-height: 2;
}
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">游戏充值</h3>
<p class="description_text">说明游戏SDK内所有支付的订单 / 最后固定数据时间:【{$lastSynTime}】</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" name="{$model['search_key']|default='user_account'}" placeholder="玩家账号" class=""
value="{:I('user_account')}">
</div>
<div class="input-list">
<input type="text" name="pay_order_number" class="" value="{:I('pay_order_number')}" placeholder="支付订单号">
</div>
<div class="input-list">
<input type="text" name="extend" class="" value="{:I('extend')}" placeholder="CP订单号">
</div>
<div class="input-list">
<input type="text" readonly id="time-start" name="timestart" class="" value="{$startDate}"
placeholder="充值开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time-end" name="timeend" class="" value="{$endDate}"
placeholder="充值结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
<option value="">游戏名称</option>
<volist name=":getAllGame()" id="vo">
<option value="{$vo.game_name}" <?php echo $vo.relation_game_name == I('game_name') ? 'selected':''; ?> >{$vo.game_name}</option>
</volist>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_type" name="game_type" class="select_gallery" >
<option value="">设备类型</option>
<option value="1" <?php echo I('game_type') == 1 ? "selected" : ''?>>安卓</option>
<option value="2" <?php echo I('game_type') == 2 ? "selected" : ''?>>苹果</option>
</select>
</div>
<div class="input-list input-list-server search_label_rehab">
<select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
<option value="">区服名称</option>
</select>
</div>
<div class="input-list input-list-spend search_label_rehab">
<select id="pay_way_id" name="pay_way" class="select_gallery" style="width:120px;">
<option value="">充值方式</option>
<volist name=":all_pay_way_other(1)" id="vo">
<option value="{$vo.key}">{$vo.value}</option>
</volist>
</select>
</div>
<div class="input-list search_item input-list-orderstatus">
<select name="pay_status" style="color:#444" class="select_gallery" id="sel_order">
<option value="">订单状态</option>
<option value="1">充值成功</option>
<option value="0">下单未付款</option>
</select>
</div>
<div class="input-list">
<input type="text" name="spend_ip" class="" value="{:I('spend_ip')}" placeholder="充值ip">
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="pay_game_status" style="color:#444" class="select_gallery" id="pay_game_status">
<option value="">游戏通知状态</option>
<option value="1">通知成功</option>
<option value="0">通知失败</option>
<option value="2">已退款</option>
</select>
</div>
<br>
<div class="input-list input-list-game search_label_rehab">
<select id="company_id" name="company_id" class="select_gallery" >
<option value="">请选择公司</option>
<volist name="promoteCompany" id="vo">
<option value="{$vo.id}" <?php if ( isset($_POST['company_id']) && $_POST['company_id'] == $vo['id']):?>selected<?php endif;?>>{$vo.name}</option>
</volist>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">
<option value="">请选择推广员等级</option>
<option value="1" <?php if ($_POST['promote_level'] == 1):?>selected<?php endif;?>>会长</option>
<option value="2" <?php if ($_POST['promote_level'] == 2):?>selected<?php endif;?>>部门长</option>
<option value="3" <?php if ($_POST['promote_level'] == 3):?>selected<?php endif;?>>组长</option>
<option value="4" <?php if ($_POST['promote_level'] == 4):?>selected<?php endif;?>>组员</option>
</select>
-
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_id" style="color:#444" class="select_gallery" id="promote_id">
<option value="">请选择推广员</option>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="platform_type" style="color:#444" class="select_gallery" id="platform_type">
<option value="0">游戏平台</option>
<option value="1">联运平台</option>
<option value="2">聚合平台</option>
</select>
</div>
<if condition="!IS_SUBSITE">
<div class="input-list search_item input-list-gamenoticestatus">
<select id="merchant_id" name="merchant_id" class="select_gallery">
<option value="0">请选择商户</option>
<volist name=":getMerchantList()" id="vo">
<option value="{$vo.id}" <if condition="$_GET['merchant_id'] eq $vo['id']">selected</if>>{$vo.name}</option>
</volist>
</select>
</div>
</if>
<div class="input-list search_item input-list-gamenoticestatus">
<select id="is_check" name="is_check" class="select_gallery">
<option value="">是否参与结算</option>
<option value="1"></option>
<option value="2"></option>
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list search_item">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<foreach name="menubtn" item="vo" >
{$vo}
</foreach>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list zdata_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>支付订单号</th>
<th style="max-width: 100px;">CP订单号</th>
<th><a class="paixu" data-order='pay_time'>
充值时间
</a></th>
<th>支付时间</th>
<th>玩家账号</th>
<th>游戏名称</th>
<th>设备类型</th>
<th>所属推广员</th>
<th>所属市场专员</th>
<th>所属商户</th>
<th>充值ip</th>
<th>区服ID</th>
<th>游戏区服</th>
<th>角色ID</th>
<th>角色名称</th>
<th>订单金额</th>
<th><a class="paixu" data-order='pay_amount'>
实付金额
</a></th>
<th>充值方式</th>
<th>订单状态</th>
<th>游戏通知状态</th>
<th>是否参与结算</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name="list_data">
<td colspan="22" class="text-center">aOh! 暂时还没有内容!</td>
<else/>
<volist name="list_data" id="data">
<tr>
<td ><input class="ids" type="checkbox" data-ischeck="{$data.is_check}" value="{$data['id']}" name="ids[]"></td>
<td>
{$data.pay_order_number}
</td>
<td>
{$data.extend}
</td>
<td>{:set_show_time($data['pay_time'])}</td>
<td>
<if condition="$data['pay_status'] eq 1">
{:set_show_time($data['payed_time'])}
<else />
------
</if>
</td>
<td>
{$data.user_account}
<gt name="data.small_id" value="0"><neq name="data.small_id" value="$data.user_id">{$data.small_account}</neq></gt></td>
<td>{$data.game_name}</td>
<td>{$data.sdk_version_name}</td>
<td>
<eq name="data.promote_id" value="-1">C('OFFICIEL_CHANNEL')<else/>
<!-- <if condition="$is_admin eq true ">
{:get_promote_account($data['promote_id'])}
<else />
{:encryptStr(get_promote_account($data['promote_id']))}
</if>-->
{$data['promote_account']}
<!-- {:get_promote_account($data['promote_id'])}-->
</eq>
</td>
<td >{$data.market_admin_username}</td>
<td >{:getMerchantName($data['merchant_id'])}</td>
<td>{$data.spend_ip}</td>
<empty name='data.server_name'>
<td>— —</td>
<td>— —</td>
<else/>
<td>{$data.server_id}</td>
<td>{$data.server_name}</td>
</empty>
<empty name='data.game_player_name'>
<td>— —</td>
<td>— —</td>
<else/>
<td>{$data.game_player_id}</td>
<td>{$data.game_player_name}</td>
</empty>
<td>{$data.cost|default=0.00}</td>
<td><span>{$data.pay_amount}</span></td>
<td>{:get_pay_way($data['pay_way'])}</td>
<td>
<if condition="$data['pay_status'] eq 1"><span class="order_status_color">{:get_info_status($data['pay_status'],9)}</span>
<else/>
{:get_info_status($data['pay_status'],9)}
</if>
</td>
<td>
<if condition="$data['pay_status'] eq 1"><span class="game_notice_status_color">{:get_info_status($data['pay_game_status'],14)}</span>
<elseif condition="$data.pay_status eq 0"/>
— —
<else/>
{:get_info_status($data['pay_game_status'],14)}
</if>
</td>
<td>{$data.is_check_str}</td>
<td style="text-indent:0;">
<?php
if (!(substr($data['pay_order_number'], 0, 3) == "PF_" &&
substr($data['pay_order_number'], -2) == '_1')) {
?>
<if condition="($data['pay_game_status'] eq 0 or $data['pay_game_status'] eq 2) and $data['pay_status'] eq 1">
<a class=" budan" href="javascript:void(0);"
href-data="{$data.pay_order_number}" href-hhh="{:U('Repair/repairEdit')}" style="width:100%;">补单</a>
<else/>
<span>补单</span>
</if>
<?php }?>
<br />
<if condition="($data['pay_game_status'] eq 0 or $data['pay_game_status'] eq 2) and ($data['pay_status'] eq 0 or $data['pay_status'] eq 2)">
<a class="pay_repair" href="javascript:void(0);"
href-data="{$data.pay_order_number}" href-hhh="{:U('Repair/noticePayed')}" style="width:100%;">通知到账</a>
</if>
</td>
</tr>
</volist>
</empty>
<tr class="data_summary">
<td colspan="2">汇总</td>
<td colspan="21">
当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))}
累计充值:{$total}(此处只汇总充值成功的订单)
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page">
<a class="sch-btn" href="{:U('exportList',array_merge(array('xlsname'=>'游戏订单_游戏充值','issubdata'=>$isSubData),I('get.')))}">导出</a>
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Spend/lists">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
<script type="text/html" id="addSubSpendTpl">
<div style="padding:10px 40px 30px;">
<spend style="font-size:14px;color:#666;">
最后固定数据时间:【{$lastSynTime}】<br/>仅能固定最后固定数据时间之后的订单<br/>订单日期表示:最后固定的时间到所选时间(含)之间的订单数据进行固定
</spend>
<table border="0" cellspacing="0" cellpadding="0" style="margin-top:30px;">
<tr>
<td class="l noticeinfo" style="width:80px;">订单日期:</td>
<td class="r table_radio">
<input type="text" id="addSubSpendTime" name="addSubSpendTime" autocomplete="off" class="date" placeholder="订单日期" />
</td>
</tr>
</table>
<button class="submit_btn mlspacing" id="addSubSpendSubmit" type="submit" style="margin-top:30px;">
保存
</button>
</div>
</script>
<script type="text/html" id="updateSubSpendTpl">
<div style="padding:10px 40px 30px;">
<spend style="font-size:14px;color:#666;">
已固定订单时间:【{$lastSynTime}】<br/>重新固定的数据将覆盖之前的订单数据
</spend>
<table border="0" cellspacing="0" cellpadding="0" style="margin-top:30px;">
<tr>
<td class="l noticeinfo" style="width:100px;">订单开始日期:</td>
<td class="r table_radio">
<input type="text" id="updateSubSpendStart" name="updateSubSpendStart" autocomplete="off" class="date" placeholder="订单开始日期" />
</td>
</tr>
<tr style="height:20px;"></tr>
<tr>
<td class="l noticeinfo" style="width:100px;">订单结束日期:</td>
<td class="r table_radio">
<input type="text" id="updateSubSpendEnd" name="updateSubSpendEnd" autocomplete="off" class="date" placeholder="订单结束日期" />
</td>
</tr>
</table>
<button class="submit_btn mlspacing" id="updateSubSpendSubmit" type="submit" style="margin-top:30px;">
保存
</button>
</div>
</script>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script>
<volist name = ":I('get.')" id = "vo">
Think.setValue('{$key}', "{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
var SPENDOP={
lastSynTime:"{$lastSynTime}",
publiucAjax:function(url,senddata,callback){
$.ajax({
type: 'post',
url: url,
data:senddata,
success: function(data) {
console.log(data)
if(data.status == 1){
callback(data.info);
}else{
layer.alert(data.info);
return false;
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
},
initFun(){
this.mainEven();
},
closeLayer(){
layer.closeAll();
},
reload(){
setTimeout(function(){
window.location.reload();
},1000);
},
oepnHtml(title,dom,callback){
var html = $(dom).html();
layer.open({
type: 1,
title: title,
maxWidth:720,
closeBtn: 1,
shadeClose: true,
content: html,
success:callback
});
},
oepnIframe(text){
var url = "{:U('changeSubSpend')}"+"&ids="+text;
layer.open({
type: 2,
title: "海南万盟天下科技有限公司",
shadeClose: true,
shade: 0.8,
area: ['40%', '60%'],
content: url
});
// layer.closeAll("loading");
},
mainEven(){
$("#addSubSpendSet").on("click",function() {
SPENDOP.oepnHtml("新增固定订单","#addSubSpendTpl",SPENDOP.addSubSpendSetEvent);
});
$("#updateSubSpend").on("click",function() {
SPENDOP.oepnHtml("重新固定订单","#updateSubSpendTpl",SPENDOP.updateSubSpendEvent);
});
$("#changeSubSpend").on("click",function() {
var ids= SPENDOP.getSelectIds();
if(ids){
SPENDOP.oepnIframe(ids);
}
});
},
getSelectIds(){
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
return $(elem).val();
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>请先选择需要换绑的数据</font>");
return;
}
return text.join(",");
},
addSubSpendSetEvent(){
$("#addSubSpendSubmit").off("click");
$("#addSubSpendTime").datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
});
$("#addSubSpendSubmit").on("click",function() {
var subtime= $("#addSubSpendTime").val();
var day2 = new Date();
day2.setTime(day2.getTime());
var today = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate();
var lastSynTime = Date.parse(SPENDOP.lastSynTime);
today = Date.parse(today);
var subtimenum = Date.parse(subtime);
if(subtimenum >= today) {
layer.msg('固化数据必须小于当日');
return false;
}
if(subtimenum <= lastSynTime) {
layer.msg('所选时间已固化');
return false;
}
//执行
SPENDOP.publiucAjax("{:U('addSubSpendSet')}",{time:subtime},function(info){
layer.msg(info);
SPENDOP.reload();
});
})
},
updateSubSpendEvent(){
$("#updateSubSpendSubmit").off("click");
$("#updateSubSpendStart").datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
});
$("#updateSubSpendEnd").datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
});
$("#updateSubSpendSubmit").on("click",function() {
var begin= $("#updateSubSpendStart").val();
var end= $("#updateSubSpendEnd").val();
var startNum = Date.parse(begin);
var endNum = Date.parse(end);
var lastSynTime = Date.parse(SPENDOP.lastSynTime);
if(startNum > endNum) {
layer.msg('开始时间必须小于结束时间');
return false;
}
if ((startNum - endNum) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
if(endNum > lastSynTime) {
layer.msg('重算结束时间必须在最后固定时间之前');
return false;
}
//执行
SPENDOP.publiucAjax("{:U('updateSubSpend')}",{begin:begin,end:end},function(info){
layer.msg(info);
SPENDOP.reload();
});
})
}
}
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
function reload() {
window.location.reload();
}
$(function () {
SPENDOP.initFun();
//搜索功能
$("#search").click(function () {
var sdate = Date.parse($('#time-start').val()) / 1000;
var edate = Date.parse($('#time-end').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
query = query.replace(/^&/g, '');
if (url.indexOf('?') > 0) {
url += '&' + query;
} else {
url += '?' + query;
}
window.location.href = url;
});
$(".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();
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var end = new Date($.trim($('#time-end').val())).getTime();
if (val>end) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$("#time-end").datetimepicker({
format:"yyyy-mm-dd",
language: "zh-CN",
showMeridian:true,
minView:2,
autoclose:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var start = new Date($.trim($('#time-start').val())).getTime();
if (val<start) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$(".budan").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
$.ajax({
type: 'post',
url: url,
data: {orderNo: data},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
if (e.msg) {
var tip_msg = e.msg;
} else {
var tip_msg = e.info ? e.info : "补单失败";
}
layer.msg(tip_msg, {icon: 2});
}
},
});
});
$(".budan2").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
$.ajax({
type: 'post',
url: url,
data: {orderNo: data},
success: function (e) {
if (e.status == 1) {
if (e.msg.length > 30) {
window.open(e.msg);
} else {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
}
} else {
layer.msg(e.msg, {icon: 2});
}
},
});
});
// 充值补单
$(".pay_repair").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
var pwd2 = prompt("请输入二级密码");
if (!pwd2) {
alert("二级密码不能为空");
return ;
}
$.ajax({
type: 'post',
url: url,
data: {orderNo: data, second: pwd2, type: 'spend'},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
if (e.msg) {
var tip_msg = e.msg;
} else {
var tip_msg = e.info ? e.info : "补单失败";
}
layer.msg(tip_msg, {icon: 2});
}
},
});
});
$(".d_list").find(".drop-down11").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down11 .nav-list li").find("a").each(function () {
var that = $(".drop-down11");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down12").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down12 .nav-list li").find("a").each(function () {
var that = $(".drop-down12");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down13").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down13 .nav-list li").find("a").each(function () {
var that = $(".drop-down13");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
//下拉内容框
$(".drop-down2").on('click', function (event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function () {
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#i_list_id').on('keyup', function (event) {
var val = $.trim($(this).val()).toLowerCase();
$('#i_list_idh').val(val);
});
$("#i_list_li").find("a").each(function () {
$(this).click(function () {
var text = $.trim($(this).text()).toLowerCase();
$("#i_list_id").val(text);
$('#i_list_idh').val(text);
})
});
})
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',
success:function(response){
str = '<option value="">请选择推广员</option>' +
// '<option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>官方渠道</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();
}
})
});
$("#promote_level").change();
var game_server = "{:I('server_id')}";
$("#game_type").change(function(){
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
type:"post",
data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json',
success:function(data){
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_id+"' "+(game_server && data[i].server_id == game_server?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
});
$("#game_name").change(function(){
$("#game_type").change();
});
$("#game_name").change();
$("#addStatement,#removeStatement").on("click",function(){
var id = $(this).attr("id");
if(id == "addStatement"){
var opname = "参与结算";
var opurl = "{:U('addStatement')}";
var opst ="[不参与结算]";
var status = [2];
}else if(id=="removeStatement"){
var opname = "移出结算";
var opurl = "{:U('removeStatement')}";
var opst ="[参与结算]";
var status = [1];
}
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
const ischeck = $(elem).data("ischeck");
if($.inArray(ischeck,status) > -1){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要'+opname+'的操作,仅'+opst+'状态可以进行'+opname+"</font>");
return;
}
text = text.join(",");
layer.confirm('【提示】'+opname+'操作后,相应的结算单需要进行重算后生效', {
btn: ['确认','取消'],
title:false
}, function(index){
layer.close(index);
layer.load(2);
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: true,
data: {ids:text},
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
})
/**
* 初始化select2单选默认带搜索功能。
*/
//初始化页面加载
$(document).ready(function () {
});
</script>
</block>

@ -0,0 +1,230 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script src="__STATIC__/juicer-min.js" type="text/javascript"></script>
</head>
<style>
html {
min-width:100%;
}
body {
max-width: 90%;
padding: 5% 0 0 5%;
}
.tabcon1711 table{
width: 480px;
}
table{
margin: auto;
}
.hidebox{
display: none;
}
.r{
width: 300px;
}
.l{
width: 180px;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;
height: 35px;
height: 28px;
border-radius: 3px;
font-size: 12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height: 35px;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height: 26px;
line-height: 26px;
font-size: 12px;
}
.select2-results__option[aria-selected] {
font-size: 12px;
}
.input-list, .i_list {
float: left;
margin: 0;
}
</style>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/pro_promote.css" type="text/css" />
<script src="__STATIC__/jquery.form.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.butnbox a{
cursor:pointer
}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.data_list table td{
line-height: 2;
}
#tablebox tr{
border-bottom: 1px solid #e6e6e6;
}
</style>
<div style="font-size:14px;color:red;margin-bottom: 30px;">
说明:换绑后的数据将归属到选择的公司
</div>
<div class="cf top_nav_list">
<!-- <div class="fl button_list">
<div class="tools">
<a class=" " href="{:U('add')}"><span class="button_icon button_icon1"></span>新增推广游戏分成</a>
</div>
</div> -->
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list" style="margin-bottom:12px">
<div class="input-list search-title-box">
<label>选择下游公司:</label>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="company_id" name="company_id" class="select_gallery" >
<option value="">请选择换绑公司</option>
<volist name="promoteCompany" id="vo">
<option value="{$vo.id}">{$vo.name}</option>
</volist>
</select>
</div>
<input id="ids" type="hidden" name="ids" value="{$ids}">
<div class="input-list" style="margin-left: 20px">
<a class="sch-btn" href="javascript:;" id="add_company" style="width: 100px;">确认换绑</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div>所选订单统计:</div>
<div class="">
<table id="tablebox">
<!-- 表头 -->
<thead>
<tr>
<th>公司</th>
<th>金额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<volist name="data['list']" id="vo">
<tr>
<td>{$vo.company_name}</td>
<td>{$vo.pay_amount}</td>
</tr>
</volist>
<tr>
<td>合计:</td>
<td>{$data['count']}</td>
</tr>
</tbody>
</table>
</div>
</div>
<script type="text/javascript">
$(function(){
$("#company_id").select2();
//添加公司比例操作
$('#add_company').click(function () {
var company_id = $("#company_id").find("option:selected").val();
var ids = $("#ids").val();
if(company_id == ''){
layer.msg('请选择要换绑到的公司');
return false;
}
layer.load(2);
$.ajax({
type: 'post',
url: "{:U('changeSubSpend')}",
data:{"ids":ids,'company_id':company_id},
success: function(data) {
if(data.status == 1){
layer.msg(data.info);
setTimeout(function(){
parent.reload();
},1000)
}else{
layer.alert(data.info);
return false;
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
});
</script>
</block>
</html>

@ -264,9 +264,9 @@ body {
<div id="bind-box" class="layer-box" style="display: none;">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label>玩家账号</label>
<label>角色ID</label>
<div class="form-item" style="width: 250px">
<input id="bind_account" name="account" type="text" class="form-input" style="width: 100%;">
<input id="bind_role_id" name="bind_role_id" type="text" class="form-input" style="width: 100%;">
</div>
</div>
<div class="form-group">
@ -535,48 +535,17 @@ body {
$('#verify-quota').html(verifyQuota)
$('#quota').html(quota-verifyQuota)
}
$('#test_account').on({
blur: function() {
var gameId = $('#game-select').val()
if (gameId == 0) {
return layer.msg('请选择游戏')
}
var serverId = $('#server-select').val()
if (serverId == 0) {
return layer.msg('请选择区服')
}
var userAccount = $('#test_account').val()
if (userAccount == '') {
return layer.msg('请输入测试资源账号')
}
getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) {
if (roles.length == 0) {
return layer.msg('当前账号在该区服未创建角色')
}
if (!isTestingAccount) {
return layer.msg('此账号非测试账号')
}
var html = "<option value=''>请选择角色</option>";
for (var i in roles){
html += "<option value='"+roles[i].role_id+"'>"+roles[i].role_name+"</option>"
}
$("#role-select").html(html);
$("#role-select").select2();
})
}
})
function getUserRoles(userAccount, gameId, serverId, callback) {
function getUserRoles(bindRoleId, gameId, callback) {
$.ajax({
url: "{:U('getUserRoles')}",
type: "post",
data: { user_account: userAccount, game_id: gameId, server_id: serverId },
data: { role_id: bindRoleId, game_id: gameId },
dataType: 'json',
success: function(result){
if (result.status == 1) {
var roles = result.data.roles
var isTestingAccount = result.data.is_testing_account
callback(roles, isTestingAccount)
callback(roles)
} else {
layer.msg(result.message)
}
@ -584,7 +553,7 @@ body {
})
}
$('#bind_account').on({
$('#bind_role_id').on({
blur: function () {
var gameId = $('#game-select').val()
if (gameId == 0) {
@ -594,16 +563,13 @@ body {
if (serverId == 0) {
return layer.msg('请选择区服')
}
var userAccount = $('#bind_account').val()
if (userAccount == '') {
return layer.msg('请输入玩家账号')
var bindRoleId = $('#bind_role_id').val()
if (bindRoleId == '') {
return layer.msg('请输入角色ID')
}
getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) {
getUserRoles(bindRoleId, gameId, function(roles) {
if (roles.length == 0) {
return layer.msg('玩家账号在该区服未创建角色')
}
if (isTestingAccount) {
return layer.msg('此账号为测试账号,无法绑定')
return layer.msg('未查询到角色')
}
var html = "<option value=''>请选择角色</option>";
for (var i in roles){
@ -726,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;

@ -2,6 +2,7 @@
namespace Base\Repository;
use Base\Service\GameService;
use Base\Tool\Registry;
use Base\Service\PromoteService;
@ -222,7 +223,7 @@ class TestingResourceRepository
'provide_status' => $batch['provide_status'],
'provide_status_text' => $this->getProvideStatusText($batch['provide_status']),
'provide_time' => $batch['provide_time'] == 0 ? '--' : date('Y-m-d H:i:s', $batch['provide_time']),
'content' => $content,
'content' => '',
];
}
return $records;
@ -317,6 +318,7 @@ class TestingResourceRepository
foreach ($roles as $role) {
$bindingOrWhere[] = '(role_id="' . $role['role_id'] . '" and game_id=' . $role['game_id'] . ')';
}
$bindingOrWhereStr = '(' . implode(' or ', $bindingOrWhere) . ')';
$userIds = array_unique(array_column($roles, 'user_id'));
$users = [];
@ -325,15 +327,30 @@ class TestingResourceRepository
$applyRecords = [];
$testingUsers = [];
if (count($roles) > 0) {
$games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($roles, 'game_id')]])->select();
$games = index_by_column('id', $games);
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$testingUsers = M('testing_user', 'tab_')->where(['user_id' => ['in', $userIds]])->select();
$testingUsers = index_by_column('user_id', $testingUsers);
$users = M('user', 'tab_')->field(['id', 'phone', 'lock_status'])->where(['id' => ['in', $userIds]])->select();
$users = index_by_column('id', $users);
$bindingRows = M('testing_binding', 'tab_')->where(['_string' => implode(' or ', $bindingOrWhere)])->select();
$bindingRows = M('testing_binding', 'tab_')->where(['_string' => $bindingOrWhereStr])->select();
$bindingRoleIds = [];
foreach ($bindingRows as $bindingRow) {
$bindings[$this->getGameRoleId($bindingRow['game_id'], $bindingRow['role_id'])] = $bindingRow;
$bindingRoleIds[] = $this->getGameRoleId($bindingRow['game_id'], $bindingRow['bind_role_id']);
$game = $games[$bindingRow['game_id']];
$gameIds = [$bindingRow['game_id']];
if ($game['data_share'] == 1) {
$baseGame = $gameRepository->getBaseGameByGameId($bindingRow['game_id'], $baseGames);
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
foreach ($gameIds as $gameId) {
$bindingRoleIds[] = $this->getGameRoleId($gameId, $bindingRow['bind_role_id']);
}
}
if (count($bindings) > 0) {
$bindingRoles = M('user_play_info', 'tab_')
@ -347,7 +364,7 @@ class TestingResourceRepository
->field('sum(apply_amount) amount, game_id, role_id')
->where([
'verify_status' => 0,
'_string' => implode(' or ', $bindingOrWhere)
'_string' => $bindingOrWhereStr,
])
->group('game_id,role_id')->select();
$verifyRecords = [];
@ -359,7 +376,7 @@ class TestingResourceRepository
->field('sum(provide_amount) amount, game_id, role_id')
->where([
'verify_status' => 1,
'_string' => implode(' or ', $bindingOrWhere)
'_string' => $bindingOrWhereStr,
])
->group('game_id,role_id')->select();
$provideRecords = [];
@ -371,9 +388,8 @@ class TestingResourceRepository
->field('sum(provide_amount) amount, game_id, role_id')
->where([
'verify_status' => 1,
'_string' => implode(' or ', $bindingOrWhere),
'provide_time' => ['egt', strtotime(date('Y-m-d 00:00:00'))],
'provide_time' => ['elt', strtotime(date('Y-m-d 23:59:59'))],
'_string' => $bindingOrWhereStr,
'provide_time' => ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]],
])
->group('game_id,role_id')->select();
$todayProvideRecords = [];
@ -384,7 +400,7 @@ class TestingResourceRepository
$applyItems = M('testing_resource_batch', 'tab_')
->field('sum(apply_amount) amount, game_id, role_id')
->where([
'_string' => implode(' or ', $bindingOrWhere),
'_string' => $bindingOrWhereStr,
])
->group('game_id,role_id')->select();
$applyRecords = [];
@ -395,10 +411,27 @@ class TestingResourceRepository
}
$spendItems = [];
$revGameIdMap = [];
$gameIdMap = [];
if (count($bindingRoles) > 0) {
$games = M('game', 'tab_')->field(['id', 'data_share'])->where(['id' => ['in', array_column($bindingRoles, 'game_id')]])->select();
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,
@ -407,7 +440,7 @@ class TestingResourceRepository
$subBindingCondition = [
'_string' =>
'tab_testing_binding.bind_role_id = tab_spend.game_player_id and ' .
'tab_testing_binding.game_id = tab_spend.game_id and ' .
'tab_testing_binding.bind_user_id = tab_spend.user_id and ' .
'UNIX_TIMESTAMP(FROM_UNIXTIME(tab_testing_binding.create_time, "%Y-%m-%d 00:00:00")) <= tab_spend.pay_time'
];
$spendRepository = new SpendRepository();
@ -424,7 +457,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();
@ -439,6 +478,7 @@ class TestingResourceRepository
'todayProvideRecords' => $todayProvideRecords,
'gameSettings' => $gameSettings,
'testingUsers' => $testingUsers,
'revGameIdMap' => $revGameIdMap
];
}
@ -451,33 +491,46 @@ class TestingResourceRepository
$gameSettings = $result['gameSettings'];
$bindings = $result['bindings'];
$bindingRoles = $result['bindingRoles'];
$revGameIdMap = $result['revGameIdMap'];
$applyRecords = $result['applyRecords'];
$provideRecords = $result['provideRecords'];
$verifyRecords = $result['verifyRecords'];
$todayProvideRecords = $result['todayProvideRecords'];
$gameSettings = index_by_column('base_game_id', $gameSettings);
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$records = [];
foreach ($roles as $role) {
$user = $users[$role['user_id']] ?? null;
$testingUser = $testingUsers[$role['user_id']] ?? null;
$binding = $bindings[$role['game_role_id']] ?? null;
$bindingRole = null;
if ($binding) {
$bindGameRoleId = $this->getGameRoleId($binding['game_id'], $binding['bind_role_id']);
$bindingRole = $bindingRoles[$bindGameRoleId] ? $bindingRoles[$bindGameRoleId] : null;
}
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
$gameSetting = null;
if ($baseGame && isset($gameSettings[$baseGame['id']])) {
$gameSetting = $gameSettings[$baseGame['id']];
}
$spendQuota = $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0;
$quota = $gameSetting ? round($spendQuota * $gameSetting['rate'] / 100, 2) : 0;
$spendQuota = 0;
$quota = 0;
if ($binding) {
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
foreach ($gameIds as $gameId) {
$bindGameRoleId = $this->getGameRoleId($gameId, $binding['bind_role_id']);
if (isset($bindingRoles[$bindGameRoleId])) {
$bindingRole = $bindingRoles[$bindGameRoleId];
break;
}
}
if ($bindingRole) {
$mainGameId = $revGameIdMap[$binding['game_id']];
$mainGameRoleId = $this->getGameRoleId($mainGameId, $binding['bind_role_id']);
$spendQuota = isset($spendItems[$mainGameRoleId]) ? $spendItems[$mainGameRoleId] : 0;
}
$quota = $gameSetting ? round($spendQuota * $gameSetting['rate'] / 100, 2) : 0;
}
$statusText = '正常';
if (is_null($user) || is_null($testingUser)) {

@ -2,6 +2,7 @@
namespace Base\Service;
use Base\Facade\Request;
use Base\Repository\GameRepository;
use Base\Tool\GameResource;
use Base\Repository\TestingResourceRepository;
use Base\Repository\SpendRepository;
@ -157,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))]
@ -167,17 +168,16 @@ class TestingResourceService
$spendRepository = new SpendRepository();
$spendMap = $spendRepository->withIsCheck($spendMap);
$spendQuota += M('spend', 'tab_')
$spendQuota = M('spend', 'tab_')
->where($spendMap)
->group('game_id,game_player_id')
->sum('pay_amount');
$totalQuota += round($gameSetting['rate'] / 100 * $spendQuota, 2);
}
$providedQuota = M('testing_resource_batch', 'tab_')
->where(['provide_status' => [in, [1, 2]], 'game_id' => $role['game_id'], 'role_id' => $role['role_id']])
->where(['provide_status' => ['in', [1, 2]], 'game_id' => $role['game_id'], 'role_id' => $role['role_id']])
->sum('provide_amount');
$providingQuota = M('testing_resource_batch', 'tab_')
->where(['verify_status' => [in, [0, 1]], 'provide_status' => 0, 'game_id' => $role['game_id'], 'role_id' => $role['role_id']])
->where(['verify_status' => ['in', [0, 1]], 'provide_status' => 0, 'game_id' => $role['game_id'], 'role_id' => $role['role_id']])
->sum('apply_amount');
return round(floatval($totalQuota) - floatval($providedQuota) - floatval($providingQuota), 2);
}
@ -300,9 +300,24 @@ class TestingResourceService
throw new \Exception('测试角色所属推广员异常');
}
$game = M('game', 'tab_')->where(['id' => $gameId])->find();
if (is_null($game)) {
throw new \Exception('游戏不存在');
}
$gameIds = [$gameId];
if ($game['data_share'] == 1) {
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$baseGame = $gameRepository->getBaseGameByGameId($gameId, $baseGames);
if (is_null($baseGame)) {
throw new \Exception('游戏不存在');
}
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
$bindRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'promote_id'])
->where(['game_role_id' => $bindGameRoleId])
->where(['role_id' => $bindRoleId, 'game_id' => ['in', $gameIds]])
->find();
if (is_null($bindRole)) {
throw new \Exception('玩家角色不存在');
@ -426,13 +441,23 @@ class TestingResourceService
$bindingRole = null;
if ($binding) {
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$gameIds = [$gameId];
if ($game['data_share'] == 1) {
$baseGame = $gameRepository->getBaseGameByGameId($gameId, $baseGames);
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
$bindingRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'promote_id', 'game_id'])
->where(['game_id' => $gameId, 'role_id' => $binding['bind_role_id']])
->where(['game_id' => ['in', $gameIds], 'role_id' => $binding['bind_role_id']])
->find();
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))) {

@ -12,6 +12,7 @@ class BaseController extends HomeController
protected $loginPromote = null;
protected $canViewUserRecharge = true;
protected $permControlUrls = [
'Home/Query/recharge',
'Home/Players/playAction',

@ -2002,6 +2002,7 @@ class DownloadController extends BaseController
$serverId = I('server_id', 0);
$isSelf = I('is_self', 0);
$roleName = I('role_name', '');
$roleId = I('role_id', '');
$userAccount = I('user_account', '');
$promoteId = I('promote_id', 0);
$sdkVersion = I('sdk_version', 0);
@ -2036,6 +2037,9 @@ class DownloadController extends BaseController
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
}
if ($roleId != '') {
$map['role_id'] = $roleId;
}
if ($userAccount != '') {
$map['user_account'] = ['like', '%' . $userAccount . '%'];
}
@ -2063,7 +2067,7 @@ class DownloadController extends BaseController
$map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
}
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
$map['role.promote_id'] = $queryPromote['id'];
}
$orderBy = 'create_time desc';
@ -3120,6 +3124,7 @@ public function iosDetailExcelInfo($id,$map) {
array('device_number','设备码'),
array('register_time','注册时间'),
array('register_ip','注册IP'),
array('role_id','角色ID'),
array('login_time','最近登录时间'),
array('login_ip','最近登录IP'),
@ -3144,6 +3149,7 @@ public function iosDetailExcelInfo($id,$map) {
'role.server_name',
'role.sdk_version',
'role.role_name',
'role.role_id',
'role.role_level',
'role.create_time',
'role.play_time',

@ -177,6 +177,7 @@ class HomeController extends Controller
{
$testKey = I('test_key', '');
$code = I('code', '');
$force = I('force', '');
$gameId = I('gid', 0);
$promoteId = I('pid', 0);
if ($code == '' && ($gameId == 0 || $promoteId == 0)) {
@ -216,6 +217,13 @@ class HomeController extends Controller
$isIOS = Request::isIOS() || Request::isIPadOS();
$isAndroid = Request::isAndroid();
$isIOS13 = Request::isIOS13();
if ($force == 'ios') {
$isIOS = true;
$isAndroid = false;
} elseif ($force == 'android') {
$isIOS = false;
$isAndroid = true;
}
if ($testKey != '') {
$tempDataDir = RUNTIME_PATH . 'Data';
@ -301,15 +309,18 @@ class HomeController extends Controller
$downloadUrl = 'itms-services://?action=download-manifest&url=' . Request::getHost() . ltrim($gameSource['org_plist_url'], '.');
} else {
$downloadUrl = $applyService->getDownloadUrl($apply);
if ($force) {
$downloadUrl .= '/force/' . $force;
}
}
$serviceQQ = M("config", "sys_")->field('value')->where("name='APP_QQ'")->find()['value'];
$ssgUrl = $downloadDomain . '/mobile.php/Ssg/pay/game_id/' . $game['id'] . '/promote_id/' . $promoteId;
/* if(in_array($game['id'], [187, 188])) {
$game['relation_game_name'] = '游戏下载';
} */
if(in_array($game['id'], [191, 192])) {
$game['relation_game_name'] = '九灵神域';
}
$this->assign("serviceQQ", $serviceQQ);
$this->assign('isNewIos', $isNewIos);

@ -29,6 +29,7 @@ class PackageController extends Controller
public function download()
{
$code = I('code', '');
$force = I('force', '');
$gameId = I('game_id', 0);
$promoteId = I('promote_id', 0);
@ -77,11 +78,11 @@ class PackageController extends Controller
$game = M('game','tab_')->field(['id', 'game_name', 'sdk_version', 'apply_auth'])->where(['id' => $apply['game_id']])->find();
if (Request::isMobile() || Request::isTablet()) {
if (!Request::isAndroid() && $game['sdk_version'] == 1) {
if (Request::isMobile() || Request::isTablet() || $force == 'ios' || $force == 'android') {
if (!(Request::isAndroid() || $force == 'android') && $game['sdk_version'] == 1) {
$this->redirect("package/downloadError", ['message' => '请使用安卓浏览器下载']);
}
if (!(Request::isIOS() || Request::isIPadOS()) && $game['sdk_version'] == 2) {
if (!(Request::isIOS() || Request::isIPadOS() || $force == 'ios') && $game['sdk_version'] == 2) {
$this->redirect("package/downloadError", ['message' => '请使用ios浏览器下载']);
}
}
@ -104,7 +105,7 @@ class PackageController extends Controller
M('user_action_log', 'tab_')->data($log)->add();
$downloadDomain = $applyService->getDownloadDomain();
if (Request::isIOS() || Request::isIPadOS()) {
if (Request::isIOS() || Request::isIPadOS() || $force == 'ios') {
$packageDownloadLogService = new PackageDownloadLogService();
$packageDownloadLogService->add([
'user_id' => 0,

@ -1352,7 +1352,7 @@ class PromoteController extends BaseController
// if (!preg_match($pattern, $_REQUEST['email'])) {
// $this->error('您输入的电子邮箱地址不合法', U('Promote/edit_chlid', array('id' => $id, 'type' => I('type', 0))));
// };
$_POST['ts_over_apply'] = $_POST['ts_over_manage'];
$user = new PromoteApi();
$res = $user->edit($_POST);

@ -1705,6 +1705,7 @@ class QueryController extends BaseController
$serverId = I('server_id', 0);
$isSelf = I('is_self', 0);
$roleName = I('role_name', '');
$roleId = I('role_id', '');
$userAccount = I('user_account', '');
$promoteId = I('promote_id', 0);
$sdkVersion = I('sdk_version', 0);
@ -1736,6 +1737,8 @@ class QueryController extends BaseController
}
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
}if ($roleId != '') {
$map['role_id'] = $roleId;
}
if ($userAccount != '') {
$map['user_account'] = ['like', '%' . $userAccount . '%'];
@ -1761,9 +1764,11 @@ class QueryController extends BaseController
$map['create_time'] = ['between', [$createTimeBegin, $createTimeEnd]];
}
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
$map['role.promote_id'] = $queryPromote['id'];
}
$orderBy = 'create_time desc';
$sortNameData = ['login_time', 'create_time', 'role_level', 'register_time', 'role.promote_account'];
if (!empty($sortName)) {
@ -1792,12 +1797,12 @@ class QueryController extends BaseController
'role.server_name',
'role.sdk_version',
'role.role_name',
'role.role_id',
'role.role_level',
'role.create_time',
'role.play_time',
'role.play_ip'
];
$query = M('user_play_info', 'tab_')
->field($columns)
->alias('role')
@ -1809,11 +1814,14 @@ class QueryController extends BaseController
list($records, $pagination, $count) = $this->paginate($query->order($orderBy));
$countRow = $countQuery->field(['count(distinct user_id) user_count'])->find();
$subSql = M('user', 'tab_')->field('id')->where(['is_repeat' => 0])->select(false);
$map['_string'] = str_replace('role.promote_id', 'promote_id', $map['_string']) . ' and user_id in (' . $subSql . ')';
$map['promote_id'] = $map['role.promote_id'];
unset($map['role.promote_id']);
$uniqueCountRow = M('user_play_info', 'tab_')->field(['count(distinct user_id) user_count, count(*) count'])->where($map)->find();
/* $users = [];
if (count($records) > 0) {
$userIds = array_column($records, 'user_id');
@ -1836,7 +1844,7 @@ class QueryController extends BaseController
$hideChar .= '*';
}
if($record['create_time'] == 0) {
if($records[$key]['create_time'] == 0) {
$records[$key]['create_time'] = date('Y-m-d', $value['play_time']) . '<br>' . date('H:i:s', $value['play_time']);
} else {
$records[$key]['create_time'] = date('Y-m-d', $value['create_time']) . '<br>' . date('H:i:s', $value['create_time']);

@ -10,6 +10,7 @@ use Think\Model;
use Base\Service\TestingResourceService;
use Base\Repository\TestingResourceRepository;
use Base\Repository\GameRepository;
use Base\Service\GameService;
class TestingResourceController extends BaseController
{
@ -135,14 +136,25 @@ class TestingResourceController extends BaseController
$bindingRole = null;
if ($role) {
$servers = M('server', 'tab_')->field('id,server_name,server_id')->where(['game_id' => $role['game_id']])->order('server_id asc')->select();
$game = M('game', 'tab_')->where(['id' => $role['game_id']])->find(['id', 'data_share']);
$binding = M('testing_binding', 'tab_')->where(['game_id' => $role['game_id'], 'role_id' => $role['role_id']])->find();
if ($binding) {
$gameIds = [$role['game_id']];
if ($game['data_share'] == 1) {
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$baseGame = $gameRepository->getBaseGameByGameId($role['game_id'], $baseGames);
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
$bindingRole = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])
->where(['game_id' => $binding['game_id'], 'role_id' => $binding['bind_role_id']])
->where(['game_id' => ['in', $gameIds], 'role_id' => $binding['bind_role_id']])
->find();
if ($bindingRole) {
$bindingRole['binding_time'] = $binding['create_time'];
$bindingRole['share_game_ids'] = $gameIds;
}
}
@ -230,25 +242,29 @@ class TestingResourceController extends BaseController
public function getUserRoles()
{
$gameId = I('game_id', 0);
$serverId = I('server_id', 0);
$userAccount = I('user_account', '');
$server = M('server', 'tab_')->field(['id', 'server_name', 'server_id'])->where(['id' => $serverId])->find();
if (is_null($server)) {
return $this->ajaxReturn(['status' => 0, 'message' => '区服不存在']);
}
$roleId = I('role_id', 0);
$user = M('user', 'tab_')->field(['id', 'promote_id'])->where(['account' => $userAccount])->find();
if (is_null($user)) {
return $this->ajaxReturn(['status' => 0, 'message' => '账号不存在']);
$game = M('game', 'tab_')->where(['id' => $gameId])->find();
if (is_null($game)) {
return $this->ajaxReturn(['status' => 0, 'message' => '游戏不存在']);
}
$testingUser = M('testing_user', 'tab_')->where(['user_account' => $userAccount])->find();
$isTestingAccount = is_null($testingUser) ? false : true;
$gameIds = [$gameId];
if ($game['data_share'] == 1) {
$gameRepository = new GameRepository();
$baseGames = $gameRepository->getBaseGames();
$baseGame = $gameRepository->getBaseGameByGameId($gameId, $baseGames);
if (is_null($baseGame)) {
return $this->ajaxReturn(['status' => 0, 'message' => '游戏不存在']);
}
$gameIds = $gameRepository->getGameIdsByBaseGame($baseGame);
}
$roles = M('user_play_info', 'tab_')
->field(['id', 'role_id', 'role_name'])
->where(['user_account' => $userAccount, 'game_id' => $gameId, 'server_id' => $server['server_id']])
->where(['role_id' => $roleId, 'game_id' => ['in', $gameIds]])
->select();
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles, 'is_testing_account' => $isTestingAccount]]);
return $this->ajaxReturn(['status' => 1, 'message' => '获取成功', 'data' => ['roles' => $roles]]);
}
}

@ -79,6 +79,19 @@
</td>
</tr>
<?php endif;?>
<tr>
<td class="l">测试资源管理权限:</td>
<td class="r table_radio">
<span class="form_radio table_btn">
<label style="margin-right: 15px" >
<input type="radio" value="1" name="ts_over_manage" class="withdraw_done" <if condition="$data['ts_over_manage'] eq 1">checked="checked"</if>> 开启
</label >
<label >
<input type="radio" value="0" name="ts_over_manage" class="withdraw_done" <if condition="$data['ts_over_manage'] eq 0">checked="checked"</if>> 关闭
</label>
</span>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">

@ -37,134 +37,144 @@
</div>
<div class="subNavBox">
<a href="{:U('Promote/index')}" class="subNav <?=is_active_class(['Promote'], ['index'])?>"> 后台首页 </a>
<?php if ($loginer['level'] < 4) :?>
<div class="subNav jssubNav"><i class="prev_icon icon_guanli"></i><span>管理中心</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<?php
function promote_is_active_class($promoteType)
{
return is_active_class(
['Promote'],
['children', 'addPromote', 'edit_chlid'],
function() use($promoteType) {
return $_GET["promote_type"] == $promoteType;
}
);
}
?>
<?php if (in_array($loginer['level'], [1])):?>
<a href="{:U('Promote/children', ['promote_type' => 0])}" class="<?=promote_is_active_class(0)?>">部门长管理</a>
<?php endif;?>
<?php if (in_array($loginer['level'], [1, 2])):?>
<a href="{:U('Promote/children', ['promote_type' => 1])}" class="<?=promote_is_active_class(1)?>">组长管理</a>
<?php endif;?>
<?php if (in_array($loginer['level'], [1, 2, 3])):?>
<a href="{:U('Promote/children', ['promote_type' => 2])}" class="<?=promote_is_active_class(2)?>">推广员管理</a>
<?php endif;?>
</div>
<?php endif;?>
<?php
$isOpenQuery = true;
?>
<?php if($isOpenQuery):?>
<div class="subNav jssubNav"><i class="prev_icon icon_shujvi"></i><span>数据管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Query/dailySummary')}" class="<?=is_active_class(['Query'], ['dailySummary'])?>">每日概况</a>
<a href="{:U('Query/summary')}" class="<?=is_active_class(['Query'], ['summary'])?>">数据汇总</a>
<?php if($canViewUserRecharge):?>
<a href="{:U('Query/recharge')}" class="<?=is_active_class(['Query'], ['recharge', 'viewSpendDetailed'])?>">订单查询</a>
<?php endif;?>
<a href="{:U('Query/register')}" class="<?=is_active_class(['Query'], ['register', 'viewRole'])?>">注册明细</a>
<?php if($canViewUserRecharge):?>
<a href="{:U('Query/arpu')}" class="<?=is_active_class(['Query'], ['arpu'])?>">ARPU统计</a>
<?php endif;?>
<!-- <a href="{:U('Query/retention_analysis')}" class="<?=is_active_class(['Query'], ['retention_analysis'])?>">留存统计</a> -->
<a href="{:U('Query/userRoles')}" class="<?=is_active_class(['Query'], ['userRoles'])?>">角色查询</a>
<?php if($canViewUserRecharge):?>
<a href="{:U('Query/userRecharges')}" class="<?=is_active_class(['Query'], ['userRecharges'])?>">充值玩家</a>
<?php endif;?>
<a href="{:U('Query/achievement')}" class="<?=is_active_class(['Query'], ['achievement'])?>">团队/推广员业绩</a>
<!-- <a href="{:U('Query/promoteQuota')}" class="<?=is_active_class(['Query'], ['promoteQuota', 'quotaDtl'])?>">推广员指标</a> -->
<a href="{:U('Query/iosDownLoadData')}" class="<?=is_active_class(['Query'], ['iosDownLoadData'])?>">IOS下载数统计</a>
<a href="{:U('Query/userretention')}" class="<?=is_active_class(['Query'], ['userretention'])?>">用户留存率</a>
<a href="{:U('Query/gameData')}" class="<?=is_active_class(['Query'], ['gameData'])?>">游戏分区数据汇总</a>
</div>
<?php endif;?>
<?php if ($canViewUserRecharge && $loginer['level'] == 1) :?>
<div class="subNav jssubNav"><i class="prev_icon icon_caiwu"></i><span>财务管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Finance/index')}" class="<?=is_active_class(['Finance'], ['index'])?>">结算中心</a>
<a href="{:U('Finance/settlementDtl')}" class="<?=is_active_class(['Finance'], ['settlementDtl'])?>">结算明细</a>
<a href="{:U('Finance/withdrawRecord')}" class="<?=is_active_class(['Finance'], ['withdrawRecord', 'withdrawDtl', 'settlementOrder'])?>">提现记录</a>
<?php if ($loginer['withdraw_show'] == 1) :?>
<a href="{:U('Withdraw/index')}" class="<?=is_active_class(['Withdraw'], ['index', 'withdrawDetail', 'withdrawOrderDetail'])?>">公司结算</a>
<?php if ($loginer['ts_over_manage'] == 0) :?>
<?php if ($loginer['level'] < 4) :?>
<div class="subNav jssubNav"><i class="prev_icon icon_guanli"></i><span>管理中心</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<?php
function promote_is_active_class($promoteType)
{
return is_active_class(
['Promote'],
['children', 'addPromote', 'edit_chlid'],
function() use($promoteType) {
return $_GET["promote_type"] == $promoteType;
}
);
}
?>
<?php if (in_array($loginer['level'], [1])):?>
<a href="{:U('Promote/children', ['promote_type' => 0])}" class="<?=promote_is_active_class(0)?>">部门长管理</a>
<?php endif;?>
<?php if (in_array($loginer['level'], [1, 2])):?>
<a href="{:U('Promote/children', ['promote_type' => 1])}" class="<?=promote_is_active_class(1)?>">组长管理</a>
<?php endif;?>
<?php if (in_array($loginer['level'], [1, 2, 3])):?>
<a href="{:U('Promote/children', ['promote_type' => 2])}" class="<?=promote_is_active_class(2)?>">推广员管理</a>
<?php endif;?>
</div>
<?php endif;?>
</div>
<?php endif ;?>
<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('Game/index')}" class="<?=is_active_class(['Game'], ['index'])?>">专服管理</a>
<?php
$isOpenQuery = true;
?>
<?php if($isOpenQuery):?>
<a href="{:U('Game/mix')}" class="<?=is_active_class(['Game'], ['mix'])?>">混服管理</a>
<if condition="getParentPromoteId(PID) eq 0">
<a href="{:U('GameDivide/index')}" class="<?=is_active_class(['GameDivide'], ['index'])?>">分成比例</a>
<a href="{:U('Promote/setChildGamePermission')}" class="<?=is_active_class(['Promote'], ['setChildGamePermission'])?>">设置</a>
</if>
<a href="{:U('Apply/feature')}" class="<?=is_active_class(['Apply'], ['feature'])?>">资料专区</a>
<div class="subNav jssubNav"><i class="prev_icon icon_shujvi"></i><span>数据管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Query/dailySummary')}" class="<?=is_active_class(['Query'], ['dailySummary'])?>">每日概况</a>
<a href="{:U('Query/summary')}" class="<?=is_active_class(['Query'], ['summary'])?>">数据汇总</a>
<?php if($canViewUserRecharge):?>
<a href="{:U('Query/recharge')}" class="<?=is_active_class(['Query'], ['recharge', 'viewSpendDetailed'])?>">订单查询</a>
<?php endif;?>
<a href="{:U('Query/register')}" class="<?=is_active_class(['Query'], ['register', 'viewRole'])?>">注册明细</a>
<?php if($canViewUserRecharge):?>
<a href="{:U('Query/arpu')}" class="<?=is_active_class(['Query'], ['arpu'])?>">ARPU统计</a>
<?php endif;?>
<!-- <a href="{:U('Query/retention_analysis')}" class="<?=is_active_class(['Query'], ['retention_analysis'])?>">留存统计</a> -->
<a href="{:U('Query/userRoles')}" class="<?=is_active_class(['Query'], ['userRoles'])?>">角色查询</a>
<?php if($canViewUserRecharge):?>
<a href="{:U('Query/userRecharges')}" class="<?=is_active_class(['Query'], ['userRecharges'])?>">充值玩家</a>
<?php endif;?>
<a href="{:U('Query/achievement')}" class="<?=is_active_class(['Query'], ['achievement'])?>">团队/推广员业绩</a>
<!-- <a href="{:U('Query/promoteQuota')}" class="<?=is_active_class(['Query'], ['promoteQuota', 'quotaDtl'])?>">推广员指标</a> -->
<a href="{:U('Query/iosDownLoadData')}" class="<?=is_active_class(['Query'], ['iosDownLoadData'])?>">IOS下载数统计</a>
<a href="{:U('Query/userretention')}" class="<?=is_active_class(['Query'], ['userretention'])?>">用户留存率</a>
<a href="{:U('Query/gameData')}" class="<?=is_active_class(['Query'], ['gameData'])?>">游戏分区数据汇总</a>
</div>
<?php endif;?>
</div>
<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('Apply/app_index')}" class="<?=is_active_class(['Apply'], ['app_index'])?>">APP列表</a>-->
<a href="{:U('Safe/bindTel')}" class="<?=is_active_class(['Safe'], ['bindTel'])?>">短信登陆设置</a>
<a href="{:U('Download/listsIndex')}" class="<?=is_active_class(['Download'], ['listsIndex'])?>">下载日志管理</a>
<a href="{:U('Safe/modifyloginpassword')}" class="<?=is_active_class(['Safe'], ['modifyloginpassword'])?>">修改登录密码</a>
<a href="{:U('Safe/setSafeIndex')}" class="<?=is_active_class(['Safe'], ['setSafeIndex'])?>">设置安全密码</a>
<?php if ($loginer['level'] == 1) :?>
<a href="{:U('Safe/modifyBaseInfo')}" class="<?=is_active_class(['Safe'], ['modifyBaseInfo'])?>">用户基本信息</a>
<?php if ($canViewUserRecharge && $loginer['level'] == 1) :?>
<div class="subNav jssubNav"><i class="prev_icon icon_caiwu"></i><span>财务管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Finance/index')}" class="<?=is_active_class(['Finance'], ['index'])?>">结算中心</a>
<a href="{:U('Finance/settlementDtl')}" class="<?=is_active_class(['Finance'], ['settlementDtl'])?>">结算明细</a>
<a href="{:U('Finance/withdrawRecord')}" class="<?=is_active_class(['Finance'], ['withdrawRecord', 'withdrawDtl', 'settlementOrder'])?>">提现记录</a>
<?php if ($loginer['withdraw_show'] == 1) :?>
<a href="{:U('Withdraw/index')}" class="<?=is_active_class(['Withdraw'], ['index', 'withdrawDetail', 'withdrawOrderDetail'])?>">公司结算</a>
<?php endif;?>
</div>
<?php endif ;?>
<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('Game/index')}" class="<?=is_active_class(['Game'], ['index'])?>">专服管理</a>
<?php if($isOpenQuery):?>
<a href="{:U('Game/mix')}" class="<?=is_active_class(['Game'], ['mix'])?>">混服管理</a>
<if condition="getParentPromoteId(PID) eq 0">
<a href="{:U('GameDivide/index')}" class="<?=is_active_class(['GameDivide'], ['index'])?>">分成比例</a>
<a href="{:U('Promote/setChildGamePermission')}" class="<?=is_active_class(['Promote'], ['setChildGamePermission'])?>">设置</a>
</if>
<a href="{:U('Apply/feature')}" class="<?=is_active_class(['Apply'], ['feature'])?>">资料专区</a>
<?php endif;?>
</div>
<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('Apply/app_index')}" class="<?=is_active_class(['Apply'], ['app_index'])?>">APP列表</a>-->
<a href="{:U('Safe/bindTel')}" class="<?=is_active_class(['Safe'], ['bindTel'])?>">短信登陆设置</a>
<a href="{:U('Download/listsIndex')}" class="<?=is_active_class(['Download'], ['listsIndex'])?>">下载日志管理</a>
<a href="{:U('Safe/modifyloginpassword')}" class="<?=is_active_class(['Safe'], ['modifyloginpassword'])?>">修改登录密码</a>
<a href="{:U('Safe/setSafeIndex')}" class="<?=is_active_class(['Safe'], ['setSafeIndex'])?>">设置安全密码</a>
<?php if ($loginer['level'] == 1) :?>
<a href="{:U('Safe/modifyBaseInfo')}" class="<?=is_active_class(['Safe'], ['modifyBaseInfo'])?>">用户基本信息</a>
<?php endif;?>
<a href="{:U('Safe/promoteLogs')}" class="<?=is_active_class(['Safe'], ['promoteLogs'])?>">操作日志</a>
</div>
<?php if($loginer['level'] == 1 || $loginer['ts_over_apply'] == 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="<?=is_active_class(['TestingResource'], ['index'])?>">测试资源申请</a>
<a href="{:U('TestingResource/batches')}" class="<?=is_active_class(['TestingResource'], ['batches'])?>">测试资源申请记录</a>
</div>
<?php endif;?>
<a href="{:U('Safe/promoteLogs')}" class="<?=is_active_class(['Safe'], ['promoteLogs'])?>">操作日志</a>
</div>
<?php if($loginer['level'] == 1 || $loginer['ts_over_apply'] == 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="<?=is_active_class(['TestingResource'], ['index'])?>">测试资源申请</a>
<a href="{:U('TestingResource/batches')}" class="<?=is_active_class(['TestingResource'], ['batches'])?>">测试资源申请记录</a>
</div>
<?php endif;?>
<?php if(C('APP_ENV') == 'dev' || $company['type'] == 1):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>评级管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<?php if($loginer['level'] <= 2):?>
<a href="{:U('PromoteGrade/settings')}" class="<?=is_active_class(['PromoteGrade'], ['settings', 'setting'])?>">评级设定</a>
<?php if(C('APP_ENV') == 'dev' || $company['type'] == 1):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>评级管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<?php if($loginer['level'] <= 2):?>
<a href="{:U('PromoteGrade/settings')}" class="<?=is_active_class(['PromoteGrade'], ['settings', 'setting'])?>">评级设定</a>
<?php endif;?>
<a href="{:U('PromoteGrade/index')}" class="<?=is_active_class(['PromoteGrade'], ['index'])?>">团队评级</a>
</div>
<?php endif;?>
<a href="{:U('PromoteGrade/index')}" class="<?=is_active_class(['PromoteGrade'], ['index'])?>">团队评级</a>
</div>
<?php endif;?>
<!-- <eq name="parent_id" value="0">
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>扶持管理</span><i class="arrow_icon"></i></div>
<!-- <eq name="parent_id" value="0">
<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('Support/index')}" class="<?=is_active_class(['Support'], ['add', 'apply'])?>">扶持申请</a>
<a href="{:U('Support/lists')}" class="<?=is_active_class(['Support'], ['lists'])?>">扶持记录</a>
<a href="{:U('Support/quota')}" class="<?=is_active_class(['Support'], ['quota'])?>">扶持额度</a>
</div>
</eq> -->
<!--<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>会长福利</span><i class="arrow_icon"></i></div>-->
<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>平台币管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Support/index')}" class="<?=is_active_class(['Support'], ['add', 'apply'])?>">扶持申请</a>
<a href="{:U('Support/lists')}" class="<?=is_active_class(['Support'], ['lists'])?>">扶持记录</a>
<a href="{:U('Support/quota')}" class="<?=is_active_class(['Support'], ['quota'])?>">扶持额度</a>
</div>
</eq> -->
<a href="{:U('PromoteCoin/myCoin')}" class="<?=is_active_class(['PromoteCoin'], ['myCoin', 'coinRecord', 'coinRecordDesc'])?>">我的平台币</a>
<a href="{:U('PromoteCoin/transferLogs')}" class="<?=is_active_class(['PromoteCoin'], ['shift', 'transferLogs'])?>">平台币转移</a>
<?php if($loginer['level'] == 1):?>
<a href="{:U('CoinOrder/order_list')}" class="<?=is_active_class(['CoinOrder'], ['order_list', 'order_add', 'order_detail'])?>">平台币充值</a>
<?php endif;?>
</div>
<!--<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>会长福利</span><i class="arrow_icon"></i></div>-->
<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>平台币管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('PromoteCoin/myCoin')}" class="<?=is_active_class(['PromoteCoin'], ['myCoin', 'coinRecord', 'coinRecordDesc'])?>">我的平台币</a>
<a href="{:U('PromoteCoin/transferLogs')}" class="<?=is_active_class(['PromoteCoin'], ['shift', 'transferLogs'])?>">平台币转移</a>
<?php if($loginer['level'] == 1):?>
<a href="{:U('CoinOrder/order_list')}" class="<?=is_active_class(['CoinOrder'], ['order_list', 'order_add', 'order_detail'])?>">平台币充值</a>
<?php if($canViewUserRecharge):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>玩家管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Players/playAction')}" class="<?=is_active_class(['Players'], ['playAction'])?>">行为日志</a>
</div>
<?php endif;?>
<?php else:?>
<?php if($loginer['level'] == 1 || $loginer['ts_over_apply'] == 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="<?=is_active_class(['TestingResource'], ['index'])?>">测试资源申请</a>
<a href="{:U('TestingResource/batches')}" class="<?=is_active_class(['TestingResource'], ['batches'])?>">测试资源申请记录</a>
</div>
<?php endif;?>
</div>
<?php if($canViewUserRecharge):?>
<div class="subNav jssubNav"><i class="prev_icon icon_fuli"></i><span>玩家管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Players/playAction')}" class="<?=is_active_class(['Players'], ['playAction'])?>">行为日志</a>
</div>
<?php endif;?>
</div>
</div>

@ -74,6 +74,9 @@
<label> ~ </label>
<input type="text" class="txt integer-input" name="role_level_end" style="width: 50px" value="{:I('role_level_end')}" >
</div>
<div class="form-group normal_space">
<input type="text" name="role_id" class="txt normal_txt" id="uid" placeholder="请输入角色ID" value="{:I('role_id')}">
</div>
<div class="form-group normal_space">
<input type="hidden" name="last_sort_name" id="last_sort_name" value="{:I('sort_name', '')}">
<input type="hidden" name="sort_name" id="sort_name" value="{:I('sort_name', '')}">
@ -115,6 +118,7 @@
</if>
</th>
<th>注册IP</th>
<th>角色ID</th>
<th class="sort" sort-name="login_time" class="title-cursor-pointer">最近登录时间
<if condition="'login_time' == I('sort_name', '')">
<if condition="1 == $sort">
@ -166,6 +170,7 @@
<td>{$record.device_number}</td>
<td>{$record.register_time}</td>
<td>{$record.register_ip}</td>
<td>{$record.role_id}</td>
<td>{$record.login_time}</td>
<td>{$record.login_ip}</td>

@ -216,9 +216,9 @@
<div id="bind-box" class="layer-box" style="display: none;">
<form method="post" enctype="multipart/form-data">
<div class="form-group">
<label>玩家账号</label>
<label>角色ID</label>
<div class="form-item" style="width: 250px">
<input id="bind_account" name="account" type="text" class="form-input" style="width: 100%;">
<input id="bind_role_id" name="bind_role_id" type="text" class="form-input" style="width: 100%;">
</div>
</div>
<div class="form-group">
@ -488,7 +488,7 @@
$('#verify-quota').html(verifyQuota)
$('#quota').html(quota-verifyQuota)
}
$('#test_account').on({
/* $('#test_account').on({
blur: function() {
var gameId = $('#game-select').val()
if (gameId == 0) {
@ -517,19 +517,18 @@
$("#role-select").select2();
})
}
})
}) */
function getUserRoles(userAccount, gameId, serverId, callback) {
function getUserRoles(bindRoleId, gameId, callback) {
$.ajax({
url: "{:U('getUserRoles')}",
type: "post",
data: { user_account: userAccount, game_id: gameId, server_id: serverId },
data: { role_id: bindRoleId, game_id: gameId },
dataType: 'json',
success: function(result){
if (result.status == 1) {
var roles = result.data.roles
var isTestingAccount = result.data.is_testing_account
callback(roles, isTestingAccount)
callback(roles)
} else {
layer.msg(result.message)
}
@ -537,26 +536,19 @@
})
}
$('#bind_account').on({
$('#bind_role_id').on({
blur: function () {
var gameId = $('#game-select').val()
if (gameId == 0) {
return layer.msg('请选择游戏')
}
var serverId = $('#server-select').val()
if (serverId == 0) {
return layer.msg('请选择区服')
}
var userAccount = $('#bind_account').val()
if (userAccount == '') {
return layer.msg('请输入玩家账号')
var bindRoleId = $('#bind_role_id').val()
if (bindRoleId == '') {
return layer.msg('请输入角色ID')
}
getUserRoles(userAccount, gameId, serverId, function(roles, isTestingAccount) {
getUserRoles(bindRoleId, gameId, function(roles) {
if (roles.length == 0) {
return layer.msg('玩家账号在该区服未创建角色')
}
if (isTestingAccount) {
return layer.msg('此账号为测试账号,无法绑定')
return layer.msg('未查询到角色')
}
var html = "<option value=''>请选择角色</option>";
for (var i in roles){

@ -84,7 +84,7 @@
<select id="server_id" name="server_id" class="reselect select_gallery" style="width:101px">
<option server-id="0" value="">请选择区服</option>
<?php foreach($servers as $server):?>
<option server-id="<?=$server['server_id']?>" value="<?=$server['server_id']?>" <?php if($server['server_id'] == I('server_id')):?>selected="selected"<?php endif;?>>
<option server-id="<?=$server['server_id']?>" value="<?=$server['id']?>" <?php if($server['id'] == I('server_id')):?>selected="selected"<?php endif;?>>
<?=$server['server_name']?>
</option>
<?php endforeach;?>
@ -280,7 +280,7 @@ $("#submit").click(function(){
var servers = result.data.servers
var str = "<option value=''>请选择区服</option>"
for (var i in servers){
str += "<option value='"+servers[i].server_name+"'>"+servers[i].server_name+"</option>"
str += "<option value='"+servers[i].id+"'>"+servers[i].server_name+"</option>"
}
$("#server_id").empty()
$("#server_id").append(str)

Loading…
Cancel
Save