873 lines
44 KiB
PHP
873 lines
44 KiB
PHP
<?php
|
||
namespace app\agent\controller;
|
||
use pay\Usdt;
|
||
use \think\Controller;
|
||
use think\Lang;
|
||
use \think\Session;
|
||
use \think\Request;
|
||
use \think\Db;
|
||
class Player Extends Common{
|
||
public function index(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
$jsonlang = json_encode($lang);
|
||
|
||
$this->assign('langType',$langType);
|
||
$this->assign('lang',$lang);
|
||
$this->assign('jsonlang',$jsonlang);
|
||
|
||
// 用于分页和搜索查询的数据
|
||
$get = Request::instance()->get();
|
||
$query = http_build_query($get);
|
||
$this->assign('get',$get);
|
||
$this->assign('query',$query);
|
||
|
||
// 搜索玩家
|
||
$username = Request::instance()->get('username');
|
||
$agent_id = Request::instance()->get('agent_id');
|
||
$is_under = Request::instance()->get('is_under');
|
||
if($agent_id > 0){
|
||
// 获取查询代理信息
|
||
$agent = Session::get('user_info');
|
||
$user_info = Db::connect('DB2')->name('user')->where('id',$agent_id)->find();
|
||
$user_info['account_type'] = $agent['account_type'];
|
||
}else{
|
||
// 登录用户信息
|
||
$user_info = Session::get('user_info');
|
||
$account_type = $user_info['account_type'];
|
||
$user_info = Db::connect('DB2')->name('user')->where('id',$user_info['id'])->find();
|
||
$user_info['account_type'] = $account_type;
|
||
}
|
||
if(!$is_under){
|
||
$is_under = 1;
|
||
$get['is_under'] = 1;
|
||
$this->assign('get',$get);
|
||
}
|
||
|
||
// 总代类型
|
||
$topAgentId = explode(',',$user_info['agent_parent_id_path'])[0];
|
||
$topAgent = Db::name('user')->where('id',$topAgentId)->find();
|
||
$user_info['top_agent_type'] = $topAgent['agent_type'];
|
||
$user_info['top_agent_pay_channel'] = $topAgent['pay_channel'];
|
||
|
||
$where = array();
|
||
$where['is_delete'] = 0;
|
||
$where['agent'] = 0;
|
||
if($is_under == 1){
|
||
if($user_info['agent_parent_id'] > 0){
|
||
$where['agent_parent_id_path'] = array('like','%,'.$user_info['id'].',%');
|
||
}else{
|
||
$where['agent_parent_id_path'] = array('like',$user_info['id'].',%');
|
||
}
|
||
}else{
|
||
$where['agent_parent_id'] = $user_info['id'];
|
||
}
|
||
if($username){
|
||
$where['username'] = $username;
|
||
}
|
||
$player_list = Db::connect('DB2')->name('user')->where($where)->order('id desc')->paginate(20,false,array('query'=>$get));
|
||
|
||
$manager_list = [];
|
||
if($user_info['bet_type'] == 2){
|
||
if($user_info['agent_parent_id'] == 0){
|
||
$manager_list = Db::name('manager')->where('parent_agent_id',$user_info['id'])->where('status',1)->field(['id','nickname'])->select();
|
||
}else{
|
||
$whereManager = explode(',',$user_info['agent_manager_id_list']);
|
||
$manager_list = Db::name('manager')->whereIn('id',$whereManager)->where('status',1)->field(['id','nickname'])->select();
|
||
}
|
||
}
|
||
$manager_list = array_column($manager_list,'nickname','id');
|
||
|
||
foreach($player_list as $k => $v){
|
||
//充值分级
|
||
$agent_parent_id_path_arr = explode(',',$v['agent_parent_id_path']);
|
||
$agent_id_intersect = array_intersect(LEVEL_AGENT_ID,$agent_parent_id_path_arr);
|
||
if($v['agent'] == 0 && !empty($agent_id_intersect)){
|
||
$v['onlineRecharge'] = Db::name('recharge')->where(array('type' => 4, 'mode' => 1, 'user_id' => $v['id']))->sum('amount');
|
||
$v['onlineRechargeTitle'] = recharge_title(intval($v['onlineRecharge']));
|
||
}else{
|
||
$v['onlineRecharge'] = '-';
|
||
$v['onlineRechargeTitle'] = '-';
|
||
}
|
||
// 信息组装
|
||
if($v['status'] == 0) $v['statusMsg'] = $lang['ban'];
|
||
if($v['status'] == 1) $v['statusMsg'] = $lang['enable'];
|
||
$v['reg_time'] = date('Y-m-d H:i:s',$v['reg_time']);
|
||
$agentParent = Db::connect('DB2')->name('user')->where('id',$v['agent_parent_id'])->find();
|
||
$v['agentParent'] = $agentParent['nickname'].'('.$agentParent['username'].')';
|
||
// 在线离线显示
|
||
$v['online'] = 0;
|
||
$v['onlineMsg'] = $lang['offline'];
|
||
$session_user = Db::connect('DB2')->name('session')->where('user_id',$v['id'])->find();
|
||
if($session_user){
|
||
$time = time() - 60*30;
|
||
if($session_user['last_time'] < $time){
|
||
// 30分钟内没操作,移除在线在在线玩家的列表
|
||
Db::name('session')->where('user_id',$v['id'])->delete();
|
||
}else{
|
||
$v['online'] = 1;
|
||
$v['onlineMsg'] = $lang['online'];
|
||
}
|
||
}
|
||
if($v['type_xima'] == 1){
|
||
// 双边洗码
|
||
$v['type_xima_msg'] = $lang['bilateral_code_wash'];
|
||
}else{
|
||
// 单边洗码
|
||
$v['type_xima_msg'] = $lang['unilateral_code_wash'];
|
||
}
|
||
//$v['ximalv'] = $v['agent_ximalv'].' / '.$v['agent_ximalv_dt'].' / '.$v['agent_ximalv_nn'].' / '.$v['agent_ximalv_tc'];
|
||
$v['ximalv'] = $v['agent_ximalv'].' / '.$v['agent_ximalv_dt'].' / '.$v['agent_ximalv_nn'];
|
||
$v['commission'] = round($v['agent_commission'],2) .' / '.round($v['agent_commission_dt'],2).' / '.round($v['agent_commission_nn'],2).' / '.round($v['agent_commission_tc'],2);
|
||
$v['commission_tc_banker'] = round($v['agent_commission_tc_banker'],2);
|
||
// 格式化数据
|
||
$v['agent_commission'] = round($v['agent_commission'],2);
|
||
$v['last_recharge'] = round($v['last_recharge'],2);
|
||
$v['money'] = round($v['money'],2);
|
||
|
||
// 钱包地址
|
||
$v['wallet_address'] = Db::name('user_wallet')->where('user_id',$v['id'])->value('address');
|
||
$v['manager_id'] = $v['manager_id'] ? $manager_list[$v['manager_id']] : '';
|
||
$player_list[$k] = $v;
|
||
}
|
||
$wt_agent = Db::connect('DB2')->name('table')->where(array('status' => 1))->order('id asc')->limit(1)->value('wt_agent');
|
||
// 渲染参数和模板
|
||
$this->assign('player_list',$player_list);
|
||
$this->assign('wt_agent',$wt_agent);
|
||
$this->assign('user_info',$user_info);
|
||
return $this->fetch();
|
||
}
|
||
|
||
// 已删除玩家页面
|
||
public function delete(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
$jsonlang = json_encode($lang);
|
||
|
||
$this->assign('langType',$langType);
|
||
$this->assign('lang',$lang);
|
||
$this->assign('jsonlang',$jsonlang);
|
||
// 登录用户信息
|
||
$user_info = Session::get('user_info');
|
||
$account_type = $user_info['account_type'];
|
||
$user_info = Db::connect('DB2')->name('user')->where('id',$user_info['id'])->find();
|
||
$user_info['account_type'] = $account_type;
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
return '非法请求';
|
||
}
|
||
|
||
// 用于分页和搜索查询的数据
|
||
$get = Request::instance()->get();
|
||
$get['searchUrl'] = '/player/index';
|
||
$query = http_build_query($get);
|
||
$this->assign('get',$get);
|
||
$this->assign('query',$query);
|
||
|
||
// 搜索玩家
|
||
$username = Request::instance()->get('username');
|
||
$where = array();
|
||
$where['is_delete'] = 1;
|
||
$where['agent'] = 0;
|
||
$where['agent_parent_id'] = $user_info['id'];
|
||
if($username){
|
||
$where['username'] = $username;
|
||
}
|
||
$player_list = Db::connect('DB2')->name('user')->where($where)->paginate(15,false,array('query'=>$get));
|
||
|
||
foreach($player_list as $k => $v){
|
||
// 信息组装
|
||
$v['reg_time'] = date('Y-m-d H:i:s',$v['reg_time']);
|
||
$v['agentParent'] = $user_info['nickname'].'('.$user_info['username'].')';
|
||
$player_list[$k] = $v;
|
||
}
|
||
|
||
// 渲染参数和模板
|
||
$this->assign('player_list',$player_list);
|
||
$this->assign('user_info',$user_info);
|
||
return $this->fetch();
|
||
}
|
||
|
||
// 添加会员页面
|
||
public function add(){
|
||
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
$jsonlang = json_encode($lang);
|
||
|
||
$this->assign('langType',$langType);
|
||
$this->assign('lang',$lang);
|
||
$this->assign('jsonlang',$jsonlang);
|
||
|
||
// 获取管理员信息
|
||
$user_info = Session::get('user_info');
|
||
$account_type = $user_info['account_type'];
|
||
$user_info = Db::name('user')->where('id',$user_info['id'])->find();
|
||
$user_info['account_type'] = $account_type;
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
return $lang['illegal_request'];
|
||
}
|
||
// 获取父代理信息
|
||
$parent_id = Request::instance()->get('parent_id');
|
||
$agentParent = Db::name('user')->where('id',$parent_id)->find();
|
||
$price_dice_arr = result_to_array($agentParent['price_dice']);
|
||
foreach ($price_dice_arr as $key => $value){
|
||
$agentParent['dice_price_'.$key] = $value;
|
||
}
|
||
/*
|
||
$price_roulette_arr = result_to_array($agentParent['price_roulette']);
|
||
foreach ($price_roulette_arr as $key => $value){
|
||
$agentParent['roulette_price_'.$key] = $value;
|
||
}
|
||
*/
|
||
if(!$agentParent || $agentParent['agent'] == 0){
|
||
echo $lang['parent_error'];
|
||
die();
|
||
}
|
||
if($parent_id == CREDIT_AGENT_ID){//是否需要字母前缀
|
||
$newLetter = config('letters');//A-Z数组
|
||
}else{
|
||
$newLetter = $agentParent['letter']?[$agentParent['letter']]:[];
|
||
}
|
||
|
||
// 总代性质
|
||
$topAgentId = explode(',',$user_info['agent_parent_id_path'])[0];
|
||
$topAgent = Db::name('user')->where('id',$topAgentId)->find();
|
||
$user_info['agent_type'] = $topAgent['agent_type'];
|
||
|
||
$manager_list = [];
|
||
if($agentParent['bet_type'] == 2){
|
||
if($agentParent['agent_parent_id'] == 0){
|
||
$manager_list = Db::name('manager')->where('parent_agent_id',$agentParent['id'])->where('status',1)->field(['id','nickname'])->select();
|
||
}else{
|
||
$whereManager = explode(',',$agentParent['agent_manager_id_list']);
|
||
$manager_list = Db::name('manager')->whereIn('id',$whereManager)->where('status',1)->field(['id','nickname'])->select();
|
||
}
|
||
}
|
||
|
||
//渲染参数和模板
|
||
$this->assign('newLetter',$newLetter);
|
||
$this->assign('user_info',$user_info);
|
||
$this->assign('manager_list',$manager_list);
|
||
$this->assign('agentParent',$agentParent);
|
||
return $this->fetch();
|
||
}
|
||
|
||
// 处理添加玩家
|
||
public function do_add(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
|
||
if(Request::instance()->post()){
|
||
// 获取管理员信息
|
||
$user_info = Session::get('user_info');
|
||
$account_type = $user_info['account_type'];
|
||
$user_info = Db::name('user')->where('id',$user_info['id'])->find();
|
||
$user_info['account_type'] = $account_type;
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['illegal_request']]));
|
||
}
|
||
// 接收参数
|
||
$parent_id = intval(Request::instance()->post('parent_id'));
|
||
$letter = trim(Request::instance()->post('letter'));
|
||
$username = trim(Request::instance()->post('username'));
|
||
$nickname = trim(Request::instance()->post('nickname'));
|
||
$password = trim(Request::instance()->post('password'));
|
||
$repassword = trim(Request::instance()->post('repassword'));
|
||
$mobile = trim(Request::instance()->post('mobile'));
|
||
$bet_type = $user_info['bet_type'];
|
||
$limit_low = round(Request::instance()->post('limit_low'),2);
|
||
$limit_high = round(Request::instance()->post('limit_high'),2);
|
||
$limit_low_tie = round(Request::instance()->post('limit_low_tie'),2);
|
||
$limit_high_tie = round(Request::instance()->post('limit_high_tie'),2);
|
||
$limit_low_pair = round(Request::instance()->post('limit_low_pair'),2);
|
||
$limit_high_pair = round(Request::instance()->post('limit_high_pair'),2);
|
||
$limit_low_nn = round(Request::instance()->post('limit_low_nn'),2);
|
||
$limit_high_nn = round(Request::instance()->post('limit_high_nn'),2);
|
||
$win_limit = round(Request::instance()->post('win_limit'),2);
|
||
$agent_commission = round(Request::instance()->post('agent_commission'),2);
|
||
$agent_commission_dt = round(Request::instance()->post('agent_commission_dt'),2);
|
||
$agent_commission_nn = round(Request::instance()->post('agent_commission_nn'),2);
|
||
$agent_commission_tc = round(Request::instance()->post('agent_commission_tc'),2);
|
||
$agent_commission_tc_banker = round(Request::instance()->post('agent_commission_tc_banker'),2);
|
||
$agent_ximalv = round(Request::instance()->post('agent_ximalv'),2);
|
||
$agent_ximalv_dt = round(Request::instance()->post('agent_ximalv_dt'),2);
|
||
$agent_ximalv_nn = round(Request::instance()->post('agent_ximalv_nn'),2);
|
||
$agent_ximalv_tc = round(Request::instance()->post('agent_ximalv_tc'),2);
|
||
$rebate_rate = Request::instance()->post('rebate_rate');
|
||
$manager_id = Request::instance()->post('manager_id');
|
||
$remark = Request::instance()->post('remark');
|
||
|
||
// 验证数据
|
||
if($parent_id <= 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['parent_error']]));
|
||
}
|
||
$agentParent = Db::name('user')->where('id',$parent_id)->find();
|
||
if(!$agentParent || $agentParent['agent'] == 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['parent_error']]));
|
||
}
|
||
if(!$username){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['empty_username']]));
|
||
}
|
||
$user = Db::name('user')->where('username',$username)->find();
|
||
if($user){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['already_exist_username']]));
|
||
}
|
||
if(!$nickname){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['empty_nickname']]));
|
||
}
|
||
if(!$password){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['empty_password']]));
|
||
}
|
||
if(strlen($password) < 6){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['new_pass_limit']]));
|
||
}
|
||
if($password != $repassword){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['pass_diff']]));
|
||
}
|
||
if($agentParent['bet_type'] == 2){
|
||
if(!$manager_id){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['select_manager']]));
|
||
}
|
||
}
|
||
if(!$mobile){
|
||
//die(json_encode(['code'=>0,'msg'=>'请填写手机!']));
|
||
$mobile = "";
|
||
}
|
||
if($bet_type > 3 && $bet_type <= 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['bet_type_error']]));
|
||
}
|
||
if($agent_commission >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_baccarat_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_dt >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_dt_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_nn >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_cow_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_tc >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_tc_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_tc_banker >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_commission_tc_cannot_exceed_10']]));
|
||
}
|
||
if($limit_low < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_limit_0']]));
|
||
}
|
||
if($limit_high < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['max_limit_0']]));
|
||
}
|
||
if($limit_low > $limit_high && $limit_low > 0 && $limit_high > 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_limit_bigger_than_max_limit']]));
|
||
}
|
||
if($limit_low_tie < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_tie_limit_0']]));
|
||
}
|
||
if($limit_high_tie < 0){
|
||
die(json_encode(['code'=>0,'msg'=> $lang['max_tie_limit_0']]));
|
||
}
|
||
if($limit_low_tie > $limit_high_tie && $limit_low_tie > 0 && $limit_high_tie > 0){
|
||
die(json_encode(['code'=>0,'msg'=> $lang['min_tie_limit_bigger_than_max_tie_limit']]));
|
||
}
|
||
if($limit_low_pair < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_pair_limit_0']]));
|
||
}
|
||
if($limit_high_pair < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['max_pair_limit_0']]));
|
||
}
|
||
if($limit_low_pair > $limit_high_pair && $limit_low_pair > 0 && $limit_high_pair > 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_pair_limit_bigger_than_max_tie_limit']]));
|
||
}
|
||
if($limit_low < $agentParent['limit_low'] || $limit_low > $agentParent['limit_high'] || $limit_high < $agentParent['limit_low'] || $limit_high > $agentParent['limit_high']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['limit_cannot_bigger'].' '.$agentParent['limit_low'].'-'.$agentParent['limit_high']]));
|
||
}
|
||
if($limit_low_tie < $agentParent['limit_low_tie'] || $limit_low_tie > $agentParent['limit_high_tie'] || $limit_high_tie < $agentParent['limit_low_tie'] || $limit_high_tie > $agentParent['limit_high_tie']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['tie_limit_cannot_bigger'].' '.$agentParent['limit_low_tie'].'-'.$agentParent['limit_high_tie']]));
|
||
}
|
||
if($limit_low_pair < $agentParent['limit_low_pair'] || $limit_low_pair > $agentParent['limit_high_pair'] || $limit_high_pair < $agentParent['limit_low_pair'] || $limit_high_pair > $agentParent['limit_high_pair']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['pair_limit_cannot_bigger'].' '.$agentParent['limit_low_pair'].'-'.$agentParent['limit_high_pair']]));
|
||
}
|
||
if($limit_low_nn < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_nn_limit_0']]));
|
||
}
|
||
if($limit_high_nn < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['max_nn_limit_0']]));
|
||
}
|
||
if($limit_low_nn > $limit_high_nn && $limit_low_nn > 0 && $limit_high_nn > 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_nn_limit_bigger_than_max']]));
|
||
}
|
||
if($limit_low_nn > 0 && $limit_high_nn > 0 && $agentParent['limit_low_nn'] > 0 && $agentParent['limit_high_nn'] > 0){
|
||
if($limit_low_nn < $agentParent['limit_low_nn'] || $limit_low_nn > $agentParent['limit_high_nn'] || $limit_high_nn < $agentParent['limit_low_nn'] || $limit_high_nn > $agentParent['limit_high_nn']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['nn_limit_cannot_bigger'].' '.$agentParent['limit_low_nn'].'-'.$agentParent['limit_high_nn']]));
|
||
}
|
||
}
|
||
if($agent_ximalv > $agentParent['agent_ximalv']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['baccarat_cannot_bigger_agent'].$agentParent['agent_ximalv'].'!']));
|
||
}
|
||
if($agent_ximalv_dt > $agentParent['agent_ximalv_dt']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['dt_cannot_bigger_agent'].$agentParent['agent_ximalv_dt'].'!']));
|
||
}
|
||
if($agent_ximalv_nn > $agentParent['agent_ximalv_nn']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['cow_cannot_bigger_agent'].$agentParent['agent_ximalv_nn'].'!']));
|
||
}
|
||
if($agent_ximalv_tc > $agentParent['agent_ximalv_tc']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['tc_cannot_bigger_agent'].$agentParent['agent_ximalv_tc'].'!']));
|
||
}
|
||
if($rebate_rate > $agentParent['rebate_rate']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['rebate_cannot_bigger_agent'].' '.$agentParent['rebate_rate'].'!']));
|
||
}
|
||
|
||
// 拼装数据创建用户
|
||
$user_data = array();
|
||
$user_data['username'] = $username;
|
||
$user_data['letter'] = $letter;
|
||
$user_data['nickname'] = $nickname;
|
||
$user_data['password'] = think_ucenter_md5($password, UC_AUTH_KEY);
|
||
$user_data['encrypt'] = getRandChar();
|
||
$user_data['mobile'] = $mobile;
|
||
$user_data['status'] = 1;
|
||
$user_data['agent'] = 0;
|
||
$user_data['type_xima'] = $agentParent['type_xima'];
|
||
$user_data['share_xima'] = $agentParent['share_xima'];
|
||
$user_data['agent_ximalv'] = $agent_ximalv;
|
||
$user_data['agent_ximalv_dt'] = $agent_ximalv_dt;
|
||
$user_data['agent_ximalv_nn'] = $agent_ximalv_nn;
|
||
$user_data['agent_ximalv_tc'] = $agent_ximalv_tc;
|
||
$user_data['rebate_rate'] = $rebate_rate;
|
||
$user_data['agent_parent_id'] = $agentParent['id'];
|
||
$user_data['agent_parent_username'] = $agentParent['username'];
|
||
$user_data['agent_parent_nickname'] = $agentParent['nickname'];
|
||
$user_data['limit_low'] = $limit_low;
|
||
$user_data['limit_high'] = $limit_high;
|
||
$user_data['limit_low_tie'] = $limit_low_tie;
|
||
$user_data['limit_high_tie'] = $limit_high_tie;
|
||
$user_data['limit_low_pair'] = $limit_low_pair;
|
||
$user_data['limit_high_pair'] = $limit_high_pair;
|
||
$user_data['limit_low_nn'] = $limit_low_nn;
|
||
$user_data['limit_high_nn'] = $limit_high_nn;
|
||
$user_data['price_banker'] = $agentParent['price_banker'];
|
||
$user_data['price_player'] = $agentParent['price_player'];
|
||
$user_data['price_tie_baccarat'] = $agentParent['price_tie_baccarat'];
|
||
$user_data['price_dragon'] = $agentParent['price_dragon'];
|
||
$user_data['price_tiger'] = $agentParent['price_tiger'];
|
||
$user_data['price_tie_dt'] = $agentParent['price_tie_dt'];
|
||
$user_data['price_n0_n6'] = $agentParent['price_n0_n6'];
|
||
$user_data['price_n7_n9'] = $agentParent['price_n7_n9'];
|
||
$user_data['price_nn'] = $agentParent['price_nn'];
|
||
$user_data['price_5n'] = $agentParent['price_5n'];
|
||
$user_data['price_bomb'] = $agentParent['price_bomb'];
|
||
$user_data['price_tc_n1'] = $agentParent['price_tc_n1'];
|
||
$user_data['price_tc_n2'] = $agentParent['price_tc_n2'];
|
||
$user_data['price_tc_n3'] = $agentParent['price_tc_n3'];
|
||
$user_data['price_tc_n4'] = $agentParent['price_tc_n4'];
|
||
$user_data['price_tc_n5'] = $agentParent['price_tc_n5'];
|
||
$user_data['price_tc_n6'] = $agentParent['price_tc_n6'];
|
||
$user_data['price_tc_n7'] = $agentParent['price_tc_n7'];
|
||
$user_data['price_tc_n8'] = $agentParent['price_tc_n8'];
|
||
$user_data['price_tc_n9'] = $agentParent['price_tc_n9'];
|
||
$user_data['price_tc_nn'] = $agentParent['price_tc_nn'];
|
||
$user_data['price_tc_bz'] = $agentParent['price_tc_bz'];
|
||
$user_data['price_tc_ths'] = $agentParent['price_tc_ths'];
|
||
$user_data['price_tc_hjths'] = $agentParent['price_tc_hjths'];
|
||
$user_data['price_toning'] = $agentParent['price_toning'];
|
||
$user_data['price_toning_0'] = $agentParent['price_toning_0'];
|
||
$user_data['price_toning_1'] = $agentParent['price_toning_1'];
|
||
$user_data['area_id'] = $agentParent['area_id'];
|
||
$user_data['win_limit'] = $win_limit;
|
||
$user_data['agent_commission'] = $agent_commission;
|
||
$user_data['agent_commission_dt'] = $agent_commission_dt;
|
||
$user_data['agent_commission_nn'] = $agent_commission_nn;
|
||
$user_data['agent_commission_tc'] = $agent_commission_tc;
|
||
$user_data['agent_commission_tc_banker'] = $agent_commission_tc_banker;
|
||
$user_data['bet_type'] = $bet_type;
|
||
$user_data['reg_time'] = time();
|
||
$ip = '0.0.0.0';
|
||
if(getIp()){
|
||
$ip = getIp();
|
||
}
|
||
$user_data['reg_ip'] = $ip;
|
||
$user_data['avatar'] = '/static/index/images/admin.png';
|
||
$user_data['update_time'] = time();
|
||
$user_data['create_mode'] = 2;
|
||
$user_data['agent_mode'] = 1;
|
||
$user_data['create_user_id'] = $user_info['id'];
|
||
$user_data['manager_id'] = $manager_id;
|
||
$user_data['remarks'] = $remark;
|
||
$insertId = Db::name('user')->insertGetId($user_data);
|
||
if($insertId){
|
||
// 写入管理员日志
|
||
insertAgentLog('添加会员','添加会员:| ID: '.$insertId.' | 账号: '.$username);
|
||
Db::name('user')->where(array('id' => $insertId))->update(array('agent_parent_id_path' => $agentParent['agent_parent_id_path'] . ',' . $insertId));
|
||
// 生成U地址 总代为 现金线 波场类的支付渠道
|
||
$topAgentId = explode(',',$user_info['agent_parent_id_path'])[0];
|
||
$topAgent = Db::name('user')->where('id',$topAgentId)->find();
|
||
if($topAgent['agent_type'] == 1 && $topAgent['pay_channel'] == "USDT"){
|
||
$Usdt = new Usdt();
|
||
$result = $Usdt->newUserWallet();
|
||
if(isset($result['code']) && $result['code'] == 0){
|
||
$walletData = [
|
||
'user_id' => $insertId,
|
||
'address' => $result['wallet']['address'],
|
||
'parent_id' => $result['wallet']['parent_id'],
|
||
'status' => $result['wallet']['status'],
|
||
'tid' => $result['wallet']['tid'],
|
||
'type' => $result['wallet']['type'],
|
||
'create_time' => time(),
|
||
'update_time' => time(),
|
||
];
|
||
Db::name('user_wallet')->insert($walletData);
|
||
}
|
||
}
|
||
die(json_encode(['code'=>1,'msg'=>$lang['added_successfully']]));
|
||
}else{
|
||
die(json_encode(['code'=>0,'msg'=>$lang['add_failed']]));
|
||
}
|
||
}else{
|
||
die(json_encode(['code'=>0,'msg'=>$lang['operation_error']]));
|
||
}
|
||
}
|
||
|
||
// 编辑会员页面
|
||
public function edit(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
$jsonlang = json_encode($lang);
|
||
|
||
$this->assign('langType',$langType);
|
||
$this->assign('lang',$lang);
|
||
$this->assign('jsonlang',$jsonlang);
|
||
|
||
$user_info = Session::get('user_info');
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
return $lang['illegal_request'];
|
||
}
|
||
// 接收需要修改的会员ID
|
||
$user_id = Request::instance()->get('user_id');
|
||
$user = Db::name('user')->where('id',$user_id)->find();
|
||
$price_dice_arr = result_to_array($user['price_dice']);
|
||
foreach ($price_dice_arr as $key => $value){
|
||
$user['dice_price_'.$key] = $value;
|
||
}
|
||
/*
|
||
$price_roulette_arr = result_to_array($user['price_roulette']);
|
||
foreach ($price_roulette_arr as $key => $value){
|
||
$user['roulette_price_'.$key] = $value;
|
||
}
|
||
*/
|
||
// 格式化数据
|
||
$user['agent_commission'] = round($user['agent_commission'],2);
|
||
$user['agent_commission_dt'] = round($user['agent_commission_dt'],2);
|
||
$user['agent_commission_nn'] = round($user['agent_commission_nn'],2);
|
||
$user['agent_commission_tc'] = round($user['agent_commission_tc'],2);
|
||
$user['agent_commission_tc_banker'] = round($user['agent_commission_tc_banker'],2);
|
||
$user['win_limit'] = round($user['win_limit'],2);
|
||
|
||
// 所属代理信息
|
||
$agent_parent = Db::name('user')->where('id',$user['agent_parent_id'])->find();
|
||
|
||
// 总代性质
|
||
$topAgentId = explode(',',$user_info['agent_parent_id_path'])[0];
|
||
$topAgent = Db::name('user')->where('id',$topAgentId)->find();
|
||
$user['agent_type'] = $topAgent['agent_type'];
|
||
|
||
$manager_list = [];
|
||
if($agent_parent['bet_type'] == 2){
|
||
if($agent_parent['agent_parent_id'] == 0){
|
||
$manager_list = Db::name('manager')->where('parent_agent_id',$agent_parent['id'])->where('status',1)->field(['id','nickname'])->select();
|
||
}else{
|
||
$whereManager = explode(',',$agent_parent['agent_manager_id_list']);
|
||
$manager_list = Db::name('manager')->whereIn('id',$whereManager)->where('status',1)->field(['id','nickname'])->select();
|
||
}
|
||
}
|
||
|
||
//渲染参数和模板
|
||
$this->assign('user',$user);
|
||
$this->assign('user_info',$user_info);
|
||
$this->assign('manager_list',$manager_list);
|
||
$this->assign('agent_parent',$agent_parent);
|
||
return $this->fetch();
|
||
}
|
||
|
||
// 处理编辑会员
|
||
public function do_edit(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
|
||
$user_info = Session::get('user_info');
|
||
$account_type = $user_info['account_type'];
|
||
$user_info = Db::name('user')->where('id',$user_info['id'])->find();
|
||
$user_info['account_type'] = $account_type;
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['illegal_request']]));
|
||
}
|
||
if(Request::instance()->post()){
|
||
// 获取管理员信息
|
||
$user_info = Session::get('user_info');
|
||
|
||
// 接收参数
|
||
$parent_id = Request::instance()->post('parent_id');
|
||
$user_id = Request::instance()->post('user_id');
|
||
$nickname = Request::instance()->post('nickname');
|
||
$mobile = trim(Request::instance()->post('mobile'));
|
||
// 编辑会员时不改变bet_type,保留原值
|
||
//$bet_type = Request::instance()->post('bet_type');
|
||
$agent_commission = round(Request::instance()->post('agent_commission'),2);
|
||
$agent_commission_dt = round(Request::instance()->post('agent_commission_dt'),2);
|
||
$agent_commission_nn = round(Request::instance()->post('agent_commission_nn'),2);
|
||
$agent_commission_tc = round(Request::instance()->post('agent_commission_tc'),2);
|
||
$agent_commission_tc_banker = round(Request::instance()->post('agent_commission_tc_banker'),2);
|
||
$win_limit = round(Request::instance()->post('win_limit'),2);
|
||
$limit_low = round(Request::instance()->post('limit_low'),2);
|
||
$limit_high = round(Request::instance()->post('limit_high'),2);
|
||
$limit_low_tie = round(Request::instance()->post('limit_low_tie'),2);
|
||
$limit_high_tie = round(Request::instance()->post('limit_high_tie'),2);
|
||
$limit_low_pair = round(Request::instance()->post('limit_low_pair'),2);
|
||
$limit_high_pair = round(Request::instance()->post('limit_high_pair'),2);
|
||
$limit_low_nn = round(Request::instance()->post('limit_low_nn'),2);
|
||
$limit_high_nn = round(Request::instance()->post('limit_high_nn'),2);
|
||
$agent_ximalv = round(Request::instance()->post('agent_ximalv'),2);
|
||
$agent_ximalv_dt = round(Request::instance()->post('agent_ximalv_dt'),2);
|
||
$agent_ximalv_nn = round(Request::instance()->post('agent_ximalv_nn'),2);
|
||
$agent_ximalv_tc = round(Request::instance()->post('agent_ximalv_tc'),2);
|
||
|
||
$rebate_rate = Request::instance()->post('rebate_rate');
|
||
$manager_id = Request::instance()->post('manager_id');
|
||
$remark = Request::instance()->post('remark');
|
||
|
||
// 验证数据
|
||
if($parent_id <= 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['parent_error']]));
|
||
}
|
||
$agentParent = Db::name('user')->where('id',$parent_id)->find();
|
||
if(!$agentParent || $agentParent['agent'] == 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['parent_error']]));
|
||
}
|
||
if(!$nickname){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['empty_nickname']]));
|
||
}
|
||
/*
|
||
if(!$mobile){
|
||
die(json_encode(['code'=>0,'msg'=>'请填写手机!']));
|
||
}
|
||
*/
|
||
if($agent_commission >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_baccarat_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_dt >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_dt_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_nn >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_cow_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_tc >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_tc_cannot_exceed_10']]));
|
||
}
|
||
if($agent_commission_tc_banker >= 10){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['agent_commission_tc_cannot_exceed_10']]));
|
||
}
|
||
if($limit_low < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_limit_0']]));
|
||
}
|
||
if($limit_high < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['max_limit_0']]));
|
||
}
|
||
if($limit_low > $limit_high && $limit_low > 0 && $limit_high > 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_limit_bigger_than_max_limit']]));
|
||
}
|
||
if($limit_low_tie < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_tie_limit_0']]));
|
||
}
|
||
if($limit_high_tie < 0){
|
||
die(json_encode(['code'=>0,'msg'=> $lang['max_tie_limit_0']]));
|
||
}
|
||
if($limit_low_tie > $limit_high_tie && $limit_low_tie > 0 && $limit_high_tie > 0){
|
||
die(json_encode(['code'=>0,'msg'=> $lang['min_tie_limit_bigger_than_max_tie_limit']]));
|
||
}
|
||
if($limit_low_pair < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_pair_limit_0']]));
|
||
}
|
||
if($limit_high_pair < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['max_pair_limit_0']]));
|
||
}
|
||
if($limit_low_pair > $limit_high_pair && $limit_low_pair > 0 && $limit_high_pair > 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_pair_limit_bigger_than_max_tie_limit']]));
|
||
}
|
||
if($limit_low < $agentParent['limit_low'] || $limit_low > $agentParent['limit_high'] || $limit_high < $agentParent['limit_low'] || $limit_high > $agentParent['limit_high']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['limit_cannot_bigger'].' '.$agentParent['limit_low'].'-'.$agentParent['limit_high']]));
|
||
}
|
||
if($limit_low_tie < $agentParent['limit_low_tie'] || $limit_low_tie > $agentParent['limit_high_tie'] || $limit_high_tie < $agentParent['limit_low_tie'] || $limit_high_tie > $agentParent['limit_high_tie']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['tie_limit_cannot_bigger'].' '.$agentParent['limit_low_tie'].'-'.$agentParent['limit_high_tie']]));
|
||
}
|
||
if($limit_low_pair < $agentParent['limit_low_pair'] || $limit_low_pair > $agentParent['limit_high_pair'] || $limit_high_pair < $agentParent['limit_low_pair'] || $limit_high_pair > $agentParent['limit_high_pair']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['pair_limit_cannot_bigger'].' '.$agentParent['limit_low_pair'].'-'.$agentParent['limit_high_pair']]));
|
||
}
|
||
if($limit_low_nn < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_nn_limit_0']]));
|
||
}
|
||
if($limit_high_nn < 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['max_nn_limit_0']]));
|
||
}
|
||
if($limit_low_nn > $limit_high_nn && $limit_low_nn > 0 && $limit_high_nn > 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['min_nn_limit_bigger_than_max']]));
|
||
}
|
||
if($limit_low_nn > 0 && $limit_high_nn > 0 && $agentParent['limit_low_nn'] > 0 && $agentParent['limit_high_nn'] > 0){
|
||
if($limit_low_nn < $agentParent['limit_low_nn'] || $limit_low_nn > $agentParent['limit_high_nn'] || $limit_high_nn < $agentParent['limit_low_nn'] || $limit_high_nn > $agentParent['limit_high_nn']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['nn_limit_cannot_bigger'].' '.$agentParent['limit_low_nn'].'-'.$agentParent['limit_high_nn']]));
|
||
}
|
||
}
|
||
|
||
if($agent_ximalv > $agentParent['agent_ximalv']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['baccarat_cannot_bigger_agent'].$agentParent['agent_ximalv'].'!']));
|
||
}
|
||
if($agent_ximalv_dt > $agentParent['agent_ximalv_dt']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['dt_cannot_bigger_agent'].$agentParent['agent_ximalv_dt'].'!']));
|
||
}
|
||
if($agent_ximalv_nn > $agentParent['agent_ximalv_nn']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['cow_cannot_bigger_agent'].$agentParent['agent_ximalv_nn'].'!']));
|
||
}
|
||
if($agent_ximalv_tc > $agentParent['agent_ximalv_tc']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['tc_cannot_bigger_agent'].$agentParent['agent_ximalv_tc'].'!']));
|
||
}
|
||
if($rebate_rate && $rebate_rate > $agentParent['rebate_rate']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['rebate_cannot_bigger_agent'].' '.$agentParent['rebate_rate'].'!']));
|
||
}
|
||
if($agentParent['bet_type'] == 2){
|
||
if(!$manager_id){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['select_manager']]));
|
||
}
|
||
}
|
||
|
||
// 拼装数据创建会员
|
||
$user_data = array();
|
||
$user_data['nickname'] = $nickname;
|
||
$user_data['mobile'] = $mobile;
|
||
$user_data['agent_commission'] = $agent_commission;
|
||
$user_data['agent_commission_dt'] = $agent_commission_dt;
|
||
$user_data['agent_commission_nn'] = $agent_commission_nn;
|
||
$user_data['agent_commission_tc'] = $agent_commission_tc;
|
||
$user_data['agent_commission_tc_banker'] = $agent_commission_tc_banker;
|
||
$user_data['win_limit'] = $win_limit;
|
||
$user_data['limit_low'] = $limit_low;
|
||
$user_data['limit_high'] = $limit_high;
|
||
$user_data['limit_low_tie'] = $limit_low_tie;
|
||
$user_data['limit_high_tie'] = $limit_high_tie;
|
||
$user_data['limit_low_pair'] = $limit_low_pair;
|
||
$user_data['limit_high_pair'] = $limit_high_pair;
|
||
$user_data['limit_low_nn'] = $limit_low_nn;
|
||
$user_data['limit_high_nn'] = $limit_high_nn;
|
||
$user_data['agent_ximalv'] = $agent_ximalv;
|
||
$user_data['agent_ximalv_dt'] = $agent_ximalv_dt;
|
||
$user_data['agent_ximalv_nn'] = $agent_ximalv_nn;
|
||
$user_data['agent_ximalv_tc'] = $agent_ximalv_tc;
|
||
$user_data['manager_id'] = $manager_id;
|
||
if ($rebate_rate){
|
||
$user_data['rebate_rate'] = $rebate_rate;
|
||
}
|
||
$user_data['update_time'] = time();
|
||
$user_data['remarks'] = $remark;
|
||
$result = Db::name('user')->where('id',$user_id)->update($user_data);
|
||
if($result){
|
||
// 写入管理员日志
|
||
$user = Db::name('user')->where('id',$user_id)->find();
|
||
insertAgentLog('编辑会员','编辑会员:| ID: '.$user['id'].' | 账号: '.$user['username']);
|
||
}
|
||
die(json_encode(['code'=>1,'msg'=>$lang['edit_successfully']]));
|
||
}else{
|
||
die(json_encode(['code'=>0,'msg'=>$lang['operation_error']]));
|
||
}
|
||
}
|
||
// 编辑会员页面
|
||
public function edit_agent(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
$jsonlang = json_encode($lang);
|
||
|
||
$this->assign('langType',$langType);
|
||
$this->assign('lang',$lang);
|
||
$this->assign('jsonlang',$jsonlang);
|
||
|
||
$user_info = Session::get('user_info');
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
return $lang['illegal_request'];
|
||
}
|
||
if($user_info['agent_parent_id'] == 0){
|
||
$under_agent_list = Db::name('user')->where('agent_parent_id_path','like',$user_info['id'].',%')->whereOr('id',$user_info['id'])->where('agent',1)->order('id asc')->select();
|
||
}else{
|
||
$under_agent_list = Db::name('user')->where('agent_parent_id_path','like','%,'.$user_info['id'].',%')->where('agent',1)->order('id asc')->select();
|
||
}
|
||
|
||
// 接收需要修改的会员ID
|
||
$user_id = Request::instance()->get('user_id');
|
||
$user = Db::name('user')->where('id',$user_id)->find();
|
||
// 格式化数据
|
||
|
||
// 所属代理信息
|
||
$agent_parent = Db::name('user')->where('id',$user['agent_parent_id'])->find();
|
||
|
||
//渲染参数和模板
|
||
$this->assign('user',$user);
|
||
$this->assign('user_info',$user_info);
|
||
$this->assign('under_agent_list',$under_agent_list);
|
||
$this->assign('agent_parent',$agent_parent);
|
||
return $this->fetch();
|
||
}
|
||
// 处理编辑会员
|
||
public function do_edit_agent(){
|
||
$langType = cookie('think_var');
|
||
$lang = Lang::get('agent');
|
||
|
||
$user_info = Session::get('user_info');
|
||
$account_type = $user_info['account_type'];
|
||
$user_info = Db::name('user')->where('id',$user_info['id'])->find();
|
||
$user_info['account_type'] = $account_type;
|
||
if($user_info['account_type'] == 2 || $user_info['account_type'] == 3){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['illegal_request']]));
|
||
}
|
||
if(Request::instance()->post()){
|
||
// 获取管理员信息
|
||
$user_info = Session::get('user_info');
|
||
|
||
// 接收参数
|
||
$user_id = Request::instance()->post('user_id');
|
||
$new_agent_id = Request::instance()->post('new_agent_id');
|
||
$update_user_info = Db::name('user')->where('id',$user_id)->find();
|
||
// 验证数据
|
||
if($new_agent_id == 0){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['choose_the_new_agent']]));
|
||
}
|
||
$user_bet = Db::name('bet')->where('user_id',$user_id)->select();
|
||
if($user_bet){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['already_bet']]));
|
||
}
|
||
if($update_user_info['money'] > 0 ){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['already_recharge']]));
|
||
}
|
||
$new_agent_info = Db::name('user')->where('id',$new_agent_id)->where('agent',1)->find();
|
||
if(!$new_agent_info){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['new_agent_error']]));
|
||
}
|
||
$wt_agent = Db::connect('DB2')->name('table')->where(array('status' => 1))->order('id asc')->limit(1)->value('wt_agent');
|
||
if($wt_agent != $user_info['username']){
|
||
die(json_encode(['code'=>0,'msg'=>$lang['cannot_do']]));
|
||
}
|
||
|
||
// 拼装数据创建会员
|
||
$user_data = array();
|
||
$user_data['agent_parent_id'] = $new_agent_info['id'];
|
||
$user_data['agent_parent_username'] = $new_agent_info['username'];
|
||
$user_data['agent_parent_nickname'] = $new_agent_info['nickname'];
|
||
$user_data['agent_parent_id_path'] = $new_agent_info['agent_parent_id_path'].','.$user_id;
|
||
$user_data['update_time'] = time();
|
||
$result = Db::name('user')->where('id',$user_id)->update($user_data);
|
||
if($result){
|
||
// 写入管理员日志
|
||
$user = Db::name('user')->where('id',$user_id)->find();
|
||
insertAgentLog('编辑会员','编辑会员:| ID: '.$user['id'].' | 账号: '.$user['username']);
|
||
}
|
||
die(json_encode(['code'=>1,'msg'=>$lang['edit_successfully']]));
|
||
}else{
|
||
die(json_encode(['code'=>0,'msg'=>$lang['operation_error']]));
|
||
}
|
||
}
|
||
}
|