diff --git a/app/http/controllers/merchant/merchant.go b/app/http/controllers/merchant/merchant.go index e5fd52c..7da9566 100644 --- a/app/http/controllers/merchant/merchant.go +++ b/app/http/controllers/merchant/merchant.go @@ -98,8 +98,8 @@ func Create(c *gin.Context) { } merchant := &merMod.Merchant{ - Name: request.Name, - Key: request.Key, + Name: request.Name, + PrivateKey: request.PrivateKey, } affected, err := merServ.Create(merchant) @@ -124,9 +124,9 @@ func Update(c *gin.Context) { } merchant := &merMod.Merchant{ - Id: request.Id, - Name: request.Name, - Key: request.Key, + Id: request.Id, + Name: request.Name, + PrivateKey: request.PrivateKey, } affected, err := merServ.Update(merchant) diff --git a/app/http/entities/merchant/merchant.go b/app/http/entities/merchant/merchant.go index 85d4727..ab5b70c 100644 --- a/app/http/entities/merchant/merchant.go +++ b/app/http/entities/merchant/merchant.go @@ -25,8 +25,8 @@ type SearchResp struct { } type CreateReq struct { - Name string `json:"name" validate:"required"` - Key string `json:"key" validate:"required"` + Name string `json:"name" validate:"required"` + PrivateKey string `json:"private_key" validate:"required"` } type CreateResp struct { @@ -34,9 +34,9 @@ type CreateResp struct { } type UpdateReq struct { - Id int64 `json:"id" validate:"required"` - Name string `json:"name"` - Key string `json:"key"` + Id int64 `json:"id" validate:"required"` + Name string `json:"name"` + PrivateKey string `json:"private_key"` } type UpdateResp struct { diff --git a/app/http/middlewares/sign_verify.go b/app/http/middlewares/sign_verify.go index 3005cb2..6a17550 100644 --- a/app/http/middlewares/sign_verify.go +++ b/app/http/middlewares/sign_verify.go @@ -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, "签名错误") diff --git a/app/models/merchant/merchant.go b/app/models/merchant/merchant.go index c9f0e1c..cd6a042 100644 --- a/app/models/merchant/merchant.go +++ b/app/models/merchant/merchant.go @@ -16,10 +16,10 @@ var ( * Merchant */ type Merchant struct { - Id int64 `xorm:"pk autoincr"` //注:使用getOne 或者ID() 需要设置主键 - Name string - Key string - CreatedAt time.Time `xorm:"created"` + Id int64 `xorm:"pk autoincr"` //注:使用getOne 或者ID() 需要设置主键 + Name string + PrivateKey string + CreatedAt time.Time `xorm:"created"` } /** diff --git a/build/sql/db.sql b/build/sql/db.sql index db69e67..d8f0c82 100644 --- a/build/sql/db.sql +++ b/build/sql/db.sql @@ -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 (