|
@@ -29,7 +29,7 @@ func ServiceOpen(context *admin.Context) (interface{}, error) {
|
|
|
return nil, err
|
|
|
}
|
|
|
//查询订单
|
|
|
- order := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": param.OrderCode}, "id,order_status,user_phone,product_type,vip_type,vip_endtime,vip_starttime,filter", "")
|
|
|
+ order := util.JysqlDB.FindOne("dataexport_order", map[string]interface{}{"order_code": param.OrderCode}, "", "")
|
|
|
if order == nil {
|
|
|
return nil, errors.New("为查询到订单信息")
|
|
|
}
|
|
@@ -137,9 +137,11 @@ func ServiceOpen(context *admin.Context) (interface{}, error) {
|
|
|
if createType == 1 { //1-新建 2-补充 3-延期
|
|
|
bigStartTime := time.Unix(param.StartTime, 0)
|
|
|
bigEndTime := GetDATE(cm.IntAll(filterMap["cycle"]), cm.IntAll(filterMap["cycleType"]), param.StartTime)
|
|
|
- if bigEndTime.Unix() > time.Now().Unix() {
|
|
|
+ if bigEndTime.Unix() < time.Now().Unix() {
|
|
|
return nil, errors.New("订单已失效")
|
|
|
}
|
|
|
+ updateMap["vip_starttime"] = bigStartTime.Format(cm.Date_Full_Layout)
|
|
|
+ updateMap["vip_endtime"] = bigEndTime.Format(cm.Date_Full_Layout)
|
|
|
var sName string
|
|
|
if cm.IntAll(filterMap["comboId"]) != 0 {
|
|
|
if cm.IntAll(filterMap["comboId"]) == 5 {
|
|
@@ -153,15 +155,15 @@ func ServiceOpen(context *admin.Context) (interface{}, error) {
|
|
|
}
|
|
|
// 企业主体判断是否开通权益
|
|
|
if cm.IntAll((*order)["buy_subject"]) == 2 {
|
|
|
- entService, userCount = EntServiceOpen(cm.IntAll((*order)["entId"]), param.Phone, fmt.Sprintf("%s%s", "大会员", sName), param.StartTime)
|
|
|
+ entService, userCount = EntServiceOpen(cm.IntAll((*order)["ent_id"]), param.Phone, fmt.Sprintf("%s%s", "大会员", sName), param.StartTime)
|
|
|
orderId := cm.IntAll((*order)["id"])
|
|
|
- if cm.IntAll((*order)["entId"]) != 0 && param.StartTime != 4070880000 && cm.IntAll((*order)["buy_count"]) > 0 {
|
|
|
+ if cm.IntAll((*order)["ent_id"]) != 0 && param.StartTime != 4070880000 && cm.IntAll((*order)["buy_count"]) > 0 {
|
|
|
regRuler := "^1[3456789]{1}\\d{9}$"
|
|
|
reg := regexp.MustCompile(regRuler)
|
|
|
if cm.IntAll((*order)["order_status"]) == 1 && reg.MatchString(param.Phone) {
|
|
|
st := cm.FormatDate(&bigStartTime, cm.Date_Full_Layout)
|
|
|
et := cm.FormatDate(&bigEndTime, cm.Date_Full_Layout)
|
|
|
- err := EntLicense(cm.IntAll((*order)["entId"]), cm.IntAll((*order)["buy_count"]), cm.IntAll(cm.If(cm.IntAll(filterMap["areaCount"]) > 0, cm.IntAll(filterMap["areaCount"]), -1)), orderId, userCount, fmt.Sprintf("%s%s", "大会员", sName), st, et, param.Phone)
|
|
|
+ err := EntLicense(cm.IntAll((*order)["ent_id"]), cm.IntAll((*order)["buy_count"]), cm.IntAll(cm.If(cm.IntAll(filterMap["areaCount"]) > 0, cm.IntAll(filterMap["areaCount"]), -1)), orderId, userCount, fmt.Sprintf("%s%s", "大会员", sName), st, et, param.Phone)
|
|
|
if err != nil {
|
|
|
log.Printf("EntLicense 创建企业授权信息失败:code:%s,err:%s", param.OrderCode, err.Error())
|
|
|
}
|
|
@@ -171,6 +173,7 @@ func ServiceOpen(context *admin.Context) (interface{}, error) {
|
|
|
return nil, errors.New("企业不存在")
|
|
|
}
|
|
|
}
|
|
|
+ ClearBigVipUserPower(fmt.Sprint((*order)["user_id"])) //订单创建成功后默认清空权限缓存
|
|
|
status := cm.If(bigStartTime.Unix() > time.Now().Unix(), 0, 1)
|
|
|
err := NewBigOpenService(filterMap, userId, bigStartTime, bigEndTime, cm.IntAll(status), cm.IntAll((*order)["buy_count"]))
|
|
|
if err != nil {
|