fix
This commit is contained in:
parent
1a4131c938
commit
0fb8e9d077
|
@ -99,7 +99,7 @@ func Create(c *gin.Context) {
|
|||
|
||||
merchant := &merMod.Merchant{
|
||||
Name: request.Name,
|
||||
Key: request.Key,
|
||||
PrivateKey: request.PrivateKey,
|
||||
}
|
||||
|
||||
affected, err := merServ.Create(merchant)
|
||||
|
@ -126,7 +126,7 @@ func Update(c *gin.Context) {
|
|||
merchant := &merMod.Merchant{
|
||||
Id: request.Id,
|
||||
Name: request.Name,
|
||||
Key: request.Key,
|
||||
PrivateKey: request.PrivateKey,
|
||||
}
|
||||
|
||||
affected, err := merServ.Update(merchant)
|
||||
|
|
|
@ -26,7 +26,7 @@ type SearchResp struct {
|
|||
|
||||
type CreateReq struct {
|
||||
Name string `json:"name" validate:"required"`
|
||||
Key string `json:"key" validate:"required"`
|
||||
PrivateKey string `json:"private_key" validate:"required"`
|
||||
}
|
||||
|
||||
type CreateResp struct {
|
||||
|
@ -36,7 +36,7 @@ type CreateResp struct {
|
|||
type UpdateReq struct {
|
||||
Id int64 `json:"id" validate:"required"`
|
||||
Name string `json:"name"`
|
||||
Key string `json:"key"`
|
||||
PrivateKey string `json:"private_key"`
|
||||
}
|
||||
|
||||
type UpdateResp struct {
|
||||
|
|
|
@ -81,7 +81,7 @@ func VerifySign() gin.HandlerFunc {
|
|||
return
|
||||
}
|
||||
//验证签名是否正确
|
||||
hash := GenMD5Sign(data, merchant.Key)
|
||||
hash := GenMD5Sign(data, merchant.PrivateKey)
|
||||
logger.Info(c, "Sign", hash)
|
||||
if hash != data["sign"] {
|
||||
common.Error(c, 400, "签名错误")
|
||||
|
|
|
@ -18,7 +18,7 @@ var (
|
|||
type Merchant struct {
|
||||
Id int64 `xorm:"pk autoincr"` //注:使用getOne 或者ID() 需要设置主键
|
||||
Name string
|
||||
Key string
|
||||
PrivateKey string
|
||||
CreatedAt time.Time `xorm:"created"`
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
create table merchant (
|
||||
id int primary key auto_increment,
|
||||
name varchar(255) not null,
|
||||
key varchar(255),
|
||||
private_key varchar(255),
|
||||
created_at timestamp default current_timestamp
|
||||
);
|
||||
|
||||
|
@ -20,7 +20,7 @@ create table orders (
|
|||
|
||||
status tinyint,
|
||||
transfer_status tinyint,
|
||||
created_at timestamp default current_timestamp,
|
||||
created_at timestamp default current_timestamp
|
||||
);
|
||||
|
||||
create table whitelist (
|
||||
|
|
Loading…
Reference in New Issue