From 627e1c852c432ea771340fee203053560979a859 Mon Sep 17 00:00:00 2001 From: wolter Date: Thu, 8 Aug 2024 14:19:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=EF=BC=8C=E5=AF=86=E9=92=A5?= =?UTF-8?q?=E5=AF=B9=E5=92=8Capi=E6=8E=A5=E5=8F=A3=E5=AF=B9=E5=BA=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/backend/app.go | 7 ++++--- app/http/entities/backend/app.go | 2 +- app/http/entities/backend/pay_channel.go | 12 ++++++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/http/controllers/backend/app.go b/app/http/controllers/backend/app.go index 6a66d5c..3ce31a6 100644 --- a/app/http/controllers/backend/app.go +++ b/app/http/controllers/backend/app.go @@ -2,6 +2,7 @@ package backend import ( "PaymentCenter/app/constants/errorcode" + "PaymentCenter/app/constants/pojo" "PaymentCenter/app/http/controllers" "PaymentCenter/app/http/entities" "PaymentCenter/app/http/entities/backend" @@ -62,11 +63,11 @@ func GenerateDecrypt(c *gin.Context) { var publicKey, privateKey string var err error switch req.KeyType { - case "sm2": + case pojo.SM2: publicKey, privateKey, err = sm2.GenerateSM2Key() - case "rsa": + case pojo.RSA: publicKey, privateKey, err = rsa.GenerateKey() - case "sm4": + case pojo.SM4: privateKey, publicKey = sm4.GenerateKey() default: controllers.HandCodeRes(c, "", errorcode.EncryptTypeNotFound) diff --git a/app/http/entities/backend/app.go b/app/http/entities/backend/app.go index 43b45f9..06f9f45 100644 --- a/app/http/entities/backend/app.go +++ b/app/http/entities/backend/app.go @@ -96,5 +96,5 @@ func (a *AppUpdateRequest) RequestToDb() (db appmodel.App) { } type GenerateDecryptKeyRequest struct { - KeyType string `json:"key_type" form:"key_type" label:"密钥类型"` + KeyType int32 `json:"key_type" form:"key_type" label:"密钥类型"` } diff --git a/app/http/entities/backend/pay_channel.go b/app/http/entities/backend/pay_channel.go index 4416175..a278b7b 100644 --- a/app/http/entities/backend/pay_channel.go +++ b/app/http/entities/backend/pay_channel.go @@ -27,8 +27,16 @@ func (p *PayChannelResponse) ResponseFromDb(db paychannelmodel.PayChannel) { p.MerchantId = db.MerchantId p.ChannelType = db.ChannelType p.AppId = db.AppId - p.ExpireTime = db.ExpireTime.Format("2006-01-02 15:04:05") - p.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + if db.ExpireTime.IsZero() { + p.ExpireTime = "" + } else { + p.ExpireTime = db.ExpireTime.Format("2006-01-02 15:04:05") + } + if db.CreateTime.IsZero() { + p.CreateTime = "" + } else { + p.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") + } switch db.ChannelType { case common.PAY_CHANNEL_WECHAT_H5, common.PAY_CHANNEL_WECHAT_JSAPI, common.PAY_CHANNEL_WECHAT_NATIVE, common.PAY_CHANNEL_WECHAT_APP, common.PAY_CHANNEL_WECHAT_MINI: