Browse Source

update

master
dengbiao 1 month ago
parent
commit
2b57c573e0
4 changed files with 9 additions and 10 deletions
  1. +6
    -6
      app/lib/gopay/init.go
  2. +3
    -3
      app/lib/gopay/utils_test.go
  3. BIN
     
  4. +0
    -1
      go.mod

app/lib/alipay/init.go → app/lib/gopay/init.go View File

@@ -1,4 +1,4 @@
package alipay
package gopay

import (
"applet/app/db"
@@ -7,10 +7,10 @@ import (
"code.fnuoos.com/EggPlanet/egg_system_rules.git/enum"
"github.com/go-pay/gopay"
"github.com/go-pay/gopay/alipay"
"github.com/go-pay/xlog"
"github.com/go-pay/gopay/pkg/xlog"
)

type InitStruct struct {
type InitAlipayStruct struct {
IsProd bool `json:"is_prod" label:"是否生产环境"`
AlipayAppId string `json:"alipay_app_id" label:"支付宝商家应用appid"`
AlipayPrivateKey string `json:"alipay_private_key" label:"支付宝商家应用私钥"`
@@ -20,15 +20,15 @@ type InitStruct struct {
AppPublicContent []byte `json:"app_public_content" label:"应用公钥证书"`
}

// Init 初始化支付宝客户端
// InitAlipay 初始化支付宝客户端
// appid:应用ID
// privateKey:应用私钥,支持PKCS1和PKCS8
// isProd:是否是正式环境,沙箱环境请选择新版沙箱应用。
func Init(initData *InitStruct) (client *alipay.Client, err error) {
func InitAlipay(initData *InitAlipayStruct) (client *alipay.Client, err error) {
if initData == nil {
sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get())
sysCfgMap := sysCfgDb.SysCfgFindWithDb(enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent)
initData = &InitStruct{
initData = &InitAlipayStruct{
IsProd: true,
AlipayAppId: sysCfgMap[enum.AlipayAppId],
AlipayPrivateKey: sysCfgMap[enum.AlipayPrivateKey],

app/lib/alipay/utils_test.go → app/lib/gopay/utils_test.go View File

@@ -1,14 +1,14 @@
package alipay
package gopay

import (
"context"
"github.com/go-pay/gopay"
"github.com/go-pay/xlog"
"github.com/go-pay/gopay/pkg/xlog"
"testing"
)

func TestFundTransUniTransfer(t *testing.T) {
client, err := Init(&InitStruct{
client, err := InitAlipay(&InitAlipayStruct{
IsProd: true,
AlipayAppId: "2021005100673124",
AlipayPrivateKey: "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCMK7YWZigquw+Ywyw6QjXFjQqkR4TkIzxMKuB62vcG1ywvnYLLpmWDxZ9YJuxoZuxZTuoZtTnfZkvgHo8ik9rdMAB8CqK03fgnlHJp57Zzstl2+kqvKw3mypM0PYWcSB9M9WxmrWF8vKHcGzMu/IK0t0lT9cjnjTJCZjC4jHKXjqWIdua4MV/9swg5EoWov1ySa0feE1ZmcLPbZWkdum7BEK7gZcOpPXMQybLvqUun0PAo/Vyx+PfZj6zyXhCbhbEXJOaXyN6BtM1wYgN4XwT/RpVVuL/SJyRzH4f7bD0f7HItYnTOBts3GxLr4kIgBE9yeSofZ0K3jn+BT4FQs0SDAgMBAAECggEAC6vkGI9fDtfOn6i4uQ0kTxPEbBNsdFaewbTcRj6PTSmDi19xMaXkVAmTkBKFotfXHESe548Yh4qMDNhekMGA+uPxVmLIU4kcDaelsz3RCmc9BlQm/dj26l25ziLFSlMTECRrZ01OjcVjMOGu7F2oQIX2fCA+H1G5ep/ptKQ1MntUy9darg+cZlppNe0YTDi9MyZ9Nmk6Tx916u2/S3aNKfR/+K0WkVYrX2N+OpsVC++PDgboy28GjX4GgBHm28yYhtf++FCzv11ZFDc+JKWayI/me/b2i8tPDVIzq/0V0mYE6HWczFOs7Sq9BAzbc2S70LF9PXINgcTui4rCz7kOOQKBgQDwCm+rxRomsL4O8kwW5k05051bR9C/jObOauot9+wUE6pZvVPRn7z5Nuz6YPGyrFKQs9f/gS6hmmGOQ+ggOUVLLDk/K6GTDzluP6NTo3OwPXbRj4n2AkwuZ+a0+HyFRO3h96xiceswYBZzOs0fBXfmgTKGQk50imfPVwSyrgX1VQKBgQCVfXVPDjE9DiZ8kWXseC6b+MFtsa7gNDsU8XVzSq+w7NdA9NvYHyQGj79HKn+Bwo+LDvkKU9edG1voEjlg8LPhdr3IVxr0L/S2g7euGeReLbl6sPUb93S/IIIZ+xEI5aaiq7fLnnd2ckQuaJvweUFvNWzUa75EW0rLujRd1fVSdwKBgFkYNoy18tfrgA/CJTXWs1FEV0KbLEL8xGpXSqZXQBvPlMoMOME0ngqONXVVaECeL2MgLYrbYvh+ebk5QT48o5icSH9G7YjM/M8L9c5Ee9stZR2xPk6+WZJb5EjFdkps5DKcIDLF/7qL36lTaPEbsX4v9BXbJI2jFZbiwI6lgvalAoGAIgVqZDKDrDSDN8hTXOzBFsgXJWLRvL7GT27gXvu5XleYaXUQb3Au37tpOcYHPL3Ns0UWEm6gXGX0la1IF7LQDVjbujNws/ASDlONwvarjW90jeKl9dZsYG8CjO0hpFe3g7/21UVcRL2enL07+A9wf+G1weY/aAkqzZC0CEMAUOMCgYBipJRBsnoJ01+2vVu7qF67zQTciuGztUKYSYtArLh8ZWxZ4U5otjyNe6rtDytEUw0I6ETDvCA9g85Lq4zCfQVXAqp0FiPqyMn5nhlTCMCwM899nn3N3wU6JZ9MS+aXrrOR0EJ8qawORUR7Yj9oxZ+iyLUsBGLGjweIwNtT6zrumw==",

BIN
View File


+ 0
- 1
go.mod View File

@@ -40,7 +40,6 @@ require (
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/gin-contrib/sessions v1.0.1
github.com/go-pay/gopay v1.5.98
github.com/go-pay/xlog v0.0.3
github.com/go-sql-driver/mysql v1.8.1
github.com/gocolly/colly v1.2.0
github.com/olivere/elastic/v7 v7.0.32


Loading…
Cancel
Save