Browse Source

fix:计费修改

duxin 3 months ago
parent
commit
4f0e43c5de

+ 2 - 2
internal/controller/userService.go

@@ -20,12 +20,12 @@ func GetUserService(r *ghttp.Request) {
 		}
 		list, err := user.GetUserService(r.Context(), param)
 		if err != nil {
-			return nil, errors.Wrap(err, "订单创建异常")
+			return nil, errors.Wrap(err, "用户开通服务异常")
 		}
 		return list, nil
 	}()
 	if err != nil {
-		g.Log().Errorf(r.Context(), "创建订单异常 %v", err)
+		g.Log().Errorf(r.Context(), "用户开通服务异常 %v", err)
 	}
 	r.Response.WriteJson(NewResult(rData, err))
 }

+ 23 - 0
internal/logic/order/detail.go

@@ -44,6 +44,29 @@ func Detail(ctx context.Context, param model.OrderDetailParams) (map[string]inte
 				m["activityName"] = gconv.String(activityData.Map()["name"])
 			}
 		}
+		productItem, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT name FROM jy_product_item WHERE code = '%s'`, gconv.String(m["product_code"])))
+		if !productItem.IsEmpty() {
+			m["productName"] = productItem.Map()["name"]
+		}
+		if gconv.String(m["product_type"]) == "大会员" {
+			bigService, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT s_name FROM bigmember_service WHERE id in (%s)`, gconv.Strings(gconv.Map(m["filter"])["serviceId"])))
+			if !bigService.IsEmpty() {
+				var bigServiceNames []string
+				for _, m1 := range bigService.List() {
+					bigServiceNames = append(bigServiceNames, gconv.String(m1["s_name"]))
+				}
+				m["bigServiceNames"] = bigServiceNames
+			}
+			supBigService, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT s_name FROM bigmember_service WHERE id in (%s)`, gconv.Strings(gconv.Map(m["filter"])["supServiceIds"])))
+			if !supBigService.IsEmpty() {
+				var bigServiceNames []string
+				for _, m1 := range supBigService.List() {
+					bigServiceNames = append(bigServiceNames, gconv.String(m1["s_name"]))
+				}
+				m["supBigmemberService"] = bigServiceNames
+			}
+		}
+
 		if linkedDetailId := gconv.String(m["linked_detail_id"]); linkedDetailId != "" {
 			var orderArr []map[string]interface{}
 			//关联订单

+ 1 - 0
internal/logic/product/bigmember/price.go

@@ -45,6 +45,7 @@ func (p jyBigProduct) GetPrice() (price int64, err error) {
 	} else { //企业
 		accountPrice = thisPriceSetting.EntAccount
 	}
+	p.param.Filter.FinalAccountCount = p.param.Filter.BuyAccountCount + p.param.Filter.GiftAccountCount + 1
 	switch p.param.ServiceType {
 	case 1, 4: //购买、试用
 		if p.param.Filter.GiftCycle != 0 && p.param.Filter.BuyType != p.param.Filter.GiftType {