Skip to content

Commit 04082fc

Browse files
committed
Merge branch 'main' into main-upstream
2 parents f8b8336 + dc3e464 commit 04082fc

38 files changed

+1796
-1263
lines changed

app/daemon/daemon.go

+30-30
Original file line numberDiff line numberDiff line change
@@ -273,9 +273,9 @@ func (d *defaultService) PaymentOrderObs(order *proto.SPaymentOrder) bool {
273273

274274
// 测试是否为子订单,并返回编号
275275
func (d *defaultService) testSubId(o *proto.SSingleOrder) (string, bool) {
276-
if o.ParentOrderId <= 0 {
277-
return o.OrderNo, true
278-
}
276+
// if o.ParentOrderId <= 0 {
277+
// return o.OrderNo, true
278+
// }
279279
return o.OrderNo, false
280280
}
281281

@@ -291,20 +291,20 @@ func (d *defaultService) batchDelKeys(conn redis.Conn, key string) {
291291

292292
// 设置订单过期时间
293293
func (d *defaultService) updateOrderExpires(conn redis.Conn, o *proto.SSingleOrder) {
294-
//订单刚创建时,设置过期时间
295-
if o.Status == order.StatAwaitingPayment {
296-
trans, cli, _ := service.FoundationServiceClient()
297-
defer trans.Close()
298-
ss, _ := cli.GetGlobMchSaleConf_(context.TODO(), &proto.Empty{})
299-
unix := o.UpdateTime + int64(ss.OrderTimeOutMinute)*60
300-
t := time.Unix(unix, 0)
301-
tk := getTick(t)
302-
orderNo, sub := d.testSubId(o)
303-
prefix := types.StringCond(sub, "sub!", "")
304-
key := fmt.Sprintf("%s:%s%s:%s", variable.KvOrderExpiresTime, prefix, orderNo, tk)
305-
//log.Println(" [Daemon][Exprire][ Key]:", key)
306-
conn.Do("SET", key, unix)
307-
}
294+
// //订单刚创建时,设置过期时间
295+
// if o.Status == order.StatAwaitingPayment {
296+
// trans, cli, _ := service.FoundationServiceClient()
297+
// defer trans.Close()
298+
// ss, _ := cli.GetGlobMchSaleConf_(context.TODO(), &proto.Empty{})
299+
// unix := o.UpdateTime + int64(ss.OrderTimeOutMinute)*60
300+
// t := time.Unix(unix, 0)
301+
// tk := getTick(t)
302+
// orderNo, sub := d.testSubId(o)
303+
// prefix := types.StringCond(sub, "sub!", "")
304+
// key := fmt.Sprintf("%s:%s%s:%s", variable.KvOrderExpiresTime, prefix, orderNo, tk)
305+
// //log.Println(" [Daemon][Exprire][ Key]:", key)
306+
// conn.Do("SET", key, unix)
307+
// }
308308
}
309309

310310
// 取消订单过期时间
@@ -332,19 +332,19 @@ func (d *defaultService) orderAutoConfirm(conn redis.Conn, o *proto.SSingleOrder
332332

333333
// 订单自动收货
334334
func (d *defaultService) orderAutoReceive(conn redis.Conn, o *proto.SSingleOrder) {
335-
if o.Status == order.StatShipped {
336-
trans, cli, _ := service.FoundationServiceClient()
337-
defer trans.Close()
338-
ss, _ := cli.GetGlobMchSaleConf_(context.TODO(), &proto.Empty{})
339-
unix := o.UpdateTime + int64(ss.OrderTimeOutReceiveHour)*60*60
340-
t := time.Unix(unix, 0)
341-
tk := getTick(t)
342-
orderNo, sub := d.testSubId(o)
343-
prefix := types.StringCond(sub, "sub!", "")
344-
key := fmt.Sprintf("%s:%s%s:%s", variable.KvOrderAutoReceive, prefix, orderNo, tk)
345-
//log.Println(" [Daemon][AutoReceive][ Key]:", key)
346-
conn.Do("SET", key, unix)
347-
}
335+
// if o.Status == order.StatShipped {
336+
// trans, cli, _ := service.FoundationServiceClient()
337+
// defer trans.Close()
338+
// ss, _ := cli.GetGlobMchSaleConf_(context.TODO(), &proto.Empty{})
339+
// unix := o.UpdateTime + int64(ss.OrderTimeOutReceiveHour)*60*60
340+
// t := time.Unix(unix, 0)
341+
// tk := getTick(t)
342+
// orderNo, sub := d.testSubId(o)
343+
// prefix := types.StringCond(sub, "sub!", "")
344+
// key := fmt.Sprintf("%s:%s%s:%s", variable.KvOrderAutoReceive, prefix, orderNo, tk)
345+
// //log.Println(" [Daemon][AutoReceive][ Key]:", key)
346+
// conn.Do("SET", key, unix)
347+
// }
348348
}
349349

350350
// 完成订单自动收货

app/daemon/supervise.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func superviseOrder(ss []Service) {
3636
// OrderNo: orderNo,
3737
// SubOrder: sub,
3838
//})
39-
o, _ := cli.GetOrder(context.TODO(), &proto.OrderNoV2{
40-
Value: orderNo,
39+
o, _ := cli.GetOrder(context.TODO(), &proto.OrderRequest{
40+
OrderNo: orderNo,
4141
})
4242
trans.Close()
4343
if o != nil {

core/domain/interface/order/complex_order.go

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ type (
2121
OrderNo string
2222
// 购买人编号
2323
BuyerId int64
24+
// 卖家编号-
25+
SellerId int64
2426
// 买家用户名
2527
BuyerUser string
2628
// 订单标题

core/domain/interface/order/normal_order.go

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package order
22

33
import (
44
"github.com/ixre/go2o/core/domain/interface/cart"
5+
"github.com/ixre/go2o/core/domain/interface/payment"
56
"github.com/ixre/go2o/core/domain/interface/promotion"
67
)
78

@@ -16,6 +17,8 @@ type (
1617
OnlinePaymentTradeFinish() error
1718
// Submit 提交订单。如遇拆单,需均摊优惠抵扣金额到商品
1819
Submit() error
20+
// BreakPaymentOrder 拆分支付单
21+
BreakPaymentOrder() ([]payment.IPaymentOrder, error)
1922
// Cancel 取消订单
2023
Cancel(buyerCancel bool, reason string) error
2124

@@ -49,6 +52,8 @@ type (
4952
Complex() *ComplexOrder
5053
// ParentOrder 获取父订单
5154
ParentOrder() IOrder
55+
// GetPaymentOrder 获取支付单
56+
GetPaymentOrder() payment.IPaymentOrder
5257
// Items 获取商品项
5358
Items() []*SubOrderItem
5459
// 更改收货人信息

core/domain/interface/order/order.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,14 @@ type (
317317
SubmitReturnData struct {
318318
// 订单号,多个订单号,用","分割
319319
OrderNo string
320-
// 交易号
321-
TradeNo string
322320
// 交易金额
323321
TradeAmount int64
324322
// 合并支付
325-
MergePay bool
323+
IsMergePay bool
326324
// 支付单号
327325
PaymentOrderNo string
326+
// 支付状态
327+
PaymentState int
328328
}
329329

330330
// Order 订单

core/domain/interface/payment/payment.go

+9-35
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@ type (
163163
IPaymentRepo interface {
164164
// GetPaymentOrderById 根据编号获取支付单
165165
GetPaymentOrderById(id int) IPaymentOrder
166+
// DeletePaymentOrder 拆分后删除父支付单
167+
DeletePaymentOrder(id int) error
168+
// DeletePaymentTradeData 删除支付单的支付数据
169+
DeletePaymentTradeData(orderId int) error
166170
// GetPaymentOrder 根据支付单号获取支付单
167171
GetPaymentOrder(paymenOrderNo string) IPaymentOrder
168172
// GetPaymentBySalesOrderId 根据订单号获取支付单
@@ -195,16 +199,6 @@ type (
195199
GetAwaitCloseOrders(lastId int, size int) []IPaymentOrder
196200
}
197201

198-
// RequestPayData 请求支付数据
199-
RequestPayData struct {
200-
// 支付方式
201-
method int
202-
// 支付方式代码
203-
code string
204-
// 支付金额
205-
amount int
206-
}
207-
208202
// Order 支付单
209203
Order struct {
210204
// 编号
@@ -227,10 +221,8 @@ type (
227221
BuyerId int64 `db:"buyer_id"`
228222
// 支付用户编号
229223
PayerId int64 `db:"payer_id"`
230-
// 商品金额
231-
ItemAmount int64 `db:"item_amount"`
232-
// 优惠金额
233-
DiscountAmount int64 `db:"discount_amount"`
224+
// 优惠金额,todo: 删除但目前依赖于优惠券
225+
DiscountAmount int64 `db:"-"`
234226
// 调整金额
235227
AdjustAmount int64 `db:"adjust_amount"`
236228
// 共计金额,包含抵扣金额
@@ -272,7 +264,9 @@ type (
272264
// TradeMethodData 支付单项
273265
TradeMethodData struct {
274266
// 编号
275-
ID int `db:"id" pk:"yes" auto:"yes"`
267+
Id int `db:"id" pk:"yes" auto:"yes"`
268+
// 支付订单号Id
269+
OrderId int `db:"order_id"`
276270
// 交易单号
277271
TradeNo string `db:"trade_no"`
278272
// 支付途径
@@ -301,26 +295,6 @@ type (
301295
SubmitTime int64 `db:"submit_time"`
302296
}
303297

304-
// PaySpTrade SP支付交易
305-
PaySpTrade struct {
306-
// 编号
307-
ID int `db:"id"`
308-
// 交易SP
309-
TradeSp string `db:"trade_sp"`
310-
// 交易号
311-
TradeNo string `db:"trade_no"`
312-
// 合并的订单号,交易号用"|"分割
313-
TradeOrders string `db:"trade_orders"`
314-
// 交易状态
315-
TradeState int `db:"trade_state"`
316-
// 交易结果
317-
TradeResult int `db:"trade_result"`
318-
// 交易备注
319-
TradeRemark string `db:"trade_remark"`
320-
// 交易时间
321-
TradeTime int `db:"trade_time"`
322-
}
323-
324298
// IntegrateApp 集成支付应用
325299
IntegrateApp struct {
326300
// 编号

0 commit comments

Comments
 (0)