diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 9d1972f58..a05e905ce 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2208,6 +2208,55 @@ function a_array_unique($array){ return $data; } } + /** + * 获取公会归属关系 + * @author chenzhi 20200219 + * $id 不传返回所有关系列表 + * 传入ID 返回对应的团体关系 + */ + function getCompanyRelation($id = -1) + { + $data = array( + ["id"=>0,'name'=>"自主开发及维护"], + ["id"=>1,'name'=>"只维护"], + ["id"=>2,'name'=>"无"] + ); + if($id > -1){ + foreach($data as $k=>$v){ + if($v['id'] == $id){ + return $v['name']; + break; + } + } + }else{ + return $data; + } + } + /** + * 获取公会等级对应名称 + * @author chenzhi 20200219 + * $id 不传返回所有等级名称 + * 传入ID 返回对应的等级名称 + */ + function getPromoteLeverName($id = -1) + { + $data = array( + ["id"=>1,'name'=>"会长"], + ["id"=>2,'name'=>"部门长"], + ["id"=>3,'name'=>"组长"], + ["id"=>4,'name'=>"组员"], + ); + if($id > -1){ + foreach($data as $k=>$v){ + if($v['id'] == $id){ + return $v['name']; + break; + } + } + }else{ + return $data; + } + } /** * 操作日志 diff --git a/Application/Admin/Controller/OldCountController.class.php b/Application/Admin/Controller/OldCountController.class.php index 903f911de..5602108ec 100644 --- a/Application/Admin/Controller/OldCountController.class.php +++ b/Application/Admin/Controller/OldCountController.class.php @@ -9,7 +9,9 @@ namespace Admin\Controller; */ class OldCountController extends \Think\Controller { - //财务分类汇总统计旧数据聚合 + /** + * 财务分类汇总统计旧数据聚合 + */ public function FinancialSummaryInit() { //清空数据库 @@ -23,7 +25,9 @@ class OldCountController extends \Think\Controller $Financial->setMonthFinancialSummary($v); } } - //超级签订单新增识别微信或者支付宝2019-12-11 + /* + *超级签订单新增识别微信或者支付宝2019-12-11 + */ public function gameSupersignPaywayInit() { $map = array( @@ -103,6 +107,25 @@ class OldCountController extends \Think\Controller } die("init ok"); } + /** + * 修改公会内外团关系跟随公司 旧数据跟随 20200318 + */ + public function promoteCompanyBelongInit() + { + //获取所有公司 + $comoany = M("PromoteCompany","tab_")->field("id,company_belong")->select(); + $comoany[] = ["id"=>0,"company_belong"=>0]; //海南万盟 + $count = count($comoany); + $promote = M("Promote","tab_"); + for ($i=0; $i < $count; $i++) { + $savedata = array( + "company_belong"=>$comoany[$i]['company_belong'] + ); + $tmpid = $comoany[$i]['id']; + $promote->where("company_id ='{$tmpid}'")->save($savedata); + } + die("promoteCompanyBelongInit success"); + } //获取公司月结所需要的所有月份截止至上个月 public function getMonthsList() { @@ -124,4 +147,5 @@ class OldCountController extends \Think\Controller } + } diff --git a/Application/Admin/Controller/PromoteCompanyController.class.php b/Application/Admin/Controller/PromoteCompanyController.class.php index 6655838a4..779518460 100644 --- a/Application/Admin/Controller/PromoteCompanyController.class.php +++ b/Application/Admin/Controller/PromoteCompanyController.class.php @@ -39,6 +39,9 @@ class PromoteCompanyController extends ThinkController if (isset($_REQUEST['company_type'])) { $map['company_type'] = $_REQUEST['company_type']; } + if (isset($_REQUEST['company_belong'])) { + $map['company_belong'] = $_REQUEST['company_belong']; + } $page = intval(I('get.p', 0)); @@ -146,8 +149,10 @@ class PromoteCompanyController extends ThinkController } } + $v['can_del'] = 0; }else{ //空值 + $v['can_del'] = 1; $v['list']=[ [ "account"=>"--", @@ -313,10 +318,23 @@ class PromoteCompanyController extends ThinkController if(isset($save['resources'])){ $save['resources'] = json_encode($save['resources'],JSON_UNESCAPED_UNICODE); } + //判断内外团是否修改 + $is_change_belong = false; + $company_id = $save['id']; + $y_belong = $model->field("company_belong")->where("id = {$save['id']}")->find()['company_belong']; + if(isset($save['company_belong']) && ($y_belong != $save['company_belong'])){ + $is_change_belong = true; + } $res = $model->save($save); if ($res) { \Think\Log::actionLog('PromoteCompany/edit', 'partner', $res); - + //处理底下所有会长的公会属性 + if($is_change_belong){ + $savedata = array( + "company_belong"=>$save['company_belong'] + ); + M("Promote","tab_")->where("company_id = '{$company_id}'")->save($savedata); + } addOperationLog(['op_type'=>1,'key'=>$_POST['company_name'],'op_name'=>'编辑推广公司','url'=>U('PromoteCompany/lists'),'menu'=>'推广员-推广员管理-推广公司管理-编辑推广公司']); $array=array( diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index ef77192dc..08799e5cf 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -50,7 +50,7 @@ class PromoteController extends ThinkController if (isset($_REQUEST['promote_id'])) { $promoteid = $_REQUEST['promote_id']; - $map['id'] = $_REQUEST['promote_id']; + $map['p.id'] = $_REQUEST['promote_id']; } if (isset($_REQUEST['parent_id'])) { if ($_REQUEST['parent_id']=='全部') { @@ -68,12 +68,12 @@ class PromoteController extends ThinkController if ($promoteid > 0 ) { if (in_array($promoteid,$zidarr)) { # code... - $map['id'] = $promoteid; + $map['p.id'] = $promoteid; }else{ - $map['id'] = 0; + $map['p.id'] = 0; } }else{ - $map['id']=array('in',$zid); + $map['p.id']=array('in',$zid); } // unset($_REQUEST['parent_id']); @@ -87,7 +87,7 @@ class PromoteController extends ThinkController } } if (I('status') || I('status', -1) == 0) { - $map['status'] = I('status'); + $map['p.status'] = I('status'); } if (I('ver_status') || I('ver_status', -1) == 0) { @@ -95,14 +95,14 @@ class PromoteController extends ThinkController } if (I("promote_level")) { - $map['level'] = I("promote_level"); + $map['p.level'] = I("promote_level"); } if (strlen(I('company_belong'))) { - $map['company_belong'] = I("company_belong"); + $map['p.company_belong'] = I("company_belong"); } if (!is_null(I('admin_uid', null))) { - $map['admin_id'] = I('admin_uid'); + $map['p.admin_id'] = I('admin_uid'); } $this->m_title = '推广员列表'; @@ -149,8 +149,21 @@ class PromoteController extends ThinkController //为数据权限添加 - setPowerPromoteIds($map, 'id'); - $list_data = D(self::model_name)->where($map)->order('id DESC')->page($p, $row)->select(); + setPowerPromoteIds($map, 'p.id'); + $list_data = D(self::model_name) + ->alias("p") + ->field("p.*,IFNULL(m.nickname,'无') admin_nickname,IFNULL(b.account,'暂无') b_account,IFNULL(if(substring_index(substring_index(p.`chain`,'/',2),'/',-1)='',p.id,substring_index(substring_index(p.`chain`,'/',2),'/',-1)),0) top_id") + ->join("sys_member m on p.admin_id = m.uid","left") + ->join("tab_business_affairs b on p.ba_id = b.id","left") + ->where($map)->order('id DESC'); + + if(isset($_REQUEST['export'])){ + $list_data = $list_data->select(false); + }else{ + $list_data = $list_data->page($p, $row)->select(false); + } + + $list_data = M()->table("(".$list_data.") a")->field("a.*,pr.account top_account")->join("tab_promote pr on a.top_id = pr.id")->select(); $list_data = D(self::model_name)->parseListData($list_data); $oa_data = []; if (I('oa_associated', -1) == -1) { @@ -178,7 +191,33 @@ class PromoteController extends ThinkController } } } - $count = D(self::model_name)->where($map)->count(); + //导出 + if(isset($_REQUEST['export'])){ + + $GetData = $_GET; + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U(CONTROLLER_NAME.'/'.ACTION_NAME,$GetData),'menu'=>"推广员-推广员管理-推广员列表-导出"]); + + data2csv($list_data,'推广员列表',array( + "id"=>"推广员ID", + "account"=>"推广员账号", + "mobile_phone"=>"手机号码", + "balance_coin"=>"平台币余额", + "pay_amount"=>"总流水", + "create_time"=>"注册时间", + "last_login_time"=>"最后登录时间", + "level_name"=>"渠道类型", + "top_account"=>"所属会长", + "company_belong_str"=>"公会归属", + "company_relation_str"=>"公会关系", + "admin_nickname"=>"归属管理员", + "b_account"=>"商务专员", + "status_str"=>"状态", + "ver_status"=>"身份状态", + "oa_associated_str"=>"oa关联" + )); + } + $count = D(self::model_name)->alias("p")->where($map)->count(); $page = set_pagination($count, $row); if ($page) { $this->assign('_page', $page); @@ -245,6 +284,9 @@ class PromoteController extends ThinkController } $company_belong = $_REQUEST['company_belong'] ?? 0; $company_relation = $_REQUEST['company_relation'] ?? 0; + if($company_id && $company_id > 0){ + $company_belong = M("PromoteCompany","tab_")->field("company_belong")->where("id = {$company_id}")->find()['company_belong']; + } $data = array( 'account'=>$account, 'password'=>$password, @@ -359,10 +401,13 @@ class PromoteController extends ThinkController if ($promote['level'] ==1) {//如果是会长才能修改的选项 if (!is_null($company_id)) { $data['company_id'] = $company_id;//推广公司 + if($company_id == 0){ + $data['company_belong'] = 0; + }else{ + $data['company_belong'] = M("PromoteCompany","tab_")->field("company_belong")->where("id = {$company_id}")->find()['company_belong']; + } } - - $data['company_belong'] = I('company_belong');//工会归属 - $data['company_relation'] = I('company_relation');//工会关系 + // $data['company_relation'] = I('company_relation');//工会关系 } $settlementType = intval(I('settlement_type', 1)); if (!empty(I('settlement_type')) && in_array($settlementType, [1, 2])) { @@ -373,6 +418,12 @@ class PromoteController extends ThinkController if ($promote['level'] == 1) {//修改会长底下推广员的推广公司 $array = array(); if ($promote['company_id'] != $company_id) { + //内外团关系也要跟着公司走 + if($company_id == 0){ + $array['company_belong'] = 0; + }else{ + $array['company_belong'] = M("PromoteCompany","tab_")->field("company_belong")->where("id = {$company_id}")->find()['company_belong']; + } $array['company_id'] = I('company_id'); } // if ($promote['company_belong'] != I('company_belong')) { @@ -1275,6 +1326,9 @@ class PromoteController extends ThinkController if (strlen(I('company_relation'))) { $map['pb.company_relation'] = I('company_relation'); } + if (isset($_REQUEST['company_belong'])) { + $map['p.company_belong'] = $_REQUEST['company_belong']; + } if (strlen(I('verify_status'))) { $map['verify_status'] = I('verify_status'); @@ -1309,16 +1363,22 @@ class PromoteController extends ThinkController //为数据权限添加 setPowerPromoteIds($map, 'pb.promote_id'); $model = M('promote_belong', 'tab_'); + $default_company = C('DEFAULT_COMPANY'); + $field = " + pb.id,pb.promote_id,pb.verify_status,pb.company_relation,pb.remark,pb.can_view_recharge,pb.approver_name,pb.applicant_name,pb.verify_time,pb.applicant_time,pb.company_type, + IFNULL(pc.company_name,'{$default_company}') company_name, + p.company_belong,p.account,p.mobile_phone,p.admin_id,p.ver_status,p.status,p.create_time + "; $list_data = $model->alias('pb') ->join('left join tab_promote as p on p.id=pb.promote_id') ->join('left join tab_promote_company as pc on pc.id = p.company_id') ->where($map) - ->field('p.*,pb.*, pc.company_name') + ->field($field) ->page($p, $row) ->order('verify_status asc,applicant_time asc') ->select(); // dd($model->_sql()); -// dd($list_data); + // dd($list_data); $count = $model->alias('pb') ->join('left join tab_promote as p on p.id=pb.promote_id')->where($map)->count(); $page = set_pagination($count, $row); if ($page) { diff --git a/Application/Admin/Controller/access_data_foldline.txt b/Application/Admin/Controller/access_data_foldline.txt deleted file mode 100644 index 06372c756..000000000 --- a/Application/Admin/Controller/access_data_foldline.txt +++ /dev/null @@ -1 +0,0 @@ -{"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":2,"player":0,"money":0},"active":[{"time":"0:00","count":1},{"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":1},{"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}]} \ No newline at end of file diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index e23869964..6b80b7179 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -421,13 +421,33 @@ class PromoteModel extends Model{ public function parseListData($result) { + //获取是否要隐藏重要信息 + $show_data_power = (is_administrator()|| session('user_auth')['show_data']); $parseData = array(); foreach ($result as $key => $value) { $parseData[$key] = $value; - $parseData[$key]['company_belong_str'] = $value['company_belong'] ? '外团' : '内团'; - $parseData[$key]['company_relation_str'] = $value['company_relation'] ? '只维护' : '自主开发及维护'; + $parseData[$key]['company_belong_str'] = getCompanyBlong($value['company_belong']); + $parseData[$key]['company_relation_str'] = getCompanyRelation($value['company_relation']); + $parseData[$key]['create_time'] = set_show_time($value['create_time']); + $parseData[$key]['last_login_time'] = set_show_time($value['last_login_time']); + $parseData[$key]['level_name'] = getPromoteLeverName($value['level']); + $parseData[$key]['status_str'] = get_info_status($value['status'],3) ?:"待审核"; + $parseData[$key]['ver_status'] = get_info_status($value['ver_status'],42) ?:"未认证"; + $parseData[$key]['oa_associated_str'] = $value['oa_associated'] == 1 ? "已关联" : "未关联"; + $parseData[$key]['pay_amount'] = sum_promote_total_money($value['id']); + + + if(!$show_data_power){ + $parseData[$key]['account'] = encryptStr($parseData[$key]['account']); + $parseData[$key]['mobile_phone'] = encryptStr($parseData[$key]['mobile_phone']); + $parseData[$key]['top_account'] = encryptStr($parseData[$key]['top_account']); + + } + + } return $parseData; + } diff --git a/Application/Admin/View/Promote/belong.html b/Application/Admin/View/Promote/belong.html index 7a0db395f..919ceca4d 100644 --- a/Application/Admin/View/Promote/belong.html +++ b/Application/Admin/View/Promote/belong.html @@ -74,35 +74,45 @@ -
- -
-
- -
-
- -
-
- -
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
diff --git a/Application/Admin/View/Promote/belong_add.html b/Application/Admin/View/Promote/belong_add.html index 145dea6b5..99ad10e4e 100644 --- a/Application/Admin/View/Promote/belong_add.html +++ b/Application/Admin/View/Promote/belong_add.html @@ -53,29 +53,30 @@ - + 工会归属: - -
- @@ -118,7 +118,7 @@
- @@ -126,7 +126,7 @@
- @@ -136,7 +136,7 @@
- @@ -144,10 +144,11 @@
- + + + +
@@ -201,8 +202,8 @@ 最后登录时间 渠道类型 所属会长 - 工会归属 - 工会关系 + 公会归属 + 公会关系 归属管理员 商务专员 状态 @@ -226,67 +227,39 @@ {$data.id} - - {$data.account} - - {$data.account|encryptStr} - + {$data.account} - - {$data.mobile_phone} - - {$data.mobile_phone|encryptStr} - + {$data.mobile_phone} {$data.balance_coin} - {:sum_promote_total_money($data['id'])} - {:set_show_time($data['create_time'])} - {:set_show_time($data['last_login_time'])} - {:get_promote_levels($data['id'])} + {$data['pay_amount']} + {$data['create_time']} + {$data['last_login_time']} + {$data['level_name']} - - {:getTopPromote($data['id'])['account']} - - {:encryptStr(getTopPromote($data['id'])['account'])} - + {$data['top_account']} {$data['company_belong_str']} {$data['company_relation_str']} - {:get_admin_nickname($data['admin_id'])} - {:get_business_affairs_account($data['ba_id'])} + {$data['admin_nickname']} + {$data['b_account']} - - {$status_str} + {$data.status_str} - {$status_str} + {$data.status_str} - {$status_str} + {$data.status_str} - - - 成功 - - - 拒绝 - - - 正在审核 - - - 修改审核中 - - - 未认证 - + {$data['ver_status']} - 已关联 + {$data.oa_associated_str} - 未关联 + {$data.oa_associated_str} 查看 @@ -296,9 +269,9 @@ $data['id'],"status"=>1,"msg_type"=>12,"field"=>"status"))}" class="ajax-get ">解锁 - + 资质认证 @@ -367,7 +340,7 @@
- 导出 + 导出 {$_page|default=''}
diff --git a/Application/Admin/View/PromoteCompany/add.html b/Application/Admin/View/PromoteCompany/add.html index 4a03c7299..6bed89cb6 100644 --- a/Application/Admin/View/PromoteCompany/add.html +++ b/Application/Admin/View/PromoteCompany/add.html @@ -111,10 +111,9 @@
diff --git a/Application/Admin/View/PromoteCompany/edit.html b/Application/Admin/View/PromoteCompany/edit.html index 733136c13..742d7e813 100644 --- a/Application/Admin/View/PromoteCompany/edit.html +++ b/Application/Admin/View/PromoteCompany/edit.html @@ -115,14 +115,9 @@
diff --git a/Application/Admin/View/PromoteCompany/lists.html b/Application/Admin/View/PromoteCompany/lists.html index 5f547a413..27564e782 100644 --- a/Application/Admin/View/PromoteCompany/lists.html +++ b/Application/Admin/View/PromoteCompany/lists.html @@ -39,7 +39,7 @@
@@ -65,6 +65,14 @@
+
+ +