|
@@ -234,58 +234,31 @@ func GetReportDetail(userinfo *models.WxUserItem, reportId int) (reportDetail fi
|
|
return
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //判断是否已经申请过
|
|
|
|
- applyCount, e := models.GetApplyRecordCount(userinfo.UserId)
|
|
|
|
- if e != nil {
|
|
|
|
- err = errors.New("判断是否已申请过试用失败")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
var hasPermission int
|
|
var hasPermission int
|
|
|
|
+ var hasPower bool
|
|
if userinfo.CompanyId > 1 {
|
|
if userinfo.CompanyId > 1 {
|
|
companyPermission, e := models.GetCompanyPermission(userinfo.CompanyId)
|
|
companyPermission, e := models.GetCompanyPermission(userinfo.CompanyId)
|
|
if e != nil {
|
|
if e != nil {
|
|
- err = errors.New("获取用户权限信息失败")
|
|
|
|
|
|
+ err = errors.New("GetCompanyPermission")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- fmt.Println(companyPermission)
|
|
|
|
- if companyPermission == "" {
|
|
|
|
- if applyCount > 0 {
|
|
|
|
- hasPermission = 6
|
|
|
|
- } else {
|
|
|
|
- hasPermission = 2
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- var hasPersion bool
|
|
|
|
|
|
+ if companyPermission != "" {
|
|
slice := strings.Split(companyPermission, ",")
|
|
slice := strings.Split(companyPermission, ",")
|
|
if utils.InArrayByStr(slice, "周期") {
|
|
if utils.InArrayByStr(slice, "周期") {
|
|
- hasPersion = true
|
|
|
|
- }
|
|
|
|
- if hasPersion {
|
|
|
|
- hasPermission = 1
|
|
|
|
- } else { //无该行业权限
|
|
|
|
- if applyCount == 0 {
|
|
|
|
- hasPermission = 4
|
|
|
|
- } else {
|
|
|
|
- hasPermission = 3
|
|
|
|
- }
|
|
|
|
|
|
+ hasPower = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //获取销售手机号
|
|
|
|
- sellerItem, e := models.GetSellerByCompanyId(userinfo.CompanyId)
|
|
|
|
- if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
|
- err = errors.New("获取销售数据失败")
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if hasPower {
|
|
|
|
+ hasPermission = 1
|
|
|
|
+ } else {
|
|
|
|
+ hasPermission, e = GetUserPermissionCode(userinfo.UserId, userinfo.CompanyId)
|
|
|
|
+ if e != nil {
|
|
|
|
+ err = errors.New("GetUserPermissionCode")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if sellerItem != nil {
|
|
|
|
- reportDetail.SellerMobile = sellerItem.Mobile
|
|
|
|
- reportDetail.SellerName = sellerItem.RealName
|
|
|
|
- }
|
|
|
|
- } else { //潜在客户
|
|
|
|
- if applyCount > 0 {
|
|
|
|
- hasPermission = 6
|
|
|
|
- } else {
|
|
|
|
- hasPermission = 5
|
|
|
|
- }
|
|
|
|
|
|
+ reportDetail.SellerName, reportDetail.SellerMobile, _ = GetSellerName(userinfo)
|
|
}
|
|
}
|
|
reportDetail.HasPermission = hasPermission
|
|
reportDetail.HasPermission = hasPermission
|
|
|
|
|