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