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

master
yulingwei 5 years ago
commit 077ba7754f

@ -923,15 +923,17 @@ public function auto_rrdae(){
$map['pay_status'] = 1;
$map['pay_game_status'] = 1;
$map['game_player_id'] = ['gt', 0];
$field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
$field = 'FROM_UNIXTIME(pay_time, "%Y-%m-%d") as day,promote_id,user_id,game_id,server_id,game_player_id,sum(pay_amount) as recharge_cost,count(id) as recharge_count';
$spendData = M('spend', 'tab_')->field($field)
->where($map)
->group('day,game_player_id,server_id,game_id')
->group('day,game_player_id,server_id,game_id,user_id,promote_id')
->select();
if (!empty($spendData)) {
$data = [];
foreach ($spendData as $list) {
$save['promote_id'] = $list['promote_id'];
$save['user_id'] = $list['user_id'];
$save['game_id'] = $list['game_id'];
$save['server_id'] = $list['server_id'];
$save['role_id'] = $list['game_player_id'];

@ -214,13 +214,13 @@ class ExportController extends Controller
// array('lock_status', L('Account_status'), 'get_info_status', '*', '4'),
// );
$field = 'a.id,a.account,a.id as get_registertype,a.promote_account,a.balance,IFNULL(sum(ss.pay_amount),0) as recharge_total,
a.gold_coin,a.alipay,a.id as small_count,a.id as vip_level,a.register_type,a.register_time
a.gold_coin,a.alipay,a.id as small_count,a.id as vip_level,a.register_type
,a.register_ip,a.login_time,a.device_number,a.lock_status,check_status,a.age_status,a.register_way,
a.register_type';
$xlsCell = [L('Account_number_ID'),"第三方来源","绑定账号",L('Subordinate_channel'), "账户平台币"
, "累计充值", "金币", "绑定支付宝", "小号", "VIP等级", L('Registration_time'),
L('Register_iP'), "最后登录时间","设备号", L('Account_status'),"拉黑状态"];
$map['tab_user.register_type']= ['in','3,4,5,6'];
// $map['tab_user.register_type']= ['in','3,4,5,6'];
}else{
// $xlsCell = array(
// array('id', L('Account_number_ID')),
@ -364,10 +364,20 @@ class ExportController extends Controller
// if (isset($_REQUEST['game_name'])) {
// //$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
// }
$game_map = "";
$game_map .= " and tab_user_play.game_id in (" . implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) . ")";
$spendprom = " and ss.game_id in (".implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')).")";
if (isset($_REQUEST['server_name'])) {
$map['server_name'] = ['like', "{$_REQUEST['server_name']}%"];
}
$game_play_map = '';
if (isset($_REQUEST['server_name'])) {
$game_play_map .= " and tab_user_play_info.server_name = '{$_REQUEST['server_name']}' ";
}
if (isset($_REQUEST['viplevel'])) {
@ -409,7 +419,7 @@ class ExportController extends Controller
// '序号ID', '姓名', '电话',
// ];
$fileName = '导出.xlsx';
// $fileName = '导出.xlsx';
$csvFileName = $xlsName.'.csv';
//设置好告诉浏览器要下载excel文件的headers
header('Content-Description: File Transfer');
@ -454,6 +464,8 @@ class ExportController extends Controller
if($_REQUEST['promote_id'] && $_REQUEST['promote_id'] > -1){
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field)
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1'.$spendprom)
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->limit(($i-1)*$perSize ,$perSize)
->having($havs)
->group('a.id')
@ -463,12 +475,15 @@ class ExportController extends Controller
}else{
$xlsData = $usermodel->table('(' . $sql1 . ') as a ')->field($field)
->join('left join tab_spend as ss on ss.user_id=a.id AND ss.pay_status = 1')
->join($game_map ? "tab_user_play on tab_user_play.user_id = a.id $game_map" : false)
->join($game_play_map ? "tab_user_play_info on tab_user_play_info.user_id = a.id $game_play_map" : false)
->limit(($i-1)*$perSize ,$perSize)
->having($havs)
->group('a.id')
->order($order)
->select();
}
// echo $usermodel->_sql();die();
//数据
@ -489,7 +504,10 @@ class ExportController extends Controller
if($_REQUEST['type']==2){
$xlsData[$k]['register_type'] = get_registertype($v['register_type']);
}
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
if ($_REQUEST['type']!=2) {
$xlsData[$k]['register_time'] = date('Y-m-d H:i:s',$xlsData[$k]['register_time']);
}
$xlsData[$k]['login_time'] = date('Y-m-d H:i:s',$xlsData[$k]['login_time']);
$xlsData[$k]['lock_status'] = $xlsData[$k]['lock_status']==1?'正常':'锁定';
$xlsData[$k]['check_status'] = $xlsData[$k]['check_status']==1?'正常':'已拉黑';

@ -789,7 +789,7 @@ class MemberController extends ThinkController
}
// $map['type'] = 1;
// $map['login_time'] = ['exp', 'login_time<>0'];
$map['login_time'] = ['gt',0];
// $map['login_time'] = ['gt',0];
$extend = array();
$extend['map'] = $map;

@ -63,16 +63,77 @@ unset($_REQUEST['parent_id']);
$map['ba_id']=$_REQUEST['admin_id'];
}
}
if (I("promote_level")) {
$map['level'] = I("promote_level");
}
$this->m_title = '推广员列表';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find());
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
if(!empty(I('oa_associated'))) {
$map['oa_associated'] = I('oa_associated');
$oa_data = [];
for($i = 1; $i > 0; $i++) {
$arr['time'] = time();
$arr['page'] = $i;
$arr['pageSize'] = 1000;
ksort($arr);
reset($arr);
$sign = md5(http_build_query($arr) . 'wmkjtx_kj213');
$arr['sign'] = $sign;
$re_data = curl_post('http://oa.76ba.com/api/wanmeng/platformAccount',$arr);
$re_data = json_decode($re_data,true);
if($re_data['code'] == 1) {
$oa = $re_data['data'];
$oa_data = array_merge($oa_data,$oa);
} else {
break;
}
}
$promote = D(self::model_name)->field('id,account')->where(['oa_associated' => 0])->order('id DESC')->select();
$oa_data = array_column($oa_data, 'platform_account');
foreach($promote as $k => $v) {
if(in_array($v['account'], $oa_data)) {
M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => 1]);
}
}
}
$list_data = D(self::model_name)->where($map)->order('id DESC')->page($p,$row)->select();
$oa_data = [];
foreach($list_data as $k => $v)
{
if($v['oa_associated'] != 1) {
$oa_data[] = $v['account'];
}
}
if(!empty($oa_data))
{
$arr['time'] = time();
$arr['account'] = implode(",", $oa_data);
ksort($arr);
reset($arr);
$sign = md5(http_build_query($arr) . 'wmkjtx_kj213');
$arr['sign'] = $sign;
$re_data = curl_post('http://oa.76ba.com/api/wanmeng/verifyBind',$arr);
$re_data = json_decode($re_data,true)['data'];
foreach($list_data as $k => $v)
{
if(in_array($v['account'], $re_data))
{
$list_data[$k]['oa_associated'] = $re_data[$v['account']];
M('promote','tab_')->where(['id' => $v['id']])->setField(['oa_associated' => $re_data[$v['account']]]);
}
}
}
$count = I('oa_associated') ? count($list_data) : D(self::model_name)->count();
$page = set_pagination($count,$row);
if($page) {$this->assign('_page', $page);}
$this->assign('list_data', $list_data);
$this->display();
parent::order_lists(self::model_name,$p,$map);
}
private function siteApplyList($p){

@ -126,7 +126,14 @@
<option value="3">审核中</option>
<option value="4">修改审核中</option>
</select>
</div>
</div>
<div class="input-list input-list-channelstatus">
<select name="oa_associated">
<option value="">oa关联</option>
<option value="1">已关联</option>
<option value="2">未关联</option>
</select>
</div>
<else/>
<div class="input-list input-list-channelstatus">
<select name="url_type">
@ -142,6 +149,13 @@
<option value="2">未审核</option>
</select>
</div>
<div class="input-list input-list-channelstatus">
<select name="oa_associated">
<option value="">oa关联</option>
<option value="1">已关联</option>
<option value="2">未关联</option>
</select>
</div>
</empty>
<input type="hidden" name="" value="" class="sortBy">
<input type="hidden" name="type" value="{$_GET['type']}">
@ -172,7 +186,8 @@
<th>所属会长</th>
<th>商务专员</th>
<th>状态</th>
<th>身份状态</th>>
<th>身份状态</th>
<th>oa关联</th>
<th>可申请游戏</th>
<th>操作</th>
</tr>
@ -225,6 +240,11 @@
<span>未认证</span>
<?php }?>
</td>
<if condition="$data['oa_associated'] eq 1">
<td>已关联</td>
<else />
<td style="color: red;">未关联</td>
</if>
<td><a class="ajax-view" data-id="{$data.id}">查看</a></td>
<td>
<a href="{:U('edit',array('id'=>$data['id']))}" class="">编辑</a>

