소스 검색

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

xingzai 8 달 전
부모
커밋
109945b037
6개의 변경된 파일127개의 추가작업 그리고 27개의 파일을 삭제
  1. 9 1
      controllers/cygx/activity.go
  2. 25 24
      models/cygx/activity.go
  3. 56 0
      models/cygx/activity_vivo_points_set.go
  4. 1 0
      models/db.go
  5. 34 0
      services/cygx/activity_points_set.go
  6. 2 2
      services/cygx/activity_poster.go

+ 9 - 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 {
@@ -690,12 +691,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)
+				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() {

+ 25 - 24
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

+ 56 - 0
models/cygx/activity_vivo_points_set.go

@@ -0,0 +1,56 @@
+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    float64   `comment:"扣点数量"`
+	GoodsMoney   float64   `comment:"商品总价"`
+	CreateTime   time.Time `comment:"创建时间"`
+	ModifyTime   time.Time `comment:"更新时间"`
+}
+
+type CygxActivityVivoPointsSetReq struct {
+	IsPay        int     `comment:"是否付费查看 ,1是。0否,默认否"`
+	PointsObject string  `comment:"扣点设置方式 1:同报名参会时的扣点数、2:输入其余点数"`
+	PointsNum    float64 `comment:"扣点数量"`
+	GoodsMoney   float64 `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 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["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),

+ 34 - 0
services/cygx/activity_points_set.go

@@ -401,3 +401,37 @@ func init0703() {
 	fmt.Println(companyIds)
 	fmt.Println(err)
 }
+
+func UpdateActivityVivoPointsSet(activityInfo *cygx.ActivityDetail, vivoPointsSet cygx.CygxActivityVivoPointsSetReq, itemPointsSet *cygx.CygxActivityPointsSet) (err error) {
+	activityId := activityInfo.ActivityId
+	if vivoPointsSet.IsPay == 0 {
+		return
+	}
+	total, e := cygx.GetCygxActivityVivoPointsSetCountByActivityId(activityId)
+	if e != nil {
+		err = errors.New("GetCygxActivityVivoPointsSetCountByActivityId, Err: " + e.Error())
+		return
+	}
+	item := new(cygx.CygxActivityVivoPointsSet)
+	item.ActivityId = activityId
+	item.PointsObject = vivoPointsSet.PointsObject
+	item.PointsNum = vivoPointsSet.PointsNum
+	item.GoodsMoney = vivoPointsSet.GoodsMoney
+	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
+}

+ 2 - 2
services/cygx/activity_poster.go

@@ -391,7 +391,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 +564,4 @@ func MakeActivityMomentsImg(activityId int) {
 //	item.CreateTime = time.Now()
 //	err = cygx.AddCygxActivityPoster(item)
 //	return
-//}
+//}