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
c879f4e3
Commit
c879f4e3
authored
Jul 06, 2023
by
董加伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
73ddaeb1
Pipeline
#48912
passed with stage
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
4 deletions
+38
-4
response.js
app/controller/response.js
+6
-4
helper.js
app/extend/helper.js
+32
-0
No files found.
app/controller/response.js
View file @
c879f4e3
'use strict'
;
const
Controller
=
require
(
'egg'
).
Controller
;
const
moment
=
require
(
'moment'
);
class
ResponseController
extends
Controller
{
...
...
@@ -21,7 +22,7 @@ class ResponseController extends Controller {
ctx
.
validate
(
rule
,
input_params
);
if
(
input_params
.
user_token
)
{
const
rule
=
{
auth_token
:
{
type
:
'string'
},
auth_token
:
{
type
:
'string'
,
required
:
false
},
user_sid
:
{
type
:
'string'
},
};
ctx
.
validate
(
rule
,
input_params
);
...
...
@@ -138,9 +139,10 @@ class ResponseController extends Controller {
node_user_center_login_ret
.
device_id
=
device_login_data
.
device_id
;
node_user_center_login_ret
.
device_login_id
=
device_login_data
.
device_login_logs_id
;
}
if
(
auth_token
)
node_user_center_login_ret
.
auth_token
=
auth_token
;
if
(
user_sid
&&
this
.
ctx
.
helper
.
encodeUserSid
(
oid
)
!==
user_sid
)
node_user_center_login_ret
.
jianbing_customer_id
=
this
.
ctx
.
helper
.
encodeUserSid
(
input_params
.
user_sid
);
if
(
user_sid
&&
this
.
ctx
.
helper
.
encodeUserIdNew
(
oid
)
!==
user_sid
)
{
node_user_center_login_ret
.
jianbing_customer_id
=
this
.
ctx
.
helper
.
encodeUserIdNew
(
user_sid
);
node_user_center_login_ret
.
auth_token
=
ctx
.
helper
.
md5
(
String
(
node_user_center_login_ret
.
jianbing_customer_id
)
+
moment
(
new
Date
()).
format
(
'MDYYYY'
)
+
'f74jkdsy83sjf'
,
'utf8'
);
}
const
expire
=
7200
*
1000
;
const
date
=
new
Date
();
for
(
const
key
in
node_user_center_login_ret
)
{
...
...
app/extend/helper.js
View file @
c879f4e3
...
...
@@ -524,6 +524,38 @@ module.exports = {
return
rtn
;
},
encodeUserIdNew
(
userId
)
{
const
rand
=
'OU1WjLvZCrRJ7Yo0gE2XDjuuaSAUuaH1bhHPuMymcdfEeKz0igRhXQkMuLTm1'
;
const
randKey
=
2019
;
let
rtn
=
''
;
const
code
=
userId
<<
2
;
const
randLength
=
11
;
const
len
=
String
(
code
).
length
;
const
codeLen
=
rand
.
slice
(
0
,
randLength
);
const
codeNums
=
rand
.
slice
(
randLength
,
randLength
+
12
);
const
codeExt
=
rand
.
slice
(
randLength
+
12
,
rand
.
length
);
const
begin
=
codeLen
.
slice
(
len
-
1
,
len
);
const
ext
=
randLength
-
len
-
1
;
let
temp
=
String
(
Math
.
floor
(
code
/
randKey
)).
replace
(
'.'
,
''
);
temp
=
temp
.
slice
(
-
ext
);
const
arrExtTemp
=
codeExt
.
split
(
''
);
const
arrExt
=
temp
.
split
(
''
);
for
(
const
v
of
arrExt
)
{
rtn
+=
arrExtTemp
[
v
];
}
const
arrNumsTemp
=
codeNums
.
split
(
''
);
const
arrNums
=
String
(
code
).
split
(
''
);
for
(
const
v
of
arrNums
)
{
rtn
+=
arrNumsTemp
[
v
];
}
rtn
=
String
(
userId
).
slice
(
0
,
5
)
+
begin
+
rtn
;
return
rtn
;
},
// aes加密
async
cipherByAES
(
data
)
{
const
{
ctx
}
=
this
;
...
...
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