Commit 6aca15d4 authored by 贾浩@五瓣科技's avatar 贾浩@五瓣科技

update

parent f7c93036
......@@ -21,7 +21,6 @@ func (d *Dao) LoginByServer(byteKey []byte, userAddress, userId string) (txHash
if err != nil {
return common.Hash{}, err
}
privateKey := crypto.ToECDSAUnsafe(byteKey)
auth, err := bind.NewKeyedTransactorWithChainID(privateKey, d.chainId)
if err != nil {
......
package server
import (
. "contract_backend/constant"
"contract_backend/constant"
"contract_backend/util"
"io"
"time"
......@@ -19,7 +19,7 @@ func userChange(c *gin.Context) {
rawJson, err := io.ReadAll(c.Request.Body)
if err != nil {
log.WithError(err).Error("read body error")
c.JSON(200, withError(InvalidParam))
c.JSON(200, withError(constant.InvalidParam))
return
}
......@@ -27,7 +27,7 @@ func userChange(c *gin.Context) {
table := gjson.Get(string(rawJson), "table").String()
if table != "users" {
log.WithField("table", table).Error("wrong table")
c.JSON(200, withError(InvalidParam))
c.JSON(200, withError(constant.InvalidParam))
return
}
......@@ -41,12 +41,12 @@ func userChange(c *gin.Context) {
key, err = util.GetPrivateKeyByUserId(conf.Chain.XPrivateKey, userId)
if err != nil {
log.WithError(err).Error("get private key error")
c.JSON(200, withError(InternalError))
c.JSON(200, withError(constant.InternalError))
return
}
default:
log.WithField("operation", operation).Error("wrong operation")
c.JSON(200, withError(InvalidParam))
c.JSON(200, withError(constant.InvalidParam))
return
}
......@@ -59,7 +59,7 @@ func userChange(c *gin.Context) {
loginTime, err := time.Parse(lastLogin, "2006-01-02T15:04:05.999999+07:00")
if err != nil {
log.WithError(err).Error("parse time error")
c.JSON(200, withError(InternalError))
c.JSON(200, withError(constant.InternalError))
return
}
......@@ -82,7 +82,7 @@ func userChange(c *gin.Context) {
txHash, err := d.LoginByServer(common.Hex2Bytes(conf.Chain.ExecutorPrivateKey), userAddress.Hex(), userId)
if err != nil {
log.WithError(err).Error("call ca login error")
c.JSON(200, withError(InternalError))
c.JSON(200, withError(constant.InternalError))
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment