三级变四级

master
ELF 5 years ago
parent 6e1a768721
commit 5b62b99765

@ -4,6 +4,7 @@ use mysql_xdevapi\Exception;
use User\Api\PromoteApi;
use User\Api\UserApi;
use Org\XiguSDK\Xigu;
use Base\Service\PromoteService;
/**
* 后台首页控制器
@ -127,20 +128,19 @@ unset($_REQUEST['parent_id']);
public function add($account=null,$password=null,$second_pwd=null,$real_name=null,$email=null,$mobile_phone=null,$bank_name=null,$bank_card=null,$admin=null,$status=null,$ba_id = null){
if(IS_POST){
if(C('PROMOTE_AUTO_AUDIT') == 1){$status = 1;}
$data=array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,'admin_id'=>$admin,'status'=>$status,'ba_id'=>$ba_id);
$data = array('account'=>$account,'password'=>$password,'second_pwd'=>$second_pwd,'real_name'=>$real_name,'email'=>$email,'mobile_phone'=>$mobile_phone,'bank_name'=>$bank_name,'bank_card'=>$bank_card,'admin_id'=>$admin,'status'=>$status,'ba_id'=>$ba_id);
if(preg_match('/^[a-zA-Z0-9]{6,15}$/',$account)==false){
$this->error('账号只能是6-15位字母或数字');
}
$user = new PromoteApi();
$res = $user->promote_add($data);
if($res>0){
if(isset($_REQUEST['ba_id'])){
$promoteService = new PromoteService();
$status = $promoteService->addPromote($data);
if($status){
/* if(isset($_REQUEST['ba_id'])) {
$ba = new \Admin\Model\BusinessAffairsModel();
$ba->add_child($_REQUEST['ba_id'],$res);
}
} */
$this->success("添加成功",U('lists'));
}
else{
@ -149,11 +149,8 @@ unset($_REQUEST['parent_id']);
}
else{
$this->meta_title ='新增渠道信息';
$this->m_title = '推广员列表';
$this->assign('commonset',M('Kuaijieicon')->where(['url'=>'Promote/lists/type/1','status'=>1])->find());
$this->display();
}
}

