修复拉卡拉支付时间偏差
This commit is contained in:
@@ -19,6 +19,8 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"hfb_sys/backend/internal/timeutil"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -174,11 +176,12 @@ func (c *Client) CreatePayment(ctx context.Context, req CreatePaymentRequest) (*
|
||||
if expireMinutes <= 0 {
|
||||
expireMinutes = 15
|
||||
}
|
||||
now := timeutil.ShanghaiNow()
|
||||
reqData := map[string]any{
|
||||
"out_order_no": req.ThirdOrderID,
|
||||
"merchant_no": c.cfg.MerchantID,
|
||||
"total_amount": req.AmountCent,
|
||||
"order_efficient_time": time.Now().Add(time.Duration(expireMinutes) * time.Minute).Format("20060102150405"),
|
||||
"order_efficient_time": now.Add(time.Duration(expireMinutes) * time.Minute).Format("20060102150405"),
|
||||
"notify_url": firstNonEmpty(req.NotifyURL, c.cfg.NotifyURL),
|
||||
"support_refund": 1,
|
||||
"support_repeat_pay": 1,
|
||||
@@ -364,7 +367,7 @@ func ParsePayload(body []byte) (map[string]string, error) {
|
||||
|
||||
func (c *Client) post(ctx context.Context, endpoint string, reqData map[string]any) (map[string]string, error) {
|
||||
body, err := json.Marshal(map[string]any{
|
||||
"req_time": time.Now().Format("20060102150405"),
|
||||
"req_time": timeutil.ShanghaiNow().Format("20060102150405"),
|
||||
"version": "3.0",
|
||||
"req_data": reqData,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user