feat: chunk uploads

This commit is contained in:
Rogee
2025-01-15 00:26:10 +08:00
parent 591771ce77
commit 9bfdf0e0ea
16 changed files with 451 additions and 40 deletions

View File

@@ -17,14 +17,10 @@ func DefaultProvider() container.ProviderContainer {
}
type Config struct {
WeChat *wechatPay
}
type wechatPay struct {
AppId string
MechID string
SubMechID string
SerialNo string
ApiV3Key string
PrivateKey string
WechatAppId string
WechatMechID string
WechatSubMechID string
WechatSerialNo string
WechatApiV3Key string
WechatPrivateKey string
}

View File

@@ -16,11 +16,12 @@ func Provide(opts ...opt.Option) error {
return err
}
return container.Container.Provide(func(app *app.Config) (*Client, error) {
return nil, nil
wechatPay, err := wechat.NewClientV3(
config.WeChat.MechID,
config.WeChat.SerialNo,
config.WeChat.ApiV3Key,
config.WeChat.PrivateKey,
config.WechatMechID,
config.WechatSerialNo,
config.WechatApiV3Key,
config.WechatPrivateKey,
)
if err != nil {
return nil, err

View File

@@ -16,9 +16,9 @@ func (client *Client) WeChat_JSApiPayRequest(ctx context.Context, payerOpenID, o
bm := make(gopay.BodyMap)
bm.
Set("sp_appid", client.conf.WeChat.AppId).
Set("sp_mchid", client.conf.WeChat.MechID).
Set("sub_mchid", client.conf.WeChat.SubMechID).
Set("sp_appid", client.conf.WechatAppId).
Set("sp_mchid", client.conf.WechatMechID).
Set("sub_mchid", client.conf.WechatSubMechID).
Set("description", title).
Set("out_trade_no", orderNo).
Set("time_expire", expire).
@@ -45,5 +45,5 @@ func (client *Client) WeChat_JSApiPayRequest(ctx context.Context, payerOpenID, o
return nil, errors.New("获取预支付ID失败")
}
return client.WeChat.PaySignOfJSAPI(client.conf.WeChat.AppId, resp.Response.PrepayId)
return client.WeChat.PaySignOfJSAPI(client.conf.WechatAppId, resp.Response.PrepayId)
}