浏览代码

价格驱动接口调整

hsun 2 年之前
父节点
当前提交
e0edfc671b

+ 21 - 18
models/response/permission.go

@@ -1,33 +1,36 @@
 package response
 
 type PermissionFirstItem struct {
-	AuthOk     bool
-	Sort       int
-	IsCheck    bool
-	List       PermissionFiccSecondList
+	Id          int `description:"一级品种ID"`
+	AuthOk      bool
+	Sort        int
+	IsCheck     bool
+	List        PermissionFiccSecondList
 	YbIndexName string
 	YbIndexIcon string
 }
 
 type PermissionFiccItem struct {
-	ClassifyName    string   `json:"classify_name"`
-	List            PermissionFiccSecondList   `json:"list"`
-	Sort           int       `json:"sort"`
-	IconUrl       string     `json:"icon_url"`
-	SelectIconUrl     string     `json:"select_icon_url"`
+	Id            int                      `json:"id"`
+	ClassifyName  string                   `json:"classify_name"`
+	List          PermissionFiccSecondList `json:"list"`
+	Sort          int                      `json:"sort"`
+	IconUrl       string                   `json:"icon_url"`
+	SelectIconUrl string                   `json:"select_icon_url"`
 }
 
 type PermissionFiccSecondItem struct {
-	ChartPermissionName string    `json:"chart_permission_name"`
+	ChartPermissionName string `json:"chart_permission_name"`
 	ChartPermissionID   int    `json:"chart_permission_id"`
-	Sort           int 	`json:"sort"`
-	AuthOk     bool   `json:"auth_ok"`
+	Sort                int    `json:"sort"`
+	AuthOk              bool   `json:"auth_ok"`
+	PirceDrivenState    int    `json:"pirce_driven_state" description:"价格驱动品种状态:0-关闭 1-开启"`
 }
 
 type PermissionFiccResp struct {
-	PermissionList 	PermissionFiccList `json:"permission_list"`
-	ContactInfo     PermissionCheckContactInfo    `json:"contact_info"`
-	CheckFlag    bool        `json:"check_flag"`
+	PermissionList PermissionFiccList         `json:"permission_list"`
+	ContactInfo    PermissionCheckContactInfo `json:"contact_info"`
+	CheckFlag      bool                       `json:"check_flag"`
 }
 type PermissionFiccList []*PermissionFiccItem
 
@@ -68,8 +71,8 @@ type PermissionCheckInfo struct {
 
 // PermissionCheckInfoContact 权限校验完成后的结果
 type PermissionCheckContactInfo struct {
-	Name         string       `json:"name" description:"销售名称"`
-	Mobile       string       `json:"mobile" description:"手机号"`
+	Name   string `json:"name" description:"销售名称"`
+	Mobile string `json:"mobile" description:"手机号"`
 }
 
 // CustomerInfo 客户信息
@@ -80,4 +83,4 @@ type CustomerInfo struct {
 	Status      string `json:"status" description:"状态"`
 	IsSuspend   int8   `json:"is_suspend" description:"启用与否字段:1:暂停,0:启用"`
 	HasApply    bool   `json:"has_apply" description:"是否有申请过"`
-}
+}

+ 7 - 6
models/tables/chart_permission/chart_permission.go

