|
@@ -16,7 +16,6 @@ import (
|
|
|
"jyOrderManager/internal/service"
|
|
|
"jyOrderManager/utility"
|
|
|
"log"
|
|
|
- "strings"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -212,11 +211,11 @@ func (p jyBigProduct) SaveUpdate(ctx context.Context, masterKey string) error {
|
|
|
return err
|
|
|
}*/
|
|
|
if p.param.Filter.ComboId > 0 {
|
|
|
- combo, err := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT * FROM bigmember_combo WHERE id = %d`, p.param.Filter.ComboId))
|
|
|
- if err != nil || combo.IsEmpty() {
|
|
|
+ serviceIds, err := BigMemberComboServiceIds(ctx, p.param.Filter.ComboId)
|
|
|
+ if err != nil {
|
|
|
return errors.New("套餐查询错误")
|
|
|
}
|
|
|
- filter.ServiceIds = strings.Split(gconv.String(combo.Map()["s_servers"]), ",")
|
|
|
+ filter.ServiceIds = serviceIds
|
|
|
}
|
|
|
filter.FinalAreaCount = productItem.UnitNum
|
|
|
filter.CutAccount = productItem.CutAccount
|
|
@@ -239,11 +238,11 @@ func (p jyBigProduct) SaveUpdate(ctx context.Context, masterKey string) error {
|
|
|
filter.FinalAccountCount = oldFilter.FinalAccountCount
|
|
|
filter.ServiceIds = oldFilter.ServiceIds
|
|
|
if len(oldFilter.ServiceIds) == 0 && p.param.Filter.ComboId > 0 {
|
|
|
- combo, err := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT * FROM bigmember_combo WHERE id = %d`, p.param.Filter.ComboId))
|
|
|
- if err != nil || combo.IsEmpty() {
|
|
|
+ serviceIds, err := BigMemberComboServiceIds(ctx, p.param.Filter.ComboId)
|
|
|
+ if err != nil {
|
|
|
return errors.New("套餐查询错误")
|
|
|
}
|
|
|
- filter.ServiceIds = strings.Split(gconv.String(combo.Map()["s_servers"]), ",")
|
|
|
+ filter.ServiceIds = serviceIds
|
|
|
}
|
|
|
var newStartTime time.Time
|
|
|
if endTime.Unix() < time.Now().Unix() { //原服务已过期
|
|
@@ -341,11 +340,11 @@ func (p jyBigProduct) OpenService(ctx context.Context, serviceOpenTime time.Time
|
|
|
switch p.param.ServiceType {
|
|
|
case Buy, Try: //购买 试用
|
|
|
if p.param.Filter.ComboId > 0 {
|
|
|
- combo, err := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT * FROM bigmember_combo WHERE id = %d`, p.param.Filter.ComboId))
|
|
|
- if err != nil || combo.IsEmpty() {
|
|
|
- return errors.New("套餐查询错误")
|
|
|
+ serviceIds, err := BigMemberComboServiceIds(ctx, p.param.Filter.ComboId)
|
|
|
+ if err != nil {
|
|
|
+ return errors.New("套餐id异常")
|
|
|
}
|
|
|
- p.param.Filter.ServiceIds = strings.Split(gconv.String(combo.Map()["s_servers"]), ",")
|
|
|
+ p.param.Filter.ServiceIds = serviceIds
|
|
|
}
|
|
|
err = p.BigMemberBuyTry(ctx, serviceOpenTime, orderData.Map(), userData, productDetail)
|
|
|
case Renew: // 续费
|