浏览代码

feat: 新增商机分配管理员

zhangxinlei1996 1 年之前
父节点
当前提交
07e2cca825
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      ent/entity/entity.go

+ 6 - 2
ent/entity/entity.go

@@ -31,6 +31,7 @@ type CurrentUser struct {
 	Empower_vip           int         //是否分配了超级订阅
 	Startdate_power       int64       //主体“企业”的开始时间
 	Enddate_power         int64       //主体“企业”的结束时间
+	NicheDis              int         //商机分配权限 1:企业商机分配管理员 2:部门商机分配管理员
 }
 
 //获取当前登录用户的手机号
@@ -53,7 +54,7 @@ func (c *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
 		Dept: &Department{},
 	}
 	currentUser.Ent = VarEntInfo.GetById(entId)
-	user := Mysql.SelectBySql(`SELECT a.name as user_name,d.product_type,d.start_time,d.end_time from entniche_user a 
+	user := Mysql.SelectBySql(`SELECT a.name as user_name,d.product_type,d.start_time,d.end_time,a.niche_dis from entniche_user a 
 		INNER JOIN entniche_user_role b on (a.id=? and b.role_id=? and a.id=b.user_id) 
 		left join entniche_power c on (c.status=1 and a.id=c.ent_user_id) 
 		left join entniche_wait_empower d on (d.end_time>? and a.ent_id=d.ent_id) 
@@ -63,6 +64,7 @@ func (c *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
 		currentUser.User_name, _ = (*user)[0]["user_name"].(string)
 		currentUser.User_power = 1
 		currentUser.Product_type, _ = (*user)[0]["product_type"].(string)
+		currentUser.NicheDis = qutil.IntAllDef((*user)[0]["niche_dis"], 1) //系统管理员P364默认是企业商机分配管理员
 		if strings.Contains(currentUser.Product_type, ProductType_member) {
 			currentUser.Empower_member = 1
 		} else if strings.Contains(currentUser.Product_type, ProductType_vip) {
@@ -86,7 +88,7 @@ func (c *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
 		}
 	} else {
 		//角色、权限
-		r := Mysql.SelectBySql(`SELECT a.name as user_name,a.power as user_power,b.role_id,d.id as dept_id,d.name as dept_name,d.subdis as dept_subdis,d.nodiff as dept_nodiff,e.id as dept_pid,g.product_type,g.start_time,g.end_time from entniche_user a 
+		r := Mysql.SelectBySql(`SELECT a.name as user_name,a.power as user_power,b.role_id,d.id as dept_id,d.name as dept_name,d.subdis as dept_subdis,d.nodiff as dept_nodiff,e.id as dept_pid,g.product_type,g.start_time,g.end_time,a.niche_dis from entniche_user a 
 			LEFT JOIN entniche_user_role b on (a.id=? and a.id=b.user_id) 
 			INNER JOIN entniche_department_user c on (a.id=? and a.id=c.user_id) 
 			INNER JOIN entniche_department d on (c.dept_id=d.id) 
@@ -97,8 +99,10 @@ func (c *CurrentUser) EntInfo(entId, entUserId int) *CurrentUser {
 		if r != nil && len(*r) == 1 {
 			currentUser.User_name, _ = (*r)[0]["user_name"].(string)
 			currentUser.User_power = qutil.IntAll((*r)[0]["user_power"])
+			currentUser.NicheDis = qutil.IntAllDef((*user)[0]["niche_dis"], 0)
 			if qutil.IntAll((*r)[0]["role_id"]) == Role_admin_department {
 				currentUser.Role_admin_department = true
+				currentUser.NicheDis = qutil.IntAllDef((*user)[0]["niche_dis"], 2) //部门管理员P364默认是部门商机分配管理员
 			}
 			currentUser.Dept.Id = qutil.IntAll((*r)[0]["dept_id"])
 			currentUser.Dept.Pid = qutil.IntAll((*r)[0]["dept_pid"])