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

update

parent f7c93036
...@@ -21,7 +21,6 @@ func (d *Dao) LoginByServer(byteKey []byte, userAddress, userId string) (txHash ...@@ -21,7 +21,6 @@ func (d *Dao) LoginByServer(byteKey []byte, userAddress, userId string) (txHash
if err != nil { if err != nil {
return common.Hash{}, err return common.Hash{}, err
} }
privateKey := crypto.ToECDSAUnsafe(byteKey) privateKey := crypto.ToECDSAUnsafe(byteKey)
auth, err := bind.NewKeyedTransactorWithChainID(privateKey, d.chainId) auth, err := bind.NewKeyedTransactorWithChainID(privateKey, d.chainId)
if err != nil { if err != nil {
......
package server package server
import ( import (
. "contract_backend/constant" "contract_backend/constant"
"contract_backend/util" "contract_backend/util"
"io" "io"
"time" "time"
...@@ -19,7 +19,7 @@ func userChange(c *gin.Context) { ...@@ -19,7 +19,7 @@ func userChange(c *gin.Context) {
rawJson, err := io.ReadAll(c.Request.Body) rawJson, err := io.ReadAll(c.Request.Body)
if err != nil { if err != nil {
log.WithError(err).Error("read body error") log.WithError(err).Error("read body error")
c.JSON(200, withError(InvalidParam)) c.JSON(200, withError(constant.InvalidParam))
return return
} }
...@@ -27,7 +27,7 @@ func userChange(c *gin.Context) { ...@@ -27,7 +27,7 @@ func userChange(c *gin.Context) {
table := gjson.Get(string(rawJson), "table").String() table := gjson.Get(string(rawJson), "table").String()
if table != "users" { if table != "users" {
log.WithField("table", table).Error("wrong table") log.WithField("table", table).Error("wrong table")
c.JSON(200, withError(InvalidParam)) c.JSON(200, withError(constant.InvalidParam))
return return
} }
...@@ -41,12 +41,12 @@ func userChange(c *gin.Context) { ...@@ -41,12 +41,12 @@ func userChange(c *gin.Context) {
key, err = util.GetPrivateKeyByUserId(conf.Chain.XPrivateKey, userId) key, err = util.GetPrivateKeyByUserId(conf.Chain.XPrivateKey, userId)
if err != nil { if err != nil {
log.WithError(err).Error("get private key error") log.WithError(err).Error("get private key error")
c.JSON(200, withError(InternalError)) c.JSON(200, withError(constant.InternalError))
return return
} }
default: default:
log.WithField("operation", operation).Error("wrong operation") log.WithField("operation", operation).Error("wrong operation")
c.JSON(200, withError(InvalidParam)) c.JSON(200, withError(constant.InvalidParam))
return return
} }
...@@ -59,7 +59,7 @@ func userChange(c *gin.Context) { ...@@ -59,7 +59,7 @@ func userChange(c *gin.Context) {
loginTime, err := time.Parse(lastLogin, "2006-01-02T15:04:05.999999+07:00") loginTime, err := time.Parse(lastLogin, "2006-01-02T15:04:05.999999+07:00")
if err != nil { if err != nil {
log.WithError(err).Error("parse time error") log.WithError(err).Error("parse time error")
c.JSON(200, withError(InternalError)) c.JSON(200, withError(constant.InternalError))
return return
} }
...@@ -82,7 +82,7 @@ func userChange(c *gin.Context) { ...@@ -82,7 +82,7 @@ func userChange(c *gin.Context) {
txHash, err := d.LoginByServer(common.Hex2Bytes(conf.Chain.ExecutorPrivateKey), userAddress.Hex(), userId) txHash, err := d.LoginByServer(common.Hex2Bytes(conf.Chain.ExecutorPrivateKey), userAddress.Hex(), userId)
if err != nil { if err != nil {
log.WithError(err).Error("call ca login error") log.WithError(err).Error("call ca login error")
c.JSON(200, withError(InternalError)) c.JSON(200, withError(constant.InternalError))
return 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