Sfoglia il codice sorgente

Merge branch 'cygx/mfyx_3.6' of http://8.136.199.33:3000/hongze/hz_crm_api

xingzai 7 mesi fa
parent
commit
5373f904e1

+ 30 - 1
controllers/cygx/activity.go

@@ -128,6 +128,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 	videoDetail := req.VideoDetail
 	isBClass := req.IsBClass
 	isResearchPoints := req.IsResearchPoints
+	vivoPointsSet := req.VivoPointsSet
 	isShowHz := req.IsShowHz
 	isResearch := req.IsResearch //是否是研选类型的活动
 	if isResearch {
@@ -654,6 +655,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 				//音频 目前只有一个
 				itemVoice := new(cygx.CygxActivityVoice)
 				//var itemVoiceList []*cygx.CygxActivityVoice
+				var sourceVivo string // 音视频文件类型
 				if len(voiceList) > 0 {
 					for _, vo := range voiceList {
 						itemVoice.ActivityId = activityId
@@ -663,6 +665,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 						itemVoice.BackgroundImg = req.BackgroundImg
 						itemVoice.ShareImg = req.ShareImg
 						itemVoice.CreateTime = time.Now()
+						sourceVivo = utils.CYGX_OBJ_ACTIVITYVOICE
 					}
 				}
 				//视频
@@ -676,6 +679,7 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 					itemVideo.ShareImg = req.ShareImg
 					itemVideo.ModifyDate = time.Now().Format(utils.FormatDateTime)
 					itemVideo.CreateTime = time.Now().Format(utils.FormatDateTime)
+					sourceVivo = utils.CYGX_OBJ_ACTIVITYVIDEO
 				}
 				//删除原有的视频数据
 				//if itemVideo.VideoUrl != "" {
@@ -690,12 +694,19 @@ func (this *ActivityCoAntroller) PreserveAndPublish() {
 				//}
 				//}
 				//处理音视频上传
-				err := cygxService.UpdateActivityVideoAndVoice(activityInfo, itemVoice, itemVideo)
+				err = cygxService.UpdateActivityVideoAndVoice(activityInfo, itemVoice, itemVideo)
 				if err != nil && err.Error() != utils.ErrNoRow() {
 					br.Msg = "获取信息失败"
 					br.ErrMsg = "UpdateActivityVideoAndVoice,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
 					return
 				}
+
+				err = cygxService.UpdateActivityVivoPointsSet(activityInfo, vivoPointsSet, itemPointsSet, sourceVivo)
+				if err != nil {
+					br.Msg = "获取信息失败"
+					br.ErrMsg = "UpdateActivityVideoAndVoice,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+					return
+				}
 				//if itemVoice.VoiceUrl != "" {
 				//voiceReqList, err := cygx.GetCygxActivityVoiceReqList(activityId)
 				//if err != nil && err.Error() != utils.ErrNoRow() {
@@ -1180,6 +1191,24 @@ func (this *ActivityCoAntroller) Detail() {
 		activityInfo.BackgroundImg = VideoDetail.BackgroundImg
 		activityInfo.ShareImg = VideoDetail.ShareImg
 	}
+
+	totalVivo, err := cygx.GetCygxActivityVivoPointsSetCountByActivityId(activityId)
+	if err != nil {
+		br.Msg = "获取信息失败"
+		br.ErrMsg = "GetCygxActivityVivoPointsSetCountByActivityId,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
+	}
+
+	if totalVivo > 0 {
+		vivoPointsSetDetail, err := cygx.GetCygxActivityVivoPointsSetByActivityId(activityId)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取信息失败,Err:" + err.Error()
+			return
+		}
+		vivoPointsSetDetail.IsPay = 1
+		activityInfo.VivoPointsSet = *vivoPointsSetDetail
+	}
+
 	if activityInfo.CustomerTypeIds != "" {
 		customerTypeIdslist := strings.Split(activityInfo.CustomerTypeIds, ",")
 		var permissionValueStr string

+ 36 - 9
controllers/cygx/activity_video.go

@@ -401,20 +401,37 @@ func (this *ActivityVideoCoAntroller) VideoAndVoice() {
 			br.ErrMsg = "活动ID错误,Err:" + err.Error() + "activityId:" + strconv.Itoa(activityId)
 			return
 		}
-		//key := utils.MicroRoadshowDefaultImgKey
-		if fileType == 1 {
-			for _, v := range list.Audio {
-				if v.ChartPermissionId == activityInfo.ChartPermissionId {
-					resp.List = v.List
+
+		if activityInfo.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN { // 研选的音视频看全部行业
+			if fileType == 1 {
+				for _, v := range list.Audio {
+					for _, vFile := range v.List {
+						resp.List = append(resp.List, vFile)
+					}
+				}
+			} else {
+				for _, v := range list.Video {
+					for _, vFile := range v.List {
+						resp.List = append(resp.List, vFile)
+					}
 				}
 			}
 		} else {
-			for _, v := range list.Video {
-				if v.ChartPermissionId == activityInfo.ChartPermissionId {
-					resp.List = v.List
+			if fileType == 1 {
+				for _, v := range list.Audio {
+					if v.ChartPermissionId == activityInfo.ChartPermissionId {
+						resp.List = v.List
+					}
+				}
+			} else {
+				for _, v := range list.Video {
+					if v.ChartPermissionId == activityInfo.ChartPermissionId {
+						resp.List = v.List
+					}
 				}
 			}
 		}
+		//key := utils.MicroRoadshowDefaultImgKey
 	}
 
 	br.Ret = 200
@@ -434,6 +451,7 @@ func (this *ActivityVideoCoAntroller) VideoAndVoice() {
 // @Param   KeyWord   query   string  false       "搜索关键词"
 // @Param   SortType          query   string    false		"排序顺序:asc、desc"
 // @Param   SearchType          query   int    false		"类型 1 路演回放 ,2:调研反馈"
+// @Param   IsResearch   query   bool  true       "是否为研选"
 // @Success 200 {object} cygx.CygxActivityVideoListRep
 // @router /activity_voice_and_video/list [get]
 func (this *ActivityVideoCoAntroller) ActivityVoiceAndVideoList() {
@@ -458,6 +476,7 @@ func (this *ActivityVideoCoAntroller) ActivityVoiceAndVideoList() {
 	endDate := this.GetString("EndDate")
 	keyWord := this.GetString("KeyWord")
 	sortType := this.GetString("SortType")
+	isResearch, _ := this.GetBool("IsResearch")
 
 	var startSize int
 	if pageSize <= 0 {
@@ -475,6 +494,14 @@ func (this *ActivityVideoCoAntroller) ActivityVoiceAndVideoList() {
 		conditionVideo += ` AND (v.video_name LIKE '%` + keyWord + `%' )  `
 		conditionVoice += ` AND (v.voice_name LIKE '%` + keyWord + `%' )  `
 	}
+
+	if isResearch {
+		chartPermissionId = utils.CHART_PERMISSION_ID_YANXUAN //如果是研选添加一个研选行业的筛选
+		searchType = 0
+	} else {
+		condition += ` AND art.chart_permission_id  != ?  `
+		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+	}
 	//行业名称
 	if chartPermissionId > 0 {
 		condition += ` AND art.chart_permission_id  = ?  `
@@ -552,7 +579,7 @@ func (this *ActivityVideoCoAntroller) ActivityVoiceAndVideoList() {
 
 		//处理音视文件标识
 		mapVoice := make(map[int]bool)
-		var conditionVoice string
+		//var conditionVoice string
 		var parsVoice []interface{}
 		conditionVoice = " AND activity_id IN (" + activityIds + ")  "
 		listVoice, err := cygx.GetActivityVoiceList(conditionVoice, parsVoice)

+ 2 - 2
controllers/cygx/askserie_video.go

@@ -86,7 +86,7 @@ func (this *AskserieVideoController) PreserveAndPublish() {
 	item.CreateTime = time.Now()
 
 	if askserieVideoId == 0 {
-		shareImg, _ = cygxService.MakeCygxMp3HtmlImg(videoDuration) //生成分享图片
+		shareImg, _ = cygxService.MakeCygxMp3HtmlImg(videoDuration, 0) //生成分享图片
 		item.ShareImg = shareImg
 		//新增
 		newId, err := cygx.AddCygxAskserieVideo(item, industrialManagementIds)
@@ -106,7 +106,7 @@ func (this *AskserieVideoController) PreserveAndPublish() {
 		}
 		//如果时长有变更就更新分享图片
 		if detail.VideoDuration != videoDuration {
-			shareImg, _ = cygxService.MakeCygxMp3HtmlImg(videoDuration) //生成分享图片
+			shareImg, _ = cygxService.MakeCygxMp3HtmlImg(videoDuration, 0) //生成分享图片
 			item.ShareImg = shareImg
 		}
 

+ 1 - 1
controllers/cygx/micro_roadshow.go

@@ -254,7 +254,7 @@ func (this *MicroRoadshowController) Add() {
 			return
 		}
 	}
-	shareImg, _ := cygxService.MakeCygxMp4HtmlImg(req.VideoDuration) //生成分享图片
+	shareImg, _ := cygxService.MakeCygxMp4HtmlImg(req.VideoDuration, 0) //生成分享图片
 	req.ShareImgUrl = shareImg
 	nameItem.IndustryName = utils.RemoveFileSuffixName(nameItem.IndustryName) //去掉后缀名称
 	if req.VideoId > 0 {

+ 8 - 0
controllers/cygx/order.go

@@ -161,6 +161,10 @@ func (this *OrderController) OrderList() {
 			item.HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_ACTIVITY: //活动详情
 			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
+		case utils.CYGX_OBJ_ACTIVITYVIDEO: //活动视频
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
+		case utils.CYGX_OBJ_ACTIVITYVOICE: //活动音频
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //专栏详情
 			item.HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.SourceId)
 		}
@@ -447,6 +451,10 @@ func (this *OrderController) OrderRefundList() {
 		case utils.CYGX_OBJ_ARTICLE: //文章详情
 			item.HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_ACTIVITY: //活动详情
+		case utils.CYGX_OBJ_ACTIVITYVIDEO: //活动视频
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
+		case utils.CYGX_OBJ_ACTIVITYVOICE: //活动音频
+			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
 			item.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //专栏详情
 			item.HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.SourceId)

+ 3 - 2
controllers/cygx/user_admin_share_history.go

@@ -70,7 +70,8 @@ func (this *UserAdminShareHistoryController) OrderList() {
 	}
 
 	//用户行为搜索
-	if action == "查看专栏" || action == "查看报告" || action == "查看活动" || action == "注册" {
+	//if action == "查看专栏" || action == "查看报告" || action == "查看活动" || action == "注册" {
+	if action != "" {
 		condition += " 	AND action = ? "
 		pars = append(pars, action)
 	}
@@ -119,7 +120,7 @@ func (this *UserAdminShareHistoryController) OrderList() {
 		switch v.Source {
 		case utils.CYGX_OBJ_ARTICLE: //文章详情
 			v.HttpUrl = utils.CYGX_MFYX_URL + "/material/info/" + strconv.Itoa(v.SourceId)
-		case utils.CYGX_OBJ_ACTIVITY: //活动详情
+		case utils.CYGX_OBJ_ACTIVITY, utils.CYGX_OBJ_ACTIVITYVIDEO, utils.CYGX_OBJ_ACTIVITYVOICE: //活动详情
 			v.HttpUrl = utils.CYGX_MFYX_URL + "/activity/detail/" + strconv.Itoa(v.SourceId)
 		case utils.CYGX_OBJ_YANXUANSPECIAL: //研选专栏
 			v.HttpUrl = utils.CYGX_MFYX_URL + "/column/detail/" + strconv.Itoa(v.SourceId)

+ 47 - 45
models/cygx/activity.go

@@ -61,30 +61,31 @@ func GetActivityCcustomerTypeList(condition string) (items []*ActivityCcustomerT
 
 // 活动添加、修改入参
 type ActivityRep struct {
-	ActivityTypeId          int                       `description:"活动类型id"`
-	PermissionName          string                    `description:"行业名称"`
-	Body                    string                    `description:"内容"`
-	LimitPeopleNum          int                       `description:"限制的人数数量"`
-	CustomerTypeIds         string                    `description:"活动可见的客户类型,多个ID用 , 隔开  1、永续客户; 2、大套餐客户; 3、行业套餐客户; 4、专家套餐客户; 5、试用客户;6、冻结客户;7、流失客户  "`
-	ActivityId              int                       `description:"活动ID 等于0新增活动,大于0修改活动"`
-	DoType                  int                       `description:"操作类型 0,保存 、1,发布"`
-	IsMakerShow             int                       `description:"是否仅决策人可见 0,否 、1,是"`
-	VisibleRange            int                       `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
-	IsYidongConduct         int                       `description:"是否属于易董办会 1:是 、0:否"`
-	IsCanOutboundCall       int                       `description:"是否提供外呼 1:是 、0:否"`
-	LabelType               int                       `description:"标签类型 ,1单主题标签 ,2多主题标签"`
-	IndustrialManagementIdS string                    `description:"产业ID,多个用 , 隔开"`
-	IndustrialSubjectIdS    string                    `description:"标的ID,多个用,隔开"`
-	Scale                   string                    `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
-	IsExternalLabel         int                       `description:"是否为外部资源 1是,0否"`
-	IsBClass                int                       `description:"是否为B类电话会 1是,0否"`
-	IsNeedEmail             int                       `description:"是否需要提供邮箱 1是,0否"`
-	SiginupDeadline         string                    `description:"报名截止时间"`
-	IsResearchPoints        int                       `description:"是否为研选扣点  1是,0否"`
-	IsResearch              bool                      `description:"是否为研选"`
-	IsShowHz                int                       `description:"是否同时在弘则展示  1是,0否"`
-	PointsSet               *CygxActivityPointsSetRsq `description:"研选扣点明细"`
-	IsAllCustomerType       int                       `description:"是否全选活动可见类型 0无 1全选"`
+	ActivityTypeId          int                          `description:"活动类型id"`
+	PermissionName          string                       `description:"行业名称"`
+	Body                    string                       `description:"内容"`
+	LimitPeopleNum          int                          `description:"限制的人数数量"`
+	CustomerTypeIds         string                       `description:"活动可见的客户类型,多个ID用 , 隔开  1、永续客户; 2、大套餐客户; 3、行业套餐客户; 4、专家套餐客户; 5、试用客户;6、冻结客户;7、流失客户  "`
+	ActivityId              int                          `description:"活动ID 等于0新增活动,大于0修改活动"`
+	DoType                  int                          `description:"操作类型 0,保存 、1,发布"`
+	IsMakerShow             int                          `description:"是否仅决策人可见 0,否 、1,是"`
+	VisibleRange            int                          `description:"可见范围 1,仅本组可见 、2,全部客户可见"`
+	IsYidongConduct         int                          `description:"是否属于易董办会 1:是 、0:否"`
+	IsCanOutboundCall       int                          `description:"是否提供外呼 1:是 、0:否"`
+	LabelType               int                          `description:"标签类型 ,1单主题标签 ,2多主题标签"`
+	IndustrialManagementIdS string                       `description:"产业ID,多个用 , 隔开"`
+	IndustrialSubjectIdS    string                       `description:"标的ID,多个用,隔开"`
+	Scale                   string                       `description:"管理规模,空不填,1::50亿以下,2:50~100亿,3:100亿以上。多个用, 隔开"`
+	IsExternalLabel         int                          `description:"是否为外部资源 1是,0否"`
+	IsBClass                int                          `description:"是否为B类电话会 1是,0否"`
+	IsNeedEmail             int                          `description:"是否需要提供邮箱 1是,0否"`
+	SiginupDeadline         string                       `description:"报名截止时间"`
+	IsResearchPoints        int                          `description:"是否为研选扣点  1是,0否"`
+	IsResearch              bool                         `description:"是否为研选"`
+	IsShowHz                int                          `description:"是否同时在弘则展示  1是,0否"`
+	PointsSet               *CygxActivityPointsSetRsq    `description:"研选扣点明细"`
+	VivoPointsSet           CygxActivityVivoPointsSetReq `description:"研选音视频扣点设置"`
+	IsAllCustomerType       int                          `description:"是否全选活动可见类型 0无 1全选"`
 	List                    []*ActivityGroupIndustrialRep
 	VoiceList               []*CygxActivityVoiceReq
 	VideoDetail             *CygxActivityVideoReq
@@ -156,27 +157,28 @@ type ActivityDetail struct {
 	YidongActivityEndTime     string `description:"易董活动截止时间"`
 	VoiceList                 []*CygxActivityVoiceReq
 	VideoDetail               *CygxActivityVideo
-	ActivityJoinType          string                    `description:"活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
-	YidongSignUpEnd           string                    `description:"易董活动截止时间"` // 报名结束时间,适应于报名审核后可入会,为空表示不限制报名时间
-	YidongSignUpStart         string                    `description:"易董活动截止时间"` // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
-	PublishDate               string                    `description:"发布时间"`
-	IsYidongConduct           int                       `description:"是否属于易董办会 1:是 、0:否"`
-	IsCanOutboundCall         int                       `description:"是否提供外呼 1:是 、0:否"`
-	YidongActivityIdByCygx    string                    `description:"通过查研观向建会易董返回的活动ID"`
-	TencentConferenceNumber   string                    `description:"腾讯会议号"`
-	IsExternalLabel           int                       `description:"是否为外部资源 1是,0否"`
-	SigninImg                 string                    `description:"签到码图片"`
-	IsResearchPoints          int                       `description:"是否为研选扣点  1是,0否"`
-	IsBClass                  int                       `description:"是否为B类电话会 1是,0否"`
-	IsNeedEmail               int                       `description:"是否需要提供邮箱 1是,0否"`
-	SiginupDeadline           string                    `description:"报名截止时间"`
-	PointsSet                 *CygxActivityPointsSetRsq `description:"研选扣点明细"`
-	IsShowHz                  int                       `description:"是否同时在弘则展示  1是,0否"`
-	ChartPermissionNameDeputy string                    `description:"副行业名称"`
-	BackgroundImg             string                    `description:"封面图片"`
-	ShareImg                  string                    `description:"分享图片"`
-	TopTime                   int                       `description:"置顶时间"`
-	AreaType                  int                       `description:"地区,1国内,2海外,默认1"`
+	ActivityJoinType          string                     `description:"活动入会类型01报名审核后可入会 02预约即可入会 03仅定向邀请人员可入会"`
+	YidongSignUpEnd           string                     `description:"易董活动截止时间"` // 报名结束时间,适应于报名审核后可入会,为空表示不限制报名时间
+	YidongSignUpStart         string                     `description:"易董活动截止时间"` // 报名开始时间,适应于报名审核后可入会,为空表示不限制报名时间
+	PublishDate               string                     `description:"发布时间"`
+	IsYidongConduct           int                        `description:"是否属于易董办会 1:是 、0:否"`
+	IsCanOutboundCall         int                        `description:"是否提供外呼 1:是 、0:否"`
+	YidongActivityIdByCygx    string                     `description:"通过查研观向建会易董返回的活动ID"`
+	TencentConferenceNumber   string                     `description:"腾讯会议号"`
+	IsExternalLabel           int                        `description:"是否为外部资源 1是,0否"`
+	SigninImg                 string                     `description:"签到码图片"`
+	IsResearchPoints          int                        `description:"是否为研选扣点  1是,0否"`
+	IsBClass                  int                        `description:"是否为B类电话会 1是,0否"`
+	IsNeedEmail               int                        `description:"是否需要提供邮箱 1是,0否"`
+	SiginupDeadline           string                     `description:"报名截止时间"`
+	PointsSet                 *CygxActivityPointsSetRsq  `description:"研选扣点明细"`
+	VivoPointsSet             CygxActivityVivoPointsResp `description:"音视频扣点明细"`
+	IsShowHz                  int                        `description:"是否同时在弘则展示  1是,0否"`
+	ChartPermissionNameDeputy string                     `description:"副行业名称"`
+	BackgroundImg             string                     `description:"封面图片"`
+	ShareImg                  string                     `description:"分享图片"`
+	TopTime                   int                        `description:"置顶时间"`
+	AreaType                  int                        `description:"地区,1国内,2海外,默认1"`
 }
 
 type ActivityDetailRep struct {

+ 75 - 0
models/cygx/activity_vivo_points_set.go

@@ -0,0 +1,75 @@
+package cygx
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxActivityVivoPointsSet struct {
+	PointSetId   int       `orm:"column(point_set_id);pk";comment:"主键id"`
+	ActivityId   int       `comment:"活动ID"`
+	PointsObject string    `comment:"扣点设置方式 1:同报名参会时的扣点数、2:输入其余点数"`
+	PointsNum    string    `comment:"扣点数量"`
+	GoodsMoney   string    `comment:"商品总价"`
+	Source       string    `comment:"来源 activityvideo 活动视频、activityvoice 活动音频"`
+	CreateTime   time.Time `comment:"创建时间"`
+	ModifyTime   time.Time `comment:"更新时间"`
+}
+
+type CygxActivityVivoPointsResp struct {
+	IsPay        int    `comment:"是否付费查看 ,1是。0否,默认否"`
+	PointSetId   int    `orm:"column(point_set_id);pk";comment:"主键id"`
+	ActivityId   int    `comment:"活动ID"`
+	PointsObject string `comment:"扣点设置方式 1:同报名参会时的扣点数、2:输入其余点数"`
+	PointsNum    string `comment:"扣点数量"`
+	GoodsMoney   string `comment:"商品总价"`
+	Source       string `comment:"来源 activityvideo 活动视频、activityvoice 活动音频"`
+}
+
+type CygxActivityVivoPointsSetReq struct {
+	IsPay        int    `comment:"是否付费查看 ,1是。0否,默认否"`
+	PointsObject string `comment:"扣点设置方式 1:同报名参会时的扣点数、2:输入其余点数"`
+	PointsNum    string `comment:"扣点数量"`
+	GoodsMoney   string `comment:"商品总价"`
+}
+
+// 根据活动ID判断音视频是否设置了扣点
+func GetCygxActivityVivoPointsSetCountByActivityId(activityId int) (count int, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sqlCount := ` SELECT COUNT(1) AS count  FROM cygx_activity_vivo_points_set  WHERE activity_id =?  `
+	err = o.Raw(sqlCount, activityId).QueryRow(&count)
+	return
+}
+
+func GetCygxActivityVivoPointsSetByActivityId(activityId int) (item *CygxActivityVivoPointsResp, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_activity_vivo_points_set WHERE activity_id = ?  `
+	err = o.Raw(sql, activityId).QueryRow(&item)
+	return
+}
+
+// 添加
+func AddCygxActivityVivoPointsSet(item *CygxActivityVivoPointsSet) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	_, err = o.Insert(item)
+	return
+}
+
+// 编辑
+func EditCygxActivityVivoPointsSet(item *CygxActivityVivoPointsSet) (err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	updateParams := make(map[string]interface{})
+	updateParams["PointsObject"] = item.PointsObject
+	updateParams["PointsNum"] = item.PointsNum
+	updateParams["GoodsMoney"] = item.GoodsMoney
+	updateParams["Source"] = item.Source
+	updateParams["ModifyTime"] = time.Now()
+	ptrStructOrTableName := "cygx_activity_vivo_points_set"
+	whereParam := map[string]interface{}{"activity_id": item.ActivityId}
+	qs := o.QueryTable(ptrStructOrTableName)
+	for expr, exprV := range whereParam {
+		qs = qs.Filter(expr, exprV)
+	}
+	_, err = qs.Update(updateParams)
+	return
+}

+ 1 - 0
models/db.go

@@ -397,6 +397,7 @@ func initCygx() {
 		new(cygx.CygxIndustrialSubject),
 		new(cygx.CygxArticle),
 		new(cygx.CygxActivity),
+		new(cygx.CygxActivityVivoPointsSet),
 		new(cygx.CygxActivitySignup),
 		new(cygx.CygxActivityRestrictSignup),
 		new(cygx.CygxActivityAttendanceDetail),

+ 16 - 16
services/cygx/activity_ocr.go

@@ -175,13 +175,13 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 			err = errors.New("GetCygxActivityVoiceCount" + e.Error())
 			return
 		}
-		activityId := itemVoice.ActivityId
-		//获取活动详情
-		activityInfo, e := cygx.GetAddActivityInfoById(activityId)
-		if e != nil {
-			err = errors.New("GetAddActivityInfoById, Err: " + e.Error())
-			return
-		}
+		//activityId := itemVoice.ActivityId
+		////获取活动详情
+		//activityInfo, e := cygx.GetAddActivityInfoById(activityId)
+		//if e != nil {
+		//	err = errors.New("GetAddActivityInfoById, Err: " + e.Error())
+		//	return
+		//}
 		//易董办会的分析师电话会,为路演回放
 		if (activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 7) && activityInfo.IsYidongConduct == 1 {
 			itemVoice.FileType = 1
@@ -189,7 +189,7 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 			itemVoice.FileType = 2
 		}
 
-		shareImg, _ := MakeCygxMp3HtmlImg(itemVoice.VoicePlaySeconds) //生成分享图片
+		shareImg, _ := MakeCygxMp3HtmlImg(itemVoice.VoicePlaySeconds, activityInfo.ChartPermissionId) //生成分享图片
 		itemVoice.ShareImg = shareImg
 		itemVoice.VoiceName = utils.RemoveFileSuffixName(itemVoice.VoiceName) //去掉后缀名称
 
@@ -246,13 +246,13 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 			err = errors.New("GetActivityVideoCount" + e.Error())
 			return
 		}
-		activityId := itemVideo.ActivityId
-		//获取活动详情
-		activityInfo, e := cygx.GetAddActivityInfoById(activityId)
-		if e != nil {
-			err = errors.New("GetAddActivityInfoById, Err: " + e.Error())
-			return
-		}
+		//activityId := itemVideo.ActivityId
+		////获取活动详情
+		//activityInfo, e := cygx.GetAddActivityInfoById(activityId)
+		//if e != nil {
+		//	err = errors.New("GetAddActivityInfoById, Err: " + e.Error())
+		//	return
+		//}
 		//易董办会的分析师电话会,为路演回放
 		if (activityInfo.ActivityTypeId == 2 || activityInfo.ActivityTypeId == 7) && activityInfo.IsYidongConduct == 1 {
 			itemVideo.FileType = 1
@@ -260,7 +260,7 @@ func UpdateActivityVideoAndVoice(activityInfo *cygx.ActivityDetail, itemVoice *c
 			itemVideo.FileType = 2
 		}
 
-		shareImg, _ := MakeCygxMp4HtmlImg(itemVideo.VideoDuration) //生成分享图片
+		shareImg, _ := MakeCygxMp4HtmlImg(itemVideo.VideoDuration, activityInfo.ChartPermissionId) //生成分享图片
 		itemVideo.ShareImg = shareImg
 		itemVideo.VideoName = utils.RemoveFileSuffixName(itemVideo.VideoName) //去掉后缀名称
 

+ 44 - 0
services/cygx/activity_points_set.go

@@ -401,3 +401,47 @@ func init0703() {
 	fmt.Println(companyIds)
 	fmt.Println(err)
 }
+
+func UpdateActivityVivoPointsSet(activityInfo *cygx.ActivityDetail, vivoPointsSet cygx.CygxActivityVivoPointsSetReq, itemPointsSet *cygx.CygxActivityPointsSet, sourceVivo string) (err error) {
+	activityId := activityInfo.ActivityId
+	if vivoPointsSet.IsPay == 0 {
+		return
+	}
+	if sourceVivo == "" {
+		return
+	}
+	total, e := cygx.GetCygxActivityVivoPointsSetCountByActivityId(activityId)
+	if e != nil {
+		err = errors.New("GetCygxActivityVivoPointsSetCountByActivityId, Err: " + e.Error())
+		return
+	}
+	if vivoPointsSet.PointsNum == "" {
+		vivoPointsSet.PointsNum = "0"
+	}
+	if vivoPointsSet.GoodsMoney == "" {
+		vivoPointsSet.GoodsMoney = "0"
+	}
+	item := new(cygx.CygxActivityVivoPointsSet)
+	item.ActivityId = activityId
+	item.PointsObject = vivoPointsSet.PointsObject
+	item.PointsNum = vivoPointsSet.PointsNum
+	item.GoodsMoney = vivoPointsSet.GoodsMoney
+	item.Source = sourceVivo
+	item.CreateTime = time.Now()
+	item.ModifyTime = time.Now()
+	if total == 0 {
+		e = cygx.AddCygxActivityVivoPointsSet(item)
+		if e != nil {
+			err = errors.New("AddCygxActivityVivoPointsSet, Err: " + e.Error())
+			return
+		}
+	} else {
+		e = cygx.EditCygxActivityVivoPointsSet(item)
+		if e != nil {
+			err = errors.New("AddCygxActivityVivoPointsSet, Err: " + e.Error())
+			return
+		}
+	}
+
+	return
+}

+ 23 - 6
services/cygx/activity_poster.go

@@ -23,6 +23,8 @@ var (
 	Cygx_activity_sigin_html = "cygx_activity_sigin_html"
 	Cygx_mp3_html            = "cygx_mp3_html"
 	Cygx_mp4_html            = "cygx_mp4_html"
+	Cygx_mp3_yx_html         = "cygx_mp3_yx_html"
+	Cygx_mp4_yx_html         = "cygx_mp4_yx_html"
 )
 
 type Html2ImgResp struct {
@@ -237,7 +239,7 @@ func MakeActivitySigninImg(activityId int) (imgUrl string, err error) {
 }
 
 // 生成音视频分享封面图
-func MakeCygxMp3HtmlImg(videoDuration string) (imgUrl string, err error) {
+func MakeCygxMp3HtmlImg(videoDuration string, chartPermissionId int) (imgUrl string, err error) {
 	var msg string
 	defer func() {
 		if err != nil || msg != "" {
@@ -245,7 +247,14 @@ func MakeCygxMp3HtmlImg(videoDuration string) (imgUrl string, err error) {
 			go alarm_msg.SendAlarmMsg("生成音视频分享封面图,失败 MakeCygxMp3HtmlImg:"+err.Error()+";msg:"+msg, 3)
 		}
 	}()
-	detailConfig, e := cygx.GetCygxConfigDetailByCode(Cygx_mp3_html)
+
+	var configCode string
+	if chartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
+		configCode = Cygx_mp3_yx_html
+	} else {
+		configCode = Cygx_mp3_html
+	}
+	detailConfig, e := cygx.GetCygxConfigDetailByCode(configCode)
 	if e != nil {
 		err = errors.New("GetCygxConfigDetailByCode 获取配置生成音视频分享封面图格式信息失败, Err: " + e.Error())
 		return
@@ -283,7 +292,7 @@ func MakeCygxMp3HtmlImg(videoDuration string) (imgUrl string, err error) {
 }
 
 // 生成音视频分享封面图
-func MakeCygxMp4HtmlImg(videoDuration string) (imgUrl string, err error) {
+func MakeCygxMp4HtmlImg(videoDuration string, chartPermissionId int) (imgUrl string, err error) {
 	var msg string
 	defer func() {
 		if err != nil || msg != "" {
@@ -291,7 +300,15 @@ func MakeCygxMp4HtmlImg(videoDuration string) (imgUrl string, err error) {
 			go alarm_msg.SendAlarmMsg("生成音视频分享封面图,失败 MakeCygxMp4HtmlImg:"+err.Error()+";msg:"+msg, 3)
 		}
 	}()
-	detailConfig, e := cygx.GetCygxConfigDetailByCode(Cygx_mp4_html)
+
+	var configCode string
+	if chartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
+		configCode = Cygx_mp4_yx_html
+	} else {
+		configCode = Cygx_mp4_html
+	}
+
+	detailConfig, e := cygx.GetCygxConfigDetailByCode(configCode)
 	if e != nil {
 		err = errors.New("GetCygxConfigDetailByCode 获取配置生成音视频分享封面图格式信息失败, Err: " + e.Error())
 		return
@@ -391,7 +408,7 @@ func MakeActivityMomentsImg(activityId int) {
 	htm2ImgReq["height"] = 3813
 	res, err := postHtml2Img(htm2ImgReq)
 	if err != nil || res == nil {
-		err = errors.New("html转图片失败: " + res.Msg)
+		err = errors.New("html转图片失败: ")
 		return
 	}
 	if res.Code != 200 {
@@ -564,4 +581,4 @@ func MakeActivityMomentsImg(activityId int) {
 //	item.CreateTime = time.Now()
 //	err = cygx.AddCygxActivityPoster(item)
 //	return
-//}
+//}

+ 4 - 4
services/cygx/askserie_video.go

@@ -149,7 +149,7 @@ func initpy() {
 	}
 
 	for _, v := range listVoice {
-		shareImg, _ := MakeCygxMp3HtmlImg(v.VoicePlaySeconds) //生成分享图片
+		shareImg, _ := MakeCygxMp3HtmlImg(v.VoicePlaySeconds, 0) //生成分享图片
 		v.ShareImg = shareImg
 		err = cygx.UpdateCygxActivityVoice(v)
 		if err != nil {
@@ -166,7 +166,7 @@ func initpy() {
 	}
 
 	for _, v := range listVideo {
-		shareImg, _ := MakeCygxMp4HtmlImg(v.VideoDuration) //生成分享图片
+		shareImg, _ := MakeCygxMp4HtmlImg(v.VideoDuration, 0) //生成分享图片
 		v.ShareImg = shareImg
 		err = cygx.UpdateCygxActivityVideo(v)
 		if err != nil {
@@ -183,7 +183,7 @@ func initpy() {
 	}
 
 	for _, v := range listVideoRoadshow {
-		shareImg, _ := MakeCygxMp4HtmlImg(v.VideoDuration) //生成分享图片
+		shareImg, _ := MakeCygxMp4HtmlImg(v.VideoDuration, 0) //生成分享图片
 		v.ShareImgUrl = shareImg
 		err = cygx.UpdateCygxMicroRoadshowVideo(v)
 		if err != nil {
@@ -200,7 +200,7 @@ func initpy() {
 	}
 
 	for _, v := range listAskserVoice {
-		shareImg, _ := MakeCygxMp3HtmlImg(v.VideoDuration) //生成分享图片
+		shareImg, _ := MakeCygxMp3HtmlImg(v.VideoDuration, 0) //生成分享图片
 		v.ShareImg = shareImg
 		err = cygx.EditCygxAskserieVideoShareImg(shareImg, v.AskserieVideoId)
 		if err != nil {