@ -0,0 +1 @@
{"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}]}

@ -11,6 +11,13 @@ class PromoteService {
private $model;
public static $levels = [
1 => '会长',
2 => '部门长',
3 => '组长',
4 => '推广员',
];
public function __construct()
{
$this->model = new PromoteModel();
@ -729,4 +736,47 @@ class PromoteService {
}
return $balanceCoin;
}
public function getLevelByChain($chain)
{
return count(explode('/', trim($chain, '/')));
}
public function getLevelName($level)
{
return self::levels[$level] ?? '未知';
}
public function addPromote($params, $parent = null)
{
$data = [
'account' => $params['account'],
'password' => $params['password'],
'nickname' => $params['nickname'] ?? $params['account'],
'second_pwd' => $params['second_pwd'] ?? null,
'real_name' => $params['real_name'],
'email' => $params['email'],
'idcard' => $params['idcard'] ?? '',
'status' => $params['status'],
'mobile_phone' => $params['mobile_phone'],
'bank_name' => $params['bank_name'] ?? '',
'bank_card' => $params['bank_card'],
'status' => 1,
'parent_id' => $parent ? $parent['id'] : 0,
'parent_name' => $parent ? $parent['account'] : '官方渠道',
'admin_id' => $params['admin_id'] ?? 0,
'invite_code' => $params['invite_code'] ?? '',
'create_time' => time(),
];
if ($parent) {
$data['chain'] = $parent['chain'] . $parent['id'] . '/';
$data['level'] = $this->getLevelByChain($data['chain']) + 1;
} else {
$data['chain'] = '/';
$data['level'] = 1;
}
return M('promote', 'tab_')->add($data);
}
}

@ -2,21 +2,24 @@
namespace Home\Controller;
use Think\Controller;
class BaseController extends HomeController{
protected $loginPromote = null;
protected function _initialize()
{
parent::_initialize();
$this->login();
$map['id'] = get_pid();
$pro = M("promote", "tab_")->where($map)->find();
$loginer = $this->getLoginPromote();
$pid = is_login_promote();
define('PLEVEL', $pro['parent_id']);
define('PLEVEL', $loginer['parent_id']);
define('PID', $pid);
define('PROMOTE_ACCOUNT',session('promote_auth.account'));
if($pro['grand_id']>0) {/* 三级 */
if($loginer['grand_id']>0) {/* 三级 */
define('PRO_GRADE',3);
} elseif($pro['parent_id']>0) {/* 二级 */
} elseif($loginer['parent_id']>0) {/* 二级 */
define('PRO_GRADE',2);
define('SETTLEMENT_GRADE','third_status'); /* 给三级结算 */
define('G_SETTLEMENT_GRADE','third_status');
@ -26,9 +29,10 @@ class BaseController extends HomeController{
define('G_SETTLEMENT_GRADE','sub_status,third_status');
}
$this->assign('loginer', $pro);
$this->assign("parent_id", $pro['parent_id']);
$this->assign("grand_id", $pro['grand_id']);
$this->assign('loginer', $loginer);
$this->assign("parent_id", $loginer['parent_id']);
$this->assign("grand_id", $loginer['grand_id']);
$result = M('site_apply','tab_')->where("promote_id=$pid")->getField('status');
if($result['status'] == 1) {
$this -> assign('noapplysite', $result);
@ -223,7 +227,10 @@ class BaseController extends HomeController{
public function getLoginPromote()
{
if ($this->loginPromote == null) {
$promoteId = session('promote_auth.pid');
return M('promote', 'tab_')->where(['id' => $promoteId])->find();
$this->loginPromote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
}
return $this->loginPromote;
}
}

@ -868,6 +868,83 @@ class PromoteController extends BaseController
parent::lists("Promote", $p, $map, $appendCallback);
}
public function children()
{
$account = I('account', '');
$idcard = I('idcard', '');
$mobile = I('mobile', '');
$realName = I('real_name', '');
$status = I('status', 'all');
$promoteType = I('promote_type', 0);
$loginer = $this->getLoginPromote();
$map = [];
$map['chain'] = ['like', $loginer['chain'] . $loginer['id'] . '/%'];
if ($promoteType == 0) {
$map['level'] = 2;
} elseif ($promoteType == 1) {
$map['level'] = 3;
} elseif ($promoteType == 2) {
$map['level'] = 4;
}
if ($account) {
$map['account'] = ['like', '%' . $account . '%'];
}
if ($mobile) {
$map['mobile_phone'] = ['like', '%' . $mobile . '%'];
}
if ($idcard) {
$map['idcard'] = ['like', '%' . $idcard . '%'];
}
if ($realName) {
$map['real_name'] = ['like', '%' . $realName . '%'];
}
if ($status != 'all') {
$map['status'] = ['eq', $status];
}
$query = M('promote', 'tab_')->where($map);
list($records, $pagination, $count) = $this->paginate($query);
$ids = array_column($records, 'id');
$parentIds = array_column($records, 'parent_id');
$countList = [];
$playerList = [];
$shiftList = [];
$shiftPlayerList = [];
if (count($ids) > 0) {
$countList = M('promote', 'tab_')->field(['count(*)' => 'count', 'parent_id' => 'parent_id'])->where(['parent_id' => ['in', $ids]])->group('parent_id')->select();
$playerList = M('user_play', 'tab_')->field(['count(*)' => 'count', 'promote_id' => 'promote_id'])->where(['promote_id' => ['in', $ids]])->group('promote_id')->select();
$shiftList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 1, 'promote_id' => ['in', $ids]])->group('from_promote_id')->select();
$shiftPlayerList = M('shift_task', 'sys_')->field(['count(*)' => 'count', 'from_promote_id' => 'from_promote_id'])->where(['status' => 0, 'type' => 2, 'promote_id' => ['in', $ids]])->group('from_promote_id')->select();
$countList = array_column($countList, 'parent_id');
$playerList = array_column($playerList, 'promote_id');
$shiftList = array_column($shiftList, 'from_promote_id');
$shiftPlayerList = array_column($shiftPlayerList, 'from_promote_id');
}
if ($promoteType == 0) {
$promoteTypeName = '部门长';
} elseif ($promoteType == 1) {
$promoteTypeName = '组长';
} elseif ($promoteType == 2) {
$promoteTypeName = '推广员';
}
$this->assign('promoteTypeName', $promoteTypeName);
$this->assign('countList', $countList);
$this->assign('playerList', $playerList);
$this->assign('shiftList', $shiftList);
$this->assign('shiftPlayerList', $shiftPlayerList);
$this->assign('count', $count);
$this->assign('pagination', $pagination);
$this->assign('records', $records);
$this->display();
}
/**
*子账号
*/
@ -958,6 +1035,64 @@ class PromoteController extends BaseController
parent::lists("Promote", $p, $map, $appendCallback);
}
public function addPromote()
{
if (IS_POST) {
$params = I('post.');
$parent = null;
if (isset($params['parent_id'])) {
$parent = M('promote', 'tab_')->where(['id' => $params['parent_id']])->find();
} else {
$parent = $this->getLoginPromote();
}
$promoteService = new PromoteService();
$status = $promoteService->addPromote($params, $parent);
if ($status) {
$this->ajaxReturn(['status' => 1, 'msg' => '添加成功']);
} else {
$this->ajaxReturn(['status' => 0, 'msg' => '添加失败']);
}
} else {
$promoteType = I('get.promote_type', 0);
$loginer = $this->getLoginPromote();
$promotes = null;
$promoteColumns = ['id', 'account', 'real_name'];
$promoteMap = ['chain' => ['like', $loginer['chain'] . $loginer['level'] . '/' . '%']];
if ($loginer['level'] == 1) {
if ($promoteType == 1) {
$promoteMap['level'] = 2;
$promotes = M('promote', 'tab_')->field($promoteColumns)->where($promoteMap)->select();
} elseif ($promoteType == 2) {
$promoteMap['level'] = 3;
$promotes = M('promote', 'tab_')->field($promoteColumns)->where($promoteMap)->select();
}
} elseif ($loginer['level'] == 2) {
if ($promoteType == 2) {
$promoteMap['level'] = 3;
$promotes = M('promote', 'tab_')->field($promoteColumns)->where($promoteMap)->select();
}
}
$promoteTypeName = '';
$parentTypeName = '';
if ($promoteType == 0) {
$promoteTypeName = '部门长';
} elseif ($promoteType == 1) {
$promoteTypeName = '组长';
$parentTypeName = '部门长';
} elseif ($promoteType == 2) {
$promoteTypeName = '推广员';
$parentTypeName = '组长';
}
$this->assign('parentTypeName', $parentTypeName);
$this->assign('promoteTypeName', $promoteTypeName);
$this->assign('promotes', $promotes);
$this->meta_title = "添加子渠道";
$this->display();
}
}
public function add_chlid()
{
if (IS_POST) {
@ -1094,6 +1229,11 @@ class PromoteController extends BaseController
}
}
public function editPromote()
{
}
public function edit_chlid($id = 0)
{
if (IS_POST) {

@ -1836,6 +1836,7 @@ class QueryController extends BaseController
];
$query = M('user', 'tab_')->field($fields)->where(['promote_id' => ['in', $ids]]);
list($records, $pagination, $count) = $this->paginate($query);
$this->assign('promotes', $promotes);
$this->assign('groupPromotes', $groupPromotes);
$this->assign('records', $records);
@ -1844,6 +1845,24 @@ class QueryController extends BaseController
$this->display();
}
private function getQueryPromote($levelPromote)
{
$queryPromote = null;
$promote = $this->getLoginPromote();
$queryPromoteId = 0;
foreach($levelPromote as $item) {
if ($item != 0) {
$queryPromoteId = $item;
}
}
if ($queryPromoteId == 0) {
$queryPromote = $this->getLoginPromote();
} else {
$queryPromote = M('promote', 'tab_')->where(['id' => $queryPromoteId])->find();
}
return $queryPromote;
}
public function userRoles()
{
$gameId = I('game_id', 0);
@ -1857,41 +1876,21 @@ class QueryController extends BaseController
$roleLevelEnd = intval(I('role_level_end', 0));
$headmanPromoteId = I('headman_promote_id', 0);
$createTime = I('create_time', '');
$levelPromote = I('level_promote', []);
$promote = $this->getLoginPromote();
$map = [
'_logic' => 'or',
'id' => $promote['id'],
'parent_id' => $promote['id'],
'grand_id' => $promote['id'],
];
if ($headmanPromoteId > 0) {
$map = [
'_logic' => 'or',
'id' => $headmanPromoteId,
'parent_id' => $headmanPromoteId,
'grand_id' => $headmanPromoteId,
];
}
if ($promoteId > 0) {
$map = [
'_logic' => 'or',
'id' => $promoteId,
'parent_id' => $promoteId,
'grand_id' => $promoteId,
];
}
$queryPromote = $this->getQueryPromote($levelPromote);
$map = [];
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$promotes = [];
$groupPromotes = $this->getGroupPromotes($promote);
if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
$promotes = $this->getNormalPromotes($promote);
}
$map = [];
if (count($ids) > 0) {
$map = ['promote_id' => ['in', $ids]];
} else {
$map['_string'] = '1<>1';
}
if ($gameId != 0) {
$map['game_id'] = $gameId;
@ -1930,20 +1929,12 @@ class QueryController extends BaseController
}
if ($isSelf) {
$map['promote_id'] = $promote['id'];
if ($headmanPromoteId != 0) {
$map['promote_id'] = $headmanPromoteId;
}
if ($promoteId != 0) {
$map['promote_id'] = $promoteId;
}
}
$query = M('user_play_info', 'tab_')->where($map)->order('create_time desc');
list($records, $pagination, $count) = $this->paginate($query);
$games = $this->getGamesByPromote($promote);
$this->assign('promotes', $promotes);
$this->assign('groupPromotes', $groupPromotes);
$this->assign('games', $games);
$this->assign('records', $records);
$this->assign('pagination', $pagination);
@ -1962,39 +1953,23 @@ class QueryController extends BaseController
$sdkVersion = I('sdk_version', 0);
$costBegin = I('cost_begin', '');
$costEnd = I('cost_end', '');
$headmanPromoteId = I('headman_promote_id', 0);
$levelPromote = I('level_promote', []);
$promote = $this->getLoginPromote();
$map = [
'_logic' => 'or',
'id' => $promote['id'],
'parent_id' => $promote['id'],
'grand_id' => $promote['id'],
];
if ($headmanPromoteId > 0) {
$map = [
'_logic' => 'or',
'id' => $headmanPromoteId,
'parent_id' => $headmanPromoteId,
'grand_id' => $headmanPromoteId,
];
}
if ($promoteId > 0) {
$map = [
'_logic' => 'or',
'id' => $promoteId,
'parent_id' => $promoteId,
'grand_id' => $promoteId,
];
}
$queryPromote = $this->getQueryPromote($levelPromote);
$map = [];
$map['chain'] = ['like', $queryPromote['chain'] . $queryPromote['id'] . '/%'];
$ids = M('promote', 'tab_')->where($map)->getField('id', true);
$promotes = [];
$groupPromotes = $this->getGroupPromotes($promote);
if ($promote['parent_id'] > 0 && $promote['grand_id'] == 0) {
$promotes = $this->getNormalPromotes($promote);
$map = [];
if (count($ids) > 0) {
$map = ['promote_id' => ['in', $ids]];
} else {
$map['_string'] = '1<>1';
}
$map = $spendMap = ['promote_id' => ['in', $ids]];
$spendMap = $map;
if ($gameId != 0) {
$map['game_id'] = $gameId;
}
@ -2013,16 +1988,6 @@ class QueryController extends BaseController
if ($isSelf) {
$map['promote_id'] = $promote['id'];
$spendMap['promote_id'] = $promote['id'];
if ($headmanPromoteId != 0) {
$map['promote_id'] = $headmanPromoteId;
$spendMap['promote_id'] = $headmanPromoteId;
}
if ($promoteId != 0) {
$map['promote_id'] = $promoteId;
$spendMap['promote_id'] = $promoteId;
}
}
if ($costBegin != '' || $costEnd != '') {
$having = '';

@ -0,0 +1,176 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-add_chlid-form">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>管理中心></span><span>添加{$promoteTypeName}</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main">添加{$promoteTypeName}</span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('Promote/addPromote')}" novalidate="novalidate" method="post" class="base_info" id="form_reg">
<table class="table2">
<?php if($promotes != null):?>
<tr>
<td class="l"><span class="req">*</span>{$parentTypeName}</td>
<td class="r">
<select id="parent_id" name="parent_id" class="reselect select_gallery" style="width: 252px;" >
<option value="0">请选择所属{$parentTypeName}</option>
<volist name="promotes" id="promote">
<option value="{$promote.id}">{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</td>
</tr>
<?php endif;?>
<tr>
<td class="l"><span class="req">*</span>帐号:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="account" id="account" maxlength="15" minlength="6" placeholder="请输入帐号">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>姓名:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="real_name" id="real_name" maxlength="4" minlength="2" placeholder="请输入姓名">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>身份证:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="idcard" id="idcard" placeholder="请输入身份证">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>手机号:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="mobile_phone" id="mobile_phone" placeholder="请输入手机号">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>密码:</td>
<td class="r">
<input type="password" class="name txt" name="password" id="password" placeholder="请输入子渠道密码">
<span id="password_tip"></span>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>确认密码:</td>
<td class="r">
<input type="password" class="name txt" name="repassword" id="repassword" placeholder="请输入确认密码">
<span id="repassword_tip"></span>
</td>
</tr>
<tr>
<td class="l">昵称:</td>
<td class="r">
<input type="text" class="name txt" name="nickname" id="nickname" placeholder="请输入子渠道昵称">
<span id="nickname_tip"></span>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="button" class="tj btn ajax-post" onclick="check()" value="确认添加" title="" target-form="base_info">
<a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
$(".select_gallery").select2();
function check() {
data = validation();
if(data.status !=1){layer.msg(data.msg,{icon:2}); return false;};
var account = $('#account').val();
var password = $('#password').val();
var nickname = $('#nickname').val();
var idcard = $('#idcard').val();
var mobile_phone = $('#mobile_phone').val();
var real_name = $('#real_name').val();
var promote_type = $('[name=promote_type]').val();
var repassword = $('#repassword').val();
var parent_id = $('#parent_id').val();
$.ajax({
type:"POST",
url:"{:U('addPromote')}",
data:{
account: account,
password: password,
real_name: real_name,
repassword: repassword,
promote_type: promote_type,
parent_id: parent_id,
mobile_phone: mobile_phone,
idcard: idcard,
nickname: nickname,
},
success:function(res){
if(res.status == 1){
layer.msg(res.msg);
setTimeout(function(){
window.location.href="{:U('children', ['promote_type' => I('promote_type', 0)])}";
},1000);
}else{
layer.msg(res.msg);
}
}
});
// $('#form_reg').submit();
}
function validation(){
var json_data = "";
if($('#account').val()==""){
return json_data = {'status':0,'msg':'子渠道账号不能为空'}
}
// if($.trim($('#account').val()).length < 6){
// return json_data = {'status':0,'msg':'子渠道账号不能小于6位字符'}
// }
if($.trim($('#account').val()).length < 6 || $.trim($('#account').val()).length > 15){
return json_data = {'status':0,'msg':'子渠道账号长度为6-15位字符'}
}
if($.trim($('#real_name').val()).length < 2 || $.trim($('#real_name').val()).length > 4){
return json_data = {'status':0,'msg':'子渠道姓名长度为2-4位字符'}
}
if($('#password').val()==""){
return json_data = {'status':0,'msg':'子渠道密码不能为空'}
}
if($.trim($('#password').val()).length < 6){
return json_data = {'status':0,'msg':'子渠道密码不能小于6位字符'}
}
if($('#repassword').val()==""){
return json_data = {'status':0,'msg':'确认密码不能为空'}
}
if($('#repassword').val()!==$('#password').val()){
return json_data = {'status':0,'msg':'子渠道密码和确认密码不一致'}
}
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
// if(!myreg.test($('#mobile_phone').val())){
// return json_data = {'status':0,'msg':'请输入正确的手机号'}
// }
// var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
// if(!myreg.test($('#email').val())){
// return json_data = {'status':0,'msg':'请输入正确的邮箱'}
// }
// if($.trim($('#nickname').val()).length == 0){
// return json_data = {'status':0,'msg':'昵称不能为空'};
// }
return json_data = {'status':1,'msg':'成功'};
}
</script>
</block>

@ -0,0 +1,442 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-mychlid-list">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>管理中心></span><span>{$promoteTypeName}管理</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main">{$promoteTypeName}管理</span>
</div>
<div class="trunk-content article">
<div class="trunk-search clearfix">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<div class="form-group fl normal_space">
<a href="{:U('Promote/addPromote', ['promote_type' => I('promote_type', 0)])}" class="submit btn"><i class="add_qudao"></i><span>添加{$promoteTypeName}</span></a>
</div>
<div class="form-group fr">
<input type="submit" class="submit normal_space" value="查询">
</div>
<div class="form-group fr normal_space">
<select name="status" class="reselect select_gallery" style="width: 220px;" >
<option value="all">请选择状态</option>
<option value="1" <if condition="I('status') === '1'">selected</if>>启用</option>
<option value="2" <if condition="I('status') === '2'">selected</if>>冻结中</option>
</select>
</div>
<div class="form-group fr normal_space">
<input type="text" name="real_name" class="txt normal_txt" id="uid" placeholder="请输入姓名" value="{:I('real_name')}">
</div>
<div class="form-group fr normal_space">
<input type="text" name="mobile" class="txt normal_txt" id="uid" placeholder="请输入手机号" value="{:I('mobile')}">
</div>
<div class="form-group fr normal_space">
<input type="text" name="idcard" class="txt normal_txt" id="uid" placeholder="请输入身份证" value="{:I('idcard')}">
</div>
<div class="form-group fr normal_space">
<input type="text" name="account" class="txt normal_txt" id="uid" placeholder="请输入帐号" value="{:I('account')}">
</div>
</form>
</div>
<div class="trunk-list list_normal">
<table class="table normal_table">
<tr class="odd">
<th>ID</th>
<th>帐号</th>
<th>真实姓名</th>
<th>身份证</th>
<th>手机号</th>
<th>上级渠道</th>
<th>昵称</th>
<th>帐号状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
<empty name="records">
<tr><td colspan="10" style="text-align: center;height: 45vh;"><img src="__IMG__/20180207/icon_wushujv2.png"/><p style="line-height: 40px;color: #A5A5A5;">暂无数据</p></td></tr>
<else />
<volist name="records" id="record" mod="2">
<tr data-id="{$record.id}" class="<eq name='mod' value='1'>odd</eq>">
<td>{$record.id}</td>
<td class="account">{$record.account}</td>
<td class="real-name">{$record.real_name}</td>
<td>{$record.idcard}</td>
<td>{$record.mobile_phone}</td>
<td>{$record.parent_name}</td>
<td>{$record.nickname}</td>
<td>
<if condition="$record['status'] eq 0">
<span class="status_close">审核中</span>
<elseif condition="$record['status'] eq 1"/>
启用
<elseif condition="$record['status'] eq 2"/>
<span class="status_close">冻结中</span>
<else />
<span class="status_close">未知状态</span>
</if>
</td>
<td>{$record.create_time|date='Y-m-d H:i:s',###}</td>
<td>
<a href="{:U('Promote/edit_chlid','id='.$record['id'])}" class="editbtn">修改</a>
<if condition="$record['status'] eq 1">
<a href="javascript:;" class="froze-btn editbtn">冻结</a>
<elseif condition="$record['status'] eq 2"/>
<a href="javascript:;" style="color: red;" class="unfreeze-btn editbtn">解冻</a>
</if>
<a href="javascript:;" class="reset-password-btn editbtn">重置密码</a>
<?php if(in_array($record['id'], $hasChildList)):?>
<?php if(!in_array($record['id'], $hasShiftList)):?>
<a href="javascript:;" class="shift-btn editbtn">渠道迁移</a>
<?php else:?>
<a href="javascript:;" style="color: red;" class="cancel-shift-btn editbtn">取消渠道迁移</a>
<?php endif;?>
<?php endif;?>
<?php if(in_array($record['id'], $hasPlayerList)):?>
<?php if(!in_array($record['id'], $hasShiftPlayerList)):?>
<a href="javascript:;" class="shift-player-btn editbtn">玩家迁移</a>
<?php else:?>
<a href="javascript:;" style="color: red;" class="cancel-shift-player-btn editbtn">取消玩家迁移</a>
<?php endif;?>
<?php endif;?>
</td>
</tr>
</volist>
</empty>
</table>
</div>
<div class="pagenation clearfix">
<a class="sch-btn" href="{:U('Export/child',array(
'p'=>I('p'),
'account'=>I('account'),'xlsname'=>'管理中心_'.get_pro_grade_name(PRO_GRADE,1),'row'=>I('request.row')
))}" >导出</a>
{$_page}
</div>
</div>
<div class="page-explain promote-mychlid-explain">
<div class="trunk-content article border_normal">
<!-- <table class="desccontent">
<tr><td class="title" style="width: 100px;display: inline-block;">二级渠道说明:</td><td class="det">推广员默认为一级渠道,一级渠道可通过推广员后台新增二级渠道;二级渠道由一级渠道管理开启权限,并由一级渠道给二级渠道结算,结算可到财务管理操作。</td></tr>
</table>-->
</div>
</div>
</div>
<script>
setValue('row','{:I("get.row",10)}');
</script>
<div id="shift-box" class="layer-box" style="display: none;">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<input type="hidden" name="promote_id" value="">
<div class="form-group">
<label>账号(真实姓名)</label>
<div class="form-item">
<p class="static-input show-account"></p>
</div>
</div>
<div class="form-group">
<label>转移至推广账号</label>
<div class="form-item">
<select name="to_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广账号</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</div>
</div>
<div class="form-group">
<label>指定订单日期</label>
<div class="form-item">
<input type="text" id="shift-order-time" autocomplete="off" class="form-input" name="order_time" placeholder="订单日期"" value="" style="width: 199px;">
</div>
</div>
<div class="form-group">
<label>平台币管理</label>
<div class="form-item">
<label class="radio-item"><input type="radio" value="1" name="balance_coin_mode" checked> 平台币平移最高账户</label>
<label class="radio-item"><input type="radio" value="2" name="balance_coin_mode"> 平台币清零</label>
</div>
</div>
<div class="form-group">
<label></label>
<a id="shift-submit" href="javascript:;" class="shift-submit btn">确定</a>
</div>
</form>
</div>
<div id="shift-player-box" class="layer-box" style="display: none;">
<form action="{:U('Promote/mychlid',array('row'=>I('get.row')))}" method="post" enctype="multipart/form-data">
<input type="hidden" name="promote_id" value="">
<div class="form-group">
<label>账号(真实姓名)</label>
<div class="form-item">
<p class="static-input show-account"></p>
</div>
</div>
<div class="form-group">
<label>转移至推广账号</label>
<div class="form-item">
<select name="to_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择推广账号</option>
<volist name="subPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</div>
</div>
<div class="form-group">
<label>指定订单日期</label>
<div class="form-item">
<input type="text" id="shift-player-order-time" autocomplete="off" class="form-input" name="order_time" placeholder="订单日期"" value="" style="width: 199px;">
</div>
</div>
<div class="form-group">
<label></label>
<a id="shift-player-submit" href="javascript:;" class="shift-submit btn">确定</a>
</div>
</form>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
$(function(){
$(".select_gallery").select2();
$('#shift-player-order-time').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
scrollMonth:false,
scrollTime:false,
scrollInput:false
});
$('#shift-order-time').datetimepicker({
format: 'yyyy-mm-dd',
language:"zh-CN",
minView:2,
autoclose:true,
scrollMonth:false,
scrollTime:false,
scrollInput:false
});
$('.reset-password-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否确认重置密码?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/resetPassword')}",
data: {promote_id: id},
type: 'post',
dataType: 'json',
success: function(response) {
layer.close(index)
if (response.status == 1) {
layer.open({
content: '重置密码成功,您的新密码为:' + response.data.password
})
} else {
layer.msg(response.msg)
}
}
})
})
}
})
$('.froze-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否确认冻结帐号?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/froze')}",
data: {promote_id: id},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
$('.unfreeze-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否确认解冻帐号?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/unfreeze')}",
data: {promote_id: id},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
$('.cancel-shift-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否要取消渠道迁移?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/cancelShift')}",
data: {promote_id: id, type: 1},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
$('.cancel-shift-player-btn').on({
click: function() {
var id = $(this).parents('tr').eq(0).attr('data-id')
layer.confirm('是否要取消玩家迁移?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "{:U('Promote/cancelShift')}",
data: {promote_id: id, type: 2},
type: 'post',
dataType: 'json',
success: function(response) {
layer.msg(response.msg, {time: 1000}, function() {
window.location.href = window.location.href
})
}
})
})
}
})
$('.shift-btn').on({
click: function() {
var box = $('#shift-box')
var id = $(this).parents('tr').eq(0).attr('data-id')
var account = $(this).parents('tr').eq(0).find('td.account').html()
var realName = $(this).parents('tr').eq(0).find('td.real-name').html()
box.find('.show-account').html(account + (realName == '' ? '' : '(' + realName + ')'))
box.find('[name=promote_id]').val(id)
layer.open({
title: '渠道迁移',
type: 1,
content: box,
area: ['600px', '350px'],
zIndex: 250,
})
}
})
$('#shift-submit').on({
click: function() {
var box = $('#shift-box')
var id = box.find('[name=promote_id]').val()
var toPromoteId = box.find('[name=to_promote_id]').val()
var orderTime = box.find('[name=order_time]').val()
var balanceCoinMode = box.find('[name=balance_coin_mode]:checked').val()
if (toPromoteId == 0) {
layer.msg('请选择转移至的推广账号')
return
}
var data = {
from_promote_id: id,
to_promote_id: toPromoteId,
order_time: orderTime,
balance_coin_mode: balanceCoinMode,
type: 1,
}
$.ajax({
url: "{:U('Promote/shift')}",
data: data,
type: 'post',
dataType: 'json',
success: function(response) {
if (response.status) {
layer.msg(response.msg, {time: 2000}, function() {
window.location.href = window.location.href
})
} else {
layer.msg(response.msg)
}
}
})
}
})
$('.shift-player-btn').on({
click: function() {
var box = $('#shift-player-box')
var id = $(this).parents('tr').eq(0).attr('data-id')
var account = $(this).parents('tr').eq(0).find('td.account').html();
var realName = $(this).parents('tr').eq(0).find('td.real-name').html();
box.find('.show-account').html(account + (realName == '' ? '' : '(' + realName + ')'))
box.find('[name=promote_id]').val(id)
layer.open({
title: '玩家迁移',
type: 1,
content: box,
area: ['600px', '350px'],
zIndex: 250,
})
}
})
$('#shift-player-submit').on({
click: function() {
var box = $('#shift-player-box')
var id = box.find('[name=promote_id]').val()
var toPromoteId = box.find('[name=to_promote_id]').val()
var orderTime = box.find('[name=order_time]').val()
var balanceCoinMode = box.find('[name=balance_coin_mode]:checked').val()
if (toPromoteId == 0) {
layer.msg('请选择转移至的推广账号')
return
}
var data = {
from_promote_id: id,
to_promote_id: toPromoteId,
order_time: orderTime,
balance_coin_mode: balanceCoinMode,
type: 2,
}
$.ajax({
url: "{:U('Promote/shift')}",
data: data,
type: 'post',
dataType: 'json',
success: function(response) {
if (response.status) {
layer.msg(response.msg, {time: 2000}, function() {
window.location.href = window.location.href
})
} else {
layer.msg(response.msg)
}
}
})
}
})
})
</script>
</block>

