瀏覽代碼

fix:计费修改

duxin 2 月之前
父節點
當前提交
6777cf8d6f
共有 1 個文件被更改,包括 15 次插入8 次删除
  1. 15 8
      internal/logic/user/getService.go

+ 15 - 8
internal/logic/user/getService.go

@@ -90,7 +90,7 @@ WHERE %s and jod.status =1 order by dor.create_time desc`, whereSql))
 				if param.BuySubject == "1" {
 				if param.BuySubject == "1" {
 					var (
 					var (
 						linkedId, comboId, areaCount, paySubNum, gifUserCount, payUserCount int
 						linkedId, comboId, areaCount, paySubNum, gifUserCount, payUserCount int
-						eTime, sTime                                                        string
+						eTime, sTime, pCode                                                 string
 						orderArr                                                            []map[string]interface{}
 						orderArr                                                            []map[string]interface{}
 						serviceList                                                         []int
 						serviceList                                                         []int
 					)
 					)
@@ -99,7 +99,7 @@ WHERE %s and jod.status =1 order by dor.create_time desc`, whereSql))
 					sTime = time.Unix(startTime, 0).Format("2006-01-02 15:04:05")
 					sTime = time.Unix(startTime, 0).Format("2006-01-02 15:04:05")
 					eTime = time.Unix(bigEnd, 0).Format("2006-01-02 15:04:05")
 					eTime = time.Unix(bigEnd, 0).Format("2006-01-02 15:04:05")
 
 
-					orderData, _ := g.DB().Query(ctx, `SELECT   a.id,a.service_type,a.order_code,b.create_time,a.service_starttime,a.service_endtime,a.filter   FROM jy_order_detail  a
+					orderData, _ := g.DB().Query(ctx, `SELECT   a.product_code,a.id,a.service_type,a.order_code,b.create_time,a.service_starttime,a.service_endtime,a.filter   FROM jy_order_detail  a
 INNER JOIN dataexport_order b on a.order_code = b.order_code
 INNER JOIN dataexport_order b on a.order_code = b.order_code
 WHERE a.status = 1  and b.user_phone = ? and b.buy_subject = 1 and a.product_type like '%大会员%' ORDER BY b.create_time desc `, param.Phone)
 WHERE a.status = 1  and b.user_phone = ? and b.buy_subject = 1 and a.product_type like '%大会员%' ORDER BY b.create_time desc `, param.Phone)
 					if !orderData.IsEmpty() {
 					if !orderData.IsEmpty() {
@@ -110,6 +110,7 @@ WHERE a.status = 1  and b.user_phone = ? and b.buy_subject = 1 and a.product_typ
 							}
 							}
 							if linkedId == 0 {
 							if linkedId == 0 {
 								linkedId = gconv.Int(m2["id"])
 								linkedId = gconv.Int(m2["id"])
+								pCode = gconv.String(m2["product_code"])
 								paySubNum = ttt.FinalAccountCount
 								paySubNum = ttt.FinalAccountCount
 								for _, id := range ttt.ServiceIds {
 								for _, id := range ttt.ServiceIds {
 									serviceList = append(serviceList, gconv.Int(id))
 									serviceList = append(serviceList, gconv.Int(id))
@@ -131,9 +132,15 @@ WHERE a.status = 1  and b.user_phone = ? and b.buy_subject = 1 and a.product_typ
 							})
 							})
 						}
 						}
 					}
 					}
+					if pCode != "" {
+						itemMap, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT JSON_EXTRACT(price, '$.comboId') as comboId  FROM jy_product_item WHERE code = '%s';`, pCode))
+						if !itemMap.IsEmpty() {
+							comboId = gconv.Int(itemMap.Map()["comboId"])
+						}
+					}
 					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)
+					//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"])
@@ -412,15 +419,15 @@ WHERE %s and dor.product_type = '%s' and jod.status =1 ORDER BY dor.create_time
 			})
 			})
 		}
 		}
 		return map[string]interface{}{
 		return map[string]interface{}{
-			"name":             fmt.Sprintf("%s标准版", productType),      //产品名称
+			"name":             fmt.Sprintf("%s标准版", productType),   //产品名称
 			"vipExist":         vipExist,                               //当前服务是否在有限期内
 			"vipExist":         vipExist,                               //当前服务是否在有限期内
 			"serviceEndTime":   common.If(endTime != "", endTime, nil), //服务结束时间
 			"serviceEndTime":   common.If(endTime != "", endTime, nil), //服务结束时间
 			"productCode":      productCode,
 			"productCode":      productCode,
-			"serviceStartTime": startTime,                                   //服务开始时间
-			"buySubject":       buySubject,                                  //个体
+			"serviceStartTime": startTime,                                        //服务开始时间
+			"buySubject":       buySubject,                                       //个体
 			"empowerCount":     common.If(productType == "数据流量包", "1", "-"), //B.产品属性为“资源包”,则为“1”; C.产品属性非“会员服务”且非“资源包”,则展示-
 			"empowerCount":     common.If(productType == "数据流量包", "1", "-"), //B.产品属性为“资源包”,则为“1”; C.产品属性非“会员服务”且非“资源包”,则展示-
-			"linkedId":         linkedId,                                    //关联id
-			"linkedOrder":      orderArr,                                    //关联订单
+			"linkedId":         linkedId,                                         //关联id
+			"linkedOrder":      orderArr,                                         //关联订单
 		}
 		}
 	}
 	}
 	return nil
 	return nil