瀏覽代碼

no message

xingzai 1 年之前
父節點
當前提交
c8503df137
共有 5 個文件被更改,包括 90 次插入17 次删除
  1. 5 4
      controllers/article.go
  2. 13 11
      models/article.go
  3. 35 0
      models/order/user_business_card.go
  4. 10 0
      services/article.go
  5. 27 2
      services/user_permission.go

+ 5 - 4
controllers/article.go

@@ -183,17 +183,18 @@ func (this *ArticleController) Detail() {
 				return
 			}
 			if sellerItemQy != nil {
-				hasPermission = 3
 				detail.SellerMobile = sellerItemQy.Mobile
 				detail.SellerName = sellerItemQy.RealName
 			}
 		}
 		detail.Body = ""
 		detail.BodyText = ""
-		resp.IsShowWxPay = utils.IS_SHOW_WX_PAY          //是否展示微信支付按钮
-		resp.GoodsList = services.GetUserGoodsCardList() //日卡月卡商品信息
+		resp.PopupPriceMsg = "您可以购买畅读卡后参与(¥99/日,¥999/月)"                                             //价格弹窗信息
+		resp.IsShowWxPay = utils.IS_SHOW_WX_PAY                                                      //是否展示微信支付按钮
+		resp.IsCompanyApply = services.GetUserApplyRecordCountByCompanyIdPay(user.CompanyId)         //获取客户是否有过历史申请记录
+		resp.IsNeedBusinessCard = services.GetCygxUserBusinessCardCount(user.UserId, user.CompanyId) //是否需要上传名片
+		resp.GoodsList = services.GetUserGoodsCardList()                                             //日卡月卡商品信息
 
-		//resp.IsCompanyApply =
 	}
 
 	if detail.ArticleTypeId == 14 {

+ 13 - 11
models/article.go

@@ -245,17 +245,19 @@ func GetArticlePermission(companyId int) (item *ChartPermission, err error) {
 }
 
 type ArticleDetailResp struct {
-	Detail         *ArticleDetail
-	HasPermission  int                    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
-	HasFree        int                    `description:"1:已付费(至少包含一个品类的权限),2:未付费(没有任何品类权限)"`
-	HaveResearch   bool                   `description:"是否有研选权限"`
-	Mobile         string                 `description:"用户手机号"`
-	PopupMsg       string                 `description:"权限弹窗信息"`
-	SellerMobile   string                 `description:"销售电话"`
-	SellerName     string                 `description:"销售姓名"`
-	IsShowWxPay    bool                   `description:"是否展示微信支付"`
-	IsCompanyApply bool                   `description:"机构是否申请过试用"`
-	GoodsList      []*order.CygxGoodsResp `description:"商品信息"`
+	Detail             *ArticleDetail
+	HasPermission      int                    `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
+	HasFree            int                    `description:"1:已付费(至少包含一个品类的权限),2:未付费(没有任何品类权限)"`
+	HaveResearch       bool                   `description:"是否有研选权限"`
+	Mobile             string                 `description:"用户手机号"`
+	PopupMsg           string                 `description:"权限弹窗信息"`
+	SellerMobile       string                 `description:"销售电话"`
+	SellerName         string                 `description:"销售姓名"`
+	PopupPriceMsg      string                 `description:"价格弹窗信息"`
+	IsShowWxPay        bool                   `description:"是否展示微信支付"`
+	IsCompanyApply     bool                   `description:"机构是否申请过试用"`
+	IsNeedBusinessCard bool                   `description:"是否需要上传名片"`
+	GoodsList          []*order.CygxGoodsResp `description:"商品信息"`
 }
 
 type ArticleDetailHtgjResp struct {

+ 35 - 0
models/order/user_business_card.go

@@ -0,0 +1,35 @@
+package order
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+	//"time"
+)
+
+type CygxUserBusinessCard struct {
+	Id               int    `orm:"column(id);pk"`
+	BusinessCarUrl   string `description:"名地址片"`
+	UserId           int    `description:"用户ID"`
+	RealName         string `description:"用户实际名称"`
+	Mobile           string `description:"手机号"`
+	CompanyName      string `description:"公司名称"`
+	SellerName       string `description:"所属销售"`
+	CreateTime       time.Time
+	ModifyTime       time.Time `description:"修改时间"`
+	RegisterPlatform int       `description:"来源"`
+	InviteName       string    `description:"邀请人"`
+}
+
+func GetCygxUserBusinessCardCount(userId int) (count int, err error) {
+	o := orm.NewOrm()
+	sql := `SELECT COUNT(1) AS count FROM cygx_user_business_card WHERE user_id=?  `
+	err = o.Raw(sql, userId).QueryRow(&count)
+	return
+}
+
+// 新增
+func AddCygxUserBusinessCard(item *CygxUserBusinessCard) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}

+ 10 - 0
services/article.go

@@ -586,6 +586,16 @@ func GetArticleDetailUserPower(user *models.WxUserItem, articleInfo *models.Arti
 		return
 	}
 
+	//是否是权益客户
+	raiCount, e := models.GetCompanyProductCount(companyId, utils.COMPANY_PRODUCT_RAI_ID)
+	if e != nil {
+		err = errors.New("GetCompanyProductCount, Err: " + e.Error())
+		return
+	}
+	if raiCount == 0 {
+		return
+	}
+
 	productDetail, e := models.GetCompanyProductDetailByCompanyId(companyId, 2)
 	if e != nil {
 		err = errors.New("GetCompanyProductDetailByCompanyId, Err: " + e.Error())

+ 27 - 2
services/user_permission.go

@@ -4,6 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"hongze/hongze_mfyx/models"
+	"hongze/hongze_mfyx/models/order"
 	"hongze/hongze_mfyx/utils"
 	"strings"
 )
@@ -97,8 +98,32 @@ func GetUserApplyRecordCount(userId int) (applyCount int, err error) {
 	return
 }
 
+// 是否需要上传名片
+func GetCygxUserBusinessCardCount(userId, companyId int) (isNeedBusinessCard bool) {
+	if companyId > 1 {
+		return
+	}
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println(err)
+			go utils.SendAlarmMsg(fmt.Sprint("判断用户是否开通了个人研选权限失败 GetCygxGoodsList, err:", err.Error()), 2)
+		}
+	}()
+	businessCardCount, e := order.GetCygxUserBusinessCardCount(userId)
+	if e != nil && e.Error() != utils.ErrNoRow() {
+		err = errors.New("GetCygxUserBusinessCardCount, Err: " + e.Error())
+		return
+	}
+	if businessCardCount > 0 {
+		return
+	}
+	isNeedBusinessCard = true
+	return
+}
+
 // 获取客户是否有过历史申请记录
-func GetUserApplyRecordCountByCompanyIdPay(companyIdPay int) (isApplyCount bool) {
+func GetUserApplyRecordCountByCompanyIdPay(companyIdPay int) (isCompanyApply bool) {
 	var err error
 	defer func() {
 		if err != nil {
@@ -116,7 +141,7 @@ func GetUserApplyRecordCountByCompanyIdPay(companyIdPay int) (isApplyCount bool)
 		return
 	}
 	if applyCount > 0 {
-		isApplyCount = true
+		isCompanyApply = true
 	}
 	return
 }