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
15801353
Commit
15801353
authored
Nov 18, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add encodeUserSid
parent
da428880
Pipeline
#16590
passed with stage
in 48 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
helper.js
app/extend/helper.js
+32
-0
option.js
app/service/course/v1/option.js
+0
-0
No files found.
app/extend/helper.js
View file @
15801353
...
...
@@ -451,6 +451,38 @@ module.exports = {
}
return
parseInt
(
rtn
)
>>
2
;
},
encodeUserSid
(
userSid
)
{
const
rand
=
'OU1WjLvZCrRJ7Yo0gE2XDjuuaSAUuaH1bhHPuMymcdfEeKz0igRhXQkMuLTm1'
;
const
randKey
=
2019
;
let
rtn
=
''
;
const
code
=
userSid
<<
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
);
let
arrExtTemp
=
codeExt
.
split
(
''
);
let
arrExt
=
temp
.
split
(
''
);
for
(
const
v
of
arrExt
)
{
rtn
+=
arrExtTemp
[
v
];
}
let
arrNumsTemp
=
codeNums
.
split
(
''
);
let
arrNums
=
String
(
code
).
split
(
''
);
for
(
const
v
of
arrNums
)
{
rtn
+=
arrNumsTemp
[
v
];
}
rtn
=
begin
+
rtn
;
return
rtn
;
}
};
app/service/course/v1/option.js
View file @
15801353
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