Merge branch 'master' of 47.111.118.107:wmtx/platform into hotfix/prompote_apply_ratio

master
chenzhi 5 years ago
commit 7e0fe5d975

@ -587,4 +587,15 @@ class AjaxController extends ThinkController{
$result = M('promote', 'tab_')->field("id,account,nickname")->where(['parent_id'=>$pid])->select(); $result = M('promote', 'tab_')->field("id,account,nickname")->where(['parent_id'=>$pid])->select();
$this->ajaxReturn(['code'=>1, 'data'=>$result]); $this->ajaxReturn(['code'=>1, 'data'=>$result]);
} }
public function getPromotersByLevelResource()
{
$level = I('level');
if (!$level) {
// return $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>[]]);
$level = '';
}
$this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>(new PromoteModel)->getPromotersByLevelResource($level)]);
}
} }

@ -78,8 +78,23 @@ class TestResourceController extends ThinkController
if(!empty(I('user_account'))){ if(!empty(I('user_account'))){
$map['tab_test_resource.user_account']=['like','%'.I('user_account').'%']; $map['tab_test_resource.user_account']=['like','%'.I('user_account').'%'];
} }
if(!empty(I('promote_name'))){ if(!empty(I('promote_id')) || I('promote_id')=="0"){
$map['tab_test_resource.promote_account']=['like','%'.I('promote_name').'%'];
$promote_id = I('promote_id');
$promnote_arr = M("promote","tab_")->field("id")->where("chain like '%/{$promote_id}/%'")->select();
$promnote_arr = array_column($promnote_arr,"id");
array_push($promnote_arr,$promote_id);
$promnote_arr = implode(",",$promnote_arr);
$map['tab_test_resource.promote_id']=['in',$promnote_arr];
if (!I("promote_level")) {
$map['tab_test_resource.promote_id']=I('promote_id');
}
} }
//为数据权限添加 //为数据权限添加
setPowerPromoteIds($map, 'tab_test_resource.promote_id'); setPowerPromoteIds($map, 'tab_test_resource.promote_id');
@ -91,6 +106,8 @@ class TestResourceController extends ThinkController
->order('tab_test_resource.create_time DESC') ->order('tab_test_resource.create_time DESC')
->select(); ->select();
// var_dump($data);die();
foreach ($data as $key => $value) { foreach ($data as $key => $value) {
$data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']); $data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']);
} }

@ -450,5 +450,30 @@ class PromoteModel extends Model{
} }
public function getPromotersByLevelResource($level)
{
if ($level) {
$where['level'] = $level;
}
$userAuth = session('user_auth');
setPowerPromoteIds($where,'id');
$offcialData = [0=>['id'=>0,'nickname'=>'官方渠道']];
$result = $this->field("*")->where($where)->select();
foreach ($result as &$item) {
$item['nickname'] = $item['account'] . ($item['nickname'] ? "({$item['nickname']})" : "");
}
if ((in_array('0',explode(',',$where['id'][1]))||$userAuth['data_empower_type']==1)) {
$result = array_merge($offcialData,$result);
// dump($result);die();
}
return $result;
}
} }

@ -74,10 +74,27 @@
<input type="text" name="user_account" placeholder="测试账号" class="" value="{:I('user_account')}"/>&nbsp; <input type="text" name="user_account" placeholder="测试账号" class="" value="{:I('user_account')}"/>&nbsp;
</div> </div>
<div class="input-list"> <!-- <div class="input-list">-->
<input type="text" name="promote_name" placeholder="所属推广员" class="" value="{:I('promote_name')}"/>&nbsp; <!-- <input type="text" name="promote_name" placeholder="所属推广员" class="" value="{:I('promote_name')}"/>&nbsp;-->
<!-- </div>-->
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">
<option value="">请选择推广员等级</option>
<option value="1" <?php if ($_POST['promote_level'] == 1):?>selected<?php endif;?>>会长</option>
<option value="2" <?php if ($_POST['promote_level'] == 2):?>selected<?php endif;?>>部门长</option>
<option value="3" <?php if ($_POST['promote_level'] == 3):?>selected<?php endif;?>>组长</option>
<option value="4" <?php if ($_POST['promote_level'] == 4):?>selected<?php endif;?>>组员</option>
</select>
-
</div> </div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_id" style="color:#444" class="select_gallery" id="promote_id">
<option value="">请选择推广员</option>
</select>
</div>
</empty> </empty>
<input type="hidden" name="" value="" class="sortBy"> <input type="hidden" name="" value="" class="sortBy">
<input type="hidden" name="type" value="{$_GET['type']}"> <input type="hidden" name="type" value="{$_GET['type']}">
@ -200,6 +217,7 @@
<script type="text/javascript"> <script type="text/javascript">
//导航高亮 //导航高亮
highlight_subnav('{:U('testResource/supportNumberList')}'); highlight_subnav('{:U('testResource/supportNumberList')}');
$(".select_gallery").select2();
$(function(){ $(function(){
$('.froze-btn').on({ $('.froze-btn').on({
@ -221,6 +239,29 @@
} }
}) })
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevelResource')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',
success:function(response){
str = '<option value="">请选择推广员</option>' +
// '<option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>官方渠道</option>' +
'';
data = response.data;
for (var i in data){
str += "<option value='"+data[i].id+"' "+(promote_id && data[i].id == promote_id?'selected':'')+">"+data[i].nickname+"</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
});
$("#promote_level").change();
$('#batch_freeze').click(function () { $('#batch_freeze').click(function () {
var ids = $('.ids:checked'); var ids = $('.ids:checked');

Loading…
Cancel
Save