@ -39,13 +39,15 @@
<div class="subNav jssubNav"><i class="prev_icon icon_guanli"></i><span>管理中心</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<a href="{:U('Promote/base_info')}" class="<if condition='CONTROLLER_NAME eq Promote and ACTION_NAME eq base_info '>active</if> ">账户信息</a>
<!-- <a href="{:U('Promote/balance')}" class="<if condition='(CONTROLLER_NAME eq Promote and ACTION_NAME eq balance) or(CONTROLLER_NAME eq PromoteCoin and ACTION_NAME eq lists) '>active</if> ">账户余额</a> -->
<if condition="($parent_id eq 0) and ($grand_id eq 0)">
<a href="{:U('Promote/mychlid')}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq mychlid or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">组长管理</a>
<a href="{:U('Promote/mygrand')}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq mygrand or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">推广员管理</a>
<elseif condition="($parent_id gt 0) and ($grand_id eq 0)"/>
<a href="{:U('Promote/mygrand')}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq mygrand or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">推广员管理</a>
</if>
<?php if (in_array($loginer['level'], [1])):?>
<a href="{:U('Promote/children', ['promote_type' => 0])}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq children or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">部门长管理</a>
<?php endif;?>
<?php if (in_array($loginer['level'], [1, 2])):?>
<a href="{:U('Promote/children', ['promote_type' => 1])}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq children or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">组长管理</a>
<?php endif;?>
<?php if (in_array($loginer['level'], [1, 2, 3])):?>
<a href="{:U('Promote/children', ['promote_type' => 2])}" class="<if condition='CONTROLLER_NAME eq Promote and (ACTION_NAME eq children or ACTION_NAME eq add_chlid or ACTION_NAME eq edit_chlid) '>active</if> ">推广员管理</a>
<?php endif;?>
</div>
<?php
$whiteList = [1, 8, 2, 84];

