明树Git Lab
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
D
deepseek_wechat_chat
Project
Project
Details
Activity
Releases
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
zengfanpei
deepseek_wechat_chat
Commits
d428878a
Commit
d428878a
authored
Feb 20, 2025
by
zfp1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
96436937
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
wechatController.js
controller/wechatController.js
+6
-1
question.js
db/models/question.js
+1
-1
userModule.js
module/userModule.js
+8
-1
No files found.
controller/wechatController.js
View file @
d428878a
...
...
@@ -44,7 +44,12 @@ async function getUserInfo(req, res, next) {
)
console
.
log
(
userRes
.
data
)
// 第三步 存起来
await
userModule
.
createUser
(
userRes
.
data
);
let
user
=
await
userModule
.
findUser
({
openid
});
if
(
user
&&
user
.
_id
)
{
//
}
else
{
await
userModule
.
createUser
(
userRes
.
data
);
}
res
.
sendData
(
userRes
.
data
)
}
catch
(
error
)
{
console
.
error
(
' 微信接口错误:'
,
error
)
...
...
db/models/question.js
View file @
d428878a
...
...
@@ -34,5 +34,5 @@ const questionSchema = new Schema({
});
const
Question
=
mongoose
.
model
(
'
Q
uestion'
,
questionSchema
,
'Question'
);
const
Question
=
mongoose
.
model
(
'
q
uestion'
,
questionSchema
,
'Question'
);
module
.
exports
=
Question
;
\ No newline at end of file
module/userModule.js
View file @
d428878a
...
...
@@ -4,5 +4,12 @@ async function createUser(obj) {
const
ret
=
await
DB
.
User
.
create
(
obj
);
return
ret
;
}
async
function
findUser
(
obj
)
{
if
(
!
obj
.
openid
)
{
throw
new
Error
(
"openid没找到"
)
}
const
ret
=
await
DB
.
User
.
findOne
({
openid
:
obj
&&
obj
.
openid
});
return
ret
;
}
module
.
exports
=
{
createUser
}
module
.
exports
=
{
createUser
,
findUser
}
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