|
@@ -201,6 +201,16 @@ func (this *CompanyUserController) AddUser() {
|
|
|
}
|
|
|
companyProductList = append(companyProductList, tmpCompanyProduct)
|
|
|
} else if req.Source == "add_user" {
|
|
|
+ shareSellerId := 0
|
|
|
+ if req.CompanyId > 0 {
|
|
|
+ item, e := company.GetCompanyProductByCompanyIdAndProductId(req.CompanyId, productId)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "客户信息有误"
|
|
|
+ br.ErrMsg = "获取客户信息失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ shareSellerId = item.ShareSellerId
|
|
|
+ }
|
|
|
//获取当前操作员产品权限
|
|
|
tmpCompanyProductList, productErr := getSysCompanyProductList(productId, req.CompanyId)
|
|
|
if productErr != nil {
|
|
@@ -1628,16 +1638,11 @@ func (this *CompanyUserController) EditUser() {
|
|
|
br.ErrMsg = "获取当前操作员找不到产品权限"
|
|
|
return
|
|
|
}
|
|
|
- item, err := company.GetCompanyDetailById(wxUser.CompanyId)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
//操作权限校验
|
|
|
for _, v := range companyProductList {
|
|
|
- companyUserStatus := services.CheckCompanyUserButton(sysUser.RoleTypeCode, v.SellerId, sysUser.AdminId, v.ProductId, item.ShareSellerId, v.Status)
|
|
|
- if item.ShareSellerId == sysUser.AdminId {
|
|
|
+ companyUserStatus := services.CheckCompanyUserButton(sysUser.RoleTypeCode, v.SellerId, sysUser.AdminId, v.ProductId, v.ShareSellerId, v.Status)
|
|
|
+ if v.ShareSellerId == sysUser.AdminId {
|
|
|
companyUserStatus = true
|
|
|
}
|
|
|
if companyUserStatus == false {
|
|
@@ -5018,13 +5023,10 @@ func checkOpCompanyUserByUserId(userId, productId, opId int, roleTypeCode string
|
|
|
err = errors.New("删除失败,获取当前操作员找不到产品权限")
|
|
|
return
|
|
|
}
|
|
|
- item, err := company.GetCompanyDetailById(userInfo.CompanyId)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
//操作权限校验
|
|
|
for _, v := range companyProductList {
|
|
|
- companyUserStatus := services.CheckCompanyUserButton(roleTypeCode, v.SellerId, opId, v.ProductId, item.ShareSellerId, v.Status)
|
|
|
+ companyUserStatus := services.CheckCompanyUserButton(roleTypeCode, v.SellerId, opId, v.ProductId, v.ShareSellerId, v.Status)
|
|
|
if companyUserStatus == false {
|
|
|
errMsg = "没有操作权限"
|
|
|
err = errors.New("没有操作权限")
|
|
@@ -5048,13 +5050,9 @@ func checkOpCompanyUserByCompanyId(companyId, productId, opId int, roleTypeCode
|
|
|
err = errors.New("删除失败,获取当前操作员找不到产品权限")
|
|
|
return
|
|
|
}
|
|
|
- item, err := company.GetCompanyDetailById(companyId)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
//操作权限校验
|
|
|
for _, v := range companyProductList {
|
|
|
- companyUserStatus := services.CheckCompanyUserButton(roleTypeCode, v.SellerId, opId, v.ProductId, item.ShareSellerId, v.Status)
|
|
|
+ companyUserStatus := services.CheckCompanyUserButton(roleTypeCode, v.SellerId, opId, v.ProductId, v.ShareSellerId, v.Status)
|
|
|
if companyUserStatus == false {
|
|
|
errMsg = "没有操作权限"
|
|
|
err = errors.New("没有操作权限")
|