@ -0,0 +1,22 @@
<input type="hidden" id="top-promote-id" value="{$loginer.id}">
<if condition="$loginer.level elt 1">
<div class="form-group normal_space">
<select name="level_promote[2]" class="level-promote reselect select_gallery" style="width: 220px;" data-level="2" data-val="{:I('level_promote', [])[2] ?? 0}">
<option value="0">请选择部门长</option>
</select>
</div>
</if>
<if condition="$loginer.level elt 2">
<div class="form-group normal_space">
<select name="level_promote[3]" class="level-promote reselect select_gallery" style="width: 220px;" data-level="3" data-val="{:I('level_promote', [])[3] ?? 0}">
<option value="0">请选择组长</option>
</select>
</div>
</if>
<if condition="$loginer.level elt 3">
<div class="form-group normal_space">
<select name="level_promote[4]" class="level-promote reselect select_gallery" style="width: 220px;" data-level="4" data-val="{:I('level_promote', [])[4] ?? 0}">
<option value="0">请选择推广员</option>
</select>
</div>
</if>

@ -121,26 +121,7 @@
<option value="0">请选择区服</option>
</select>
</div>
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select id="group-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="subPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="sub_promote_id" class="reselect select_gallery" style="width: 220px;" data-promote="{:I('sub_promote_id', 0)}">
<option value="0">请选择推广员</option>
<volist name="subPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<include file="Public/promote_select" />
<div class="form-group normal_space">
<label>起止时间:</label>
<input type="text" class="txt range-date" name="time" placeholder="起止时间" value="{:I('time')}" >
@ -281,45 +262,8 @@ var gameId = $('#game-select').val();
})
}
var parentId = $('#group-select').val();
var defaultPromoteId = $('#promote-select').attr('data-promote');
if ($('#group-select').length > 0) {
getSubPromotes(parentId, defaultPromoteId)
}
$('#group-select').on({
change: function name() {
parentId = $('#group-select').val()
getSubPromotes(parentId, 0)
}
})
function getSubPromotes(parentId, defaultPromoteId) {
if (parentId == 0) {
var options = '<option value="0">请选择推广员</option>'
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
return
}
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultPromoteId > 0 && promote.id==defaultPromoteId) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '(' + promote.real_name + ')' + '</option>'
}
$('#promote-select').html(options)
console.log(defaultPromoteId)
$("#promote-select").val(defaultPromoteId).trigger("change")
}
})
}
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
layer.config({
extend: 'skin/myskin/style.css', //同样需要加载新皮肤

@ -44,26 +44,7 @@
<option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</select>
</div>
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select id="group-select" name="headman_promote_id" class="reselect select_gallery" style="width: 220px;">
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('headman_promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" data-promote="{:I('promote_id', 0)}">
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<include file="Public/promote_select" />
<div class="form-group normal_space">
<input type="text" name="role_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('role_name')}">
</div>
@ -175,44 +156,8 @@ $(function(){
})
}
var parentId = $('#group-select').val();
var defaultPromoteId = $('#promote-select').attr('data-promote');
if ($('#group-select').length > 0) {
getSubPromotes(parentId, defaultPromoteId)
}
$('#group-select').on({
change: function name() {
parentId = $('#group-select').val()
getSubPromotes(parentId, 0)
}
})
function getSubPromotes(parentId, defaultPromoteId) {
if (parentId == 0) {
var options = '<option value="0">请选择推广员</option>'
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
return
}
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultPromoteId > 0 && promote.id==defaultPromoteId) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '(' + promote.real_name + ')' + '</option>'
}
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
}
})
}
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
})
</script>
</block>

