Răsfoiți Sursa

修改权限

xiexiaoyuan 3 ani în urmă
părinte
comite
8a2947eb56
2 a modificat fișierele cu 10 adăugiri și 23 ștergeri
  1. 5 14
      models/report.go
  2. 5 9
      services/user_permission.go

+ 5 - 14
models/report.go

@@ -169,21 +169,12 @@ type ReportDetailResp struct {
 // PermissionCheckInfo 权限校验完成后的结果
 type PermissionCheckInfoResp struct {
 	Name         string       `description:"销售名称"`
-	Mobile       string       `description:"手机号"`
+	Mobile       string       `description:"销售手机号"`
 	Type         string       `description:"校验失败,没有权限,需要让前端处理的类型,枚举值:apply,contact"`
-	HzPhone      string       `description:"弘则公司电话"`
-	CustomerInfo CustomerInfoResp `description:"客户信息"`
-}
-
-
-// CustomerInfoResp 客户信息
-type CustomerInfoResp struct {
-	CompanyName string `description:"客户(公司)名称"`
-	Name        string `description:"联系人名称"`
-	Mobile      string `description:"手机号"`
-	Status      string `description:"状态"`
-	IsSuspend   int8   `description:"启用与否字段:1:暂停,0:启用"`
-	HasApply    bool   `description:"是否有申请过"`
+	Status       string       `description:"客户状态"`
+	HasApply     bool         `description:"是否有申请过"`
+	CompanyName  string       `description:"公司名称"`
+	RealName     string       `description:"联系人姓名"`
 }
 
 type ReportRecordReq struct {

+ 5 - 9
services/user_permission.go

@@ -86,14 +86,7 @@ func CheckUserReportPermission(user *models.WxUserItem, productId int, report *m
 		checkInfo.Type = "apply"
 	}else {
 		checkInfo.Type = "contact"
-		customerInfo := models.CustomerInfoResp{
-			CompanyName: company.CompanyName,
-			Status:      company.Status,
-			Name:        user.RealName,
-			IsSuspend:   int8(company.IsSuspend),
-			Mobile:      user.Mobile,
-		}
-		checkInfo.CustomerInfo = customerInfo
+		checkInfo.Status = company.Status
 		// 判断用户状态
 		if company.Status == utils.COMPANY_STATUS_LOSE {
 			status = 2
@@ -105,7 +98,10 @@ func CheckUserReportPermission(user *models.WxUserItem, productId int, report *m
 		}else if company.IsSuspend > 0 && company.Status == "试用" {  //如果客户产品被禁用了,只有在试用状态下,才不允许查看报告,那么没有权限
 			status = 2
 			msg = "您还未开通权限,如有需要请联系对口销售"
+			checkInfo.Status = "暂停试用"
 		}
+		checkInfo.CompanyName = company.CompanyName
+		checkInfo.RealName = user.RealName
 		//查找对应客户的销售信息
 		if company.SellerId > 0 {
 			adminInfo, tmpErr := models.GetAdminByAdminId(company.SellerId)
@@ -205,7 +201,7 @@ func CheckUserReportPermission(user *models.WxUserItem, productId int, report *m
 		}
 		//查询是否有申请过,如果有申请过的话,那么err是nil
 		if record != nil {
-			checkInfo.CustomerInfo.HasApply = true
+			checkInfo.HasApply = true
 		}
 	}
 	return