diff --git a/Application/Admin/Controller/PromoteCoinController.class.php b/Application/Admin/Controller/PromoteCoinController.class.php
index a7103c06f..d120b1be5 100644
--- a/Application/Admin/Controller/PromoteCoinController.class.php
+++ b/Application/Admin/Controller/PromoteCoinController.class.php
@@ -215,4 +215,160 @@ class PromoteCoinController extends ThinkController {
$this->display();
}
+ //获取线下充值列表
+ public function offlineList($p=0)
+ {
+ //获取记录
+ $map = array();
+ $map['pay_type'] = 2;
+ $map['is_del'] = 0;
+ //其他条件查询
+ if(isset($_REQUEST['promote_account'])){
+ $map['promote_account']=array('like','%'.trim($_REQUEST['promote_account']).'%');
+ unset($_REQUEST['promote_account']);
+ }
+ if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){
+ $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1));
+ unset($_REQUEST['time-start']);unset($_REQUEST['time-end']);
+ }elseif(isset($_REQUEST['time-start'])){
+ $map['create_time'] = ['GT',strtotime(I('time-start'))];
+ unset($_REQUEST['time-start']);
+ }elseif(isset($_REQUEST['time-end'])){
+ $map['create_time'] = ['LT',strtotime(I('time-end'))+86399];
+ unset($_REQUEST['time-end']);
+ }
+ if(isset($_REQUEST['order_status'])){
+ $map['order_status']=$_REQUEST['order_status'];
+ unset($_REQUEST['order_status']);
+ }
+ $data = D("CoinPayOrder")->lists($_GET["p"], $map, $order);
+ // dump($data);
+ //执行查询
+ // parent::order_lists("CoinPayOrder",$_GET["p"],$extend);
+ $this->meta_title = '线下充值审核列表';
+ $this->assign('list_data',$data['data']);
+ $this->assign('_page',$data['page']);
+ $this->display();
+ # code...
+ }
+ public function offlineOrderInfo()
+ {
+ if(!isset($_REQUEST['id'])){
+ exit("参数错误");
+ }
+ $id = $_REQUEST['id'];
+ $data = D("CoinPayOrder")->info($id);
+ $this->meta_title = '线下充值审核详情';
+ $this->assign('data', $data);
+ $this->display();
+ # code...
+ }
+ //审核通过
+ public function offlineAgree()
+ {
+ if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){
+ exit("参数错误");
+ }
+ $ids = I("ids");
+ $count = count($ids);
+ //执行操作
+ for ($i=0; $i <$count; $i++) {
+ $this->doOfflineAgree($ids[$i]);
+ }
+ $this->success("批量通过成功");
+ # code...
+ }
+ //批量审核拒绝
+ public function offlineReject()
+ {
+ if(!isset($_REQUEST['ids']) || count($_REQUEST['ids']) < 1){
+ exit("参数错误");
+ }
+ $ids = I("ids");
+ $count = count($ids);
+ //执行操作
+ for ($i=0; $i <$count; $i++) {
+ $this->orderReject($ids[$i]);
+ }
+ $this->success("批量拒绝成功");
+ # code...
+ }
+
+ public function doOfflineAgree($id)
+ {
+ //获取记录
+ $order = D("CoinPayOrder")->info($id);
+ if($order['order_status'] != 2){
+ return;
+ }
+ //
+ $balance_map['promote_id'] = $order['promote_id'];
+ $balance_map['game_id'] = 0;
+ $balance = M('promote_balance_coin', 'tab_')->where($balance_map)->find();
+ $this->balance_coin_update($order,$balance);//更新汇总
+ $this->coin_record_add($order,$balance); //添加流水
+ $this->promote_balance_coin_update($order); //更新推广员平台币余额
+ $this->orderAgree($id);//更新表
+ }
+ public function orderReject($id)
+ {
+ $order = D("CoinPayOrder")->info($id);
+ if($order['order_status'] != 2){
+ return;
+ }
+ $savedata = array();
+ $auth = $_SESSION['onethink_admin']['user_auth'];
+ $savedata['auditor_id']=$auth['uid'];
+ $savedata['auditor_account']=$auth['username'];
+ $savedata['auditor_time']=time();
+ $savedata['order_status']=-1;
+ D("CoinPayOrder")->updateData($savedata,$id);
+ # code...
+ }
+ public function orderAgree($id)
+ {
+ $savedata = array();
+ $auth = $_SESSION['onethink_admin']['user_auth'];
+ $savedata['auditor_id']=$auth['uid'];
+ $savedata['auditor_account']=$auth['username'];
+ $savedata['auditor_time']=time();
+ $savedata['order_status']=4;
+ D("CoinPayOrder")->updateData($savedata,$id);
+ # code...
+ }
+ // 添加流水
+ public function coin_record_add($order,$balance){
+ $data['sn']=date('Ymd') . date('His') . sp_random_num(6);
+ $data['type']=1;
+ $data['sub_type'] =1;
+ $data['target_id'] = $order['promote_id'];
+ $data['target_type'] = 1;
+ $data['ref_id'] = $order['id'];
+ $data['coin'] = $order['real_amount'];
+ $data['balance_coin'] = $balance['num']+$order['coin_num'];
+ $data['remark'] = $order['remark'];
+ $data['create_time']=time();
+ $data['description']='线下充值';
+ M('promote_coin_record', 'tab_')->data($data)->add();
+ }
+
+ //更新汇总
+ public function balance_coin_update($order,$balance){
+ if(!empty($balance)){
+ $map['promote_id'] = $order['promote_id'];
+ $map['game_id'] = 0;
+ M('promote_balance_coin', 'tab_')->where($map)->setInc('num',$order['coin_num']);
+ }else{
+ $balance['promote_id']= $order['promote_id'];
+ $balance['game_id'] = 0;
+ $balance['num']=$order['coin_num'];
+ M('promote_balance_coin', 'tab_')->data($balance)->add();
+ }
+ }
+
+ //更新推广员平台币余额
+ public function promote_balance_coin_update($order){
+ $map['id'] = $order['promote_id'];
+ M('promote', 'tab_')->where($map)->setInc('balance_coin',$order['coin_num']);
+ }
}
diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php
index c16003a1b..db3697742 100644
--- a/Application/Admin/Controller/PromoteController.class.php
+++ b/Application/Admin/Controller/PromoteController.class.php
@@ -1,5 +1,6 @@
meta_title = '快捷菜单管理';
+ $this->m_title = '站点设置(推广员后台)';
+
+ $list = M("quick_menu","tab_")->page($page,$row)->select();
+
+ $count = M("quick_menu","tab_")->count();
+
+ $page = set_pagination($count,$row);
+ if($page) {$this->assign('_page', $page);}
+
+ $this->assign('list',$list);
+ $this->display();
+
+ }
+
+ public function shortCutMenuEdit() {
+
+ $id = I("id");
+ $where['id'] = $id;
+
+ $data = M("quick_menu","tab_")->where($where)->find();
+
+ $this->assign("data",$data);
+ $this->meta_title = '快捷菜单管理编辑';
+ $this->m_title = '站点设置(推广员后台)';
+ $this->display();
+ }
+
+ public function shortCutMenuSave() {
+
+ $where['id'] = I("id");
+ $save['icon'] = I("icon");
+
+ M('quick_menu', 'tab_')->startTrans(); //事物
+ try{
+ M('quick_menu', 'tab_')->where($where)->save($save);
+ }catch (Exception $e) {
+ M('quick_menu', 'tab_')->rollback();//回滚
+ }
+ M('quick_menu', 'tab_')->commit(); //提交事物
+
+ $this->success('保存成功',U("promote/shortCutMenu"));
+
+ }
+
}
diff --git a/Application/Admin/Controller/TestResourceController.class.php b/Application/Admin/Controller/TestResourceController.class.php
index bfe155bea..e05b25b6c 100644
--- a/Application/Admin/Controller/TestResourceController.class.php
+++ b/Application/Admin/Controller/TestResourceController.class.php
@@ -199,9 +199,14 @@ class TestResourceController extends ThinkController
$arrUserId = array_column($data,'id');
$logId = implode(',',$arrUserId);
- $logRead = M('protect_log_read','tab_')
- ->where("log_id IN({$logId}) and promote_id = {$promote_id}")
- ->select();
+ if ($logId) {
+ $logRead = M('protect_log_read','tab_')
+ ->where("log_id IN({$logId}) and promote_id = {$promote_id}")
+ ->select();
+ }
+ else {
+ $logRead = [];
+ }
$upsetData = array_column($logRead,'log_id');
diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt
deleted file mode 100644
index f2bc7fb38..000000000
--- a/Application/Admin/Controller/access_data_foldline.txt
+++ /dev/null
@@ -1 +0,0 @@
-{"news":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"sum":{"news":0,"active":0,"player":0,"money":0},"active":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"player":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}],"money":[{"time":"0:00","count":0},{"time":"1:00","count":0},{"time":"2:00","count":0},{"time":"3:00","count":0},{"time":"4:00","count":0},{"time":"5:00","count":0},{"time":"6:00","count":0},{"time":"7:00","count":0},{"time":"8:00","count":0},{"time":"9:00","count":0},{"time":"10:00","count":0},{"time":"11:00","count":0},{"time":"12:00","count":0},{"time":"13:00","count":0},{"time":"14:00","count":0},{"time":"15:00","count":0},{"time":"16:00","count":0},{"time":"17:00","count":0},{"time":"18:00","count":0},{"time":"19:00","count":0},{"time":"20:00","count":0},{"time":"21:00","count":0},{"time":"22:00","count":0},{"time":"23:00","count":0}]}
\ No newline at end of file
diff --git a/Application/Admin/Model/CoinPayOrderModel.class.php b/Application/Admin/Model/CoinPayOrderModel.class.php
new file mode 100644
index 000000000..b5bd300cb
--- /dev/null
+++ b/Application/Admin/Model/CoinPayOrderModel.class.php
@@ -0,0 +1,82 @@
+
+// +----------------------------------------------------------------------
+
+namespace Admin\Model;
+use Think\Model;
+
+/**
+ * 文档基础模型
+ */
+class CoinPayOrderModel extends Model{
+ /**
+ * 构造函数
+ * @param string $name 模型名称
+ * @param string $tablePrefix 表前缀
+ * @param mixed $connection 数据库连接信息
+ */
+ public function __construct($name = '', $tablePrefix = '', $connection = '') {
+ /* 设置默认的表前缀 */
+ $this->tablePrefix ='tab_';
+ /* 执行构造方法 */
+ parent::__construct($name, $tablePrefix, $connection);
+ }
+ public function lists($p=1, $map=array(), $order, $field=true)
+ {
+
+ $page = intval($p);
+
+ $page = $page ? $page : 1; //默认显示第一页数据
+
+ if(isset($_REQUEST['row'])) {
+ $row = $_REQUEST['row'];
+ } else {
+ $row = 10;
+ }
+
+ $list = $this->field($field?:true)
+ ->where($map)
+ ->page($page, $row)
+ ->order($order?$order:'pay_time desc')
+ ->select();
+
+ $count = $this->where($map)->count();
+
+ $data['data'] = $list;
+
+ $page = set_pagination($count,$row);
+
+ if($page) {
+ $data['page']=$page;
+ }
+
+ return $data;
+ }
+ //获取单个信息
+ public function info($id)
+ {
+ $info = $this->field($field?:true)
+ ->where("id = '".$id."'")
+ ->find();
+ if(!empty($info['voucher_img'])){
+ $info['voucher_img'] = get_cover($info['voucher_img'])['path'];
+ }
+
+ return $info;
+ # code...
+ }
+ //更新
+ public function updateData($save,$id)
+ {
+ if(!empty($save['id'])){
+ return false;
+ }
+ return $this->where("id = {$id}")->save($save);
+ # code...
+ }
+}
\ No newline at end of file
diff --git a/Application/Admin/Model/UserModel.class.php b/Application/Admin/Model/UserModel.class.php
index e031fb6a5..1dc8c4bdf 100644
--- a/Application/Admin/Model/UserModel.class.php
+++ b/Application/Admin/Model/UserModel.class.php
@@ -1051,16 +1051,31 @@ class UserModel extends Model{
}
}
- public function login_sdk($account,$password,$type=1,$game_id,$game_name,$sdk_version){
+ public function login_sdk($account,$password,$type=1,$game_id,$game_name,$sdk_version,$unique_code){
$map['account'] = $account;
/* 获取用户数据 */
$user = $this->where($map)->find();
if(is_array($user) && $user['lock_status'] && $user['check_status']){
/* 验证用户密码 */
if(think_ucenter_md5($password, UC_AUTH_KEY) === $user['password']||$type==2){
- $token = $this->updateLogin_($user['id'],$account,$password,$user['fgame_id'],$game_id,$game_name); //更新用户登录信息
- $this->user_login_record2($user,$type,$game_id,$game_name,$sdk_version);
- return array("user_id"=>$user['id'],"token"=>$token); //登录成功,返回用户ID
+ $test_resource = M('test_resource','tab_')->where("user_id=%s and apply_status=2",$user['id'])->find();//测试资源(扶持号)
+ if($test_resource){ //扶持号
+ if($user['device_number'] && $unique_code && $user['device_number'] !=$unique_code){ //#当前登录设备信息与历史登录设备信息不一致,触发账户冻结
+ $this->sdklogin_device_error($user,$test_resource,$unique_code);
+ $this->sdklogin_ip_error($user,$test_resource,get_client_ip());
+ return -1;//扶持号被禁用
+ }else{
+ $token = $this->sdklogin_update($user,$account,$password,$user['fgame_id'],$game_id,$game_name,$unique_code); //更新用户登录信息
+ $this->user_login_record2($user,$type,$game_id,$game_name,$sdk_version);
+ $this->sdklogin_ip_error($user,$test_resource,get_client_ip());
+ return array("user_id"=>$user['id'],"token"=>$token); //登录成功,返回用户ID
+ }
+ }else{
+ $token = $this->sdklogin_update($user,$account,$password,$user['fgame_id'],$game_id,$game_name,$unique_code); //更新用户登录信息
+ $this->user_login_record2($user,$type,$game_id,$game_name,$sdk_version);
+ return array("user_id"=>$user['id'],"token"=>$token); //登录成功,返回用户ID
+ }
+
} else {
return -2; //密码错误
}
@@ -1070,6 +1085,79 @@ class UserModel extends Model{
}
+ //更新用户登录信息
+ protected function sdklogin_update($user,$account,$password,$user_fgame_id,$game_id,$game_name,$unique_code=''){
+ $model = M('User','tab_');
+ $uid = $user['id'];
+ $data["id"] = $uid;
+ $data["login_time"] = NOW_TIME;
+ $data["login_ip"] = get_client_ip();
+ $data["device_number"] = $unique_code;
+ $data["last_login_ip"] = $user['login_ip'];
+ $data["last_device_number"] = $user['device_number'];
+ $data["token"] = $this->generateToken($uid,$account,$password);
+ if($user_fgame_id){
+ $model->save($data);
+ }else{
+ $data['fgame_id']=$game_id;
+ $data['fgame_name']=$game_name;
+ $model->save($data);
+ }
+ return $data["token"];
+ }
+
+ // 扶持号登录设备异常
+ protected function sdklogin_device_error($user,$resource,$unique_code){
+ $model = M('User','tab_');
+ $uid = $user['id'];
+ $data["id"] = $uid;
+ $data["device_number"] = $unique_code;
+ $data["last_device_number"] = $user['device_number'];
+ $data["lock_status"] = 0 ;
+ $model->save($data);
+ $protect_data['user_id']= $uid;
+ $protect_data['user_account']= $resource['user_account'];
+ $protect_data['server_id'] = $resource['server_id'];
+ $protect_data['server_name']= $resource['server_name'];
+ $protect_data['game_id']=$resource['game_id'];
+ $protect_data['game_name']=$resource['game_name'];
+ $protect_data['nickname']=$resource['role_name'];
+ $protect_data['promote_id']=$resource['promote_id'];
+ $protect_data['promote_account']=$resource['promote_account'];
+ $protect_data['type']=2;
+ $protect_data['detail']="登录设备号异常,本次异常设备号:".$unique_code.",历史登录设备号:".$user['device_number'];
+ $protect_data['create_time'] = NOW_TIME;
+ M('protect_log','tab_')->add($protect_data);
+ }
+
+ // 扶持号登录IP异常
+ protected function sdklogin_ip_error($user,$resource,$ip){
+ $newloginip_source = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=".$ip);
+ $aldloginip_source = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=".$user['login_ip']);
+
+ $newloginip_source = json_decode($newloginip_source,true);
+ $aldloginip_source = json_decode($aldloginip_source,true);
+
+ if($newloginip_source['data']['city']!=$aldloginip_source['data']['city']){ //登录城市不一致时触发IP异常
+ $uid = $user['id'];
+ $protect_data['user_id']= $uid;
+ $protect_data['user_account']= $resource['user_account'];
+ $protect_data['server_id'] = $resource['server_id'];
+ $protect_data['server_name']= $resource['server_name'];
+ $protect_data['game_id']=$resource['game_id'];
+ $protect_data['game_name']=$resource['game_name'];
+ $protect_data['nickname']=$resource['role_name'];
+ $protect_data['promote_id']=$resource['promote_id'];
+ $protect_data['promote_account']=$resource['promote_account'];
+ $protect_data['type']=1;
+ $protect_data['detail']="登录IP异常,本次异常IP:".$ip.",历史登录IP:".$user['login_ip'];
+ $protect_data['create_time'] = NOW_TIME;
+ M('protect_log','tab_')->add($protect_data);
+ }
+ }
+
+
+
//判断game_id是否有值
protected function updateLogin_($uid,$account,$password,$user_fgame_id,$game_id,$game_name){
$model = M('User','tab_');
diff --git a/Application/Admin/View/Promote/shortCutMenu.html b/Application/Admin/View/Promote/shortCutMenu.html
new file mode 100644
index 000000000..f72fd9812
--- /dev/null
+++ b/Application/Admin/View/Promote/shortCutMenu.html
@@ -0,0 +1,59 @@
+ 说明:当用户在推广后台发起线下充值时,可在本页面审核是否通过,通过则自动发币 说明:当用户在推广后台发起线下充值时,可在本页面审核是否通过,通过则自动发币快捷菜单管理
+
+
+
+
+
+
+
+
+ ID
+ 菜单名称
+ 菜单跳转地址
+ 菜单图标
+ 操作
+
+
+ {$list.id}
+ {$list.name}
+ {$list.url}
+
+ 编辑
+ aOh! 暂时还没有内容!
+ 快捷菜单管理
+
+ 线下充值审核
+
+
+
+
+
+
+
+
+
+
+
+
+ 充值账号
+ 提交时间
+
+ 平台币数量
+ 付款金额
+
+ 汇入银行
+ 支付凭证
+
+ 备注
+ 审核状态
+
+ 操作
+ aOh! 暂时还没有内容!
+
+
+
+ {$data.promote_account}
+ {:set_show_time($data['create_time'])}
+ {$data.coin_num}
+ {$data.real_amount}
+ — —
+ {$data.pay_order_number}
+ {$data.remark}
+
+
+
+ 查看
+
+ 线下充值审核
+
+
+
+
+ 充值账号:
+
+ {$data['promote_account']}
+
+
+
+ 平台币数量:
+
+ {$data['coin_num']}
+
+
+
+ 购买金额:
+
+ {$data['real_amount']}
+
+
+
+ 汇入银行:
+
+ --
+
+
+
+ 支付凭证:
+
+ {$data['pay_order_number']}
+
+
+
+ 支付截图:
+
+
+
+
+
+ 备注:
+
+ {$data['remark']}
+
+
+
+
+
+
+
昨日注册用户
{$yesterday_user_regist_count}昨日充值金额
¥{$yesterday_total_money}今日注册用户
{$yesterday_regist_user_count}今日充值金额
¥{$yesterday_total_money}今日注册用户
{$today_regist_user_count}今日充值金额
¥{$today_total_money}