@ -44,32 +44,13 @@
<option value="2" <if condition="I('sdk_version') === '2'">selected</if>>IOS</option>
</select>
</div>
<include file="Public/promote_select" />
<div class="form-group normal_space">
<input type="text" name="role_name" class="txt normal_txt" id="uid" placeholder="请输入角色名" value="{:I('role_name')}">
</div>
<div class="form-group normal_space">
<input type="text" name="user_account" class="txt normal_txt" id="uid" placeholder="请输入玩家账号" value="{:I('user_account')}">
</div>
<if condition="$parent_id eq 0">
<div class="form-group normal_space">
<select id="group-select" name="headman_promote_id" class="reselect select_gallery" style="width: 220px;" >
<option value="0">请选择组长</option>
<volist name="groupPromotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('headman_promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<if condition="$grand_id eq 0">
<div class="form-group normal_space">
<select id="promote-select" name="promote_id" class="reselect select_gallery" style="width: 220px;" data-promote="{:I('promote_id', 0)}">
<option value="0">请选择推广员</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}" <if condition="I('promote_id') == $promote['id']">selected</if>>{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</div>
</if>
<div class="form-group normal_space fr">
<label>创建时间:</label>
<input type="text" class="txt range-date" name="create_time" placeholder="创建时间" value="{:I('create_time')}" >
@ -185,44 +166,8 @@ $(function() {
})
}
var parentId = $('#group-select').val();
var defaultPromoteId = $('#promote-select').attr('data-promote');
if ($('#group-select').length > 0) {
getSubPromotes(parentId, defaultPromoteId)
}
$('#group-select').on({
change: function name() {
parentId = $('#group-select').val()
getSubPromotes(parentId, 0)
}
})
function getSubPromotes(parentId, defaultPromoteId) {
if (parentId == 0) {
var options = '<option value="0">请选择推广员</option>'
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
return
}
$.ajax({
url: "{:U('Query/getSubPromotes')}",
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择推广员</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultPromoteId > 0 && promote.id==defaultPromoteId) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '(' + promote.real_name + ')' + '</option>'
}
$('#promote-select').html(options)
$("#promote-select").val(defaultPromoteId).trigger("change")
}
})
}
var promoteUrl = "{:U('Query/getSubPromotes')}"
initPromoteSelect(promoteUrl)
})
</script>
</block>