@@ -16,12 +16,13 @@ type ChartPermission struct {
 	ClassifyName        string    `gorm:"column:classify_name;type:varchar(50)" json:"classifyName"`
 	ProductName         string    `gorm:"column:product_name;type:varchar(50);default:''" json:"productName"`
 	ProductID           int       `gorm:"column:product_id;type:int(11);default:0" json:"productId"`
-	ImageURL            string    `gorm:"column:image_url;type:varchar(255)" json:"imageUrl"`                                  // 图片地址
-	ShowType            int8      `gorm:"column:show_type;type:tinyint(4);default:0" json:"showType"`                          // 1:查研观向小程序展示
-	IsOther             int8      `gorm:"column:is_other;type:tinyint(2);not null;default:0" json:"isOther"`                   // 是否是其他,用于查研观向小程序后台展示
-	IsReport            int8      `gorm:"index:is_report;column:is_report;type:tinyint(4);not null;default:0" json:"isReport"` // 是否是报告,用于查研观向小程序前台报告展示
-	CygxAuth            int8      `gorm:"column:cygx_auth;type:tinyint(4);not null;default:0" json:"cygxAuth"`                 // 是否是权限,用于查研观向小程序前台权限校验
-	YbImgUrl            string      `gorm:"column:yb_img_url;type:varchar(255)" json:"yb_img_url"`                            // 研报小程序报告列表icon
+	ImageURL            string    `gorm:"column:image_url;type:varchar(255)" json:"imageUrl"`                                     // 图片地址
+	ShowType            int8      `gorm:"column:show_type;type:tinyint(4);default:0" json:"showType"`                             // 1:查研观向小程序展示
+	IsOther             int8      `gorm:"column:is_other;type:tinyint(2);not null;default:0" json:"isOther"`                      // 是否是其他,用于查研观向小程序后台展示
+	IsReport            int8      `gorm:"index:is_report;column:is_report;type:tinyint(4);not null;default:0" json:"isReport"`    // 是否是报告,用于查研观向小程序前台报告展示
+	CygxAuth            int8      `gorm:"column:cygx_auth;type:tinyint(4);not null;default:0" json:"cygxAuth"`                    // 是否是权限,用于查研观向小程序前台权限校验
+	YbImgUrl            string    `gorm:"column:yb_img_url;type:varchar(255)" json:"yb_img_url"`                                  // 研报小程序报告列表icon
+	PriceDrivenState    int       `gorm:"column:price_driven_state;type:tinyint(4);not null;default:0" json:"price_driven_state"` // 品种价格驱动状态:0-关闭 1-开启
 }
 
 // TableName get sql table name.获取数据库表名

+ 1 - 1
models/tables/chart_permission_first/chart_permission_first.go

