Merge branch 'master' of 8.136.139.249:wmtx/platform into feature/more_payment
commit
fd285df021
@ -0,0 +1,369 @@
|
||||
<?php
|
||||
// 游戏默认分成比例模板
|
||||
namespace Admin\Controller;
|
||||
|
||||
class CompanySystemRatioController extends AdminController
|
||||
{
|
||||
|
||||
private $api = "https://admin.wmtxkj.com/index.php?g=Api&m=CpJuheCompany&a=ratioIndex";
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
$this->admininfo = $_SESSION['onethink_admin']['user_auth'];
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
//比例类型 0-内团 1-外团 2-分发联盟 3上游游戏 4聚合比例
|
||||
private $checkRatio = [0,1,2,3,4];
|
||||
|
||||
public function index()
|
||||
{
|
||||
$params = I('get.');
|
||||
$page = $params['p'] ? intval($params['p']) : 1;
|
||||
$row = $params['row'] ? intval($params['row']) : 10;
|
||||
//权限分配
|
||||
if(!IS_ROOT){
|
||||
$this->OpAuthList= getModuleControllerAuth();
|
||||
}
|
||||
|
||||
$map = [];
|
||||
|
||||
|
||||
|
||||
$data = M("game_ratio_mould","tab_")->where($map)->select();
|
||||
|
||||
$handleData=[];
|
||||
$handleData = $this->getAggregateData();
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$handleData[$value['relation_game_id']][$value['company_belong']][] = ['turnover'=>"0.00",'ratio'=>$value['ratio'],'instanceof'=>1];
|
||||
|
||||
$handleData[$value['relation_game_id']][$value['company_belong']]=array_merge($handleData[$value['relation_game_id']][$value['company_belong']],json_decode($value['turnover_ratio'],true)??[]);
|
||||
}
|
||||
|
||||
$handleData = $this->getCpGameRatio($handleData);
|
||||
$data = $this->handleRatio($handleData);
|
||||
|
||||
$checkData = $handleData;
|
||||
|
||||
// dump($data);die();
|
||||
|
||||
$gameData = M("game","tab_")->field("original_package_name,relation_game_name game_name,game_type_name,relation_game_id game_id")
|
||||
->where($map)
|
||||
->group("original_package_name")
|
||||
->select();
|
||||
$gameOriginData = M("game","tab_")->field("original_package_name,relation_game_name game_name,relation_game_id")->where($map)->group("relation_game_id")->select();
|
||||
//类型区分
|
||||
$handleGameData = [];
|
||||
foreach ($gameData as $key => $value) {
|
||||
if ($value['game_type_name']) {
|
||||
$handleGameData[$value['game_type_name']][] = $value;
|
||||
}
|
||||
}
|
||||
//游戏原包名区分
|
||||
$handleOriginData = [];
|
||||
foreach ($gameOriginData as $key => $value) {
|
||||
if ($value['original_package_name']) {
|
||||
$handleOriginData[$value['original_package_name']][] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
//将比例打进游戏中
|
||||
foreach ($handleOriginData as $key => $value) {
|
||||
foreach ($value as $k => $v) {
|
||||
$handleOriginData[$key][$k]['ratio_data'] = $data[$v['relation_game_id']];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//处理数据
|
||||
$data = [];
|
||||
foreach ($handleGameData as $key => $value) {
|
||||
|
||||
$handleData = [];
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
// unset($handleGameData[$key][$k]['original_package_name']);
|
||||
$handleGameData[$key][$k]['game_data'] = $handleOriginData[$v['original_package_name']];
|
||||
|
||||
}
|
||||
$handleData['game_type'] = $key;
|
||||
$handleData['data'] = $handleGameData[$key];
|
||||
$data[] = $handleData;
|
||||
|
||||
}
|
||||
// dump($data);die();
|
||||
foreach ($data as $key => $value) {
|
||||
|
||||
foreach ($value['data'] as $k => $v) {
|
||||
|
||||
if (!$v['game_data']) {
|
||||
$data[$key]['data'][$k]['row'] = 1;
|
||||
$data[$key]['row'] += 1;
|
||||
}
|
||||
|
||||
foreach ($v['game_data'] as $vk => $vv) {
|
||||
$data[$key]['data'][$k]['game_data'][$vk]['row'] = $vv['ratio_data']?count($vv['ratio_data']):1;
|
||||
$data[$key]['data'][$k]['row'] += $vv['ratio_data']?count($vv['ratio_data']):1;
|
||||
$data[$key]['row'] += $vv['ratio_data']?count($vv['ratio_data']):1;
|
||||
|
||||
// if (!$vv['ratio_data']) {
|
||||
// $data[$key]['data'][$k]['game_data'][$vk]['row']=1;
|
||||
// }
|
||||
|
||||
foreach($vv['ratio_data'] as $vvk=>$vvv) {
|
||||
if (count($data[$key]['data'][$k]['game_data'][$vk]['ratio_data']) == 1) {
|
||||
$data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk]['turnover'] = '无阶梯';
|
||||
break;
|
||||
} else {
|
||||
|
||||
if ($vvv['is_equal'] != 1) {
|
||||
|
||||
if (($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover'] == $vvv['turnover'] && !$data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+2]['turnover'])
|
||||
||!($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover'])) {
|
||||
$end = '∞';
|
||||
} elseif($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover'] == $vvv['turnover'] && $data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+2]['turnover']) {
|
||||
$end = floatval($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+2]['turnover']);
|
||||
} else {
|
||||
$end = floatval($data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk+1]['turnover']);
|
||||
}
|
||||
|
||||
$data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk]['turnover']
|
||||
= floatval($vvv['turnover']).($vvv['instanceof']==1?'<=':'<').'月流水'.
|
||||
('<').
|
||||
($end);
|
||||
} else {
|
||||
|
||||
if ($vvv['instanceof'] != 1) {
|
||||
foreach ($this->checkRatio as $ck => $cv) {
|
||||
// if($v['game_id'] == 187) {
|
||||
//
|
||||
// dump($checkData[$v['game_id']][$cv]);
|
||||
// dump($vvv);
|
||||
// }
|
||||
foreach ($checkData[$v['game_id']][$cv] as $gk=> $gv){
|
||||
// if($cv == 2){
|
||||
// dump($gv);
|
||||
// dump($vvv['turnover']);
|
||||
// die();
|
||||
if($gv['turnover'] < $vvv['turnover']) {
|
||||
$checkInstanceof = array_column($checkData[$v['game_id']][$cv],'instanceof');
|
||||
// if($v['game_id'] == 187 && $cv == 2) {
|
||||
// dump($checkData[$v['game_id']][$cv]);
|
||||
// dump($vvv['turnover']);
|
||||
// dump(in_array(3,$checkInstanceof));
|
||||
// }
|
||||
// in_array($checkInstanceof,2);
|
||||
|
||||
// die();
|
||||
if (in_array(2,$checkInstanceof)) {
|
||||
$data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk][$cv] = $gv['ratio'];
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$data[$key]['data'][$k]['game_data'][$vk]['ratio_data'][$vvk]['turnover']=
|
||||
'月流水='.$vvv['turnover'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// die();
|
||||
|
||||
if ($_REQUEST['export']) {
|
||||
$this->assign("is_export",true);
|
||||
$this->assign("data",$data);
|
||||
|
||||
$time = date("Y-m-d",time());
|
||||
|
||||
$this->assign('title',"海南万盟天下产品分成比例体系[{$time}]");
|
||||
$this->display("export");die();
|
||||
}
|
||||
|
||||
$count = count($data);
|
||||
$page = set_pagination($count, $row,$params);
|
||||
if($page) {
|
||||
$this->assign('_page', $page);
|
||||
}
|
||||
|
||||
$size = $row;//每页显示的记录数
|
||||
|
||||
$data = array_slice($data, (($params['p']??1) - 1) * $size, $size);
|
||||
|
||||
// dump($data);die();
|
||||
|
||||
$this->assign("data",$data);
|
||||
$this->display();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取上游游戏比例
|
||||
function getCpGameRatio($handleData = []) {
|
||||
$cpGameData = M('cp_game_ratio', 'tab_')->where(['is_del'=>"0"])->order('id asc')->select();
|
||||
|
||||
foreach ($cpGameData as $key => $value) {
|
||||
|
||||
$cpRatio['turnover'] = $value['begin_total_amount'];
|
||||
$cpRatio['instanceof'] = $value['instanceof'];
|
||||
$cpRatio['ratio'] = $value['ratio'];
|
||||
|
||||
$handleData[$value['game_id']][3][] =$cpRatio;
|
||||
|
||||
}
|
||||
|
||||
return $handleData;
|
||||
}
|
||||
|
||||
//将比例整合
|
||||
function handleRatio($handleData = []) {
|
||||
$finalData = [];
|
||||
// dump($handleData);die();
|
||||
foreach ($handleData as $key => $value) {
|
||||
foreach ($value as $vk => $vv) {
|
||||
foreach ($vv as $k => $v) {
|
||||
|
||||
if ($finalData[$key][$v['turnover']]) {
|
||||
$finalData[$key][$v['turnover']][$vk] = $v["ratio"];
|
||||
// if($v["instanceof"] != 0 && ($vk==0||$vk==1||$vk==2) && $handleData[$key][$vk][$k-1]["ratio"]) {
|
||||
// $finalData[$key][$v['turnover']][$vk] = $handleData[$key][$vk][$k-1]["ratio"];
|
||||
// }
|
||||
//判断是否有相同值且一个是>=另一个是>的情况
|
||||
if ($finalData[$key][$v['turnover']]["instanceof"] != $v["instanceof"]) {
|
||||
$finalData[$key][$v['turnover']]["instanceof"] = 0;
|
||||
|
||||
$finalData[$key][$v['turnover']."ed"] = $finalData[$key][$v['turnover']];
|
||||
$finalData[$key][$v['turnover']."ed"]['is_equal'] = 1;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
$v['is_equal'] = 0;
|
||||
$v[$vk] = $v["ratio"];
|
||||
unset($v["ratio"]);
|
||||
$finalData[$key][$v['turnover']] = $v;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($finalData as $key => $value) {
|
||||
|
||||
$last_names = array_column($finalData[$key],'turnover');
|
||||
array_multisort($last_names,SORT_ASC,$finalData[$key]);
|
||||
|
||||
}
|
||||
|
||||
// dump($finalData);die();
|
||||
$data = [];
|
||||
foreach ($finalData as $key => $value) {
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
|
||||
foreach ($this->checkRatio as $ck=>$cv) {
|
||||
if ($k == "0.00" && !$finalData[$key][$k][$cv]) {
|
||||
$finalData[$key][$k][$cv] = "0.00";
|
||||
}
|
||||
|
||||
if ($k != "0.00" && !$finalData[$key][$k][$cv]) {
|
||||
//查找上一个比例
|
||||
$finalData[$key][$k][$cv] = $data[$key][count($data[$key])-1][$cv];
|
||||
}
|
||||
}
|
||||
// dump($finalData[$key]);
|
||||
|
||||
$data[$key][] = $finalData[$key][$k];
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// dump($data);die();
|
||||
|
||||
// foreach ($data as $key => $value) {
|
||||
//
|
||||
// $last_names = array_column($data[$key],'turnover');
|
||||
// array_multisort($last_names,SORT_ASC,$data[$key]);
|
||||
//
|
||||
// }
|
||||
// dump($data);
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
function getAggregateData() {
|
||||
$request = [];
|
||||
$request['remote'] = 1;
|
||||
|
||||
$aggregateData = json_decode(curl_post($this->api,$request),true);
|
||||
|
||||
// dump($aggregateData);
|
||||
|
||||
$gameData = M("game","tab_")
|
||||
->field("unique_code,relation_game_id game_id")
|
||||
->where('unique_code is not null or unique_code!=""')
|
||||
->group("unique_code")
|
||||
->select();
|
||||
|
||||
// dump($gameData);
|
||||
|
||||
$gameUniqueData = [];
|
||||
foreach ($gameData as $key => $value ) {
|
||||
|
||||
$gameUniqueData[$value['unique_code']] = $value['game_id'];
|
||||
|
||||
}
|
||||
|
||||
$handleAggregateData = [];
|
||||
foreach ($aggregateData as $key => $value) {
|
||||
|
||||
if ($value['unique_code']) {
|
||||
|
||||
$explodeData = explode('|',$value['exploitation_rate']);
|
||||
$explodeDefauleData = explode('|',$value['default_exploitation_rate']);
|
||||
|
||||
$temporaryNum = 100;
|
||||
$temporaryData = [];
|
||||
|
||||
foreach ($explodeDefauleData as $k => $v) {
|
||||
// dump($v);
|
||||
if ($v<$temporaryNum && $v>0) {
|
||||
$temporaryData = [];
|
||||
$temporaryNum = $v;
|
||||
|
||||
$temporaryData[] = ['turnover'=>'0.00','instanceof'=>1,'ratio'=>number_format(100.00-$v,2,'.','')];
|
||||
|
||||
$defauleData = json_decode($explodeData[$k],true);
|
||||
|
||||
foreach ($defauleData as $ek => $ev) {
|
||||
$temporaryData[] = ['turnover'=>number_format($ev['money'],2,'.',''),'instanceof'=>$ev['symbol'],'ratio'=>number_format(100.00-$ev['rate'],2,'.','')];
|
||||
}
|
||||
// dump($temporaryData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if($temporaryData) {
|
||||
$handleAggregateData[$gameUniqueData[$value['unique_code']]][4] = $temporaryData;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $handleAggregateData;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,274 @@
|
||||
<!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>
|
||||
<script src="__STATIC__/table2excel.js"></script>
|
||||
</head>
|
||||
<style>
|
||||
html {
|
||||
min-width:100%;
|
||||
}
|
||||
body {
|
||||
padding: 0px 10px 150px 10px;
|
||||
/* width: 960px; */
|
||||
margin: auto;
|
||||
}
|
||||
/* .tabcon1711 table{
|
||||
width: 480px;
|
||||
} */
|
||||
table{
|
||||
|
||||
margin: auto;
|
||||
}
|
||||
tr{
|
||||
border-bottom: dotted 1px #c7c7c7;
|
||||
}
|
||||
.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;
|
||||
}
|
||||
#statementShow td{
|
||||
line-height: 1.5;
|
||||
padding: 8px 0;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
|
||||
海南万盟天下科技有限公司
|
||||
</div> -->
|
||||
|
||||
<div class="data_list box_mt" style="margin-top: 10px;">
|
||||
<div class="">
|
||||
<table id="exporttable" <if condition="$is_export">style="display:none"</if>>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th>产品类型</th>
|
||||
<th>原包名</th>
|
||||
<th>现包名</th>
|
||||
|
||||
<th>比例等级标准</th>
|
||||
<th>cp合作方</th>
|
||||
|
||||
<th>下游内团</th>
|
||||
<th>下游外团</th>
|
||||
<th>下游外团分发</th>
|
||||
<th>聚合方</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="statementShow">
|
||||
<if condition = "empty($data)">
|
||||
<tr>
|
||||
<td colspan="50" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
</tr>
|
||||
|
||||
</if>
|
||||
<foreach name="data" item="data" key="akey">
|
||||
<tr>
|
||||
<td rowspan="{$data['row']}">{$data['game_type']|default='无'}</td>
|
||||
<td rowspan="{$data['data'][0]['row']}">{$data['data'][0]['original_package_name']|default='无'}</td>
|
||||
<td rowspan="{$data['data'][0]['game_data'][0]['row']|default=1}">{$data['data'][0]['game_data'][0]['game_name']|default='无'}</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][3]|default='0.00'}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][0]|default='0.00'}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][1]|default='0.00'}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][2]|default='0.00'}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][4]|default='0.00'}%</td>
|
||||
</tr>
|
||||
|
||||
<foreach name="data['data'][0]['game_data'][0]['ratio_data']" item="ratio_data" key="rkey">
|
||||
<if condition="$rkey gt 0">
|
||||
<tr>
|
||||
<td>{$ratio_data['turnover']|default='无阶梯'}</td>
|
||||
<td>{$ratio_data[3]|default='0.00'}%</td>
|
||||
<td>{$ratio_data[0]|default='0.00'}%</td>
|
||||
<td>{$ratio_data[1]|default='0.00'}%</td>
|
||||
<td>{$ratio_data[2]|default='0.00'}%</td>
|
||||
<td>{$ratio_data[4]|default='0.00'}%</td>
|
||||
</tr>
|
||||
</if>
|
||||
</foreach>
|
||||
|
||||
<foreach name="data['data'][0]['game_data']" item="game_data" key="gkey">
|
||||
<if condition="$gkey gt 0">
|
||||
<tr>
|
||||
<td rowspan="{$game_data['row']}">{$game_data['game_name']}</td>
|
||||
</tr>
|
||||
|
||||
<foreach name="game_data['ratio_data']" item="game_data_other" key="okey">
|
||||
<tr>
|
||||
<td>{$game_data_other['turnover']|default='无阶梯'}</td>
|
||||
<td>{$game_data_other['3']|default='0.00'}%</td>
|
||||
<td>{$game_data_other['0']|default='0.00'}%</td>
|
||||
<td>{$game_data_other['1']|default='0.00'}%</td>
|
||||
<td>{$game_data_other['2']|default='0.00'}%</td>
|
||||
<td>{$game_data_other['4']|default='0.00'}%</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
</foreach>
|
||||
|
||||
<foreach name="data['data']" item="sun_data" key="skey">
|
||||
|
||||
<if condition="$skey gt 0">
|
||||
<tr>
|
||||
<td rowspan="{$sun_data['row']}">{$sun_data['original_package_name']|default='无'}</td>
|
||||
<td rowspan="{$sun_data['game_data'][0]['row']}">{$sun_data['game_data'][0]['game_name']|default='无'}</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['3']|default='0.00'}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['0']|default='0.00'}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['1']|default='0.00'}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['2']|default='0.00'}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['4']|default='0.00'}%</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<foreach name="sun_data['game_data'][0]['ratio_data']" item="game_datas" key="gkey">
|
||||
|
||||
<if condition="$gkey gt 0">
|
||||
|
||||
<tr>
|
||||
<td>{$game_datas['turnover']|default='无阶梯'}</td>
|
||||
<td>{$game_datas['3']|default='0.00'}%</td>
|
||||
<td>{$game_datas['0']|default='0.00'}%</td>
|
||||
<td>{$game_datas['1']|default='0.00'}%</td>
|
||||
<td>{$game_datas['2']|default='0.00'}%</td>
|
||||
<td>{$game_datas['4']|default='0.00'}%</td>
|
||||
</tr>
|
||||
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
|
||||
<foreach name="sun_data['game_data']" item="game_datas" key="gkey">
|
||||
<if condition="$gkey gt 0">
|
||||
<tr>
|
||||
<td rowspan="{$game_datas['row']}">{$game_datas['game_name']|default='无'}</td>
|
||||
<td >{$game_datas['ratio_data'][0]['turnover']|default='无阶梯'}</td>
|
||||
<td >{$game_datas['ratio_data'][0][3]|default='0.00'}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][0]|default='0.00'}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][1]|default='0.00'}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][2]|default='0.00'}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][4]|default='0.00'}%</td>
|
||||
</tr>
|
||||
<volist name="game_datas['ratio_data']" id="game_data_others" key="otherskey">
|
||||
<if condition="$otherskey-1 gt 0">
|
||||
<tr>
|
||||
<td>{$game_data_others['turnover']|default='无阶梯'}</td>
|
||||
<td>{$game_data_others['3']|default='0.00'}%</td>
|
||||
<td>{$game_data_others['0']|default='0.00'}%</td>
|
||||
<td>{$game_data_others['1']|default='0.00'}%</td>
|
||||
<td>{$game_data_others['2']|default='0.00'}%</td>
|
||||
<td>{$game_data_others['4']|default='0.00'}%</td>
|
||||
</tr>
|
||||
</if>
|
||||
</volist>
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
|
||||
</foreach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
</body>
|
||||
</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 src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
console.log(1);
|
||||
<if condition="$is_export">
|
||||
console.log(1);
|
||||
$(function(){
|
||||
$("#exporttable").table2excel({
|
||||
filename: "{$title}.xls", // do include extension
|
||||
preserveColors: false // set to true if you want background colors and font colors preserved
|
||||
});
|
||||
});
|
||||
</if>
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,293 @@
|
||||
<extend name="Public/base"/>
|
||||
<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__/layer3/layer.js"></script>
|
||||
|
||||
<script src="__STATIC__/table2excel.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;}
|
||||
.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;
|
||||
}
|
||||
.tooltip {
|
||||
position: relative;
|
||||
/* display: block; */
|
||||
/* color: #056dae; */
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext {
|
||||
display: none;
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
padding: 5px 10px 5px 5px;
|
||||
position: absolute;
|
||||
z-index: 1;
|
||||
bottom: 80%;
|
||||
left: 0;
|
||||
border: #000 solid 1px;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.tooltip .tooltiptext::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 50%;
|
||||
margin-left: -5px;
|
||||
border-width: 5px;
|
||||
border-style: solid;
|
||||
border-color: black transparent transparent transparent;
|
||||
}
|
||||
|
||||
.tooltip:hover .tooltiptext {
|
||||
color: #333;
|
||||
display: block;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
<div class="cf main-place top_nav_list navtab_list">
|
||||
<h3 class="page_title">海南万盟天下产品分成比例体系</h3>
|
||||
<!-- <p class="description_text" id="order_url">仅当汇总单审批通过的单子才允许进行打款</p>-->
|
||||
</div>
|
||||
<body>
|
||||
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
|
||||
海南万盟天下科技有限公司
|
||||
</div> -->
|
||||
|
||||
<div class="data_list box_mt" style="margin-top: 10px;">
|
||||
<div class="">
|
||||
<table id="exporttable" <if condition="$is_export">style="display:none"</if>>
|
||||
<!-- 表头 -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2">产品类型</th>
|
||||
<th rowspan="2">原包名</th>
|
||||
<th rowspan="2">现包名</th>
|
||||
<th rowspan="2">比例等级标准</th>
|
||||
|
||||
<th colspan="5">分成比例</th>
|
||||
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<th>cp合作方</th>
|
||||
<th>下游内团</th>
|
||||
<th>下游外团</th>
|
||||
<th>下游外团分发</th>
|
||||
<th>聚合方</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="statementShow">
|
||||
<if condition = "empty($data)">
|
||||
<tr>
|
||||
<td colspan="50" class="text-center">aOh! 暂时还没有内容!</td>
|
||||
</tr>
|
||||
|
||||
</if>
|
||||
<foreach name="data" item="data" key="akey">
|
||||
<tr>
|
||||
<td rowspan="{$data['row']}">{$data['game_type']|default='无'}</td>
|
||||
<td rowspan="{$data['data'][0]['row']}">{$data['data'][0]['original_package_name']|default='无'}</td>
|
||||
<td rowspan="{$data['data'][0]['game_data'][0]['row']|default=1}">{$data['data'][0]['game_data'][0]['game_name']|default='无'}</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][3]|floatval}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][0]|floatval}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][1]|floatval}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][2]|floatval}%</td>
|
||||
<td>{$data['data'][0]['game_data'][0]['ratio_data'][0][4]|floatval}%</td>
|
||||
</tr>
|
||||
|
||||
<foreach name="data['data'][0]['game_data'][0]['ratio_data']" item="ratio_data" key="rkey">
|
||||
<if condition="$rkey gt 0">
|
||||
<tr>
|
||||
<td>{$ratio_data['turnover']|default='无阶梯'}</td>
|
||||
<td>{$ratio_data[3]|floatval}%</td>
|
||||
<td>{$ratio_data[0]|floatval}%</td>
|
||||
<td>{$ratio_data[1]|floatval}%</td>
|
||||
<td>{$ratio_data[2]|floatval}%</td>
|
||||
<td>{$ratio_data[4]|floatval}%</td>
|
||||
</tr>
|
||||
</if>
|
||||
</foreach>
|
||||
|
||||
<foreach name="data['data'][0]['game_data']" item="game_data" key="gkey">
|
||||
<if condition="$gkey gt 0">
|
||||
<tr>
|
||||
<td rowspan="{$game_data['row']}">{$game_data['game_name']}</td>
|
||||
</tr>
|
||||
|
||||
<foreach name="game_data['ratio_data']" item="game_data_other" key="okey">
|
||||
<tr>
|
||||
<td>{$game_data_other['turnover']|default='无阶梯'}</td>
|
||||
<td>{$game_data_other['3']|floatval}%</td>
|
||||
<td>{$game_data_other['0']|floatval}%</td>
|
||||
<td>{$game_data_other['1']|floatval}%</td>
|
||||
<td>{$game_data_other['2']|floatval}%</td>
|
||||
<td>{$game_data_other['4']|floatval}%</td>
|
||||
</tr>
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
</foreach>
|
||||
|
||||
<foreach name="data['data']" item="sun_data" key="skey">
|
||||
|
||||
<if condition="$skey gt 0">
|
||||
<tr>
|
||||
<td rowspan="{$sun_data['row']}">{$sun_data['original_package_name']|default='无'}</td>
|
||||
<td rowspan="{$sun_data['game_data'][0]['row']}">{$sun_data['game_data'][0]['game_name']|default='无'}</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['turnover']|default='无阶梯'}</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['3']|floatval}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['0']|floatval}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['1']|floatval}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['2']|floatval}%</td>
|
||||
<td>{$sun_data['game_data'][0]['ratio_data'][0]['4']|floatval}%</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<foreach name="sun_data['game_data'][0]['ratio_data']" item="game_datas" key="gkey">
|
||||
|
||||
<if condition="$gkey gt 0">
|
||||
|
||||
<tr>
|
||||
<td>{$game_datas['turnover']|default='无阶梯'}</td>
|
||||
<td>{$game_datas['3']|floatval}%</td>
|
||||
<td>{$game_datas['0']|floatval}%</td>
|
||||
<td>{$game_datas['1']|floatval}%</td>
|
||||
<td>{$game_datas['2']|floatval}%</td>
|
||||
<td>{$game_datas['4']|floatval}%</td>
|
||||
</tr>
|
||||
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
|
||||
<foreach name="sun_data['game_data']" item="game_datas" key="gkey">
|
||||
<if condition="$gkey gt 0">
|
||||
<tr>
|
||||
<td rowspan="{$game_datas['row']}">{$game_datas['game_name']|default='无'}</td>
|
||||
<td >{$game_datas['ratio_data'][0]['turnover']|default='无阶梯'}</td>
|
||||
<td >{$game_datas['ratio_data'][0][3]|floatval}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][0]|floatval}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][1]|floatval}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][2]|floatval}%</td>
|
||||
<td >{$game_datas['ratio_data'][0][4]|floatval}%</td>
|
||||
</tr>
|
||||
<volist name="game_datas['ratio_data']" id="game_data_others" key="otherskey">
|
||||
<if condition="$otherskey-1 gt 0">
|
||||
<tr>
|
||||
<td>{$game_data_others['turnover']|default='无阶梯'}</td>
|
||||
<td>{$game_data_others['3']|floatval}%</td>
|
||||
<td>{$game_data_others['0']|floatval}%</td>
|
||||
<td>{$game_data_others['1']|floatval}%</td>
|
||||
<td>{$game_data_others['2']|floatval}%</td>
|
||||
<td>{$game_data_others['4']|floatval}%</td>
|
||||
</tr>
|
||||
</if>
|
||||
</volist>
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
|
||||
</if>
|
||||
|
||||
</foreach>
|
||||
|
||||
</foreach>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="page">
|
||||
<a class="sch-btn" href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
|
||||
{$_page|default=''}
|
||||
</div>
|
||||
</body>
|
||||
</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 src="__STATIC__/layer/extend/layer.ext.js"></script>
|
||||
<script type="text/javascript">
|
||||
</script>
|
||||
<script>
|
||||
<volist name=":I('get.')" id="vo">
|
||||
Think.setValue('{$key}',"{$vo}");
|
||||
</volist>
|
||||
$(".select_gallery").select2();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
highlight_subnav("{:U('CompanySystemRatio/index')}");
|
||||
|
||||
<if condition="$is_export">
|
||||
console.log(1);
|
||||
$(function(){
|
||||
$("#exporttable").table2excel({
|
||||
filename: "{$title}.xls", // do include extension
|
||||
preserveColors: false // set to true if you want background colors and font colors preserved
|
||||
});
|
||||
});
|
||||
</if>
|
||||
</script>
|
||||
</block>
|
||||
</html>
|
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
namespace Base\Service;
|
||||
|
||||
class MendService
|
||||
{
|
||||
public static $statusList = [
|
||||
0 => '处理中',
|
||||
1 => '处理成功',
|
||||
2 => '处理失败',
|
||||
];
|
||||
|
||||
public function getStatusText($status)
|
||||
{
|
||||
return self::$statusList[$status] ?? '未知';
|
||||
}
|
||||
|
||||
public function addMendTask($params, $permPromote = null, $handlePromote = null)
|
||||
{
|
||||
$userId = $params['user_id'] ?? 0;
|
||||
$remark = $params['remark'] ?? '';
|
||||
$orderTime = $params['order_time'] ?? '';
|
||||
$toPromoteId = $params['promote_id_to'] ?? '';
|
||||
|
||||
$promoteService = new PromoteService();
|
||||
if ($toPromoteId == -1) {
|
||||
$toPromoteId = 0;
|
||||
}
|
||||
if ($toPromoteId === '') {
|
||||
throw new \Exception('请选择需要变更的渠道');
|
||||
}
|
||||
|
||||
$user = M('user', 'tab_')->where(['id' => $userId])->find();
|
||||
if (!$user) {
|
||||
throw new \Exception('用户不存在');
|
||||
}
|
||||
if ($user['promote_id'] == $toPromoteId) {
|
||||
throw new \Exception('没有变更数据');
|
||||
}
|
||||
if ($orderTime == '') {
|
||||
throw new \Exception('没有订单日期');
|
||||
}
|
||||
|
||||
if ($permPromote) {
|
||||
$levelColumn = 'level'. $permPromote['level'] . '_id';
|
||||
$promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $permPromote['id']])->find();
|
||||
if (!$promote) {
|
||||
throw new \Exception('所属推广员异常');
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->checkOrderTime(strtotime($orderTime))) {
|
||||
throw new \Exception('仅能补链本周数据,请重新选择补链时间');
|
||||
}
|
||||
|
||||
if ($this->checkPromote(strtotime($orderTime), $user['account'])) {
|
||||
throw new \Exception('在订单日期内含有多个推广员,无法补链');
|
||||
}
|
||||
|
||||
$data = [
|
||||
'from_promote_id' => $user['promote_id'],
|
||||
'to_promote_id' => $toPromoteId,
|
||||
'order_time' => $orderTime,
|
||||
'type' => 2,
|
||||
'shift_ids' => [$userId],
|
||||
'creator_type' => $handlePromote ? 1 : 0,
|
||||
'creator_id' => $handlePromote ? $handlePromote['id'] : $_SESSION["onethink_admin"]["user_auth"]["uid"]
|
||||
];
|
||||
|
||||
if(!empty($params['remark'])){
|
||||
$data['remark'] = $params['remark'];
|
||||
}
|
||||
|
||||
$result = $promoteService->addShiftTask($data);
|
||||
if (!$result['status']) {
|
||||
throw new \Exception($result['msg']);
|
||||
}
|
||||
}
|
||||
|
||||
private function checkOrderTime($orderTime)
|
||||
{
|
||||
$sdefaultDate = date('Y-m-d');
|
||||
$first = 1; //周一开始
|
||||
$w = date('w',strtotime($sdefaultDate));
|
||||
$checktime = strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) .' days'); //本周开始时间
|
||||
if($orderTime >= $checktime){
|
||||
//在本周允许换绑
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private function checkPromote($orderTime, $account)
|
||||
{
|
||||
$res = M('Spend','tab_')->field('promote_id')->where(['pay_time' => array('EGT', $orderTime), 'user_account' => $account])->group('promote_id')->select();
|
||||
if(count($res)>1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
<?php
|
||||
|
||||
namespace Home\Controller;
|
||||
|
||||
use Base\Service\MendService;
|
||||
use Base\Service\PromoteService;
|
||||
|
||||
/**
|
||||
* 补链控制器
|
||||
*/
|
||||
class MendController extends BaseController
|
||||
{
|
||||
|
||||
protected function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
$page = intval(I('p', 1));
|
||||
$row = intval(I('row', 10));
|
||||
$params = I('get.');
|
||||
$loginer = $this->getLoginPromote();
|
||||
$promoteService = new PromoteService();
|
||||
|
||||
$permPromote = $loginer;
|
||||
if ($loginer['shift_over_apply'] == 1) {
|
||||
$permPromote = $promoteService->getTopPromote($loginer);
|
||||
}
|
||||
|
||||
$map = ['op_type' => 1, '_string' => '1=1'];
|
||||
if(isset($params['account'])) {
|
||||
$map['user_account']= ['like', '%' . $params['account'] . '%'];
|
||||
}
|
||||
if(!empty($params['promote_id'])) {
|
||||
$map['promote_id']= $params['promote_id'];
|
||||
}
|
||||
if(!empty($params['promote_id_to'])) {
|
||||
$map['promote_id_to'] = $params['promote_id_to'];
|
||||
}
|
||||
if(!empty($params['op_id'])) {
|
||||
$map['op_id'] = $params['op_id'];
|
||||
}
|
||||
if (!empty($params['time_start'])) {
|
||||
$map['order_time'] = ['egt', strtotime($params['time_start'])];
|
||||
}
|
||||
if (!empty($params['time_end'])) {
|
||||
$map['order_time'] = ['elt', strtotime($params['time_end']) + 86399];
|
||||
}
|
||||
|
||||
$subInSql = $promoteService->subInSql($permPromote);
|
||||
$map['_string'] .= ' and (promote_id in (' . $subInSql . ') or promote_id_to in (' . $subInSql . '))';
|
||||
|
||||
$records = M('mend', 'tab_')->where($map)->order('create_time desc')->page($page, $row)->select();
|
||||
$count = M('mend', 'tab_')->where($map)->count();
|
||||
|
||||
$mendService = new MendService();
|
||||
foreach ($records as $key => $record) {
|
||||
$record['status_text'] = $mendService->getStatusText($record['status']);
|
||||
$records[$key] = $record;
|
||||
}
|
||||
|
||||
|
||||
$page = set_pagination($count, $row, $params);
|
||||
if ($page) {
|
||||
$this->assign('_page', $page);
|
||||
}
|
||||
|
||||
$levelColumn = 'level'. $permPromote['level'] . '_id';
|
||||
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select();
|
||||
|
||||
$this->assign('promotes', $promotes);
|
||||
$this->assign('count', $count);
|
||||
$this->assign('records', $records);
|
||||
$this->meta_title = '补链记录';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function add()
|
||||
{
|
||||
$userId = I('user_id', 0);
|
||||
$user = M('user', 'tab_')->where(['id' => $userId])->find();
|
||||
if (!$user) {
|
||||
return $this->error('用户不存在');
|
||||
}
|
||||
|
||||
$loginer = $this->getLoginPromote();
|
||||
$permPromote = $loginer;
|
||||
$promoteService = new PromoteService();
|
||||
if ($loginer['shift_over_apply'] == 1) {
|
||||
$permPromote = $promoteService->getTopPromote($loginer);
|
||||
}
|
||||
|
||||
$levelColumn = 'level'. $permPromote['level'] . '_id';
|
||||
$promote = M('promote', 'tab_')->where(['id' => $user['promote_id']])->where([$levelColumn => $permPromote['id']])->find();
|
||||
if (!$promote) {
|
||||
return $this->error('所属推广员异常');
|
||||
}
|
||||
|
||||
$promotes = M('promote', 'tab_')->field(['id', 'account'])->where([$levelColumn => $permPromote['id']])->select();
|
||||
|
||||
$this->meta_title = '玩家补链';
|
||||
$this->assign('user', $user);
|
||||
$this->assign('promotes', $promotes);
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$params = I('post.');
|
||||
$loginer = $this->getLoginPromote();
|
||||
|
||||
$permPromote = $loginer;
|
||||
$promoteService = new PromoteService();
|
||||
if ($loginer['shift_over_apply'] == 1) {
|
||||
$permPromote = $promoteService->getTopPromote($loginer);
|
||||
}
|
||||
|
||||
$service = new MendService();
|
||||
try {
|
||||
$service->addMendTask($params, $permPromote, $loginer);
|
||||
$this->ajaxReturn(['status' => 1, 'msg' => '补链申请成功']);
|
||||
} catch (\Exception $e) {
|
||||
$this->ajaxReturn(['status' => 0, 'msg' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,168 @@
|
||||
<extend name="Public/promote_base"/>
|
||||
<block name="css">
|
||||
<link href="__CSS__/20180207/platform.css" rel="stylesheet">
|
||||
<style>
|
||||
.trunk-list .table3 {width: 100%;}
|
||||
.table3 tr td{border: 1px solid #E0E7EF;}
|
||||
.pagenation{line-height: 6.5vh;}
|
||||
.pagenation>div {text-align: right;}
|
||||
.trunk-list .table3 tr {height: 4.2vh;}
|
||||
|
||||
.table_scroll {width:100%;table-layout:fixed;}
|
||||
.table_scroll tr td {border:none;border-right:1px solid #E0E7EF;}
|
||||
.table_scroll tr td:last-child{border-right:none;}
|
||||
.table_scroll tr+tr td {border-top:1px solid #E0E7EF;}
|
||||
.btn {cursor: pointer;}
|
||||
</style>
|
||||
</block>
|
||||
|
||||
<block name="body">
|
||||
<div class="page-search normal_list promoteCoin-shift-search">
|
||||
<div class="trunk-title">
|
||||
<div class="location">
|
||||
<div class="location-container">当前位置:<span>数据管理></span><span>玩家补链</span></div>
|
||||
</div>
|
||||
<img src="__IMG__/20180207/icon_normal_yve.png"><span class="title_main">玩家补链</span>
|
||||
</div>
|
||||
<div class="trunk-content article">
|
||||
<div class="trunk-list" style="padding-top:33px;">
|
||||
<form id="form" action="{:U('save')}" method="post">
|
||||
<input type="hidden" name="user_id" value="<?=$user['id']?>">
|
||||
<table class="table2">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="l"><span class="req">*</span>用户账号:</td>
|
||||
<td class="r">
|
||||
<input type="text" class="name txt" disabled value="<?=getHideAccount($user['account'])?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><span class="req">*</span>修改前推广员:</td>
|
||||
<td class="r">
|
||||
<input type="text" class="name txt" disabled value="<?=$user['promote_account']?>">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><span class="req">*</span>补链后推广员:</td>
|
||||
<td class="r">
|
||||
<select name="promote_id_to" class="reselect select_gallery" style="width: 220px;" >
|
||||
<option value="">请选择推广账号</option>
|
||||
<?php foreach($promotes as $promote):?>
|
||||
<option value="<?=$promote['id']?>"><?=$promote['account']?></option>
|
||||
<?php endforeach;?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"><span class="req">*</span>订单日期:</td>
|
||||
<td class="r">
|
||||
<input id="shift-order-time" type="text" autocomplete="off" class="name txt" name="order_time" placeholder="订单日期"" value="" style="width: 199px;">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l">备注:</td>
|
||||
<td class="r">
|
||||
<textarea name="remark" id="" cols="30" rows="10" class="name txt" style="padding: 10px"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="l"></td>
|
||||
<td class="r">
|
||||
<button type="button" class="tjbnt btn" onclick="check()" >确认</button>
|
||||
<button type="button" style="background: #E5E5E5; color: #8B8CA0;" class="tjbnt btn" onclick="window.history.back();" >返回</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
<block name="script">
|
||||
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<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 type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
$("#promote_id").change();
|
||||
$("#promote_child").change();
|
||||
$(".select_gallery").select2();
|
||||
|
||||
$('#shift-order-time').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language:"zh-CN",
|
||||
minView:2,
|
||||
autoclose:true,
|
||||
scrollMonth:false,
|
||||
scrollTime:false,
|
||||
scrollInput:false
|
||||
})
|
||||
});
|
||||
|
||||
function addParamsToUrl(url, params)
|
||||
{
|
||||
var pos = url.indexOf('.html')
|
||||
url = url.substring(0, pos)
|
||||
for (var i in params) {
|
||||
url += '/' + i + '/' + params[i]
|
||||
}
|
||||
url += '.html'
|
||||
return url
|
||||
}
|
||||
|
||||
function submit() {
|
||||
var userId = $('[name=user_id]').val()
|
||||
var toPromoteId = $('[name=promote_id_to]').val()
|
||||
var remark = $('[name=remark]').val()
|
||||
var orderTime = $('[name=order_time]').val()
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:"{:U('save')}",
|
||||
data: {
|
||||
user_id: userId,
|
||||
remark: remark,
|
||||
promote_id_to: toPromoteId,
|
||||
order_time: orderTime,
|
||||
},
|
||||
success:function(res){
|
||||
if(res.status==1){
|
||||
layer.msg(res.msg);
|
||||
setTimeout(function(){
|
||||
window.location.href = "{:U('Mend/index')}";
|
||||
}, 1500);
|
||||
} else {
|
||||
layer.msg(res.msg);
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function check() {
|
||||
data = validation();
|
||||
if (data.status != 1) {
|
||||
layer.msg(data.msg, {icon: 2});
|
||||
return false;
|
||||
} else {
|
||||
submit();
|
||||
}
|
||||
}
|
||||
|
||||
function validation() {
|
||||
var json_data = "";
|
||||
var limits = parseInt("{$loginer['balance_coin']|default=0}");
|
||||
if ($('[name=promote_id_to]').val() == '') {
|
||||
return json_data = {'status': 0, 'msg': '请选择补链后推广员'}
|
||||
}
|
||||
if ($('#shift-order-time').val() == '') {
|
||||
return json_data = {'status': 0, 'msg': '请选择订单日期'}
|
||||
}
|
||||
return json_data = {'status': 1, 'msg': '成功'};
|
||||
}
|
||||
</script>
|
||||
</block>
|
@ -0,0 +1,179 @@
|
||||
<extend name="Public/promote_base"/>
|
||||
<block name="css">
|
||||
<link href="__CSS__/20180207/data.css" rel="stylesheet">
|
||||
<link href="__CSS__/20180207/manager.css" rel="stylesheet">
|
||||
<link href="__CSS__/20180207/finance.css" rel="stylesheet">
|
||||
<link href="__STATIC__/icons_alibaba/iconfont.css?v=1.2" rel="stylesheet">
|
||||
</block>
|
||||
|
||||
<block name="body">
|
||||
<div class="page-search normal_list query-register-search jssearch" style="font-size: small;">
|
||||
<div class="trunk-title">
|
||||
<div class="location">
|
||||
<div class="location-container">当前位置:<span>数据管理></span><span>补链记录</span></div>
|
||||
</div>
|
||||
<img src="__IMG__/20180207/icon_zhuce.png">
|
||||
<span class="title_main">补链记录</span>
|
||||
</div>
|
||||
<div class="trunk-content article">
|
||||
<div class="trunk-search clearfix">
|
||||
<!-- <form action="{:U('Query/viewRole',array('row'=>I('get.row'),'id'=>I('get.id')))}" method="post" enctype="multipart/form-data">-->
|
||||
<div class="form-group normal_space fl">
|
||||
<input type="text" name="account" class="txt normal_txt" placeholder="请输入玩家账号"
|
||||
value="{:I('account')}">
|
||||
</div>
|
||||
<div class="form-group normal_space fl">
|
||||
<select id="promote_id" name="promote_id" class="reselect select_gallery">
|
||||
<option value="">补链前推广员</option>
|
||||
<volist name="promotes" id="vo">
|
||||
<option value="{$vo.id}" title="{$vo.account}">{$vo.account}</option>
|
||||
</volist>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group normal_space fl">
|
||||
<select id="promote_id_to" name="promote_id_to" class="reselect select_gallery">
|
||||
<option value="">补链后推广员</option>
|
||||
<volist name="promotes" id="vo">
|
||||
<option value="{$vo.id}" title="{$vo.account}">{$vo.account}</option>
|
||||
</volist>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group normal_space fl">
|
||||
<select id="op_id" name="op_id" class="reselect select_gallery">
|
||||
<option value="">操作人员</option>
|
||||
<volist name="promotes" id="vo">
|
||||
<option value="{$vo.id}" title="{$vo.account}">{$vo.account}</option>
|
||||
</volist>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group normal_space fl">
|
||||
<label class="form-title select-title" style="position: relative;">起止时间:</label>
|
||||
<div class="select-time">
|
||||
<input type="text" id="sdate" class="txt" name="time_start" placeholder="开始时间" value="{:I('time_start')}">
|
||||
</div>
|
||||
<label class="form-title select-title zhi_color"> — </label>
|
||||
<div class="select-time">
|
||||
<input type="text" id="edate" class="txt" name="time_end" placeholder="结束时间" value="{:I('time_end')}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group normal_space fl">
|
||||
<input type="submit" class="submit" id='submit' url="{:U('Mend/index',array('model'=>$model['name']),false)}"
|
||||
value="查询">
|
||||
</div>
|
||||
<!-- </form>-->
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-list query-register-list">
|
||||
<div class="trunk-content article">
|
||||
<div class="trunk-list list_normal" style="">
|
||||
<table class="table normal_table">
|
||||
<tr class="odd">
|
||||
<th>玩家账号</th>
|
||||
<th>补链前推广账号</th>
|
||||
<th>补链前归属金额</th>
|
||||
<th>补链后推广账号</th>
|
||||
<th>备注</th>
|
||||
<th>切分时间</th>
|
||||
<th>补链时间</th>
|
||||
<th>状态</th>
|
||||
<th>操作人员</th>
|
||||
</tr>
|
||||
<empty name="records">
|
||||
<tr class="num2">
|
||||
<td colspan="7" style="text-align: center;height: 45vh;">
|
||||
<img src="__IMG__/20180207/icon_wushujv2.png"/>
|
||||
<p style="line-height: 40px;color: #A5A5A5;">暂无数据</p>
|
||||
</td>
|
||||
</tr>
|
||||
<else/>
|
||||
<volist name="records" id="vo">
|
||||
<tr class="num2">
|
||||
<td><?=getHideAccount($vo['user_account'])?></td>
|
||||
<td>{$vo.promote_account}</td>
|
||||
<td>{$vo.pay_amount}</td>
|
||||
<td>{$vo.promote_account_to}</td>
|
||||
<td>{$vo.remark}</td>
|
||||
<td>{$vo.order_time|date='Y-m-d H:i:s',###}</td>
|
||||
<td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
|
||||
<td>{$vo.status_text}</td>
|
||||
<td>{$vo.op_account}</td>
|
||||
</tr>
|
||||
</volist>
|
||||
</empty>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pagenation clearfix">
|
||||
{$_page}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</block>
|
||||
<block name="script">
|
||||
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
|
||||
<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 type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$().ready(function () {
|
||||
setValue('promote_id', {$Think.request.promote_id |default = '""'});
|
||||
setValue('promote_id_to', {$Think.request.promote_id_to |default = '""'});
|
||||
setValue('op_id', {$Think.request.op_id |default = '""'});
|
||||
setValue('row', '{:I("get.row",10)}');
|
||||
|
||||
var date = "{$setdate}";
|
||||
$('#sdate').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language: "zh-CN",
|
||||
minView: 2,
|
||||
autoclose: true,
|
||||
scrollMonth: false,
|
||||
scrollTime: false,
|
||||
scrollInput: false,
|
||||
endDate: date
|
||||
});
|
||||
|
||||
$('#edate').datetimepicker({
|
||||
format: 'yyyy-mm-dd',
|
||||
language: "zh-CN",
|
||||
minView: 2,
|
||||
autoclose: true,
|
||||
pickerPosition: 'bottom-left',
|
||||
scrollMonth: false,
|
||||
scrollTime: false,
|
||||
scrollInput: false,
|
||||
endDate: date
|
||||
});
|
||||
|
||||
$(".select_gallery").select2();
|
||||
|
||||
$('#submit').click(function () {
|
||||
var sdate = $('#sdate').val();
|
||||
var edate = $('#edate').val();
|
||||
if (Date.parse(sdate) > Date.parse(edate)) {
|
||||
layer.msg('开始时间必须小于等于结束时间');
|
||||
return false;
|
||||
}
|
||||
var url = $(this).attr('url');
|
||||
console.log(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;
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</block>
|
Loading…
Reference in New Issue