@ -176,3 +176,7 @@ ALTER TABLE `tab_coin_pay_order` CHANGE COLUMN `currency_num` `coin_num` int(11
-- 2019-10-23 zcl
update tab_quick_menu set name='订单查询' where name='充值明细'
-- 2019-10-28 elf 推广员3级变4级
ALTER TABLE `tab_promote` ADD COLUMN `chain` varchar(255) not NULL DEFAULT '' COMMENT '推广员链路' AFTER `parent_id`;
ALTER TABLE `tab_promote` ADD COLUMN `level` tinyint(1) not NULL DEFAULT 0 COMMENT '推广员级别' AFTER `chain`;

@ -219,3 +219,63 @@ $(".integer-input").keyup(function(){
}).bind("paste",function(){
$(this).val($(this).val().replace(/\D|^0/g,''));
})
function initPromoteSelect(url) {
var firstTag = $('.level-promote').eq(0)
var topPromoteId = $('#top-promote-id').val()
var firstLevel = firstTag.attr('data-level')
getSubPromotes(url, topPromoteId, firstLevel)
$('.level-promote').on({
change: function name() {
var parentId = $(this).val()
var level = parseInt($(this).attr('data-level'))
getSubPromotes(url, parentId, level + 1)
}
})
}
function getLevelName(level) {
var name = ''
if (level == 2) {
name = '部门长'
} else if (level == 3) {
name = '组长'
} else if (level == 4) {
name = '推广员'
}
return name
}
function getSubPromotes(url, parentId, level) {
var selectTag = $('.level-promote[data-level=' + level + ']')
if (selectTag.length == 0) {
return
}
var defaultVal = selectTag.attr('data-val')
var levelName = getLevelName(level)
if (parentId == 0) {
var options = '<option value="0">请选择' + levelName + '</option>'
selectTag.html(options)
selectTag.val(defaultVal).trigger("change")
return
}
$.ajax({
url: url,
dataType: 'json',
data: {promote_id: parentId},
success: function(response) {
var options = '<option value="0">请选择' + levelName + '</option>'
for (var i in response.data.promotes) {
var promote = response.data.promotes[i]
var selected = ''
if (defaultVal > 0 && promote.id == defaultVal) {
selected = 'selected'
}
options += '<option value="' + promote.id + '"' + selected + '>' + promote.account + '(' + promote.real_name + ')' + '</option>'
}
selectTag.html(options)
selectTag.val(defaultVal).trigger("change")
}
})
}
Loading…
Cancel
Save