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.phpmaster
commit
f474095a24
@ -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;
|
||||
}
|
||||
|
||||
}
|
@ -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>
|
Loading…
Reference in New Issue