|
@@ -37,24 +37,24 @@ func GetUserService(ctx context.Context, param model.UserServiceParams) (interfa
|
|
|
}
|
|
|
if userData != nil && len(*userData) > 0 {
|
|
|
userId := mongodb.BsonIdToSId((*userData)["_id"])
|
|
|
- sqlStr := fmt.Sprintf(`SELECT b.* FROM jy_order_detail
|
|
|
-WHERE status = 1 and is_service_open = 0 and user_id = '%s' and product_type like '%s' AND service_endtime < '%s'`, userId, common.If(param.ProductType == "VIP订阅", "%VIP订阅%", "%大会员%"), time.Now().Format(date.Date_Full_Layout))
|
|
|
- if param.OrderCode != "" {
|
|
|
- sqlStr += fmt.Sprintf(" AND order_code != '%s'", param.OrderCode)
|
|
|
- }
|
|
|
- //检验订单是否可以进行传创建
|
|
|
- order, _ := g.DB().Query(ctx, sqlStr)
|
|
|
- if !order.IsEmpty() && order.Len() > 0 {
|
|
|
- return map[string]interface{}{
|
|
|
- "willEffect": true,
|
|
|
- "userData": userData,
|
|
|
- "serviceArrMap": nil,
|
|
|
- }, nil
|
|
|
- }
|
|
|
-
|
|
|
if param.ProductType != "大会员" && param.ProductType != "VIP订阅" {
|
|
|
serviceArrMap = SpecialService(ctx, userId, param.ProductType)
|
|
|
} else {
|
|
|
+ sqlStr := fmt.Sprintf(`SELECT b.* FROM jy_order_detail
|
|
|
+WHERE status = 1 and is_service_open = 0 and user_id = '%s' and product_type like '%s' AND service_endtime < '%s'`, userId, common.If(param.ProductType == "VIP订阅", "%VIP订阅%", "%大会员%"), time.Now().Format(date.Date_Full_Layout))
|
|
|
+ if param.OrderCode != "" {
|
|
|
+ sqlStr += fmt.Sprintf(" AND order_code != '%s'", param.OrderCode)
|
|
|
+ }
|
|
|
+ //检验订单是否可以进行传创建
|
|
|
+ order, _ := g.DB().Query(ctx, sqlStr)
|
|
|
+ if !order.IsEmpty() && order.Len() > 0 {
|
|
|
+ return map[string]interface{}{
|
|
|
+ "willEffect": true,
|
|
|
+ "userData": userData,
|
|
|
+ "serviceArrMap": nil,
|
|
|
+ }, nil
|
|
|
+ }
|
|
|
+
|
|
|
var (
|
|
|
serviceList []int
|
|
|
endTime, startTime string
|
|
@@ -183,6 +183,26 @@ WHERE a.status = 1 %s and a.user_id = '%s' and a.product_type like '%s' ORDER BY
|
|
|
return nil, errors.New("企业名称获取异常")
|
|
|
}
|
|
|
//获取企业信息
|
|
|
+ if param.ProductType == "大会员" {
|
|
|
+ vipRes1, _ := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf("SELECT ewe.* ,bc.id AS comoboId FROM entniche_info ei INNER JOIN entniche_wait_empower ewe ON ei.id = ewe.ent_id LEFT JOIN bigmember_combo bc ON REPLACE(ewe.product_type,\"大会员\",\"\") = bc.s_name WHERE ei.NAME = '%s' AND phone = '%s' ORDER BY ewe.create_time DESC LIMIT 1", param.EntName, param.Phone))
|
|
|
+ if !vipRes1.IsEmpty() {
|
|
|
+ start := common.ObjToString(vipRes1.Map()["start_time"])
|
|
|
+ end := common.ObjToString(vipRes1.Map()["end_time"])
|
|
|
+ starts, _ := time.ParseInLocation(date.Date_Full_Layout, start, time.Local)
|
|
|
+ ends, _ := time.ParseInLocation(date.Date_Full_Layout, end, time.Local)
|
|
|
+ bigStart := starts.Unix()
|
|
|
+ bigEnd := ends.Unix()
|
|
|
+ nowTime := time.Now().Unix()
|
|
|
+ if nowTime < bigEnd && nowTime < bigStart {
|
|
|
+ return map[string]interface{}{
|
|
|
+ "willEffect": true,
|
|
|
+ "userData": userData,
|
|
|
+ "serviceArrMap": nil,
|
|
|
+ }, nil
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
vipRes, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT a.id,b.id as entUserId FROM entniche_info a
|
|
|
inner JOIN entniche_user b on a.id = b.ent_id
|
|
|
WHERE b.phone = '%s' and a.name = '%s'`, param.Phone, param.EntName))
|
|
@@ -190,6 +210,7 @@ WHERE b.phone = '%s' and a.name = '%s'`, param.Phone, param.EntName))
|
|
|
if param.ProductType != "大会员" && param.ProductType != "VIP订阅" {
|
|
|
serviceArrMap = SpecialService(ctx, gconv.String(vipRes.Map()["entUserId"]), param.ProductType)
|
|
|
} else {
|
|
|
+
|
|
|
entID := gconv.String(vipRes.Map()["id"])
|
|
|
var whereEntTime string
|
|
|
if param.ServiceType != 1 && param.ServiceType != 4 {
|