Merge branch 'dev' of 47.111.118.107:/srv/git/platform into dev

master
chenzhi 5 years ago
commit 53f18bb86a

@ -102,15 +102,21 @@ class ExportController extends Controller
break;
case 2:
$xlsName = $xlsName?$xlsName:"渠道注册";
// $xlsCell = array(
// array('account', "玩家账号"),
// array('fgame_name', "注册游戏"),
// array('promote_account', L('Subordinate_channel')),
// array('register_time', L('Registration_time'), 'time_format', '*'),
// array('register_ip', L('Register_iP')),
// array('parent_id', "上级推广员"),
// array('ba_id', '商务专员'),
// );
$xlsCell = array(
array('account', "玩家账号"),
array('fgame_name', "注册游戏"),
array('promote_account', L('Subordinate_channel')),
array('register_time', L('Registration_time'), 'time_format', '*'),
array('register_ip', L('Register_iP')),
array('parent_id', "上级推广员"),
array('ba_id', '商务专员', 'get_business_affairs_account', '*'),
"玩家账号", "注册游戏", L('Subordinate_channel'), L('Registration_time'), L('Register_iP'),
"上级推广员", '商务专员',
);
if (isset($_REQUEST['game_name'])) {
if ($_REQUEST['game_name'] == L('All')) {
unset($_REQUEST['game_name']);
@ -121,16 +127,41 @@ class ExportController extends Controller
}
$map['tab_user.promote_id'] = array("neq", 0);
if (isset($_REQUEST['promote_name'])) {
if ($_REQUEST['promote_name'] == L('All')) {
if ($_REQUEST['promote_name']=='全部') {
unset($_REQUEST['promote_name']);
} else if ($_REQUEST['promote_name'] == "官方渠道") {
$map['tab_user.promote_id'] = array("elt", 0);
} elseif ($_REQUEST['promote_name']=='自然注册') {
$map['tab_user.promote_id']=array("elt",0);
unset($_REQUEST['promote_name']);
} else {
$map['tab_user.promote_id'] = get_promote_id($_REQUEST['promote_name']);
$promoteid = get_promote_id($_REQUEST['promote_name']);
$map['tab_user.promote_id']=array('eq',get_promote_id($_REQUEST['promote_name']));
unset($_REQUEST['promote_name']);
if (isset($_REQUEST['parent_id'])) {
$parent_id = get_promote_id($_REQUEST['parent_id']);
if ($promoteid == $parent_id) {
$map['tab_user.promote_id'] = $promoteid;
} else {
$parent_id = get_promote_id($_REQUEST['parent_id']);
}
} else {
$map['tab_user.promote_id'] = $promoteid;
}
}
} else {
if (isset($_REQUEST['parent_id'])) {
$parent_id = get_promote_id($_REQUEST['parent_id']);
$pro = M('promote', 'tab_')->field('id,account')->where("chain like '%/{$parent_id}/%'")->select();
$pro_ids = array_column($pro, 'id');
$pro_ids[] = get_promote_id($_REQUEST['parent_id']);
if (!empty($pro_ids)) {
$map['tab_user.promote_id'] = ['in',$pro_ids];
} else {
$map['tab_user.promote_id'] = array('eq',-1);
}
}
}
if (isset($_REQUEST['is_check']) && $_REQUEST['is_check'] != L('All')) {
$map['is_check'] = check_status($_REQUEST['is_check']);
unset($_REQUEST['is_check']);
@ -172,7 +203,8 @@ class ExportController extends Controller
'promote_account',
'tab_user.parent_name',
'is_check',
'tab_promote.ba_id'
'tab_promote.ba_id',
"REPLACE(substring_index(tab_promote.chain, '/', 2),'/','') as top_promote"
),
'key' => array('tab_user.account', 'tab_game.fgame_name'),
'map' => $map,
@ -180,8 +212,21 @@ class ExportController extends Controller
'title' => "渠道注册",
'template_list' => 'ch_reg_list',
);
$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流中
$name = $model['m_name'];
$xlsData = M($name, "tab_")
$xlsData = M($name, "tab_",'union_table')
->field($model['fields'])
->join($model['join'])
->join($model['joins'])
@ -189,10 +234,65 @@ class ExportController extends Controller
->where($model['map'])
->order($model['order'])
->group($model['group'])
->select();
foreach ($xlsData as $key => &$value) {
$xlsData[$key]['parent_id'] = get_top_promote($value['promote_id'], $value['parent_id']);
->select(false);
$accessNum = M()->table("({$xlsData}) as a")
->field("a.id,count(a.account) as count")
->join("left join tab_promote ON a.top_promote = tab_promote.id")
->join("left join tab_business_affairs ON tab_business_affairs.id=a.ba_id")
->order("id desc")
->find();
$accessNum =$accessNum['count'];
$perSize = 2000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
$lastId = 0;
// $xlsCell = array(
// array('account', "玩家账号"),
// array('fgame_name', "注册游戏"),
// array('promote_account', L('Subordinate_channel')),
// array('register_time', L('Registration_time'), 'time_format', '*'),
// array('register_ip', L('Register_iP')),
// array('parent_id', "上级推广员"),
// array('ba_id', '商务专员'),
// );
for($i = 1; $i <= $pages; $i++) {
$xlsData = M($name, "tab_",'union_table')
->field($model['fields'])
->join($model['join'])
->join($model['joins'])
->join($model['joinss'])
->where($model['map'])
->limit(($i-1)*$perSize ,$perSize)
->order($model['order'])
->group($model['group'])
->select(false);
$xlsData = M()->table("({$xlsData}) as a")
->field("a.account,a.fgame_name,a.promote_account,a.register_time,a.register_ip,tab_promote.account as parent_id,tab_business_affairs.account as ba_id")
->join("left join tab_promote ON a.top_promote = tab_promote.id")
->join("left join tab_business_affairs ON tab_business_affairs.id=a.ba_id")
->order("a.id desc")
->select();
foreach($xlsData as $value) {
if (!$value['ba_id']) {
$value['ba_id'] = "暂无";
}
$value['register_time'] = date("Y-m-d H:i:s",$value['register_time']);
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
$lastId = $value['id'];
}
unset($xlsData);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
fclose($fp);
exit();
break;
case 3:
if($_REQUEST['type']==2){
@ -925,8 +1025,8 @@ class ExportController extends Controller
$xlsCell = array(
"订单号", "充值时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "充值ip", "游戏区服",
"角色名称", "订单金额", "实付金额", "充值方式", L('Order_status'), "游戏通知状态", "消费"."{$total}"
"支付订单号","CP订单号", "充值时间", "玩家账号", "游戏名称", L('Subordinate_channel'), "充值ip","区服ID", "游戏区服",
"角色ID","角色名称", "订单金额", "实付金额", "充值方式", L('Order_status'), "游戏通知状态", "消费"."{$total}"
);
$csvFileName = $xlsName.'.csv';
@ -942,7 +1042,7 @@ class ExportController extends Controller
fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中
$accessNum = D('Spend')
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
->where($map)
->join($tab_promote_join)
->order('pay_time DESC')
@ -954,7 +1054,7 @@ class ExportController extends Controller
// var_dump($count);die();
for($i = 1; $i <= $pages; $i++) {
$xlsData = D('Spend')
->field('pay_order_number,pay_time,user_account,game_name,promote_account,spend_ip,server_name,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
->field('pay_order_number,extend,pay_time,user_account,game_name,promote_account,spend_ip,server_id,server_name,game_player_id,game_player_name,cost,pay_amount,pay_way,pay_status,pay_game_status')
->where($map)
->limit(($i-1)*$perSize ,$perSize)
->join($tab_promote_join)
@ -1180,20 +1280,23 @@ class ExportController extends Controller
break;
case 11:
$xlsName = $xlsName?$xlsName:"礼包领取";
// $xlsCell = array(
// array('user_account', "玩家账号"),
// array('game_name', "游戏名称"),
// array('gift_name', '礼包名称'),
// array('novice', '礼包卡号'),
// array('gift_id', '运营平台', 'get_operation_platform', '*', 'giftbag'),
// array('create_time', '领取时间', 'time_format', '*'),
// );
$xlsCell = array(
array('user_account', "玩家账号"),
array('game_name', "游戏名称"),
array('gift_name', '礼包名称'),
array('novice', '礼包卡号'),
array('gift_id', '运营平台', 'get_operation_platform', '*', 'giftbag'),
array('create_time', '领取时间', 'time_format', '*'),
"玩家账号", "游戏名称", '礼包名称', '礼包卡号', '运营平台', '领取时间',
);
if (isset($_REQUEST['game_name'])) {
$extend['game_name'] = trim($_REQUEST['game_name']);
$extend['tab_gift_record.game_name'] = trim($_REQUEST['game_name']);
unset($_REQUEST['game_name']);
}
if (isset($_REQUEST['user_account'])) {
$extend['user_account'] = trim($_REQUEST['user_account']);
$extend['tab_gift_record.user_account'] = trim($_REQUEST['user_account']);
unset($_REQUEST['user_account']);
}
if (isset($_REQUEST['sdk_version'])) {
@ -1203,14 +1306,70 @@ class ExportController extends Controller
$map['sdk_version'] = $_REQUEST['sdk_version'];
$game_ids = M('game', 'tab_')->field('id')->where($map)->select();
$game_ids = array_column($game_ids, 'id');
$extend['sdk_version'] = ['in', $game_ids];
$extend['tab_gift_record.game_id'] = ['in', $game_ids];
unset($_REQUEST['sdk_version']);
}
}
$xlsData = M('gift_record', 'tab_')
// var_dump($extend);die();
$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 = M('gift_record', 'tab_')
->field("user_account,game_name,gift_name,novice,gift_id,FROM_UNIXTIME(create_time) as create_time")
->where($extend)
->order("id DESC")
->select();
->count();
$perSize = 5000;//每次查询的条数
$pages = ceil($accessNum / $perSize);
// var_dump($count);die();
for($i = 1; $i <= $pages; $i++) {
$xlsData = M('gift_record', 'tab_')
->field("tab_gift_record.user_account,tab_gift_record.game_name,tab_gift_record.gift_name,tab_gift_record.novice,giftbag_version,FROM_UNIXTIME(tab_gift_record.create_time) as create_time")
->join("left join tab_giftbag on tab_gift_record.gift_id = tab_giftbag.id")
->where($extend)
->limit(($i-1)*$perSize ,$perSize)
->order("tab_gift_record.id DESC")
->select();
foreach($xlsData as $value) {
if($value['giftbag_version']==0){
$value['giftbag_version']= '双平台';
}elseif($value['giftbag_version']==1){
$value['giftbag_version']= "安卓";
}elseif($value['giftbag_version']==2){
$value['giftbag_version']= "苹果";
} else {
$value['giftbag_version']= "";
}
// $value['gift_id'] = get_operation_platform($value['gift_id'],'giftbag');
mb_convert_variables('GBK', 'UTF-8', $value);
fputcsv($fp, $value);
}
unset($xlsData);//释放变量的内存
//刷新输出缓冲到浏览器
ob_flush();
flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。
}
fclose($fp);
exit();
break;
case 12:
get_info_status();
@ -4956,11 +5115,12 @@ if ($key == 'model'){
}
$map['id']=array('in',$zid);
}
$map['level'] = I('promote_level');
if (I("promote_level")) {
$map['level'] = I("promote_level");
}
if(I('oa_associated',-1) != -1) {
$map['oa_associated'] = I('oa_associated');
}
}

@ -130,15 +130,15 @@ class SsgController extends BaseController {
$_SESSION['user_id'] = $user_id;
$user = M('user', 'tab_')->where(array(
'id' => $user_id
'id' => $user_id
))->find();
if (!$user['promote_id'] && $promote) {
M('user', 'tab_')->where(array(
'id' => $user_id
))->save(array(
'promote_id' => $promoteId,
'promote_account' => $promote['account']
));
M('user', 'tab_')->where(array(
'id' => $user_id
))->save(array(
'promote_id' => $promoteId,
'promote_account' => $promote['account']
));
}
}
$this->ajaxReturn(array("ErrorCode"=>$res_code,"ResultMsg"=>$res_msg),'JSON');
@ -182,15 +182,15 @@ class SsgController extends BaseController {
#验证短信验证码
$this -> sms_verify($user['account'], $user['code']);
$res = $this -> doRegister($user['account'],$user['password'],$user['account'],$promoteId,4,2, $game_id);
if(empty($res)){
$res = $this -> doRegister($user['account'],$user['password'],$user['account'],$promoteId,4,2, $game_id);
if(empty($res)){
$this -> set_message(1017, "fail", "添加失败");
}
//添加自动登录
$userApi = new MemberApi();
$user_id = $userApi->login($user['account'], $user['password'],1);
}
//添加自动登录
$userApi = new MemberApi();
$user_id = $userApi->login($user['account'], $user['password'],1);
$this -> set_message(1, "success", "添加成功");
$this -> set_message(1, "success", "添加成功");
}
//忘记密码
@ -229,18 +229,18 @@ class SsgController extends BaseController {
$res = $this -> doRegister($account,$password,'',$promoteId,4,1);
if(empty($res)){
$this -> set_message(1017, "fail", "添加失败");
}
}
//添加自动登录
$userApi = new MemberApi();
$user_id = $userApi->login($account, $password,1);
//添加自动登录
$userApi = new MemberApi();
$user_id = $userApi->login($account, $password,1);
$this -> set_message(1, "success", "添加成功");
$this -> set_message(1, "success", "添加成功");
# code...
}
//消息返回
public function set_message($status=0,$return_code="fail",$return_msg="操作失败"){
public function set_message($status=0,$return_code="fail",$return_msg="操作失败"){
$msg = array(
"status" => $status,
"return_code" => $return_code,
@ -482,15 +482,14 @@ class SsgController extends BaseController {
))->find();
$payLog = M('game_supersign', 'tab_')->where(array(
$isPay = M('game_supersign', 'tab_')->where(array(
'user_id' => $userId,
'game_id' => $gameId
'game_id' => $gameId,
'pay_status' =>1
))->find();
if($payLog && $payLog['pay_status']==1){
//$this->assign("error","亲~您已购买过了~<br/>请到【订单查询】查看订单信息哟~");
//$this->display('blank');
redirect("/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/".$payLog['order_id']);
if($isPay){
redirect("/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/".$isPay['order_id']);
}else{
if (!$gameInfo['supersign_token']) {
//$this->error("超级签token未填写");
@ -527,27 +526,19 @@ class SsgController extends BaseController {
exit();
}
$payLog = M('game_supersign', 'tab_')->where(array(
$isPay = M('game_supersign', 'tab_')->where(array(
'user_id' => $userId,
'game_id' => $gameId
))->find();
'game_id' => $gameId,
'pay_status' => 1
))->find(); //是否有已支付订单
$gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array(
'id' => $gameId,
))->find();
if ($payLog && $payLog['pay_status']==0) {
$orderId = $payLog['order_id'];
}elseif ($payLog && $payLog['pay_status']==1){
/*$orderId = $payLog['order_id'];
if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){
redirect("http://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
}else{
redirect("https://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
}*/
if ($isPay){
$this->assign("error","亲~您已购买过了~<br/>请到【订单查询】查看订单信息哟~");
$this->display('blank');
//$this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~");
exit();
} else {
$orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签

Loading…
Cancel
Save