|
@@ -4,6 +4,7 @@ import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
"hongze/hongze_yb/models/response"
|
|
|
+ "hongze/hongze_yb/models/tables/company_product"
|
|
|
"hongze/hongze_yb/models/tables/rddp/report"
|
|
|
"hongze/hongze_yb/models/tables/rddp/report_chapter"
|
|
|
"hongze/hongze_yb/models/tables/yb_community_video"
|
|
@@ -23,7 +24,7 @@ const (
|
|
|
)
|
|
|
|
|
|
// AddCollection 加入收藏
|
|
|
-func AddCollection(userId, collectionType, primaryId, extendId, sourceAgent int) (collectionId int, err error) {
|
|
|
+func AddCollection(userId, collectionType, primaryId, extendId, sourceAgent int, companyId int64) (collectionId int, err error) {
|
|
|
if userId <= 0 || collectionType <= 0 || primaryId <= 0 {
|
|
|
return
|
|
|
}
|
|
@@ -110,11 +111,28 @@ func AddCollection(userId, collectionType, primaryId, extendId, sourceAgent int)
|
|
|
err = errors.New(fmt.Sprintf("收藏类型有误, 当前收藏类型%d", collectionType))
|
|
|
return
|
|
|
}
|
|
|
+ companyStatus := "潜在"
|
|
|
+ sellerId := 0
|
|
|
+ if companyId > 0 {
|
|
|
+ //查询ficc产品信息和ficc销售信息
|
|
|
+ companyInfo, e := company_product.GetByCompany2ProductId(companyId, 1)
|
|
|
+ if e != nil && e != utils.ErrNoRow {
|
|
|
+ err = errors.New("获取客户信息失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if companyInfo != nil && companyInfo.CompanyID > 0 {
|
|
|
+ companyStatus = companyInfo.Status
|
|
|
+ sellerId = companyInfo.SellerID
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
// 新增收藏
|
|
|
item := &yb_user_collection.YbUserCollection{
|
|
|
CollectionType: collectionType,
|
|
|
UserID: userId,
|
|
|
+ CompanyID: int(companyId),
|
|
|
+ CompanyStatus: companyStatus,
|
|
|
+ SellerID: sellerId,
|
|
|
PrimaryID: primaryId,
|
|
|
ExtendID: extendId,
|
|
|
State: 1,
|