|
@@ -143,6 +143,7 @@ func (this *OrderController) AddByActivity() {
|
|
|
uid := user.UserId
|
|
|
goodsId := req.GoodsId
|
|
|
sourceId := req.SourceId
|
|
|
+ source := req.Source
|
|
|
if goodsId == 0 {
|
|
|
br.Msg = "支付失败"
|
|
|
br.ErrMsg = "支付失败,goodsId 信息错误Err:" + err.Error()
|
|
@@ -163,14 +164,20 @@ func (this *OrderController) AddByActivity() {
|
|
|
}
|
|
|
var title string
|
|
|
var oldOrderCode string
|
|
|
+ var payTimeCountdown int
|
|
|
//var _ int
|
|
|
item := new(order.CygxOrder)
|
|
|
- if (!activityDetail.IsResearchPoints && activityDetail.IsLimitPeople == 0) || activityDetail.YidongActivityId != "" { //易董的活动 或者(不扣点且不限制人数)走月卡日卡逻辑
|
|
|
- oldOrderCode = services.GetHaverEquallyOrderByUser10Min(uid, goodsId) //获取用户十分钟之内是否有相同的订单信息
|
|
|
- item.OrderType = 1
|
|
|
+ if source == "ActivityVivo" {
|
|
|
+ oldOrderCode, payTimeCountdown = services.GetHaverEquallyOrderByUser10MinByActivtyVivo(uid, sourceId)
|
|
|
+ item.OrderType = 3
|
|
|
} else {
|
|
|
- oldOrderCode, _ = services.GetHaverEquallyOrderByUser10MinByActivty(uid, sourceId)
|
|
|
- item.OrderType = 2
|
|
|
+ if (!activityDetail.IsResearchPoints && activityDetail.IsLimitPeople == 0) || activityDetail.YidongActivityId != "" { //易董的活动 或者(不扣点且不限制人数)走月卡日卡逻辑
|
|
|
+ oldOrderCode = services.GetHaverEquallyOrderByUser10Min(uid, goodsId) //获取用户十分钟之内是否有相同的订单信息
|
|
|
+ item.OrderType = 1
|
|
|
+ } else {
|
|
|
+ oldOrderCode, payTimeCountdown = services.GetHaverEquallyOrderByUser10MinByActivty(uid, sourceId)
|
|
|
+ item.OrderType = 2
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
title = activityDetail.ActivityName
|
|
@@ -190,6 +197,8 @@ func (this *OrderController) AddByActivity() {
|
|
|
item.GoodsName = "日卡"
|
|
|
case 2:
|
|
|
item.GoodsName = "月卡"
|
|
|
+ case 9:
|
|
|
+ item.GoodsName = "活动回放"
|
|
|
}
|
|
|
//如果活动有自定义的价格就优先按照自定义的价格来
|
|
|
if activityDetail.ActivityPrice > 0 {
|
|
@@ -215,6 +224,40 @@ func (this *OrderController) AddByActivity() {
|
|
|
item.ModifyTime = time.Now()
|
|
|
item.RegisterPlatform = utils.REGISTER_PLATFORM
|
|
|
|
|
|
+ //如果是音视频的订单,数据做二次处理
|
|
|
+ if source == "ActivityVivo" {
|
|
|
+ vivoPointsSetDetail, err := models.GetCygxActivityVivoPointsSetByActivityId(sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item.GoodsMoney = vivoPointsSetDetail.GoodsMoney
|
|
|
+ item.OrderMoney = vivoPointsSetDetail.GoodsMoney
|
|
|
+ item.Source = vivoPointsSetDetail.Source
|
|
|
+ if vivoPointsSetDetail.Source == utils.CYGX_OBJ_ACTIVITYVIDEO {
|
|
|
+ activityVideoInfo, err := models.GetCygxActivityVideoByActivityId(sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ title = activityVideoInfo.VideoName
|
|
|
+ } else if vivoPointsSetDetail.Source == utils.CYGX_OBJ_ACTIVITYVOICE {
|
|
|
+ activityVoiceInfo, err := models.GetCygxActivityVoiceByActivityId(sourceId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ title = activityVoiceInfo.VoiceName
|
|
|
+ } else {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取信息失败,音视频数据类型错误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//如果十分钟之内有相同的订单就修改,没有就新增
|
|
|
if oldOrderCode == "" {
|
|
|
err = order.AddCygxOrder(item)
|
|
@@ -229,7 +272,7 @@ func (this *OrderController) AddByActivity() {
|
|
|
return
|
|
|
}
|
|
|
resp := new(order.WxNativeApiResp)
|
|
|
- _, resp.PayTimeCountdown = services.GetHaverEquallyOrderByUser10MinByActivty(uid, sourceId) //截止支付时间倒计时
|
|
|
+ resp.PayTimeCountdown = payTimeCountdown //截止支付时间倒计时
|
|
|
resp.CodeUrl = codeUrl
|
|
|
resp.OrderCode = item.OrderCode
|
|
|
br.Data = resp
|