Browse Source

fix:客户状态是:试用暂停状态(联系销售)

Roc 3 years ago
parent
commit
72b45419e4
2 changed files with 30 additions and 24 deletions
  1. 18 13
      logic/user/user.go
  2. 12 11
      services/company/permission.go

+ 18 - 13
logic/user/user.go

@@ -259,6 +259,9 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
 			if companyProductInfo.ProductID == 1 {
 				sellerName = companyProductInfo.SellerName
 				status = companyProductInfo.Status
+				if companyProductInfo.IsSuspend == 1 {
+					status = `试用暂停`
+				}
 			}
 		}
 		if len(sellerNameList) > 0 && len(statusList) > 0 {
@@ -305,18 +308,20 @@ func Apply(userId int, companyId int64, mobile, email string, applyInfo userReq.
 func GetUserTabBar(userInfo user.UserInfo) (list []string, err error) {
 	//buy,report,chart,activity,user
 	list = []string{"activity", "user"}
-	companyProduct, err := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
-	if err != nil {
-		if err == utils.ErrNoRow {
-			err = nil
-		}
-		return
-	}
-	if strings.Contains("永续,正式,试用", companyProduct.Status) {
-		list = append(list, "report", "chart")
-	}
-	if strings.Contains("永续,正式", companyProduct.Status) {
-		list = append(list, "buy")
-	}
+
+	//companyProduct, err := company_product.GetByCompany2ProductId(userInfo.CompanyID, 1)
+	//if err != nil {
+	//	if err == utils.ErrNoRow {
+	//		err = nil
+	//	}
+	//	return
+	//}
+	//if strings.Contains("永续,正式,试用", companyProduct.Status) {
+	//	list = append(list, "report", "chart")
+	//}
+	//if strings.Contains("永续,正式", companyProduct.Status) {
+	//	list = append(list, "buy")
+	//}
+
 	return
 }

+ 12 - 11
services/company/permission.go

@@ -60,6 +60,7 @@ type CustomerInfo struct {
 	Name        string `json:"name" description:"联系人名称"`
 	Mobile      string `json:"mobile" description:"手机号"`
 	Status      string `json:"status" description:"状态"`
+	IsSuspend   int8   `json:"is_suspend" description:"启用与否字段:1:暂停,0:启用"`
 	HasApply    bool   `json:"has_apply" description:"是否有申请过"`
 }
 
@@ -178,6 +179,7 @@ func CheckPermissionByPermissionIdList2Ficc(companyId int64, userId int, permiss
 			CompanyName: companyInfo.CompanyName,
 			Status:      companyProductInfo.Status,
 			Name:        wxUser.RealName,
+			IsSuspend:   companyProductInfo.IsSuspend,
 			Mobile:      wxUser.Mobile,
 		}
 		permissionCheckInfo.CustomerInfo = customerInfo
@@ -191,17 +193,21 @@ func CheckPermissionByPermissionIdList2Ficc(companyId int64, userId int, permiss
 		//查找对应客户的销售信息
 		adminInfo, tmpErr := admin.GetByAdminId(companyProductInfo.SellerID)
 		if tmpErr != nil {
+			//if tmpErr ==
 			err = tmpErr
 			return
 		}
 
+		permissionCheckInfo.Name = adminInfo.RealName
+		permissionCheckInfo.Mobile = adminInfo.Mobile
+		if companyProductInfo.Status == "冻结" {
+			permissionCheckInfo.Type = "contact"
+			return
+		}
+
 		//客户状态是:试用暂停状态(联系销售)
 		if companyProductInfo.Status == "试用" && companyProductInfo.IsSuspend == 1 {
-			permissionCheckInfo = PermissionCheckInfo{
-				Name:   adminInfo.RealName,
-				Mobile: adminInfo.Mobile,
-				Type:   "contact",
-			}
+			permissionCheckInfo.Type = "contact"
 			return
 		}
 
@@ -219,12 +225,7 @@ func CheckPermissionByPermissionIdList2Ficc(companyId int64, userId int, permiss
 				return
 			}
 		}
-
-		permissionCheckInfo = PermissionCheckInfo{
-			Name:   adminInfo.RealName,
-			Mobile: adminInfo.Mobile,
-			Type:   "contact",
-		}
+		permissionCheckInfo.Type = "contact"
 	} else {
 		permissionCheckInfo.Type = "apply"
 	}