Ver Fonte

fix:提交

duxin há 4 meses atrás
pai
commit
ddb6bb2d92

+ 5 - 5
internal/jyutil/equityOpen.go

@@ -74,7 +74,7 @@ func AutomaticallyCreatingEnt(name, phone, orderCode string, userId string) (int
 func EntLicense(ctx context.Context, entId, empowerCount, provinceCount, orderId, userCount int, productType, st, et, phone string) (error, int64) {
 	log.Println("订单企业授权信息记录===", entId, productType)
 	e, pid := func() (error, int64) {
-		if count, _ := g.DB().Ctx(ctx).GetCount(ctx, fmt.Sprintf(`SELECT count(1) FROM entniche_order WHERE product_id = '%d' `, orderId)); count > 0 {
+		if count, _ := g.DB().Ctx(ctx).GetCount(ctx, fmt.Sprintf(`SELECT count(1) FROM entniche_order WHERE order_detail_id = '%d' `, orderId)); count > 0 {
 			return nil, 0
 		}
 		var pid int64
@@ -93,7 +93,7 @@ func EntLicense(ctx context.Context, entId, empowerCount, provinceCount, orderId
 				return errors.New("企业待授权表更新失败"), 0
 			} else {
 				inData := map[string]interface{}{
-					"product_id":      orderId,
+					"order_detail_id": orderId,
 					"wait_empower_id": id,
 					"create_time":     time.Now(),
 				}
@@ -116,7 +116,7 @@ func EntLicense(ctx context.Context, entId, empowerCount, provinceCount, orderId
 			if id > 0 {
 				pid = id
 				inData := map[string]interface{}{
-					"product_id":      orderId,
+					"order_detail_id": orderId,
 					"wait_empower_id": id,
 					"create_time":     time.Now(),
 				}
@@ -145,14 +145,14 @@ func SaveUpEntOrder(ctx context.Context, waitEmpowerId, orderId int) error {
 	count, err := g.DB().Ctx(ctx).GetCount(ctx, fmt.Sprintf(`selet * from entniche_wait_empower where id ='%d'`, waitEmpowerId))
 	if err == nil && count > 0 {
 		_, err = g.DB().Ctx(ctx).Update(ctx, "entniche_order", map[string]interface{}{
-			"product_id": orderId,
+			"order_detail_id": orderId,
 		}, map[string]interface{}{"wait_empower_id": waitEmpowerId})
 		if err != nil {
 			return errors.New(fmt.Sprintf("套餐续费失败 id: %d", waitEmpowerId))
 		}
 	} else {
 		_, err = g.DB().Ctx(ctx).Insert(ctx, "entniche_order", map[string]interface{}{
-			"product_id":      orderId,
+			"order_detail_id": orderId,
 			"wait_empower_id": waitEmpowerId,
 		})
 		if err != nil {

+ 10 - 10
internal/logic/order/detail.go

@@ -60,10 +60,10 @@ WHERE a.status = 1 and a.is_service_open = 1 and a.user_id = '%s' and a.product_
 				if !orderData.IsEmpty() {
 					for _, m2 := range orderProduct.List() {
 						orderArr = append(orderArr, map[string]interface{}{
-							"order_code":   m2["order_code"],
-							"create_time":  m2["create_time"],
-							"service_type": m2["service_type"],
-							"detail_id":    m2["id"],
+							"order_code":      m2["order_code"],
+							"create_time":     m2["create_time"],
+							"service_type":    m2["service_type"],
+							"order_detail_id": m2["id"],
 						})
 					}
 				}
@@ -111,20 +111,20 @@ WHERE a.status = 1 and a.is_service_open = 1 and a.user_id = '%s' and a.product_
 			case 2:
 				entService, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT a.id,a.product_type,a.end_time,a.start_time,a.empower_count,a.province_count FROM entniche_wait_empower a 
          INNER JOIN  entniche_order b on a.wait_empower_id = b.id
-WHERE b.detail_id=%s`, linkedDetailId))
+WHERE b.order_detail_id=%s`, linkedDetailId))
 				if !entService.IsEmpty() {
 					entOrderService, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT jod.*,do.create_time
 FROM jy_order_detail jod
-INNER JOIN entniche_order eo ON jod.id = eo.detail_id
+INNER JOIN entniche_order eo ON jod.id = eo.order_detail_id
 INNER JOIN dataexport_order do on jod.order_code=on do.order_code
 WHERE eo.wait_empower_id = %s and jod.is_service_open =1 ORDER BY do.create_time desc`, gconv.String(entService.Map()["id"])))
 					if !entOrderService.IsEmpty() {
 						for _, m2 := range entOrderService.List() {
 							orderArr = append(orderArr, map[string]interface{}{
-								"order_code":   m2["order_code"],
-								"create_time":  m2["create_time"],
-								"service_type": m2["service_type"],
-								"detail_id":    m2["id"],
+								"order_code":      m2["order_code"],
+								"create_time":     m2["create_time"],
+								"service_type":    m2["service_type"],
+								"order_detail_id": m2["id"],
 							})
 						}
 						m["linkedOrder"] = map[string]interface{}{

+ 1 - 1
internal/logic/order/examine.go

@@ -414,7 +414,7 @@ func GetUserTime(phone, orderId string, isVip, isEnt bool) (monthCount int) {
 		waitEmpower, err := g.DB().Ctx(context.Background()).GetOne(context.Background(), fmt.Sprintf(`
 SELECT e.start_time,e.end_time FROM entniche_order e
 INNER JOIN entniche_wait_empower w on e.wait_empower_id = w.id
-WHERE e.product_id = %s`, orderId))
+WHERE e.order_detail_id = %s`, orderId))
 		if err == nil || waitEmpower.IsEmpty() {
 			return monthCount
 		}

+ 1 - 1
internal/logic/product/bigmember/BigMemberRenew.go

@@ -126,7 +126,7 @@ func (p jyBigProduct) BigMemberRenew(ctx context.Context, orderData, userData ma
 			waitEmpowerId            int
 		)
 		data, _ := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT c.id as waitEmpowerId,c.start_time as sTime,c.end_time as eTime from jy_datareport_order a 
-INNER JOIN entniche_order b on a.id = b.product_id
+INNER JOIN entniche_order b on a.id = b.order_detail_id
 INNER JOIN entniche_wait_empower c on b.wait_empower_id=c.id
 where a.id = %d  `, p.param.LinkedOrderId))
 		if !data.IsEmpty() {

+ 2 - 2
internal/logic/product/bigmember/BigMemberUpgrades.go

@@ -34,7 +34,7 @@ func (p jyBigProduct) BigMemberUpgrades(ctx context.Context, orderData, userData
 				newStartTime, newEndTime time.Time
 			)
 			data, _ := g.DB().Ctx(ctx).GetOne(ctx, fmt.Sprintf(`SELECT c.id as waitEmpowerId,c.start_time as sTime,c.end_time as eTime,c.ent_id from jy_datareport_order a 
-INNER JOIN entniche_order b on a.id = b.product_id
+INNER JOIN entniche_order b on a.id = b.order_detail_id
 INNER JOIN entniche_wait_empower c on b.wait_empower_id=c.id
 where a.id = %d  `, p.param.LinkedOrderId))
 			if data.IsEmpty() {
@@ -110,7 +110,7 @@ func (p jyBigProduct) BigMemberSub(ctx context.Context, orderData, userData map[
 		}
 	case "2":
 		var areaCount int
-		res, _ := g.DB().GetOne(ctx, fmt.Sprintf("SELECT c.end_time,c.start_time,c.province_count FROM jy_order_detail a LEFT JOIN entniche_order b on a.id = b.product_id LEFT JOIN entniche_wait_empower c ON b.wait_empower_id = c.id WHERE a.id = %d", p.param.LinkedOrderId))
+		res, _ := g.DB().GetOne(ctx, fmt.Sprintf("SELECT c.end_time,c.start_time,c.province_count FROM jy_order_detail a LEFT JOIN entniche_order b on a.id = b.order_detail_id LEFT JOIN entniche_wait_empower c ON b.wait_empower_id = c.id WHERE a.id = %d", p.param.LinkedOrderId))
 		if !res.IsEmpty() {
 			bs, _ := time.ParseInLocation(date.Date_Full_Layout, common.ObjToString(res.Map()["start_time"]), time.Local)
 			be, _ := time.ParseInLocation(date.Date_Full_Layout, common.ObjToString(res.Map()["end_time"]), time.Local)

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

@@ -127,7 +127,7 @@ func (p jyBigProduct) SaveUpdate(ctx context.Context, masterKey string) error {
 			"phone":            p.param.Phone,
 			"original_price":   p.param.OriginalPrice,
 			"final_price":      p.param.Amount,
-			"product_id":       p.param.ProductCode,
+			"order_detail_id":  p.param.ProductCode,
 			"tactics":          p.param.Tactics,
 			"linked_detail_id": p.param.LinkedOrderId,
 			"is_master":        common.If(fmt.Sprintf("%s_%d", p.param.ProductCode, p.param.Amount) == masterKey, 1, 0),

+ 1 - 1
internal/logic/product/common.go

@@ -83,7 +83,7 @@ func GetLinkBigUserNumber(ctx context.Context, linkOrderDetailId, reqBuySet int6
 	case 2:
 		re, err = g.DB().GetOne(ctx, fmt.Sprintf(`SELECT a.empower_count FROM entniche_wait_empower a
 INNER JOIN entniche_order b on a.id = b.wait_empower_id
-WHERE b.product_id = %d`, linkOrderDetailId))
+WHERE b.order_detail_id = %d`, linkOrderDetailId))
 		if err != nil {
 			return 0, err
 		}

+ 4 - 4
internal/logic/product/subvip/service.go

@@ -177,7 +177,7 @@ func (p jySubVipProduct) OpenService(ctx context.Context) error {
 
 // entPower 企业超级订阅
 func vipEntPower(ctx context.Context, entId, entUserId int64, doType, empowerCount, provinceCount int, orderDetailId int64, st, et time.Time) (pid int64, err error) {
-	if count, _ := g.DB().GetCount(ctx, "SELECT count(1) FROM entniche_order WHERE product_id = ?", orderDetailId); count > 0 {
+	if count, _ := g.DB().GetCount(ctx, "SELECT count(1) FROM entniche_order WHERE order_detail_id = ?", orderDetailId); count > 0 {
 		return 0, fmt.Errorf("此订单已开通服务")
 	}
 	t := date.NowFormat(date.Date_Full_Layout)
@@ -201,7 +201,7 @@ func vipEntPower(ctx context.Context, entId, entUserId int64, doType, empowerCou
 			return 0, errors.Wrap(err, "获取 entniche_wait_empower Id失败")
 		}
 		if _, err := g.DB().Ctx(ctx).Insert(ctx, "entniche_order", map[string]interface{}{
-			"product_id":      orderDetailId,
+			"order_detail_id": orderDetailId,
 			"wait_empower_id": pid,
 			"create_time":     time.Now(),
 		}); err != nil {
@@ -231,7 +231,7 @@ func vipEntPower(ctx context.Context, entId, entUserId int64, doType, empowerCou
 		if orderDetailId == 0 {
 			return 0, fmt.Errorf("缺少关联订单字段")
 		}
-		record, err := g.DB().GetOne(ctx, "SELECT wait_empower_id FROM entniche_order WHERE product_id = ? order by create_time desc", orderDetailId)
+		record, err := g.DB().GetOne(ctx, "SELECT wait_empower_id FROM entniche_order WHERE order_detail_id = ? order by create_time desc", orderDetailId)
 		if err != nil {
 			return -1, errors.Wrap(err, "获取关联订单异常")
 		}
@@ -264,7 +264,7 @@ func vipEntPower(ctx context.Context, entId, entUserId int64, doType, empowerCou
 			return 0, errors.Wrap(err, "修改entniche_wait_empower异常")
 		}
 		if _, err := g.DB().Ctx(ctx).Insert(ctx, "entniche_order", map[string]interface{}{
-			"product_id":      orderDetailId,
+			"order_detail_id": orderDetailId,
 			"wait_empower_id": pid,
 			"create_time":     time.Now(),
 		}); err != nil {

+ 10 - 10
internal/logic/user/getService.go

@@ -82,10 +82,10 @@ WHERE a.status = 1 and a.is_service_open = 1 and a.user_id = '%s' and a.product_
 							linkedId = gconv.Int(m2["id"])
 						}
 						orderArr = append(orderArr, map[string]interface{}{
-							"order_code":   m2["order_code"],
-							"create_time":  m2["create_time"],
-							"service_type": m2["service_type"],
-							"detail_id":    m2["id"],
+							"order_code":      m2["order_code"],
+							"create_time":     m2["create_time"],
+							"service_type":    m2["service_type"],
+							"order_detail_id": m2["id"],
 						})
 					}
 				}
@@ -192,7 +192,7 @@ WHERE a.ent_id = '%s' and a.end_time>'%s' and a.product_type like '%s' and  ORDE
 						if param.ProductType == "大会员" {
 							//大会员获取下服务最新id
 							serviceId, _ := g.DB().GetOne(ctx, fmt.Sprintf(`SELECT  b.filter FROM entniche_order a 
-	INNER JOIN  jy_order_detail b on a.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() {
 								for _, id := range gconv.Ints(gconv.Map(serviceId.Map()["filter"])["serviceIds"]) {
 									if id == 12 {
@@ -211,7 +211,7 @@ WHERE a.ent_id = '%s' and a.end_time>'%s' and a.product_type like '%s' and  ORDE
 						)
 						//获取订单
 						entOrderService, _ := g.DB().Query(ctx, fmt.Sprintf(`SELECT  b.id,b.service_type,b.order_code,c.create_time FROM entniche_order a 
-	INNER JOIN  jy_order_detail b on a.detail_id = b.id
+	INNER JOIN  jy_order_detail b on a.order_detail_id = b.id
 	LEFT JOIN dataexport_order c on b.order_code = c.order_code WHERE a.wait_empower_id = %d order by b.id desc`, gconv.Int(m["id"])))
 						if !entOrderService.IsEmpty() {
 							for _, m2 := range entOrderService.List() {
@@ -219,10 +219,10 @@ WHERE a.ent_id = '%s' and a.end_time>'%s' and a.product_type like '%s' and  ORDE
 									linkedId = gconv.Int(m2["id"])
 								}
 								orderArr = append(orderArr, map[string]interface{}{
-									"order_code":   m2["order_code"],
-									"create_time":  m2["create_time"],
-									"service_type": m2["service_type"],
-									"detail_id":    m2["id"],
+									"order_code":      m2["order_code"],
+									"create_time":     m2["create_time"],
+									"service_type":    m2["service_type"],
+									"order_detail_id": m2["id"],
 								})
 							}
 						}