23 lines
446 B
Go
23 lines
446 B
Go
package walletctrl
|
|
|
|
import (
|
|
"91jd-server/app/appg"
|
|
"91jd-server/common/store"
|
|
"encoding/json"
|
|
"errors"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Check(ctx *gin.Context, param interface{}) (err error) {
|
|
b, _ := json.Marshal(param)
|
|
sign, err := store.Encrypt(b, appg.Conf.Base.StoreEncryptKey)
|
|
if err != nil {
|
|
return
|
|
}
|
|
headerSign := ctx.Request.Header.Get("sign")
|
|
if sign != headerSign {
|
|
return errors.New("校验失败")
|
|
}
|
|
return nil
|
|
}
|