|
@@ -73,3 +73,46 @@ func GetUserHasPermission(user *models.WxUserItem) (hasPermission int, sellerNam
|
|
|
popupMsg = "需要升级行业套餐权限才可参与此活动,请联系对口销售"
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+//获取用户对应的权限申请状态 文章详情
|
|
|
+func GetUserHasPermissionArticle(user *models.WxUserItem) (hasPermission int, sellerName, sellerMobile, popupMsg string, err error) {
|
|
|
+ //`description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,4:潜在客户,未提交过申请,5:潜在客户,已提交过申请"`
|
|
|
+ uid := user.UserId
|
|
|
+ applyCount, e := models.GetApplyRecordCount(uid)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCompanyPermissionUpgrade, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if user.CompanyId <= 1 {
|
|
|
+ if applyCount == 0 {
|
|
|
+ hasPermission = 4
|
|
|
+ } else {
|
|
|
+ hasPermission = 5
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ companyPermission, e := models.GetCompanyPermission(user.CompanyId)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetCompanyPermission, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if companyPermission != "" {
|
|
|
+ if applyCount > 0 {
|
|
|
+ hasPermission = 2
|
|
|
+ } else {
|
|
|
+ hasPermission = 3
|
|
|
+ //获取权益销售信息 如果是FICC的客户类型,则默认他申请过
|
|
|
+ sellerItemQy, e := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetSellerByCompanyIdCheckFicc, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if sellerItemQy != nil {
|
|
|
+ sellerName = sellerItemQy.Mobile
|
|
|
+ sellerMobile = sellerItemQy.RealName
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ popupMsg = "需要升级行业套餐权限才可查看此报告,请联系对口销售"
|
|
|
+ return
|
|
|
+}
|