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: