From a8125bf37756cdc868d7cf273cfb3a7b8042d3ce Mon Sep 17 00:00:00 2001 From: jbrazz <2436953959@qq.com> Date: Mon, 4 Nov 2019 11:20:13 +0800 Subject: [PATCH] upt --- Application/Admin/Common/extend.php | 29 +++++++++++------ .../Controller/MemberController.class.php | 2 +- .../Controller/PromoteController.class.php | 10 ++---- .../RechargeSumController.class.php | 32 ++++++------------- .../Controller/SpendController.class.php | 2 +- .../Admin/Controller/UserController.class.php | 2 +- .../Admin/Model/PromoteModel.class.php | 23 ++++++------- Application/Admin/View/Member/user_info.html | 6 ++-- Application/Admin/View/Promote/lists.html | 1 + .../Admin/View/RechargeSum/summation.html | 5 +-- Application/Admin/View/Spend/lists.html | 4 ++- Application/Admin/View/User/rolelist.html | 7 ++-- Application/Home/Common/function.php | 24 ++++++++++---- 13 files changed, 79 insertions(+), 68 deletions(-) diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 5830f251a..12f895d64 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -200,7 +200,7 @@ function get_promote_list($select='') { */ function get_all_toppromote(){ $map['status']=1; - $map['parent_id']=0; + $map['level']=['lt', 4]; $list = M("Promote","tab_")->where($map)->select(); if (empty($list)){return '';} return $list; @@ -1364,14 +1364,25 @@ function get_pos_game($type=16){ return $data; } -function get_promote_levels($id=0){ - $data = M('promote','tab_')->field('parent_id,grand_id')->where(array('id'=>$id))->find(); - if($data['parent_id']==0&&$data['grand_id']==0){ - return '一级推广员'; - }elseif($data['parent_id']>0&&$data['grand_id']==0){ - return '二级推广员'; - }elseif($data['parent_id']>0&&$data['grand_id']>0){ - return '三级推广员'; +function get_promote_levels($id = 0) +{ + $data = M('promote', 'tab_')->field('parent_id, level')->where(array('id' => $id))->find(); + switch ($data['level']) { + case '1': + return "一级推广员"; + break; + case '2': + return "二级推广员"; + break; + case '3': + return "三级推广员"; + break; + case '4': + return "四级推广员"; + break; + + default: + return ''; } } diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index 98f059052..5c9666a5c 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -23,7 +23,7 @@ class MemberController extends ThinkController $maps['tab_user.promote_id'] = 0; $hav .= "tab_user.promote_id = 0"; } else{ - $promoter_ids = D("Promote")->where("parent_id={$_REQUEST['promote_id']} or grand_id={$_REQUEST['promote_id']} or id={$_REQUEST['promote_id']}")->field('id')->select(); + $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); if ($promoter_ids) { $maps['tab_user.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))]; $hav .= "tab_user.promote_id in (".implode(',', array_column($promoter_ids, 'id')).") "; diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 455386841..c17d531f2 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -86,14 +86,8 @@ unset($_REQUEST['parent_id']); } } - if(I('promote_level') == 1){ - $map['parent_id'] = 0; - }elseif(I('promote_level') == 2){ - $map['parent_id'] = ['neq',0]; - $map['grand_id'] = 0; - }elseif (I('promote_level') == 3) { - $map['parent_id'] = ['neq',0]; - $map['grand_id'] = ['neq',0]; + if (I("promote_level")) { + $map['level'] = I("promote_level"); } $this->m_title = '推广员列表'; diff --git a/Application/Admin/Controller/RechargeSumController.class.php b/Application/Admin/Controller/RechargeSumController.class.php index 8bd895682..02fcff00a 100644 --- a/Application/Admin/Controller/RechargeSumController.class.php +++ b/Application/Admin/Controller/RechargeSumController.class.php @@ -28,6 +28,15 @@ class RechargeSumController extends ThinkController{ $total = ['current'=>0,'sum'=>0]; + if(isset($_REQUEST['promote_id'])){ + if ($_REQUEST['promote_id'] > 0) { + $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); + $promoter_ids ? $rmap['promote_id'] = $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null; + } else { + $rmap['promote_id'] = $map['promote_id'] = 0; + } + } + for($start = $endtime; $start >= $starttime;$start -= 86400) { $startDate = $start; @@ -44,29 +53,6 @@ class RechargeSumController extends ThinkController{ $map['pay_way'] = array('egt',0); } - if(isset($_REQUEST['promote_id'])){ - // switch ($_REQUEST['promote_id']) { - // case 'GUANFANG': - // $map['promote_id'] = 0; - // $rmap['promote_id'] = 0; - // break; - // case 'PROMOTE': - // $map['promote_id'] = array('neq',0); - // $rmap['promote_id'] = array('neq',0); - // break; - // default: - // $map['promote_id'] = $_REQUEST['promote_id']; - // $rmap['promote_id'] = $_REQUEST['promote_id']; - // break; - // } - if ($_REQUEST['promote_id'] > 0) { - $promoter_ids = D("Promote")->where("parent_id={$_REQUEST['promote_id']} or grand_id={$_REQUEST['promote_id']} or id={$_REQUEST['promote_id']}")->field('id')->select(); - $promoter_ids ? $rmap['promote_id'] = $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null; - } else { - $rmap['promote_id'] = $map['promote_id'] = 0; - } - } - //当天注册人数 $registerNum = D('User')->where(array_merge($rmap,array('puid'=>0)))->getField("id",true); diff --git a/Application/Admin/Controller/SpendController.class.php b/Application/Admin/Controller/SpendController.class.php index 688a73315..ec6b90c4a 100644 --- a/Application/Admin/Controller/SpendController.class.php +++ b/Application/Admin/Controller/SpendController.class.php @@ -74,7 +74,7 @@ class SpendController extends ThinkController { if ($_REQUEST['promote_id'] == 0) { $map['promote_id'] = 0; } else { - $map['_complex'] = ['tp.parent_id'=>$_REQUEST['promote_id'], 'tp.grand_id'=>$_REQUEST['promote_id'], 'tp.id'=>$_REQUEST['promote_id'], '_logic' => 'or']; + $map['_complex'] = ['tp.chain'=>['like', "%/{$_REQUEST['promote_id']}/%"], 'tp.id'=>$_REQUEST['promote_id'], '_logic' => 'or']; } $tab_promote_join = "left join tab_promote as tp on tp.id = tab_spend.promote_id"; //unset($_REQUEST['promote_id']); diff --git a/Application/Admin/Controller/UserController.class.php b/Application/Admin/Controller/UserController.class.php index c95dec0b5..c4124f626 100644 --- a/Application/Admin/Controller/UserController.class.php +++ b/Application/Admin/Controller/UserController.class.php @@ -574,7 +574,7 @@ function think_ucenter_md5($str, $key = 'ThinkUCenter'){ if ($_REQUEST['promote_id'] == 0) { $map['promote_id'] = '0'; } else { - $queryStr = "parent_id={$_REQUEST['promote_id']} or grand_id={$_REQUEST['promote_id']} or id={$_REQUEST['promote_id']}"; + $queryStr = "chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}"; $promoter_ids = D("Promote")->where($queryStr)->field('id')->select(); $promoter_ids ? $map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))] : null; } diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index a12fecfa6..d3099116f 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -375,17 +375,18 @@ class PromoteModel extends Model{ public function getPromotersByLevel($level=1) { $result = []; - switch ($level) { - case 1: // 会长 - $result = $this->field("id, nickname")->where("grand_id = 0 and parent_id = 0")->select(); - break; - case 2: // 组长 - $result = $this->field("id, nickname")->where("grand_id = 0 and parent_id > 0")->select(); - break; - case 3: //组员 - $result = $this->field("id, nickname")->where("parent_id > 0 and grand_id > 0")->select(); - break; - } + // switch ($level) { + // case 1: // 会长 + // $result = $this->field("id, nickname")->where("grand_id = 0 and parent_id = 0")->select(); + // break; + // case 2: // 组长 + // $result = $this->field("id, nickname")->where("grand_id = 0 and parent_id > 0")->select(); + // break; + // case 3: //组员 + // $result = $this->field("id, nickname")->where("parent_id > 0 and grand_id > 0")->select(); + // break; + // } + $result = $this->field("*")->where("level={$level}")->select(); return $result; } } \ No newline at end of file diff --git a/Application/Admin/View/Member/user_info.html b/Application/Admin/View/Member/user_info.html index a44d286fe..92c825e37 100644 --- a/Application/Admin/View/Member/user_info.html +++ b/Application/Admin/View/Member/user_info.html @@ -124,7 +124,9 @@ - @@ -406,7 +408,7 @@ $(function(){ data:{level:$("#promote_level option:selected").val()}, dataType:'json', success:function(response){ - str = ''; + str = ''; // $.each(response.data, function(index, item){ // console.log(item.id); // str += ''; diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index 533dacbdc..62bfa1f13 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -96,6 +96,7 @@ +
diff --git a/Application/Admin/View/RechargeSum/summation.html b/Application/Admin/View/RechargeSum/summation.html index 585758b64..c761c06cb 100644 --- a/Application/Admin/View/RechargeSum/summation.html +++ b/Application/Admin/View/RechargeSum/summation.html @@ -77,8 +77,9 @@ -
diff --git a/Application/Admin/View/Spend/lists.html b/Application/Admin/View/Spend/lists.html index 5de823dd5..6d8831616 100644 --- a/Application/Admin/View/Spend/lists.html +++ b/Application/Admin/View/Spend/lists.html @@ -101,7 +101,9 @@ - diff --git a/Application/Admin/View/User/rolelist.html b/Application/Admin/View/User/rolelist.html index 896e1ff41..00067a910 100644 --- a/Application/Admin/View/User/rolelist.html +++ b/Application/Admin/View/User/rolelist.html @@ -73,7 +73,10 @@ - @@ -248,7 +251,7 @@ $(".select_gallery").select2(); data:{level:$("#promote_level option:selected").val()}, dataType:'json', success:function(response){ - str = ''; + str = ''; // $.each(response.data, function(index, item){ // console.log(item.id); // str += ''; diff --git a/Application/Home/Common/function.php b/Application/Home/Common/function.php index 82c350c61..4f9d93b91 100644 --- a/Application/Home/Common/function.php +++ b/Application/Home/Common/function.php @@ -713,13 +713,23 @@ function sum_promote_total_money($id) function get_promote_levels($id = 0) { - $data = M('promote', 'tab_')->field('parent_id,grand_id')->where(array('id' => $id))->find(); - if ($data['parent_id'] == 0 && $data['grand_id'] == 0) { - return '一级推广员'; - } elseif ($data['parent_id'] > 0 && $data['grand_id'] == 0) { - return '二级推广员'; - } elseif ($data['parent_id'] > 0 && $data['grand_id'] > 0) { - return '三级推广员'; + $data = M('promote', 'tab_')->field('parent_id, level')->where(array('id' => $id))->find(); + switch ($data['level']) { + case '1': + return "一级推广员"; + break; + case '2': + return "二级推广员"; + break; + case '3': + return "三级推广员"; + break; + case '4': + return "四级推广员"; + break; + + default: + return ''; } }