Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
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
方斌
51business
Commits
c6350304
Commit
c6350304
authored
Feb 10, 2020
by
Hsinli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
6fab868b
Pipeline
#19288
passed with stage
in 56 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
1 deletion
+60
-1
duxiaoman_log.js
app/model/prometheus/duxiaoman_log.js
+36
-0
check.js
app/service/duxiaoman/check.js
+24
-1
No files found.
app/model/prometheus/duxiaoman_log.js
0 → 100644
View file @
c6350304
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
app
=>
{
const
{
INTEGER
,
STRING
,
DATE
}
=
app
.
Sequelize
;
const
DuxiaomanLog
=
app
.
prometheusModel
.
define
(
'duxiaoman_log'
,
{
id
:
{
type
:
INTEGER
,
primaryKey
:
true
,
autoIncrement
:
true
},
user_id
:
STRING
,
app_user_id
:
STRING
,
app_id
:
STRING
,
app_type_id
:
STRING
,
user_sid
:
INTEGER
,
phone
:
STRING
,
is_target_user
:
INTEGER
,
request
:
STRING
,
respones
:
STRING
,
created_at
:
{
type
:
DATE
,
get
()
{
const
date
=
this
.
getDataValue
(
'created_at'
);
return
date
?
moment
(
date
).
format
(
'YYYY-MM-DD HH:mm:ss'
)
:
undefined
;
},
}
},
{
timestamps
:
false
,
tableName
:
'duxiaoman_log'
,
});
return
DuxiaomanLog
;
};
app/service/duxiaoman/check.js
View file @
c6350304
...
@@ -63,6 +63,9 @@ class CheckService extends Service {
...
@@ -63,6 +63,9 @@ class CheckService extends Service {
async
check
()
{
async
check
()
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
let
ret
=
{
is_target_user
:
0
//1 true 0 false -1 NOT_FOUND
}
if
(
!
ctx
.
oldUserId
||
!
ctx
.
userId
)
{
if
(
!
ctx
.
oldUserId
||
!
ctx
.
userId
)
{
//如果没有登录就不做处理
//如果没有登录就不做处理
ctx
.
failed
(
'登录异常'
);
ctx
.
failed
(
'登录异常'
);
...
@@ -95,7 +98,27 @@ class CheckService extends Service {
...
@@ -95,7 +98,27 @@ class CheckService extends Service {
ctx
.
logger
.
info
(
'dxmUrl:'
+
dxmUrl
);
ctx
.
logger
.
info
(
'dxmUrl:'
+
dxmUrl
);
let
result
=
await
ctx
.
helper
.
send_request
(
dxmUrl
,
{},
{
method
:
'GET'
});
let
result
=
await
ctx
.
helper
.
send_request
(
dxmUrl
,
{},
{
method
:
'GET'
});
ctx
.
logger
.
info
(
'result:'
+
JSON
.
stringify
(
result
));
ctx
.
logger
.
info
(
'result:'
+
JSON
.
stringify
(
result
));
return
result
;
if
(
result
.
status
===
200
)
{
if
(
result
.
data
.
retCode
===
0
)
{
ret
.
is_target_user
=
result
.
data
.
result
.
is_target_user
;
}
//数据库记录
let
addData
=
{
user_id
:
ctx
.
userId
,
app_user_id
:
ctx
.
appUserId
,
app_id
:
ctx
.
appId
,
app_type_id
:
ctx
.
appTypeId
,
user_sid
:
ctx
.
oldUserId
,
phone
:
userInfo
.
passport
,
is_target_user
:
result
.
data
.
result
.
is_target_user
,
request
:
JSON
.
stringify
(
params
),
response
:
JSON
.
stringify
(
result
.
data
),
}
await
ctx
.
prometheusModel
.
DuxiaomanLog
.
create
(
addData
);
}
else
{
ctx
.
failed
(
'服务异常,请稍后再试'
);
}
return
ret
;
...
...
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