|
@@ -235,9 +235,15 @@ INNER JOIN jy_product_class jpc on jpi.product_class_id = jpc.id WHERE jpi.code
|
|
|
}*/
|
|
|
|
|
|
if linkedDetailId := gconv.Int(m["linked_detail_id"]); linkedDetailId > 0 {
|
|
|
+ linkedDetail, _ := g.DB().GetOne(ctx, `SELECT * FROM jy_order_detail where id = ?`, linkedDetailId)
|
|
|
+ if linkedDetail.IsEmpty() {
|
|
|
+ log.Println("产品关联订单获取异常", param.OrderCode, linkedDetailId)
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
var orderArr []map[string]interface{}
|
|
|
//关联订单
|
|
|
- if gconv.String(m["product_type"]) != "大会员" && gconv.String(m["product_type"]) != "VIP订阅" {
|
|
|
+ if gconv.String(linkedDetail.Map()["product_type"]) != "大会员" && gconv.String(linkedDetail.Map()["product_type"]) != "VIP订阅" {
|
|
|
var whereSql string
|
|
|
if gconv.Int(orderMap["buy_subject"]) == 1 {
|
|
|
whereSql = fmt.Sprintf("dor.user_phone = '%s' and dor.buy_subject =1 and dor.create_time< '%s' ", gconv.String(orderMap["user_phone"]), gconv.String(orderMap["create_time"]))
|
|
@@ -252,12 +258,7 @@ INNER JOIN jy_product_class jpc on jpi.product_class_id = jpc.id WHERE jpi.code
|
|
|
areaCount, paySubNum, buySubject int
|
|
|
endTime, startTime string
|
|
|
)
|
|
|
- linkedDetail, _ := g.DB().GetOne(ctx, `SELECT * FROM jy_order_detail where id = ?`, linkedDetailId)
|
|
|
- if linkedDetail.IsEmpty() {
|
|
|
- log.Println("产品关联订单获取异常", param.OrderCode, linkedDetailId)
|
|
|
- continue
|
|
|
- }
|
|
|
- switch gconv.String(m["product_type"]) {
|
|
|
+ switch gconv.String(linkedDetail.Map()["product_type"]) {
|
|
|
case "VIP订阅":
|
|
|
var ttt model.VipCycleFilter
|
|
|
if err = gconv.Struct(linkedDetail.Map()["filter"], &ttt); err != nil {
|
|
@@ -279,7 +280,7 @@ INNER JOIN jy_product_class jpc on jpi.product_class_id = jpc.id WHERE jpi.code
|
|
|
buySubject = 1
|
|
|
orderProduct, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT b.id,a.service_type,b.order_code,b.create_time,a.service_starttime,a.service_endtime FROM jy_order_detail a
|
|
|
INNER JOIN dataexport_order b on a.order_code = b.order_code
|
|
|
-WHERE a.status = 1 and a.is_service_open = 1 and b.user_phone = '%s' and b.create_time< '%s' and b.buy_subject = 1 and a.product_type like '%s' ORDER BY b.create_time desc `, gconv.String(orderMap["user_phone"]), orderMap["create_time"], common.If(gconv.String(m["product_type"]) == "VIP订阅", "%VIP订阅%", "%大会员%")))
|
|
|
+WHERE a.status = 1 and a.is_service_open = 1 and b.user_phone = '%s' and b.create_time< '%s' and b.buy_subject = 1 and a.product_type like '%s' ORDER BY b.create_time desc `, gconv.String(orderMap["user_phone"]), orderMap["create_time"], gconv.String(linkedDetail.Map()["product_type"])))
|
|
|
if !orderData.IsEmpty() {
|
|
|
for _, m2 := range orderProduct.List() {
|
|
|
if endTime == "" && gconv.String(m2["service_endtime"]) != "" {
|
|
@@ -786,7 +787,7 @@ func TotalPeriod(filterMap map[string]interface{}) string {
|
|
|
if month > 0 {
|
|
|
totalPeriodStr = append(totalPeriodStr, fmt.Sprintf("%d月", month))
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if day > 0 {
|
|
|
totalPeriodStr = append(totalPeriodStr, fmt.Sprintf("%d天", day))
|
|
|
}
|