Bladeren bron

no message

xingzai 1 jaar geleden
bovenliggende
commit
069ae7407b

+ 118 - 0
controllers/cygx/yanxuan_special.go

@@ -13,6 +13,7 @@ import (
 	"os"
 	"path/filepath"
 	"strconv"
+	"strings"
 	"time"
 )
 
@@ -363,7 +364,21 @@ func (this *YanxuanSpecialController) List() {
 		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
 		return
 	}
+	pars = make([]interface{}, 0)
+	listAuthor, tmpErr := cygx.GetYanxuanSpecialAuthorList("", pars, 0, 999)
+	if tmpErr != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+		return
+	}
+
+	mapUserId := make(map[int]int)
+	for _, v := range listAuthor {
+		mapUserId[v.UserId] = v.Id
+	}
+
 	for _, v := range list {
+		v.SpecialAuthorId = mapUserId[v.UserId]
 		hasImg, err := utils.ArticleHasImgUrl(v.Content)
 		if err != nil {
 			return
@@ -591,5 +606,108 @@ func (this *YanxuanSpecialController) ListPv() {
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "导出成功"
+}
+
+// @Title 审批记录
+// @Description 审批记录接口
+// @Param   PageSize   query   int  true       "每页数据条数"
+// @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
+// @Success 200 {object} models.CygxYanxuanSpecialApprovalLogListResp
+// @router /yanxuan_special/approval_log_list [get]
+func (this *YanxuanSpecialController) ApprovalLogList() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+
+	pageSize, _ := this.GetInt("PageSize")
+	currentIndex, _ := this.GetInt("CurrentIndex")
+
+	var startSize int
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+	var condition string
+	var pars []interface{}
+	//只是查询驳回状态的数据
+	condition += ` AND a.approval_status =  2 `
+	total, err := cygx.GetCygxYanxuanSpecialApprovalLogCount(condition, pars)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+
+	list, tmpErr := cygx.GetCygxYanxuanSpecialApprovalLogList(condition, pars, startSize, pageSize)
+	if tmpErr != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败, Err:" + tmpErr.Error()
+		return
+	}
+
+	resp := new(cygx.CygxYanxuanSpecialApprovalLogListResp)
+	page := paging.GetPaging(currentIndex, pageSize, total)
+
+	resp.List = list
+	resp.Paging = page
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+}
+
+// @Title 按钮是否展示接口
+// @Description 按钮是否展示接口
+// @Success 200 {object} models.AddEnglishReportResp
+// @router /yanxuan_special/show_button [get]
+func (this *YanxuanSpecialController) ShowButton() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
 
+	resp := new(cygx.CygxYanxuanSpecialShowButton)
+	configCode := utils.TPL_MSG_NEI_RONG_ZU
+	cnfNeiRong, err := cygx.GetConfigByCode(configCode)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	//汪洋王芳手机号
+	configCode = utils.TPL_MSG_WANG_FANG_WANG_YANG
+	cnfWang, err := cygx.GetConfigByCode(configCode)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取失败,Err:" + err.Error()
+		return
+	}
+	//作者管理栏,只有内容组、汪洋、王芳、超管可见
+	if strings.Contains(cnfNeiRong.ConfigValue, sysUser.Mobile) || strings.Contains(cnfWang.ConfigValue, sysUser.Mobile) || sysUser.Role == utils.ROLE_TYPE_CODE_ADMIN {
+		resp.IsShowSpecialAuthor = true
+	}
+	br.Data = resp
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
 }

+ 7 - 0
models/cygx/config.go

@@ -49,3 +49,10 @@ func CygxConfigUpdateByCode(configValue, newValue string) (err error) {
 	_, err = o.Raw(sql, configValue, newValue).Exec()
 	return
 }
+
+func GetConfigByCode(configCode string) (item *CygxConfig, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_config WHERE config_code=? `
+	err = o.Raw(sql, configCode).QueryRow(&item)
+	return
+}

+ 5 - 0
models/cygx/cygx_yanxuan_special.go

@@ -52,6 +52,7 @@ type CygxYanxuanSpeciaResplItem struct {
 	Uv                string `description:"Uv"`
 	ArticleCollectNum int    // 文章收藏数量
 	AdminName         string // 审核人员姓名
+	SpecialAuthorId   int    //cygx_yanxuan_special_author 表主键ID 作者专栏ID
 }
 
 type Doc struct {
@@ -170,3 +171,7 @@ func GetCygxYanxuanSpecialCount(condition string, pars []interface{}) (count int
 	err = o.Raw(sqlCount, pars).QueryRow(&count)
 	return
 }
+
+type CygxYanxuanSpecialShowButton struct {
+	IsShowSpecialAuthor bool // 作者管理的按钮是否
+}

+ 57 - 0
models/cygx/cygx_yanxuan_special_approval_log.go

@@ -0,0 +1,57 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"github.com/rdlucklib/rdluck_tools/paging"
+)
+
+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
+}
+
+// 获取数量
+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)
+	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
+}

+ 18 - 0
routers/commentsRouter.go

@@ -3013,6 +3013,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"],
+        beego.ControllerComments{
+            Method: "ApprovalLogList",
+            Router: `/yanxuan_special/approval_log_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"],
         beego.ControllerComments{
             Method: "Add",
@@ -3067,6 +3076,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"],
+        beego.ControllerComments{
+            Method: "ShowButton",
+            Router: `/yanxuan_special/show_button`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"] = append(beego.GlobalControllerRouter["hongze/hz_crm_api/controllers/cygx:YanxuanSpecialController"],
         beego.ControllerComments{
             Method: "SpecialCollectList",

+ 2 - 0
utils/constants.go

@@ -400,6 +400,8 @@ const (
 	CYGX_USER_KEY_LABEL                            = "CYGX_USER_KEY_LABEL"              //查研观向用户标签
 	TPL_MSG_WANG_YANG                              = "tpl_msg_wang_yang"                //汪洋手机号地址参数
 	MicroRoadshowDefaultImgKey                     = "micro_roadshow_default_img"       // 音视频封面图
+	TPL_MSG_NEI_RONG_ZU                            = "tpl_msg_nei_rong_zu"              //内容组四人
+	TPL_MSG_WANG_FANG_WANG_YANG                    = "tpl_msg_wang_fang_wang_yang"      //权限模板消息接收人,王芳,汪洋
 	PERMISSION_ID_YANXUAN_DIFF                     = 20000                              // 买方研选区分3w和5w的差值
 	PERMISSION_ID_YANXUAN_10W_DIFF                 = 20032                              // 买方研选区分10W
 	ZHUAN_JIA_NAME                          string = "专家"