Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
contract_backend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
contract_backend
Commits
6aca15d4
Commit
6aca15d4
authored
Jan 09, 2025
by
贾浩@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
f7c93036
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
8 deletions
+7
-8
contract.go
dao/contract.go
+0
-1
user.go
server/user.go
+7
-7
No files found.
dao/contract.go
View file @
6aca15d4
...
@@ -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
{
...
...
server/user.go
View file @
6aca15d4
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
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment