zhangchuanxing 1 mēnesi atpakaļ
vecāks
revīzija
a4503673fe
2 mainītis faili ar 16 papildinājumiem un 1 dzēšanām
  1. 8 1
      models/company/company_product.go
  2. 8 0
      services/wx_user.go

+ 8 - 1
models/company/company_product.go

@@ -79,12 +79,19 @@ func GetCompanyProductCount(companyId, productId int) (count int, err error) {
 }
 
 func GetCompanyProductDetailByCompanyId(companyId, productId int) (item *CompanyProduct, err error) {
-	sql := ` SELECT * FROM company_product WHERE company_id = ? AND product_id = ?; `
+	sql := ` SELECT * FROM company_product WHERE company_id = ? AND product_id = ?  `
 	o := orm.NewOrmUsingDB("weekly_report")
 	err = o.Raw(sql, companyId, productId).QueryRow(&item)
 	return
 }
 
+func GetCompanyProductDetailByCompanyIdCount(companyId, groupId int) (count int, err error) {
+	o := orm.NewOrmUsingDB("weekly_report")
+	sql := ` SELECT COUNT(1) AS count FROM   company_product WHERE company_id = ? AND product_id = ?  `
+	err = o.Raw(sql, companyId, groupId, groupId).QueryRow(&count)
+	return
+}
+
 func GetCompanyProductAaiServeCount(companyId, groupId int) (count int, err error) {
 	o := orm.NewOrmUsingDB("weekly_report")
 	sql := ` SELECT COUNT(1) AS count FROM  company_product WHERE  company_id = ?  AND product_id = 2 AND  (group_id = ? OR  share_group_id = ?) `

+ 8 - 0
services/wx_user.go

@@ -1518,6 +1518,14 @@ func GetWxUserEndDate(user *models.WxUserItem) (isShowTerminateButton bool, endD
 			go utils.SendAlarmMsg(fmt.Sprint("权益正式客户到期前30天弹窗消息提醒 失败GetWxUserEndDate, err:", err.Error(), "UserId", userId), 2)
 		}
 	}()
+	productDetailCount, e := company.GetCompanyProductDetailByCompanyIdCount(companyId, 2)
+	if e != nil {
+		err = errors.New("GetCompanyProductDetailByCompanyIdCount, Err: " + e.Error())
+		return
+	}
+	if productDetailCount == 0 {
+		return
+	}
 
 	productDetail, e := company.GetCompanyProductDetailByCompanyId(companyId, 2)
 	if e != nil {