diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index 9d1972f58..db22be30f 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -2208,6 +2208,30 @@ 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; + } + } /** * 操作日志 diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 3adbadd69..a1ab50267 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -362,10 +362,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])) { @@ -376,6 +379,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')) { diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index 32da8b7dc..c086e0589 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -425,7 +425,7 @@ class PromoteModel extends Model{ foreach ($result as $key => $value) { $parseData[$key] = $value; $parseData[$key]['company_belong_str'] = getCompanyBlong($value['company_belong']); - $parseData[$key]['company_relation_str'] = $value['company_relation'] ? '只维护' : '自主开发及维护'; + $parseData[$key]['company_relation_str'] = getCompanyRelation($value['company_relation']); } return $parseData; } diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index a5a89189b..3e0fb49bf 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -93,7 +93,7 @@