浏览代码

no message

xingzai 1 年之前
父节点
当前提交
601cdb15bf

+ 1 - 1
controllers/cygx/yanxuan_special.go

@@ -457,7 +457,7 @@ func (this *YanxuanSpecialController) Enable() {
 	} else {
 	} else {
 		status = 4
 		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.Msg = "审批失败"
 		br.ErrMsg = "审批失败, Err:" + tmpErr.Error()
 		br.ErrMsg = "审批失败, Err:" + tmpErr.Error()
 		return
 		return

+ 11 - 3
models/cygx/cygx_yanxuan_special.go

@@ -99,11 +99,11 @@ type EnableCygxYanxuanSpecialReq struct {
 	Reason string //理由
 	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")
 	o := orm.NewOrmUsingDB("hz_cygx")
 	sql := ``
 	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
 	return
 }
 }
 
 
@@ -175,3 +175,11 @@ func GetCygxYanxuanSpecialCount(condition string, pars []interface{}) (count int
 type CygxYanxuanSpecialShowButton struct {
 type CygxYanxuanSpecialShowButton struct {
 	IsShowSpecialAuthor bool // 作者管理的按钮是否
 	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
+}

+ 24 - 47
models/cygx/cygx_yanxuan_special_approval_log.go

@@ -2,56 +2,33 @@ package cygx
 
 
 import (
 import (
 	"github.com/beego/beego/v2/client/orm"
 	"github.com/beego/beego/v2/client/orm"
-	"github.com/rdlucklib/rdluck_tools/paging"
+	"time"
 )
 )
 
 
-type CygxYanxuanSpecialApprovalLogResp struct {
-	ApprovalLogId    int    `orm:"column(approval_log_id);pk"`
-	UserId           int    // 用户ID
-	CreateTime       string // 创建时间
-	ModifyTime       string // 修改时间
-	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 // 昵称
-	SpecialAuthorId  int    //cygx_yanxuan_special_author 表主键ID 作者专栏ID
+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    // 昵称
 }
 }
 
 
-// 获取数量
-func GetCygxYanxuanSpecialApprovalLogCount(condition string, pars []interface{}) (count int, err error) {
-	o := orm.NewOrmUsingDB("hz_cygx")
-	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_yanxuan_special_approval_log as a WHERE 1= 1  `
-	if condition != "" {
-		sqlCount += condition
-	}
-	err = o.Raw(sqlCount, pars).QueryRow(&count)
+func AddCygxYanxuanSpecialApprovalLog(item *CygxYanxuanSpecialApprovalLog) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Insert(item)
 	return
 	return
 }
 }
-
-func GetCygxYanxuanSpecialApprovalLogList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxYanxuanSpecialApprovalLogResp, err error) {
-	o := orm.NewOrmUsingDB("hz_cygx")
-	sql := ``
-	sql = `SELECT * FROM cygx_yanxuan_special_approval_log AS a WHERE 1=1 `
-	if condition != "" {
-		sql += condition
-	}
-	sql += ` LIMIT ?,? `
-	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-	return
-}
-
-type CygxYanxuanSpecialApprovalLogListResp struct {
-	Paging *paging.PagingItem `description:"分页数据"`
-	List   []*CygxYanxuanSpecialApprovalLogResp
-}

+ 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)
 	err = o.Raw(sql, id).QueryRow(&item)
 	return
 	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

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

+ 48 - 0
services/cygx/cygx_yanxuan_special.go

@@ -271,3 +271,51 @@ func UpdateYanxuanSpecialResourceData(sourceId int) {
 	}
 	}
 	return
 	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
+}