Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fc-minigame
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
陈冲
fc-minigame
Commits
1abd0126
Commit
1abd0126
authored
Jul 02, 2026
by
陈冲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 添加日志
parent
ce0327b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
8 deletions
+52
-8
socket_io.rs
backend/src/protocols/socket_io.rs
+52
-8
No files found.
backend/src/protocols/socket_io.rs
View file @
1abd0126
...
...
@@ -576,34 +576,73 @@ async fn post_screen_game_score(game: &Game) {
.unwrap_or_default
();
if
auth_token
.is_empty
()
{
println!
(
"[screen_game_score] skip: empty auth token, wechat_id={}, item_num={}, score={}, rank={}, batch_no={}"
,
game
.wechat_id
,
game
.item_num
,
game
.score
,
game
.game_rank
,
game
.batch_no
);
return
;
}
let
code
=
game_code
(
game
.item_num
);
if
code
.is_empty
()
{
println!
(
"[screen_game_score] skip: empty game code, wechat_id={}, item_num={}, score={}, rank={}, batch_no={}"
,
game
.wechat_id
,
game
.item_num
,
game
.score
,
game
.game_rank
,
game
.batch_no
);
return
;
}
let
body
=
json!
({
"game_code"
:
code
,
"score"
:
game
.score
,
"batch_no"
:
game
.batch_no
,
"rank_no"
:
game
.game_rank
,
});
dbg!
(
json!
({
"event"
:
"screen_game_score_post"
,
"wechat_id"
:
game
.wechat_id
.clone
(),
"auth_token_len"
:
auth_token
.len
(),
"body"
:
body
.clone
(),
}));
let
resp
=
reqwest
::
Client
::
new
()
.post
(
"https://api.guocai365.org.cn/api/offline_clearance/user/screen_game_score"
)
.header
(
"Authorization"
,
auth_token
)
.json
(
&
json!
({
"game_code"
:
code
,
"score"
:
game
.score
,
"batch_no"
:
game
.batch_no
,
"rank_no"
:
game
.game_rank
,
}))
.json
(
&
body
)
.send
()
.await
;
let
log_msg
=
match
resp
{
Ok
(
resp
)
if
resp
.status
()
.is_success
()
=>
return
,
Ok
(
resp
)
if
resp
.status
()
.is_success
()
=>
{
let
status
=
resp
.status
();
let
msg
=
resp
.text
()
.await
.unwrap_or_default
();
dbg!
(
"[screen_game_score] success: wechat_id={}, status={}, msg={}"
,
&
game
.wechat_id
,
status
,
msg
);
return
;
}
Ok
(
resp
)
=>
{
let
status
=
resp
.status
();
let
body
=
resp
.text
()
.await
.unwrap_or_default
();
dbg!
(
json!
({
"event"
:
"screen_game_score_fail"
,
"wechat_id"
:
game
.wechat_id
.clone
(),
"status"
:
status
.as_u16
(),
"body"
:
body
.clone
(),
}));
format!
(
"提交第三方大屏游戏分数失败: {status}, {body}"
)
}
Err
(
err
)
=>
err
.to_string
(),
Err
(
err
)
=>
{
dbg!
(
json!
({
"event"
:
"screen_game_score_error"
,
"wechat_id"
:
game
.wechat_id
.clone
(),
"err"
:
err
.to_string
(),
}));
err
.to_string
()
}
};
{
...
...
@@ -1273,6 +1312,11 @@ pub async fn on_connect(_io: SocketIo, socket: SocketRef, Data(data): Data<Value
}
if
let
Some
(
token
)
=
data
.get
(
"token"
)
.and_then
(|
v
|
v
.as_str
())
.filter
(|
v
|
!
v
.is_empty
())
{
println!
(
"[screen_game_score] cache auth token: userid={}, token_len={}"
,
userid
,
token
.len
()
);
CLIENT_AUTH_TOKEN_MAP
.insert
(
userid
.clone
(),
token
.to_string
());
}
...
...
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