Compare commits

..

No commits in common. "2f88c1be58393214e1708b5e5c55f8591586e634" and "b34dd4f96f5327ba5bef1a15bda7fbc34300b32f" have entirely different histories.

1 changed files with 3 additions and 8 deletions

View File

@ -1,7 +1,6 @@
package backend
import (
"PaymentCenter/app/constants/pojo"
"PaymentCenter/app/http/entities"
"PaymentCenter/app/models/appmodel"
"errors"
@ -50,11 +49,11 @@ type AppCreateRequest struct {
AppRemark string `json:"app_remark" label:"应用备注"`
Status int32 `json:"status" validate:"oneof=0 1 2" label:"应用状态"`
KeyType int32 `json:"key_type" label:"应用密钥类型"`
PublicKey string `json:"public_key" label:"应用公钥"`
PrivateKey string `json:"private_key" label:"应用私钥"`
PublicKey string `json:"public_key" validate:"required" label:"应用公钥"`
PrivateKey string `json:"private_key" validate:"required" label:"应用私钥"`
MerchantPublicKey string `json:"merchant_public_key" label:"商户公钥"`
WhiteIp string `json:"white_ip"`
NotifyUrl string `json:"notify_url" label:"通知地址"`
NotifyUrl string `json:"notify_url" validate:"required" label:"通知地址"`
}
func (a *AppCreateRequest) RequestToDb() (db appmodel.App, err error) {
@ -65,10 +64,6 @@ func (a *AppCreateRequest) RequestToDb() (db appmodel.App, err error) {
db.AppRemark = a.AppRemark
db.Status = a.Status
db.KeyType = a.KeyType
if a.KeyType != pojo.NO_CRYPT && (a.PublicKey == "" || a.PrivateKey == "") {
err = errors.New("请填写密钥")
return
}
db.PublicKey = a.PublicKey
db.PrivateKey = a.PrivateKey
db.MerchantPublicKey = a.MerchantPublicKey