|
@@ -8,6 +8,7 @@ import (
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/frame/g"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
"github.com/gogf/gf/v2/util/gconv"
|
|
|
|
+ "github.com/pkg/errors"
|
|
"jyOrderManager/internal/jyutil"
|
|
"jyOrderManager/internal/jyutil"
|
|
"jyOrderManager/internal/model"
|
|
"jyOrderManager/internal/model"
|
|
"time"
|
|
"time"
|
|
@@ -80,6 +81,7 @@ WHERE a.status = 1 %s and a.user_id = '%s' and a.product_type like '%s' ORDER BY
|
|
})
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ var comboId int
|
|
switch param.ProductType {
|
|
switch param.ProductType {
|
|
case "VIP订阅":
|
|
case "VIP订阅":
|
|
vipExist = gconv.Int((*userData)["i_vip_status"]) == 2
|
|
vipExist = gconv.Int((*userData)["i_vip_status"]) == 2
|
|
@@ -92,7 +94,7 @@ WHERE a.status = 1 %s and a.user_id = '%s' and a.product_type like '%s' ORDER BY
|
|
if common.IntAll((*buySet)["upgrade"]) == 1 {
|
|
if common.IntAll((*buySet)["upgrade"]) == 1 {
|
|
//newVip = true
|
|
//newVip = true
|
|
}
|
|
}
|
|
- endTime = time.Unix(common.Int64All((*userData)["l_vip_endtime"]), 0).Format(time.DateTime)
|
|
|
|
|
|
+ endTime = time.Unix(common.Int64All((*userData)["l_vip_endtime"]), 0).Format("2006-01-02 15:04:05")
|
|
}
|
|
}
|
|
|
|
|
|
case "大会员":
|
|
case "大会员":
|
|
@@ -100,16 +102,17 @@ WHERE a.status = 1 %s and a.user_id = '%s' and a.product_type like '%s' ORDER BY
|
|
bigEnd := common.Int64All((*userData)["i_member_endtime"])
|
|
bigEnd := common.Int64All((*userData)["i_member_endtime"])
|
|
subStatus := common.IntAll((*userData)["i_member_sub_status"])
|
|
subStatus := common.IntAll((*userData)["i_member_sub_status"])
|
|
memberStatus := common.IntAll((*userData)["i_member_status"])
|
|
memberStatus := common.IntAll((*userData)["i_member_status"])
|
|
|
|
+ comboId = common.If(memberStatus == 5, 0, memberStatus).(int)
|
|
mainId := common.ObjToString((*userData)["s_member_mainid"])
|
|
mainId := common.ObjToString((*userData)["s_member_mainid"])
|
|
if memberJyMap, ok1 := ((*userData)["o_member_jy"]).(map[string]interface{}); ok1 {
|
|
if memberJyMap, ok1 := ((*userData)["o_member_jy"]).(map[string]interface{}); ok1 {
|
|
areaCount = common.IntAll(memberJyMap["i_areacount"])
|
|
areaCount = common.IntAll(memberJyMap["i_areacount"])
|
|
}
|
|
}
|
|
if bigStart >= time.Now().Unix() {
|
|
if bigStart >= time.Now().Unix() {
|
|
- endTime = time.Unix(bigEnd, 0).Format(time.DateTime)
|
|
|
|
|
|
+ endTime = time.Unix(bigEnd, 0).Format("2006-01-02 15:04:05")
|
|
vipExist = true
|
|
vipExist = true
|
|
} else if (time.Now().Unix() < bigEnd && memberStatus > 0) || bigStart >= time.Now().Unix() {
|
|
} else if (time.Now().Unix() < bigEnd && memberStatus > 0) || bigStart >= time.Now().Unix() {
|
|
vipExist = true
|
|
vipExist = true
|
|
- endTime = time.Unix(bigEnd, 0).Format(time.DateTime)
|
|
|
|
|
|
+ endTime = time.Unix(bigEnd, 0).Format("2006-01-02 15:04:05")
|
|
}
|
|
}
|
|
if (subStatus == 0 && memberStatus < 0 && mainId != "") || (subStatus == 1 && memberStatus > 0 && mainId != "") {
|
|
if (subStatus == 0 && memberStatus < 0 && mainId != "") || (subStatus == 1 && memberStatus > 0 && mainId != "") {
|
|
vipExist = true
|
|
vipExist = true
|
|
@@ -152,12 +155,16 @@ WHERE a.status = 1 %s and a.user_id = '%s' and a.product_type like '%s' ORDER BY
|
|
"empowerCount": paySubNum, //服务授权数
|
|
"empowerCount": paySubNum, //服务授权数
|
|
"provinceCount": areaCount, //订阅省份
|
|
"provinceCount": areaCount, //订阅省份
|
|
"buySubject": 1, //个体
|
|
"buySubject": 1, //个体
|
|
|
|
+ "comboId": comboId, //套餐id
|
|
"serviceList": serviceList, //大会员服务id
|
|
"serviceList": serviceList, //大会员服务id
|
|
"linkedId": linkedId, //关联id
|
|
"linkedId": linkedId, //关联id
|
|
"linkedOrder": orderArr, //关联订单
|
|
"linkedOrder": orderArr, //关联订单
|
|
})
|
|
})
|
|
}
|
|
}
|
|
} else { //企业版本会员状态查询
|
|
} else { //企业版本会员状态查询
|
|
|
|
+ if param.EntName == "" {
|
|
|
|
+ return nil, errors.New("企业名称获取异常")
|
|
|
|
+ }
|
|
//获取企业信息
|
|
//获取企业信息
|
|
vipRes, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT a.id FROM entniche_info a
|
|
vipRes, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT a.id FROM entniche_info a
|
|
inner JOIN entniche_user b on a.id = b.ent_id
|
|
inner JOIN entniche_user b on a.id = b.ent_id
|
|
@@ -166,19 +173,23 @@ WHERE b.phone = '%s' and a.name = '%s'`, param.Phone, param.EntName))
|
|
entID := gconv.String(vipRes.Map()["id"])
|
|
entID := gconv.String(vipRes.Map()["id"])
|
|
var whereEntTime string
|
|
var whereEntTime string
|
|
if param.ServiceType != 1 && param.ServiceType != 4 {
|
|
if param.ServiceType != 1 && param.ServiceType != 4 {
|
|
- whereEntTime = fmt.Sprintf(` and a.end_time>'%s' `, time.Now().Format(time.DateTime))
|
|
|
|
|
|
+ whereEntTime = fmt.Sprintf(` and a.end_time>'%s' `, time.Now().Format("2006-01-02 15:04:05"))
|
|
}
|
|
}
|
|
//获取企业下的服务
|
|
//获取企业下的服务
|
|
entService, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT * FROM entniche_wait_empower a
|
|
entService, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT * FROM entniche_wait_empower a
|
|
WHERE a.ent_id = '%s' %s and a.product_type like '%s' and ORDER BY a.create_time desc`, entID, whereEntTime, common.If(param.ProductType == "VIP订阅", "%VIP订阅%", `%大会员%`)))
|
|
WHERE a.ent_id = '%s' %s and a.product_type like '%s' and ORDER BY a.create_time desc`, entID, whereEntTime, common.If(param.ProductType == "VIP订阅", "%VIP订阅%", `%大会员%`)))
|
|
if !entService.IsEmpty() {
|
|
if !entService.IsEmpty() {
|
|
for _, m := range entService.List() {
|
|
for _, m := range entService.List() {
|
|
- var serviceList []int
|
|
|
|
|
|
+ var (
|
|
|
|
+ serviceList []int
|
|
|
|
+ comboId int
|
|
|
|
+ )
|
|
if param.ProductType == "大会员" {
|
|
if param.ProductType == "大会员" {
|
|
//大会员获取下服务最新id
|
|
//大会员获取下服务最新id
|
|
serviceId, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT b.filter FROM entniche_order a
|
|
serviceId, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT b.filter FROM entniche_order a
|
|
INNER JOIN jy_order_detail b on a.order_detail_id = b.id WHERE a.wait_empower_id = %d ORDER BY a.create_time desc LIMIT 1`, gconv.Int(m["id"])))
|
|
INNER JOIN jy_order_detail b on a.order_detail_id = b.id WHERE a.wait_empower_id = %d ORDER BY a.create_time desc LIMIT 1`, gconv.Int(m["id"])))
|
|
if !serviceId.IsEmpty() {
|
|
if !serviceId.IsEmpty() {
|
|
|
|
+ comboId = gconv.Int(gconv.Map(serviceId.Map()["filter"])["comboId"])
|
|
for _, id := range gconv.Ints(gconv.Map(serviceId.Map()["filter"])["serviceIds"]) {
|
|
for _, id := range gconv.Ints(gconv.Map(serviceId.Map()["filter"])["serviceIds"]) {
|
|
if id == 12 {
|
|
if id == 12 {
|
|
serviceList = append(serviceList, 23)
|
|
serviceList = append(serviceList, 23)
|
|
@@ -222,6 +233,7 @@ WHERE a.ent_id = '%s' %s and a.product_type like '%s' and ORDER BY a.create_ti
|
|
"provinceCount": gconv.String(m["province_count"]), //订阅省份
|
|
"provinceCount": gconv.String(m["province_count"]), //订阅省份
|
|
"buySubject": 2, //个体
|
|
"buySubject": 2, //个体
|
|
"linkedId": linkedId, //关联id
|
|
"linkedId": linkedId, //关联id
|
|
|
|
+ "comboId": comboId, //套餐id
|
|
"serviceList": serviceList, //大会员服务id
|
|
"serviceList": serviceList, //大会员服务id
|
|
"linkedOrder": orderArr, //关联订单
|
|
"linkedOrder": orderArr, //关联订单
|
|
})
|
|
})
|