@ -1253,7 +1253,7 @@ class DownloadController extends BaseController {
}
public function userRecharge_data_export() {
$gameId = I('game_id', 0);
$gameId = I('relation_game_id', 0);
$serverId = I('server_id', 0);
$isSelf = I('is_self', 0);
$roleName = I('role_name', '');
@ -1310,7 +1310,12 @@ class DownloadController extends BaseController {
}
if ($gameId != 0) {
$map['game_id'] = $gameId;
$gameMap['relation_game_id'] = $gameId;
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
$map['game_id'] = ['in', $gameId1];
}
if ($serverId != 0) {
$map['server_id'] = $serverId;
@ -1371,7 +1376,7 @@ class DownloadController extends BaseController {
public function achievement_data_export() {
$time = I('time', date('Y-m-d'));
$sdkVersion = I('sdk_version', 0);
$gameId = I('game_id', 0);
$gameId = I('relation_game_id', 0);
$serverId = I('server_id', 0);
$parentId = I('parent_id', 0);
$promoteId = I('promote_id', 0);
@ -1424,7 +1429,12 @@ class DownloadController extends BaseController {
$map['currentDisplay'] = $currentDisplay;
$map['ids'] = $ids;
if ($gameId > 0) {
$params['game_id'] = $gameId;
$gameMap['relation_game_id'] = $gameId;
if ($sdkVersion > 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
$params['game_id'] = ['in', $gameId1];
}
if ($serverId > 0) {
$params['server_id'] = $serverId;
@ -1461,7 +1471,7 @@ class DownloadController extends BaseController {
}
//玩家角色
public function userRoles_data_export() {
$gameId = I('game_id', 0);
$gameId = I('relation_game_id', 0);
$serverId = I('server_id', 0);
$isSelf = I('is_self', 0);
$roleName = I('role_name', '');
@ -1517,7 +1527,12 @@ class DownloadController extends BaseController {
if ($gameId != 0) {
$map['game_id'] = $gameId;
$gameMap['relation_game_id'] = $gameId;
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId1 = M('game', 'tab_')->where($gameMap)->getField('id', true);
$map['game_id'] = ['in', $gameId1];
}
if ($serverId != 0) {
$map['serverId'] = $serverId;

@ -1726,6 +1726,7 @@ class QueryController extends BaseController
$begTime = strtotime($initBegTime);
$endTime = strtotime($initEndTime);
$endTime += 3600 * 24;
$nowTime = strtotime(date('Y-m-d 00:00:00', time()));
$promote = $this->getLoginPromote();
$levelPromote = $this->getLevelPromote();
@ -1735,50 +1736,38 @@ class QueryController extends BaseController
$pagination = '';
$count = 0;
if (intval($endTime - $begTime) / (24 * 3600) <= 31) {
$map = [
'_logic' => 'or',
'id' => $queryPromote['id'],
'chain' => ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%']
];
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$ids[] = $queryPromote['id'];
$map = [];
if (count($ids) > 0) {
$map = ['promote_id' => ['in', $ids]];
} else {
$map['_string'] = '1<>1';
}
$map = ['uc.promote_id' => ['in', $ids]];
$subMap = ['promote_id' => ['in', $ids]];
$subMap = [];
if ($relationGameId != 0) {
$gameMap['relation_game_id'] = $relationGameId;
if ($sdkVersion != 0) {
$gameMap['sdk_version'] = $sdkVersion;
}
$gameId = M('game', 'tab_')->where($gameMap)->getField('id', true);
$map['game_id'] = ['in', $gameId];
$map['uc.game_id'] = ['in', $gameId];
$subMap['game_id'] = ['in', $gameId];
}
if ($serverId != 0) {
$map['server_id'] = $serverId;
$map['uc.server_id'] = $serverId;
$subMap['server_id'] = $serverId;
}
if ($roleName != '') {
$map['role_name'] = ['like', '%' . $roleName . '%'];
$map['ui.role_name'] = ['like', $roleName . '%'];
}
if ($userAccount != '') {
$map['user_account'] = ['like', '%' . $userAccount . '%'];
$map['ui.user_account'] = ['like', $userAccount . '%'];
}
if ($isSelf) {
$map['promote_id'] = $queryPromote['id'];
$map['uc.promote_id'] = $queryPromote['id'];
}
$subMap['create_time'] = ['between', [$begTime, $endTime - 1]];
$roleIdMap = $subMap;
$roleIds = M('user_play_data_count', 'tab_')->where($roleIdMap)->group('role_id')->getField('role_id', true);
if (count($roleIds) > 0) {
$map['role_id'] = ['in', $roleIds];
}
if ($costBegin != '' || $costEnd != '') {
$having = '';
if ($costBegin != '' && $costEnd != '') {
@ -1793,10 +1782,10 @@ class QueryController extends BaseController
->group('game_id,server_id,role_id')
->having($having)
->buildSql();
$map['_string'] = 'role_id in(' . $subQuery . ')';
$map['_string'] = 'ui.role_id in(' . $subQuery . ')';
}
$orderBy = 'play_time desc';
$orderBy = 'ui.play_time desc';
if (!empty($sortName)) {
if (in_array($sortName, $sortNameData)) {
$desc = ' desc';
@ -1819,53 +1808,25 @@ class QueryController extends BaseController
}
}
$spendMap['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
$spendMap['_string'] = 'uc.game_id = tab_user_play_info.game_id and uc.server_id = tab_user_play_info.server_id and uc.role_id = tab_user_play_info.role_id';
$sqlCost = M('user_play_data_count', 'tab_')->alias('uc')
->field('sum(uc.recharge_cost) cost')
->where($spendMap)
->buildSql();
$sqlCount = M('user_play_data_count', 'tab_')->alias('uc')
->field('sum(uc.recharge_count) count')
->where($spendMap)
->buildSql();
$spendMap['uc.create_time'] = ['between', [strtotime(date('Y-m-d 00:00:00')), strtotime(date('Y-m-d 23:59:59'))]];
$sqlTodayCost = M('user_play_data_count', 'tab_')->alias('uc')
->field('sum(uc.recharge_count) count')
->where($spendMap)
->buildSql();
$subQuery = M('user_play_info', 'tab_')
->field("*,$sqlCost as recharge_cost,$sqlCount as recharge_count,$sqlTodayCost as recharge_cost_today")
$map['uc.create_time'] = ['between', [$begTime, $endTime - 1]];
$fieldUC = "sum(uc.recharge_cost) recharge_cost,sum(uc.recharge_count) recharge_count,sum(if(uc.create_time = {$nowTime},uc.recharge_cost,0)) as recharge_cost_today";
$fieldUI = "ui.user_account,ui.game_name,ui.role_name,ui.role_level,ui.server_name,ui.play_time,ui.play_ip,ui.promote_account,ui.sdk_version";
$field = $fieldUC . ',' . $fieldUI;
$subQuery = M('user_play_data_count', 'tab_')->alias('uc')
->field($field)
->join('tab_user_play_info as ui on ui.promote_id = uc.promote_id and ui.game_id = uc.game_id and ui.server_id = uc.server_id and ui.role_id = uc.role_id')
->where($map)
->having('recharge_cost > 0')
->order('play_time desc')
->group('uc.role_id,uc.server_id,uc.game_id')
->buildSql();
$query = M()->field('*')
$query = M()->alias('record')
->table($subQuery)
->alias('a')
->order($orderBy);
list($roles, $pagination, $count) = $this->paginate($query);
list($records, $pagination, $count) = $this->paginate($query);
foreach ($roles as $role) {
$records[] = [
'user_account' => encryption($role['user_account']),
'game_name' => $role['game_name'],
'role_name' => $role['role_name'],
'role_id' => $role['role_id'],
'role_level' => $role['role_level'],
'server_id' => $role['server_id'],
'server_name' => $role['server_name'],
'recharge_cost' => empty($role['recharge_cost']) ? 0 : $role['recharge_cost'],
'recharge_count' => empty($role['recharge_count']) ? 0 : $role['recharge_count'],
'recharge_cost_today' => empty($role['recharge_cost_today']) ? 0 : $role['recharge_cost_today'],
'play_time' => $role['play_time'],
'play_ip' => $role['play_ip'],
'promote_id' => $role['promote_id'],
'promote_account' => $role['promote_account'],
'sdk_version' => $role['sdk_version'],
'unlogin_day' => intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $role['play_time']))) / (24 * 3600))
];
foreach ($records as &$list) {
$list['user_account'] = encryption($list['user_account']);
$list['unlogin_day'] = intval((strtotime(date('Y-m-d 00:00:00')) - strtotime(date('Y-m-d 00:00:00', $list['play_time']))) / (24 * 3600));
}
}

@ -547,3 +547,15 @@ ALTER TABLE `tab_withdraw`
ADD COLUMN `last_up_update_time` int(10) NOT NULL DEFAULT 0 COMMENT '最后更新时间',
ADD COLUMN `spend_ids` longtext NOT NULL COMMENT '充值订单id';
--广oa
ALTER TABLE `tab_promote`
ADD COLUMN`oa_associated` tinyint(1) DEFAULT '0' COMMENT 'oa是否关联',
----ID广ID
ALTER TABLE `tab_user_play_data_count`
ADD COLUMN `user_id` int(11) NOT NULL DEFAULT 0 COMMENT '玩家ID',
ADD COLUMN `promote_id` int(11) NOT NULL DEFAULT 0 COMMENT '推广员ID';
ALTER TABLE `tab_user_play_data_count`
DROP INDEX `search`,
ADD INDEX `search`(`user_id`, `promote_id`, `game_id`, `server_id`, `role_id`, `create_time`) USING BTREE;

Loading…
Cancel
Save