|
|
<?php
|
|
|
/**
|
|
|
* Created by PhpStorm.
|
|
|
* User: 67snow
|
|
|
* Date: 2019/8/5
|
|
|
* Time: 16:04
|
|
|
*/
|
|
|
namespace Sdk\Controller;
|
|
|
use Think\Controller;
|
|
|
use Think\Log;
|
|
|
|
|
|
class FengHuoApi2Controller extends GetInfoBaseController{
|
|
|
// protected function _initialize(){
|
|
|
// // 制定允许其他域名访问
|
|
|
// header("Access-Control-Allow-Origin:*");
|
|
|
//// 响应类型
|
|
|
// header('Access-Control-Allow-Methods:POST');
|
|
|
//// 响应头设置
|
|
|
// header('Access-Control-Allow-Headers:x-requested-with, content-type');
|
|
|
//// var_dump(111);
|
|
|
// $key = '138FE30A2C';
|
|
|
// $data = $_REQUEST;
|
|
|
//
|
|
|
// $md5Sign = $data['signatureMD5'];
|
|
|
// unset($data['signatureMD5']);
|
|
|
// $time = $data['time'];
|
|
|
// $page = $data['page'];
|
|
|
// $pageSize = $data['page_size'];
|
|
|
// $appId = $data['app_id'];
|
|
|
// $signatureStamp = $data['signature_stamp'];
|
|
|
//
|
|
|
// if(empty($md5Sign) || empty($time) || empty($page) || empty($pageSize) || empty($appId) || empty($signatureStamp)){
|
|
|
// return $this->ajaxReturn(array("ResultCode"=>0,"ResultMessage"=>"缺少必要的参数","Data"=>"null"));
|
|
|
// }
|
|
|
//
|
|
|
//
|
|
|
// $signData = array($appId,$page,$pageSize,$signatureStamp,$time);
|
|
|
// $md5_sign = md5(http_build_query($signData).$key);
|
|
|
//
|
|
|
//
|
|
|
// if($md5Sign != $md5_sign){
|
|
|
// return $this->ajaxReturn(array("ResultCode"=>0,"ResultMessage"=>"验签失败"));
|
|
|
// }
|
|
|
// $endSignatureStamp = intval(time()) + 600;
|
|
|
// if($signatureStamp > $endSignatureStamp){
|
|
|
// return $this->ajaxReturn(array("ResultCode"=>0,"ResultMessage"=>"请求超时"));
|
|
|
// }
|
|
|
//
|
|
|
// $pageSize = intval($pageSize);
|
|
|
// if($pageSize > 1000){
|
|
|
// return $this->ajaxReturn(array("ResultCode"=>0,"ResultMessage"=>"每页数量数值过大"));
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
/**
|
|
|
* 注册明细
|
|
|
* @param
|
|
|
*/
|
|
|
public function registerDetail(){
|
|
|
$time = $_REQUEST['time'];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
|
|
|
//时间区间
|
|
|
if (isset($time)) {
|
|
|
$where['register_time'] = array('between',[$time,$time+86399]);
|
|
|
}
|
|
|
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
// 默认排序:id降序
|
|
|
$order = 'register_time asc';
|
|
|
$data = M('user','tab_')
|
|
|
->field('id,account,promote_account,register_ip,register_time,device_type,device_number,fgame_name')
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
foreach ($data as $k => $v) {
|
|
|
$bindType = $v['device_type'];
|
|
|
if ($bindType == 1) {
|
|
|
$data[$k]['device_type'] = 'Android';
|
|
|
}elseif($bindType == 2) {
|
|
|
$data[$k]['device_type'] = 'IOS';
|
|
|
}else{
|
|
|
if(!empty($v['fgame_name'])){
|
|
|
$gameServer = substr($v['fgame_name'], -10, 9);
|
|
|
if($gameServer == '安卓版'){
|
|
|
$data[$k]['device_type'] = 'Android';
|
|
|
} elseif($gameServer == '苹果版') {
|
|
|
$data[$k]['device_type'] = 'IOS';
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
unset($data[$k]['fgame_name']);
|
|
|
|
|
|
}
|
|
|
|
|
|
if($data){
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "调用成功",
|
|
|
'Data' => $data
|
|
|
];
|
|
|
}else{
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "没有数据,换个条件试试吧",
|
|
|
'Data' => 'null'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('registerDetail:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 支付明细
|
|
|
* @param
|
|
|
*/
|
|
|
public function payDetail(){
|
|
|
|
|
|
$time = $_REQUEST['time'];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
|
|
|
//时间区间
|
|
|
if (isset($time)) {
|
|
|
$where['pay_time'] = array('between',[$time,$time+86399]);
|
|
|
}
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
// 默认排序:id降序
|
|
|
$order = 'pay_time asc';
|
|
|
$where['pay_status'] = array('neq',0);
|
|
|
$where['is_check'] = 1;
|
|
|
|
|
|
$data = M('spend','tab_')
|
|
|
->field('pay_order_number,promote_account,user_id,game_name,game_player_name,server_name,pay_time,cost,user_account,discount_amount,pay_amount')
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
|
|
|
if($data){
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => '调用成功',
|
|
|
'Data' => $data
|
|
|
];
|
|
|
}else{
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => '没有数据,换个条件试试吧',
|
|
|
'Data' => 'null'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('payDetail:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 玩家角色信息
|
|
|
* @param
|
|
|
*/
|
|
|
public function roleInfo(){
|
|
|
|
|
|
$time = $_REQUEST['time'];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
//时间区间
|
|
|
if (isset($time)) {
|
|
|
$where['play_time'] = array('between',[$time,$time+86399]);
|
|
|
}
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
// 默认排序:id降序
|
|
|
$order = 'play_time asc';
|
|
|
$data = M('user_play_info','tab_')
|
|
|
->field('promote_account,user_id,game_name,server_name,role_name,role_level,play_time,role_id,user_account,create_time')
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
|
|
|
if($data){
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "调用成功",
|
|
|
'Data' => $data
|
|
|
];
|
|
|
}else{
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "没有数据,换换条件吧",
|
|
|
'Data' => 'null'
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('roleInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 玩家登陆信息
|
|
|
* @param
|
|
|
*/
|
|
|
public function loginInfo(){
|
|
|
|
|
|
$time = $_REQUEST['time'];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
|
|
|
//时间区间
|
|
|
if (isset($time)) {
|
|
|
$where['login_time'] = array('between',[$time,$time+86399]);
|
|
|
}
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
// 默认排序:id降序
|
|
|
$order = 'login_time asc';
|
|
|
|
|
|
// $where['login_time'] = array('neq',0);
|
|
|
|
|
|
$data = M('user_login_record','tab_')
|
|
|
->field('tab_user_login_record.id,tab_user_login_record.login_ip,user_id,game_name,server_name,login_time,user_account,game_player_name,CASE WHEN promote_id = 0 THEN "官方渠道" ELSE account END as promote_account')
|
|
|
->join("left join tab_promote as promote on tab_user_login_record.promote_id=promote.id")
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
|
|
|
// echo $data;die();
|
|
|
// foreach ($data as $k=>$v){
|
|
|
// $promoteId = $v['promote_id'];
|
|
|
// if($promoteId == 0){
|
|
|
// $data[$k]['promote_account'] = '官方渠道';
|
|
|
// }else{
|
|
|
// $promote_account = M('promote','tab_')
|
|
|
// ->field('account')
|
|
|
// ->where('id',$promoteId)
|
|
|
// ->find();
|
|
|
//
|
|
|
// $data[$k]['promote_account'] = $promote_account;
|
|
|
// }
|
|
|
//
|
|
|
// }
|
|
|
|
|
|
// dump($data);die();
|
|
|
|
|
|
if($data){
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "调用成功",
|
|
|
'Data' => $data
|
|
|
];
|
|
|
}else{
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "没有数据,换个条件试试吧",
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('loginInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 登入历史信息
|
|
|
public function loginHistoryInfo(){
|
|
|
$where = [];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
|
|
|
//时间区间
|
|
|
// if (isset($time)) {
|
|
|
// $where['login_time'] = array('between',[$time,$time+86399]);
|
|
|
// }
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
$order = 'id desc';
|
|
|
|
|
|
$data = M('user','tab_')
|
|
|
->field('id,nickname,login_time as last_login_time,last_login_ip, login_ip')
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
foreach ($data as &$v) {
|
|
|
if (!$v['last_login_ip'])
|
|
|
$v['last_login_ip'] = $v['login_ip'];
|
|
|
}
|
|
|
|
|
|
if($data){
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "调用成功",
|
|
|
'Data' => $data
|
|
|
];
|
|
|
}else{
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "没有数据,换个条件试试吧",
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('loginHistoryInfo:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 下载记录
|
|
|
public function downloadLog(){
|
|
|
$where = [];
|
|
|
$time = $_REQUEST['time'];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
|
|
|
//时间区间
|
|
|
if (isset($time)) {
|
|
|
$where['create_time'] = array('between',[$time,$time+86399]);
|
|
|
}
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
// 默认排序:id降序
|
|
|
$order = 'id asc';
|
|
|
|
|
|
$where['type'] = 6;
|
|
|
|
|
|
$ret = M('user_action_log','tab_')
|
|
|
->field('id,game_id,action,ip,create_time')
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
|
|
|
$data = [];
|
|
|
foreach ($ret as $k=>$v){
|
|
|
$needle = 'landingPage/code/';
|
|
|
$code = substr($v['action'], strpos($v['action'], $needle)+strlen($needle));
|
|
|
$promote = $this->decodeApplyCode($code);
|
|
|
$promoteId = $promote['promote_id'];
|
|
|
if(!$promoteId){
|
|
|
$data[$k]['promote_id'] = 0;
|
|
|
$data[$k]['promote_account'] = '官方渠道';
|
|
|
}else{
|
|
|
$promoteInfo = M('promote','tab_')
|
|
|
->field('account')
|
|
|
->where(['id' => $promoteId])
|
|
|
->find();
|
|
|
$data[$k]['promote_id'] = $promoteId;
|
|
|
$data[$k]['promote_account'] = $promoteInfo['account'];
|
|
|
}
|
|
|
$game = M('game', 'tab_')->where(['id' => $v['game_id']])->find();
|
|
|
$data[$k]['game_id'] = $v['game_id'];
|
|
|
$data[$k]['game_name'] = $game['game_name'];
|
|
|
$data[$k]['ip'] = $v['ip'];
|
|
|
$data[$k]['create_time'] = $v['create_time'];
|
|
|
$data[$k]['create_time1'] = date('Y-m-d H:i:s', $v['create_time']);
|
|
|
}
|
|
|
|
|
|
if($data){
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "调用成功",
|
|
|
'Data' => $data
|
|
|
];
|
|
|
}else{
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "没有数据,换个条件试试吧",
|
|
|
'Data' => []
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('downloadLog:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
|
|
|
}
|
|
|
|
|
|
private function decodeApplyCode($code)
|
|
|
{
|
|
|
$decryptStr = openssl_decrypt(base64_decode($code), 'AES-256-ECB', 'jianghuifa1@#Landing&Download2048');
|
|
|
$result = json_decode($decryptStr, true);
|
|
|
if (is_null($result)) {
|
|
|
$items = explode('|', $decryptStr);
|
|
|
if (count($items) != 5) {
|
|
|
return null;
|
|
|
}
|
|
|
return [
|
|
|
'promote_id' => $items[0],
|
|
|
'game_id' => $items[1],
|
|
|
'expires_in' => $items[2],
|
|
|
'created_at' => date('Y-m-d H:i:s', $items[3]),
|
|
|
'type' => $items[4],
|
|
|
];
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 换绑记录
|
|
|
* @param
|
|
|
*/
|
|
|
public function bindHistory()
|
|
|
{
|
|
|
|
|
|
$time = $_REQUEST['time'];
|
|
|
$page = $_REQUEST['page'];
|
|
|
$pageSize = $_REQUEST['page_size'];
|
|
|
|
|
|
//时间区间
|
|
|
$where = [];
|
|
|
$where['m.status'] = 1;
|
|
|
if (isset($time)) {
|
|
|
$where['m.create_time'] = array('between', [$time, $time + 86399]);
|
|
|
}
|
|
|
// 第几页数据
|
|
|
$page = intval($page);
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
// 一页显示数据的条数
|
|
|
$pageSize = intval($pageSize);
|
|
|
$row = $pageSize ? $pageSize : 1000;
|
|
|
// 默认排序:id降序
|
|
|
$order = 'm.create_time asc';
|
|
|
$data = M('mend as m', 'tab_')
|
|
|
->join('tab_user as u on m.user_id = u.id','LEFT')
|
|
|
->field('m.user_id,m.create_time,m.promote_account,m.promote_account_to,m.bind_type,m.user_account,u.register_time')
|
|
|
->where($where)
|
|
|
->order($order)
|
|
|
->page($page, $row)
|
|
|
->select();
|
|
|
|
|
|
foreach ($data as $k => $v) {
|
|
|
$bindType = $v['bind_type'];
|
|
|
if ($bindType == 1) {
|
|
|
$data[$k]['bind_type'] = 'In';
|
|
|
}elseif($bindType == 2){
|
|
|
$data[$k]['bind_type'] = 'Out';
|
|
|
}
|
|
|
|
|
|
}
|
|
|
if ($data) {
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "调用成功",
|
|
|
'Data' => $data
|
|
|
];
|
|
|
} else {
|
|
|
$result = [
|
|
|
'ResultCode' => 1,
|
|
|
'ResultMessage' => "没有数据,换个条件试试吧",
|
|
|
];
|
|
|
}
|
|
|
|
|
|
Log::write('bindHistory:' . date('Y-m-d H:i:s') . ' ---- ' . json_encode($result), 'INFO');
|
|
|
|
|
|
return $this->ajaxReturn($result);
|
|
|
}
|
|
|
} |