Merge remote-tracking branch 'origin/release-1.0.0' into release-1.0.0

master
zhengchanglong 5 years ago
commit 01c79143b1

@ -44,16 +44,11 @@ function get_promote_list_by_id($id=0) {
if(is_numeric($id) && $id>=0) {
$map['parent_id'] = $id;
$list = $query->where($map)->select();
} elseif(is_array($id)) {
$map['parent_id'] = array('in',$id);
$list = $query->where($map)->select();
} elseif(is_numeric($id) && $id<0){
$list = $query->where($map)->select();
} else {
$list = '';
}
return $list;
$list = $query->where($map)->select();
return $list;
}
/*
@ -1557,9 +1552,9 @@ function getAdminData ($uid) {
->join('left join sys_auth_group on sys_auth_group_access.group_id=sys_auth_group.id')
->where(array('uid'=>$uid))->find();
$promoteData = M('promote','tab_')->field('id')->where(array('admin_id'=>$uid))->select();
$promoteData = implode(',',array_column($promoteData,'id'));
$adminData['data_president'] = $adminData['data_president'].','.$promoteData;
// $promoteData = M('promote','tab_')->field('id')->where(array('admin_id'=>$uid))->select();
// $promoteData = implode(',',array_column($promoteData,'id'));
// $adminData['data_president'] = $adminData['data_president'].','.$promoteData;
return $adminData;
}
@ -1590,7 +1585,8 @@ function getPowerPromoteIds()
if ($myPromote_ids) {
if ($userAuth['data_empower_type'] == 2) {//部分会长加上自己创建的会长
$userAuth['data_president'] .= "," . $myPromote_ids;
// $userAuth['data_president'] .= "," . $myPromote_ids;
} elseif ($userAuth['data_empower_type'] == 3) {//自己创建的会长和底下推广员
$userAuth['data_president'] = $myPromote_ids;
}
@ -1598,6 +1594,7 @@ function getPowerPromoteIds()
if (!empty($userAuth['data_president'])) {//查询有权限查看的会长以及底下的推广员
$map = array();
//查询会长底下的推广员(首个斜杆之间的数字)
$userAuth['data_president']= trim($userAuth['data_president'], ",");
$where['SUBSTRING_INDEX(SUBSTRING_INDEX(`chain`,"/",2),"/",-1)'] = array('exp',"IN({$userAuth['data_president']})");
$where['id'] = array('in', $userAuth['data_president']);//会长本身
$where['_logic'] = 'or';
@ -1619,11 +1616,17 @@ function getPowerPromoteIds()
return $promoteIds;
}
/**
* 为数据权限添加筛选参数
* @param array $map 查询条件
* @param string $column 字段名默认为promote_id
* @return mixed
*/
function setPowerPromoteIds(&$map, $column = 'promote_id') {
//为数据权限添加
$promoteIds = getPowerPromoteIds();
if (empty($promoteIds)) {
$map[$column] = -1;
$map[$column] = -1;//没权限时将promote_id置为-1
} elseif ($promoteIds != 'all') {
if (isset($map[$column])) {
if (isset($map['_string'])) {//查询字段中已存在promote_id不覆盖此条件而处理
@ -1697,4 +1700,19 @@ function get_admin_listOther()
if(empty($list)){return false;}
return $list;
}
/**
* 根据会长id底下的推广员id
* @param $promote_id
* @return mixed
*/
function getOffspringByPromoteId($promote_id) {
$promote_ids = M('promote', 'tab_')
->where(['chain' => ['like', "%/{$promote_id}/%"]])
->field('group_concat(id) as promote_ids')
->find();
return $promote_ids['promote_ids'];
}
?>

@ -51,9 +51,13 @@ class AdminController extends Controller {
if(CONTROLLER_NAME !== "Ajax"){//ajax放行
//检测访问权限
$rule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME);
if ( !$this->checkRule($rule,array('in','1,2')) ){
if($rule == "admin/statistics/overview"){//第一级菜单单独判断
$this->strictCheckRule($rule);
if ($rule == "admin/index/index"){
}elseif ( !$this->checkRule($rule,array('in','1,2')) ){
if ($rule == "admin/index/index"){
//如果首页没有访问权限 自动检测有访问权限的页面然后跳转过去
$qx = M("Auth_group")->table("__AUTH_GROUP__ as ag")
->join("__AUTH_GROUP_ACCESS__ as aga on(ag.id=aga.group_id and aga.uid=".UID.")",'right')
@ -92,7 +96,49 @@ class AdminController extends Controller {
$this->assign('__MENU__', $this->getMenus());
}
/**
* 大菜单存在两个及以上的同方法菜单,需要进行多级菜单确认
*/
protected function strictCheckRule($rule)
{
$flag =false;
$id= 0;
$ruleres = M("auth_rule")->field("id,type")->where("name LIKE '%{$rule}%'")->select();
foreach ($ruleres as $k => $v) {
$checkRule = $this->checkRule($rule,array('eq',$v['type']));
if(!$checkRule){
$flag = true;
}else{
$id = $v['id'];
}
}
if($flag){ //不通过
//获取菜单下的
$rulearr = explode("/",$rule);
$where = array();
$where['pid'] = 0;
$where['hide'] = 0;
$where['url'] = array("like",$rulearr[1]."/".$rulearr[2]);
$second_id = M('Menu')->where($where)->field('id')->find()['id'];
$where2['pid'] = $second_id;
$where2['hide'] = 0;
$menu = M('Menu')->where($where2)->field('id,url')->order('sort asc')->select();
foreach ($menu as $k=>$v) {
$to_check_url = $v['url'];
if( stripos($to_check_url,MODULE_NAME)!==0 ){
$trule = MODULE_NAME.'/'.$to_check_url;
}else{
$trule = $to_check_url;
}
if($this->checkRule($trule, AuthRuleModel::RULE_URL,null)){
redirect(U("$trule"));
}
}
}
# code...
}
/**
* 权限检测
* @param string $rule 检测的规则

@ -1070,17 +1070,26 @@ class MemberController extends ThinkController
setPowerPromoteIds($map,'promote_id');
if (isset($_REQUEST['promote_id'])) {
$map['promote_id'] = $_REQUEST['promote_id'];
if (I('promote_level') ==1) {
$promote_ids = getOffspringByPromoteId($_REQUEST['promote_id']);
if (empty($promote_ids)) {
$promote_ids = -1;
}
$map['promote_id'] = ['exp', "in($promote_ids)"];
} else {
$map['promote_id'] = $_REQUEST['promote_id'];
}
unset($_REQUEST['promote_id']);
}
// $map['type'] = 1;
// $map['login_time'] = ['exp', 'login_time<>0'];
$extend = array();
$extend['map'] = $map;
$count = M('UserLoginRecord','tab_')->field('user_id')->where($extend['map'])->group('user_id')->select(false);
$sql = "select count(user_id) as count from ({$count})t";
$count = M('UserLoginRecord','tab_')->query($sql);
// var_dump($sql);die();
$this->m_title = '登录记录';
$this->assign('user_count',$count[0]['count']);

@ -199,6 +199,16 @@ class PromoteController extends ThinkController
parent::lists('SiteApply', $p, $map);
}
private function accountExist($account, $id = null)
{
$res = M('promote', 'tab_')->where(['account' => $account])->field('id')->find();
if ($res) {
return $id != $res['id'];
} else {
return false;
}
}
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, $company_id = null)
{
@ -206,6 +216,9 @@ class PromoteController extends ThinkController
if (C('PROMOTE_AUTO_AUDIT') == 1) {
$status = 1;
}
if ($this->accountExist($account)) {
$this->error('该账号已存在');
}
$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'=>session('user_auth')['uid'],'status'=>$status,'ba_id'=>$ba_id, 'company_id' => $company_id);
@ -224,7 +237,7 @@ class PromoteController extends ThinkController
session('user_auth_promote_ids', null);
$this->success("添加成功", U('lists'));
} else {
$this->error($res);
$this->error('添加失败');
}
} else {
$this->meta_title ='新增渠道信息';
@ -264,7 +277,9 @@ class PromoteController extends ThinkController
$data['account'] = I('post.account');
$map1['id'] = array('neq',$_POST['id']);
$map1['account'] = $data['account'];
if ($this->accountExist($data['account'])) {
$this->error('该账号已存在');
}
$pdata = D('Promote')->where($map1)->find();
if ($pdata) {

@ -25,10 +25,6 @@
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.select2-dropdown {
z-index: 1;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">

@ -232,12 +232,14 @@
</if>
</td>
<td>{:get_business_affairs_account($data['ba_id'])}</td>
<td><if condition="$data['status'] eq 0">
<span class="preview_status">{:get_info_status($data['status'],3)}</span>
<td>
<?php $status_str = get_info_status($data['status'],3); $status_str = $status_str ?: '待审核';?>
<if condition="$data['status'] eq 0">
<span class="preview_status">{$status_str}</span>
<elseif condition="$data['status'] eq 2 " />
<span class="disabled_status">{:get_info_status($data['status'],3)}</span>
<span class="disabled_status">{$status_str}</span>
<else/>
{:get_info_status($data['status'],3)}
{$status_str}
</if>
</td>
<td>
@ -605,7 +607,8 @@
jsgameid();
}else{
alert('请求失败');
var tip_msg = res.info ? res.info : '操作失败';
layer.msg(tip_msg);
}
});
});

@ -10,7 +10,7 @@
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<block name="css"></block>
<link rel="stylesheet" type="text/css" href="__CSS__/{$Think.config.COLOR_STYLE}.css" media="all">
<!--[if lt IE 9]>
<script type="text/javascript" src="__STATIC__/jquery-1.10.2.min.js"></script>
<![endif]--><!--[if gte IE 9]><!-->
@ -77,7 +77,7 @@
</div>
</div>
</div>
<!--下拉样式-->
<script type="text/javascript">
$(function(){
@ -89,23 +89,23 @@ $(function(){
}else{
ul.slideUp();
}
});
});
$('.jscbtn').click(function() {
$(this).siblings().slideToggle(200);
$(this).siblings().slideToggle(200);
return false;
});
$('.jssetcolor').click(function() {
var that = $(this),value=that.attr('data-value');
var par = that.closest('.jssubjectlist');
if (that.hasClass('disabled')) {return false;}
$('.jssetcolor').addClass('disabled');
$.post('{:U("Admin/set_color_style")}',{value:value},function(data) {
if (data.status==1) {
updateAlert(data.info,'tip_right');
@ -113,7 +113,7 @@ $(function(){
$('#tip').find('.tipclose').click();
setTimeout(function(){location.reload();},300);
},1500);
} else {
updateAlert(data.info,'tip_error');
setTimeout(function(){
@ -123,13 +123,13 @@ $(function(){
$('.jssetcolor').removeClass('disabled');
}
},'json');
return false;
});
})
</script>
<div id="tip" class="tip"><a class="tipclose hidden" ></a><div class="tipmain"><div class="tipicon"></div><div class="tipinfo">这是内容</div></div></div>
@ -138,7 +138,7 @@ $(function(){
var content = $('#main');
var top_alert = $('#tip');
//$('body').append('<div class="notice"><div><i></i>成功</div></div>');
top_alert.find('.tipclose').on('click', function () {
top_alert.removeClass('block').slideUp(200);
// content.animate({paddingTop:'-=55'},200);
@ -155,7 +155,7 @@ $(function(){
}
});
})
$('.new li:eq(1)').click(function(){
$.ajax({
type: 'POST',
@ -204,7 +204,7 @@ $(function(){
</div>
<div class="fgx">功能菜单</div>
<!-- 子导航 -->
<block name="sidebar">
<div id="subnav" class="subnav">
@ -255,7 +255,7 @@ $(function(){
<!-- nav -->
</block>
<if condition="CONTROLLER_NAME neq 'Index' ">
</if>
<block name="body"> </block>
</div>
@ -315,11 +315,11 @@ $(function(){
$this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
prev("h3").addClass('no').find("i").addClass("icon-fold").end().end().hide();
});*/
$("#subnav").on("click", "h3", function(event){
var e = event || window.event;
var target = $(e.target);
var $this = $(this);
var $this = $(this);
if ($this.index() == target.index())
$this.find(".icon").toggleClass("icon-fold");
else
@ -327,7 +327,7 @@ $(function(){
$this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
prev("h3").find("i").addClass("icon-fold").end().end().hide();
});
$("#subnav h3 a").click(function(e){e.stopPropagation()});

@ -934,7 +934,6 @@ class PromoteService {
'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,

@ -18,7 +18,7 @@
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
z-index: 10;
display: none;
float: left;
min-width: 160px;

@ -7,7 +7,7 @@
.select2-container .select2-search--inline{float:left;}
.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;margin-top:5px;border:none;font-size:100%;}
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none;}
.select2-dropdown{position:absolute;left:-100000px;z-index:1051;display:block;box-sizing:border-box;width:100%;border:1px solid #aaa;border-radius:4px;background-color:#fff;}
.select2-dropdown{position:absolute;left:-100000px;z-index:10;display:block;box-sizing:border-box;width:100%;border:1px solid #aaa;border-radius:4px;background-color:#fff;}
.select2-results{display:block;}
.select2-results__options{margin:0;padding:0;list-style:none;}
.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none;}

@ -17,7 +17,7 @@ body{
position: fixed;
top: 0;
left: 0;
z-index: 1000;
z-index: 9999;
width: 100%;
/* height: 50px;
line-height: 50px; */

Loading…
Cancel
Save