后台,密钥对和api接口对应
This commit is contained in:
parent
342a247c67
commit
627e1c852c
|
@ -2,6 +2,7 @@ package backend
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"PaymentCenter/app/constants/errorcode"
|
"PaymentCenter/app/constants/errorcode"
|
||||||
|
"PaymentCenter/app/constants/pojo"
|
||||||
"PaymentCenter/app/http/controllers"
|
"PaymentCenter/app/http/controllers"
|
||||||
"PaymentCenter/app/http/entities"
|
"PaymentCenter/app/http/entities"
|
||||||
"PaymentCenter/app/http/entities/backend"
|
"PaymentCenter/app/http/entities/backend"
|
||||||
|
@ -62,11 +63,11 @@ func GenerateDecrypt(c *gin.Context) {
|
||||||
var publicKey, privateKey string
|
var publicKey, privateKey string
|
||||||
var err error
|
var err error
|
||||||
switch req.KeyType {
|
switch req.KeyType {
|
||||||
case "sm2":
|
case pojo.SM2:
|
||||||
publicKey, privateKey, err = sm2.GenerateSM2Key()
|
publicKey, privateKey, err = sm2.GenerateSM2Key()
|
||||||
case "rsa":
|
case pojo.RSA:
|
||||||
publicKey, privateKey, err = rsa.GenerateKey()
|
publicKey, privateKey, err = rsa.GenerateKey()
|
||||||
case "sm4":
|
case pojo.SM4:
|
||||||
privateKey, publicKey = sm4.GenerateKey()
|
privateKey, publicKey = sm4.GenerateKey()
|
||||||
default:
|
default:
|
||||||
controllers.HandCodeRes(c, "", errorcode.EncryptTypeNotFound)
|
controllers.HandCodeRes(c, "", errorcode.EncryptTypeNotFound)
|
||||||
|
|
|
@ -96,5 +96,5 @@ func (a *AppUpdateRequest) RequestToDb() (db appmodel.App) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type GenerateDecryptKeyRequest struct {
|
type GenerateDecryptKeyRequest struct {
|
||||||
KeyType string `json:"key_type" form:"key_type" label:"密钥类型"`
|
KeyType int32 `json:"key_type" form:"key_type" label:"密钥类型"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,16 @@ func (p *PayChannelResponse) ResponseFromDb(db paychannelmodel.PayChannel) {
|
||||||
p.MerchantId = db.MerchantId
|
p.MerchantId = db.MerchantId
|
||||||
p.ChannelType = db.ChannelType
|
p.ChannelType = db.ChannelType
|
||||||
p.AppId = db.AppId
|
p.AppId = db.AppId
|
||||||
p.ExpireTime = db.ExpireTime.Format("2006-01-02 15:04:05")
|
if db.ExpireTime.IsZero() {
|
||||||
p.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05")
|
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 {
|
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:
|
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:
|
||||||
|
|
Loading…
Reference in New Issue