ziwen 1 year ago
parent
commit
5703df08f9

+ 5 - 0
controllers/research.go

@@ -805,6 +805,11 @@ func (this *ResearchController) ArticleNewList() {
 		if v.ArticleTypeId == -1 {
 			item.ArticleTypeName = utils.CYGX_YANXUAN_SPECIAL
 		}
+		if v.SpecialType == 1 {
+			item.Title = "【笔记】"+item.Title
+		} else if v.SpecialType == 2 {
+			item.Title = "【观点】"+item.Title
+		}
 		resp.List = append(resp.List, &item)
 	}
 	resp.Paging = page

+ 2 - 0
controllers/yanxuan_special.go

@@ -147,6 +147,8 @@ func (this *YanxuanSpecialController) Detail() {
 		resp.Docs = docs
 	}
 
+	go services.AddSpecialRecord(this.User, specialId)
+
 	br.Data = resp
 	br.Ret = 200
 	br.Success = true

+ 3 - 0
models/report.go

@@ -500,6 +500,7 @@ type ArticleCollectionResp struct {
 	List                   []*IndustrialManagementResp `description:"产业列表"`
 	IsSpecial              int                         `description:"是否为研选专栏"`
 	SpecialTags            string                      `description:"研选专栏标签"`
+	SpecialType            int                         `description:"专栏类型 1:笔记,2:观点"`
 }
 
 type IndustrialManagementResp struct {
@@ -625,6 +626,7 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 			( SELECT count( 1 ) FROM cygx_article_collect AS ac  INNER JOIN wx_user as u ON  u.user_id = ac.user_id  WHERE ac.article_id = a.article_id AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( ac.create_time )  ) AS collect_num_order, 
 			( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id  AND user_id = ? ) AS my_collect_num,
 			0 AS is_special,
+			0 AS special_type,
 			'' AS special_tags 
 		FROM
 			cygx_article AS a
@@ -651,6 +653,7 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
 		0 AS collect_num_order,
 		( SELECT count( 1 ) FROM cygx_yanxuan_special_collect AS ac WHERE ac.yanxuan_special_id = a.id  AND user_id = ? ) AS my_collect_num,
 		1 AS is_special,
+		a.type AS special_type,
 		a.tags AS special_tags 
 	FROM
 	cygx_yanxuan_special AS a

+ 26 - 0
services/cygx_yanxuan_special_company.go

@@ -8,6 +8,7 @@ import (
 	"hongze/hongze_cygx/utils"
 	"io/ioutil"
 	"net/http"
+	"time"
 )
 
 func GetStocksFromVmp(cont context.Context) (err error) {
@@ -62,4 +63,29 @@ func GetStocksFromVmp(cont context.Context) (err error) {
 		return
 	}
 	return
+}
+
+func AddSpecialRecord(user *models.WxUserItem, specialId int) {
+	var sellerName string
+	sellerName, err := models.GetCompanySellerName(user.CompanyId)
+	if err != nil {
+		return
+	}
+	item := models.CygxYanxuanSpecialRecord{
+		UserId:           user.UserId,
+		Mobile:           user.Mobile,
+		Email:            user.Email,
+		CompanyId:        user.CompanyId,
+		CompanyName:      user.CompanyName,
+		RealName:         user.RealName,
+		SellerName:       sellerName,
+		CreateTime:       time.Now(),
+		ModifyTime:       time.Now(),
+		RegisterPlatform: utils.REGISTER_PLATFORM,
+		YanxuanSpecialId: specialId,
+	}
+	_, err = models.AddCygxYanxuanSpecialRecord(&item)
+	if err != nil {
+		return
+	}
 }