소스 검색

Merge branch 'cygx/cygx_12.8' of http://8.136.199.33:3000/hongze/hz_crm_api into debug

xingzai 1 년 전
부모
커밋
bd978a5fca

+ 1 - 1
controllers/cygx/yanxuan_special.go

@@ -457,7 +457,7 @@ func (this *YanxuanSpecialController) Enable() {
 	} else {
 		status = 4
 	}
-	if tmpErr := cygx.EnableYanxuanSpecial(req.Id, status, req.Reason); tmpErr != nil {
+	if tmpErr := cygx.EnableYanxuanSpecial(req.Id, status, req.Reason, sysUser.RealName); tmpErr != nil {
 		br.Msg = "审批失败"
 		br.ErrMsg = "审批失败, Err:" + tmpErr.Error()
 		return

+ 6 - 5
models/cygx/cygx_user.go

@@ -366,11 +366,12 @@ type UserInteraction struct {
 	RegisterPlatform      int    `description:"来源 1小程序,2:网页 ,3:策略平台"`
 	SourcePlatform        string `description:"来源 'MOBILE:移动端小程序','PC:PC端小程序','CELUE:上海策略平台','WEB:查研观向网页版'"`
 	TagId                 int
-	TagName               string `orm:"column(tag_name);NOT NULL"`       // 标签名
-	ArticleTypes          string `orm:"column(article_types);NOT NULL"`  // 报告系列
-	ActivityTypes         string `orm:"column(activity_types);NOT NULL"` // 活动类型
-	Industries            string `orm:"column(industries);NOT NULL"`     // 产业
-	SubjectNames          string `orm:"column(subject_names);NOT NULL"`  // 标的
+	TagName               string // 标签名
+	ArticleTypes          string // 报告系列
+	ActivityTypes         string // 活动类型
+	Industries            string // 产业
+	SubjectNames          string // 标的
+	SpecialType           int    `description:"专栏类型 1:笔记,2:观点"`
 }
 
 // 查研观向图表

+ 11 - 3
models/cygx/cygx_yanxuan_special.go

@@ -99,11 +99,11 @@ type EnableCygxYanxuanSpecialReq struct {
 	Reason string //理由
 }
 
-func EnableYanxuanSpecial(id, status int, reason string) (err error) {
+func EnableYanxuanSpecial(id, status int, reason, adminName string) (err error) {
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
-	sql = `UPDATE cygx_yanxuan_special SET status=?,reason=?,publish_time=NOW() WHERE id = ? `
-	_, err = o.Raw(sql, status, reason, id).Exec()
+	sql = `UPDATE cygx_yanxuan_special SET status=?,reason=?,admin_name = ? , publish_time=NOW() WHERE id = ? `
+	_, err = o.Raw(sql, status, reason, adminName, id).Exec()
 	return
 }
 
@@ -175,3 +175,11 @@ func GetCygxYanxuanSpecialCount(condition string, pars []interface{}) (count int
 type CygxYanxuanSpecialShowButton struct {
 	IsShowSpecialAuthor bool // 作者管理的按钮是否
 }
+
+func GetYanxuanSpecialBySpecialId(specialId int) (item *CygxYanxuanSpecialItem, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := ``
+	sql = `SELECT a.* FROM cygx_yanxuan_special AS a WHERE a.id=? `
+	err = o.Raw(sql, specialId).QueryRow(&item)
+	return
+}

+ 29 - 1
models/cygx/cygx_yanxuan_special_approval_log.go

@@ -3,8 +3,31 @@ package cygx
 import (
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
 )
 
+type CygxYanxuanSpecialApprovalLog struct {
+	ApprovalLogId    int       `orm:"column(approval_log_id);pk"`
+	UserId           int       // 用户ID
+	CreateTime       time.Time // 创建时间
+	ModifyTime       time.Time // 修改时间
+	Content          string    // 内容
+	Tags             string    // 标签
+	ApprovalStatus   int       // 1通过、2驳回
+	ImgUrl           string    // 图片链接
+	DocUrl           string    // 文档链接
+	Reason           string    // 理由
+	Title            string    // 标题
+	Type             int       // 类型1:笔记,2:观点
+	CompanyTags      string    // 公司标签
+	IndustryTags     string    // 行业标签
+	YanxuanSpecialId int       // cygx_yanxuan_special 表主键ID
+	AdminName        string    // 审核人员姓名
+	AdminUserId      int       // 审核人员用户ID
+	SpecialName      string    // 专栏名称
+	NickName         string    // 昵称
+}
+
 type CygxYanxuanSpecialApprovalLogResp struct {
 	ApprovalLogId    int    `orm:"column(approval_log_id);pk"`
 	UserId           int    // 用户ID
@@ -25,7 +48,6 @@ type CygxYanxuanSpecialApprovalLogResp struct {
 	AdminUserId      int    // 审核人员用户ID
 	SpecialName      string // 专栏名称
 	NickName         string // 昵称
-	SpecialAuthorId  int    //cygx_yanxuan_special_author 表主键ID 作者专栏ID
 }
 
 // 获取数量
@@ -55,3 +77,9 @@ type CygxYanxuanSpecialApprovalLogListResp struct {
 	Paging *paging.PagingItem `description:"分页数据"`
 	List   []*CygxYanxuanSpecialApprovalLogResp
 }
+
+func AddCygxYanxuanSpecialApprovalLog(item *CygxYanxuanSpecialApprovalLog) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
+	return
+}

+ 8 - 0
models/cygx/cygx_yanxuan_special_user.go

@@ -119,3 +119,11 @@ func GetCygxYanxuanSpecialAuthorItemById(id int) (item *CygxYanxuanSpecialAuthor
 	err = o.Raw(sql, id).QueryRow(&item)
 	return
 }
+
+// 根据用户ID获取专栏详情
+func GetCygxYanxuanSpecialAuthorByUserId(userId int) (item *CygxYanxuanSpecialAuthorItem, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_yanxuan_special_author  WHERE user_id = ? `
+	err = o.Raw(sql, userId).QueryRow(&item)
+	return
+}

+ 1 - 0
models/db.go

@@ -454,6 +454,7 @@ func initCygx() {
 		new(cygx.CygxResourceDataIndustrialGroupManagement),
 		new(cygx.CygxResourceDataIndustrialGroupSubject),
 		new(cygx.CygxYanxuanSpecialAuthor),
+		new(cygx.CygxYanxuanSpecialApprovalLog),
 		new(cygx.CygxAllocationCompanyContract),
 		new(cygx.CygxAllocationCompanyContractLog),
 		new(cygx.CygxAllocationCompanyContractPermission),

+ 48 - 0
services/cygx/cygx_yanxuan_special.go

@@ -271,3 +271,51 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 	}
 	return
 }
+
+// 研选专栏审批记录
+func AddAddCygxYanxuanSpecialApprovalLog(user *models.WxUserItem, specialId, status int, reason string) {
+	var err error
+	defer func() {
+		if err != nil {
+			go alarm_msg.SendAlarmMsg(fmt.Sprint("获取研选专栏用户信息失败,GetYanxuanSpecialAuthorInfo Err ", err, "userId", user.UserId), 2)
+		}
+	}()
+	detail, e := cygx.GetYanxuanSpecialBySpecialId(specialId)
+	if e != nil {
+		err = errors.New("GetYanxuanSpecialBySpecialId, Err: " + e.Error())
+		return
+	}
+
+	specialAuthor, e := cygx.GetCygxYanxuanSpecialAuthorByUserId(detail.UserId)
+	if e != nil {
+		err = errors.New("GetCygxYanxuanSpecialAuthorByUserId, Err: " + e.Error())
+		return
+	}
+
+	item := new(cygx.CygxYanxuanSpecialApprovalLog)
+	item.UserId = detail.UserId
+	item.Content = detail.Content
+	item.Tags = detail.Tags
+	item.ApprovalStatus = status
+	item.ImgUrl = detail.ImgUrl
+	item.DocUrl = detail.DocUrl
+	item.Reason = reason
+	item.Title = detail.Title
+	item.Type = detail.Type
+	item.CompanyTags = detail.CompanyTags
+	item.IndustryTags = detail.IndustryTags
+	item.YanxuanSpecialId = specialId
+	item.AdminName = user.RealName
+	item.AdminUserId = user.UserId
+	item.SpecialName = specialAuthor.SpecialName
+	item.NickName = specialAuthor.NickName
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+
+	e = cygx.AddCygxYanxuanSpecialApprovalLog(item)
+	if e != nil {
+		err = errors.New("AddCygxYanxuanSpecialApprovalLog, Err: " + e.Error())
+		return
+	}
+	return
+}