@@ -4,7 +4,7 @@ import "time"
 
 // ChartPermissionFirst 报告权限一级分类表
 type ChartPermissionFirst struct {
-	Id           uint64    `gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null" json:"-"`
+	Id           uint64    `gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null" json:"id"`
 	ClassifyName string    `gorm:"column:classify_name;type:varchar(50)"`                                        // 权限一级分类名称,与chart_permission的classify_name一致
 	YbIndexName  string    `gorm:"column:yb_index_name;type:varchar(50);default:''" `                            // 研报小程序首页简称
 	YbIndexSort  int      `gorm:"column:yb_index_sort;type:tinyint(4);default:0"`                               // 研报小程序首页排序

+ 4 - 1
models/tables/yb_price_driven/model.go

@@ -4,6 +4,9 @@ import "hongze/hongze_yb/global"
 
 // GetPriceDrivenByChartPermissionId 通过品种获取价格驱动
 func GetPriceDrivenByChartPermissionId(chartPermissionId int) (item *YbPriceDriven, err error) {
-	err = global.DEFAULT_MYSQL.Where("chart_permission_id = ?", chartPermissionId).First(&item).Error
+	err = global.DEFAULT_MYSQL.
+		Where("chart_permission_id = ? AND publish_state = 1", chartPermissionId).
+		Order("create_time DESC").
+		First(&item).Error
 	return
 }

+ 6 - 3
services/company/permission.go

@@ -599,9 +599,9 @@ func CheckUserChartPermission(companyId int64, userId int) (ok bool, permissionC
 }
 
 type FiccPermissionList struct {
-	ClassifyName  string            `description:"分类"`
+	ClassifyName string `description:"分类"`
 	//HasPermission bool              `description:"是否有权限"`
-	Items         []*PermissionItem `description:"子类"`
+	Items []*PermissionItem `description:"子类"`
 }
 
 type PermissionItem struct {
@@ -664,7 +664,8 @@ func GetHomeFiccPermissions(user user.UserInfo) (ret response.PermissionFiccResp
 	}
 	for _, v := range permissionFirstList {
 		permissionFirstMap[v.ClassifyName] = &response.PermissionFirstItem{
-			Sort: v.YbIndexSort+1000,
+			Id:          int(v.Id),
+			Sort:        v.YbIndexSort + 1000,
 			YbIndexName: v.YbIndexName,
 			YbIndexIcon: v.YbIndexIcon,
 		}
@@ -692,6 +693,7 @@ func GetHomeFiccPermissions(user user.UserInfo) (ret response.PermissionFiccResp
 		temp.ChartPermissionID = int(v.ChartPermissionID)
 		temp.ChartPermissionName = v.PermissionName
 		temp.AuthOk = permissionMap[v.ChartPermissionID]
+		temp.PirceDrivenState = v.PriceDrivenState
 		if _, ok := permissionFirstMap[v.ClassifyName]; ok {
 			permissionFirstMap[v.ClassifyName].List = append(permissionFirstMap[v.ClassifyName].List, temp)
 		} else {
@@ -704,6 +706,7 @@ func GetHomeFiccPermissions(user user.UserInfo) (ret response.PermissionFiccResp
 	var list response.PermissionFiccList
 	for _, v := range permissionFirstMap {
 		temp := new(response.PermissionFiccItem)
+		temp.Id = v.Id
 		temp.Sort = v.Sort
 		temp.ClassifyName = v.YbIndexName
 		temp.IconUrl = v.YbIndexIcon

+ 45 - 33
services/share_poster.go

@@ -72,6 +72,7 @@ func CreatePosterFromSource(codePage, codeScene, source, version, pars string) (
 		"chart_list":            1352,
 		"report_detail":         1420,
 		"report_list":           1344,
+		"price_driven":          1344,
 	}
 	widthMap := map[string]int{
 		"activity_detail":       1280,
@@ -82,6 +83,7 @@ func CreatePosterFromSource(codePage, codeScene, source, version, pars string) (
 		"chart_list":            1176,
 		"report_detail":         1176,
 		"report_list":           1176,
+		"price_driven":          1176,
 	}
 	width := widthMap[source]
 	height := heightMap[source]
@@ -245,37 +247,41 @@ func CreateAndUploadSunCode(page, scene, version string) (imgUrl string, err err
 }
 
 type PosterParsReq struct {
-	ActivityTitle   string `json:"activity_title"`
-	ActivityAvatar  string `json:"activity_avatar"`
-	ActivitySpeaker string `json:"activity_speaker"`
-	ActivityTime    string `json:"activity_time"`
-	ChartName       string `json:"chart_name"`
-	ChartImage      string `json:"chart_image"`
-	ReportType      string `json:"report_type"`
-	ReportAvatar    string `json:"report_avatar"`
-	ReportTitle     string `json:"report_title"`
-	ReportAbstract  string `json:"report_abstract"`
-	Stage1          string `json:"stage_1"`
-	Avatar1         string `json:"avatar_1"`
-	Title1          string `json:"title_1"`
-	Author1         string `json:"author_1"`
-	Tag1            string `json:"tag_1"`
-	Img1            string `json:"img_1"`
-	Time1           string `json:"time_1"`
-	Abstract1       string `json:"abstract_1"`
-	Status1         string `json:"status_1"`
-	Speaker1        string `json:"speaker_1"`
-	Stage2          string `json:"stage_2"`
-	Avatar2         string `json:"avatar_2"`
-	Title2          string `json:"title_2"`
-	Author2         string `json:"author_2"`
-	Tag2            string `json:"tag_2"`
-	Img2            string `json:"img_2"`
-	Abstract2       string `json:"abstract_2"`
-	Time2           string `json:"time_2"`
-	Status2         string `json:"status_2"`
-	Speaker2        string `json:"speaker_2"`
-	ListTitle       string `json:"list_title"`
+	ActivityTitle     string `json:"activity_title"`
+	ActivityAvatar    string `json:"activity_avatar"`
+	ActivitySpeaker   string `json:"activity_speaker"`
+	ActivityTime      string `json:"activity_time"`
+	ChartName         string `json:"chart_name"`
+	ChartImage        string `json:"chart_image"`
+	ReportType        string `json:"report_type"`
+	ReportAvatar      string `json:"report_avatar"`
+	ReportTitle       string `json:"report_title"`
+	ReportAbstract    string `json:"report_abstract"`
+	Stage1            string `json:"stage_1"`
+	Avatar1           string `json:"avatar_1"`
+	Title1            string `json:"title_1"`
+	Author1           string `json:"author_1"`
+	Tag1              string `json:"tag_1"`
+	Img1              string `json:"img_1"`
+	Time1             string `json:"time_1"`
+	Abstract1         string `json:"abstract_1"`
+	Status1           string `json:"status_1"`
+	Speaker1          string `json:"speaker_1"`
+	Stage2            string `json:"stage_2"`
+	Avatar2           string `json:"avatar_2"`
+	Title2            string `json:"title_2"`
+	Author2           string `json:"author_2"`
+	Tag2              string `json:"tag_2"`
+	Img2              string `json:"img_2"`
+	Abstract2         string `json:"abstract_2"`
+	Time2             string `json:"time_2"`
+	Status2           string `json:"status_2"`
+	Speaker2          string `json:"speaker_2"`
+	ListTitle         string `json:"list_title"`
+	CoreDrivenType    string `json:"core_driven_type"`
+	CoreDrivenContent string `json:"core_driven_content"`
+	MainVariable      string `json:"main_variable"`
+	UpdateTime        string `json:"update_time"`
 }
 
 // fillContent2Html 填充HTML动态内容
@@ -382,12 +388,12 @@ func fillContent2Html(source, pars, sunCodeUrl string, height int) (contentStr s
 		contentStr = strings.Replace(contentStr, "{{REPORT_ABSTRACT}}", abstract, 1)
 	case "special_column_list":
 		contentStr = strings.Replace(contentStr, "{{LIST_TITLE}}", params.ListTitle, 1)
-		contentStr = strings.Replace(contentStr, "{{STAGE_1}}", "第" + params.Stage1 + "期", 1)
+		contentStr = strings.Replace(contentStr, "{{STAGE_1}}", "第"+params.Stage1+"期", 1)
 		contentStr = strings.Replace(contentStr, "{{AVATAR_1}}", params.Avatar1, 1)
 		contentStr = strings.Replace(contentStr, "{{TITLE_1}}", params.Title1, 1)
 		contentStr = strings.Replace(contentStr, "{{AUTHOR_1}}", params.Author1, 1)
 		contentStr = strings.Replace(contentStr, "{{TAG_1}}", params.Tag1, 1)
-		contentStr = strings.Replace(contentStr, "{{STAGE_2}}", "第" + params.Stage2 + "期", 1)
+		contentStr = strings.Replace(contentStr, "{{STAGE_2}}", "第"+params.Stage2+"期", 1)
 		contentStr = strings.Replace(contentStr, "{{AVATAR_2}}", params.Avatar2, 1)
 		contentStr = strings.Replace(contentStr, "{{TITLE_2}}", params.Title2, 1)
 		contentStr = strings.Replace(contentStr, "{{AUTHOR_2}}", params.Author2, 1)
@@ -408,6 +414,12 @@ func fillContent2Html(source, pars, sunCodeUrl string, height int) (contentStr s
 		contentStr = strings.Replace(contentStr, "{{ABSTRACT_2}}", params.Abstract2, 1)
 		contentStr = strings.Replace(contentStr, "{{IMG_2}}", params.Img2, 1)
 		contentStr = strings.Replace(contentStr, "{{TIME_2}}", params.Time2, 1)
+	case "price_driven":
+		contentStr = strings.Replace(contentStr, "{{LIST_TITLE}}", params.ListTitle, 1)
+		contentStr = strings.Replace(contentStr, "{{CORE_DRIVEN_TYPE}}", params.CoreDrivenType, 1)
+		contentStr = strings.Replace(contentStr, "{{CORE_DRIVEN_CONTENT}}", params.CoreDrivenContent, 1)
+		contentStr = strings.Replace(contentStr, "{{MAIN_VARIABLE}}", params.MainVariable, 1)
+		contentStr = strings.Replace(contentStr, "{{UPDATE_TIME}}", params.UpdateTime, 1)
 	case "activity_list":
 		bgColorMap := map[string]string{
 			"未开始": "#E3B377",

+ 111 - 0
static/htm2img/price_driven.html

@@ -0,0 +1,111 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        html,body{
+            margin: 0;
+            padding: 0;
+        }
+        div{
+            box-sizing: border-box;
+        }
+        .box{
+            /* width: 294px;
+            height: 336px; */
+            width: 1176px;
+            height: 1344px;
+            background-color: #fff;
+            padding: 100px 64px 64px 60px;
+            border-radius: 16px;
+            border: 1px solid #ECECEC;
+            background-image: url('https://hzstatic.hzinsights.com/static/icon/hzyb/yb-bg-hzlogo.png');
+            background-position: top right;
+            background-size: 300px 300px;
+            background-repeat: no-repeat;
+        }
+        .title{
+            font-size: 64px;
+            font-weight: bold;
+            margin-bottom: 40px;
+        }
+        .flex{
+            height: 256x;
+            margin-top: 40px;
+            font-size: 56px;
+        }
+        .content-box{
+            height: 500px;
+            margin: 80px 0;
+            overflow: hidden;
+            font-size: 56px;
+        }
+        .text-one{
+            overflow: hidden;
+            white-space: nowrap;
+            text-overflow: ellipsis;
+        }
+        .item-img{
+            width: 188px;
+            height: 252px;
+            float: left;
+            object-fit: cover;
+            border-radius: 16px;
+            margin-right: 20px;
+        }
+        .item-title{
+            font-size: 52px;
+        }
+        .item-des{
+            height: 80px;
+            font-size: 44px;
+        }
+        .audio-box{
+            width: 200px;
+            height: 80px;
+            background: #E3B377;
+            border-radius: 40px;
+            color: #fff;
+            font-size: 48px;
+            float: right;
+            text-align: center;
+            line-height: 80px;
+        }
+        .audio-box img{
+            width: 60px;
+            height: 60px;
+            object-fit: cover;
+            position: relative;
+            top: 12px;
+        }
+        
+        
+        .xcx-img{
+            width: 256px;
+            height: 256px;
+            float: right;
+        }
+    </style>
+</head>
+<body>
+    <div class="box">
+        <div class="title">{{LIST_TITLE}}</div>
+        <div class="content-box">
+            <div style="margin-bottom: 40px;line-height: 80px">核心驱动({{CORE_DRIVEN_TYPE}}):{{CORE_DRIVEN_CONTENT}}</div>
+            <div style="margin-bottom: 40px;">关键变量: {{MAIN_VARIABLE}}</div>
+            <div>更新时间:{{UPDATE_TIME}}</div>
+        </div>
+        <div style="text-align:center;font-size:56px;color:#999">长按图片分享</div>
+        <div class="flex">
+            <div style="float: left;">
+                <div>长按识别小程序码</div>
+                <div style="color:#999">查看更多</div>
+            </div>
+            <img class="xcx-img" src="{{SUN_CODE}}" alt="">
+        </div>
+    </div>
+</body>
+</html>