Merge pull request 'feature/oa1215' (#2) from feature/oa1215 into master

Reviewed-on: http://8.136.139.249:3000/wmtx/sdk/pulls/2
master
廖金灵 4 years ago
commit 5fd94ba802

@ -288,6 +288,147 @@ class FengHuoApi2Controller extends GetInfoBaseController{
} }
// 登入历史信息
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['login_time'] = array('between',[$time,$time+86399]);
// }
// 第几页数据
$page = intval($page);
$page = $page ? $page : 1; //默认显示第一页数据
// 一页显示数据的条数
$pageSize = intval($pageSize);
$row = $pageSize ? $pageSize : 1000;
// 默认排序id降序
$order = 'id desc';
$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'];
}
if($data){
$result = [
'ResultCode' => 1,
'ResultMessage' => "调用成功",
'Data' => $data
];
}else{
$result = [
'ResultCode' => 1,
'ResultMessage' => "没有数据,换个条件试试吧",
];
}
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', 'WmtX1@#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 * @param

Loading…
Cancel
Save