Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oto
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
龚小红
oto
Commits
f7aa86cf
Commit
f7aa86cf
authored
Mar 21, 2022
by
龚小红
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'Feature/20220305-gxh' into 'master'
增加生成otoCookie的方法 See merge request test-group/kejiji!237
parents
14871378
d6c46741
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
2 deletions
+105
-2
OtoTokenCookie.java
src/test/java/com/kjj/bean/jmterbean/OtoTokenCookie.java
+28
-0
IdConvertBase64Enum.java
src/test/java/com/kjj/utils/IdConvertBase64Enum.java
+46
-0
IdMakeUtil.java
src/test/java/com/kjj/utils/IdMakeUtil.java
+9
-0
JmeterAccountFile.java
src/test/java/com/kjj/utils/JmeterAccountFile.java
+22
-2
No files found.
src/test/java/com/kjj/bean/jmterbean/OtoTokenCookie.java
0 → 100644
View file @
f7aa86cf
package
com
.
kjj
.
bean
.
jmterbean
;
import
lombok.Data
;
/**
* OTO-销售工作台token
*
* @author ZhangJun
* @date 2022/1/8 5:00 下午
*/
@Data
public
class
OtoTokenCookie
{
/**
* 登录用户id
*/
private
String
loginId
;
/**
* 登录手机号
*/
private
String
phoneNumber
;
/**
* 过期时间
*/
private
Long
expiredTime
;
}
src/test/java/com/kjj/utils/IdConvertBase64Enum.java
0 → 100644
View file @
f7aa86cf
package
com
.
kjj
.
utils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author lizhi
* @date 2020/4/9 11:36 AM
*/
public
enum
IdConvertBase64Enum
{
/**
* 注意,code只能是两位
*/
DEF
(
"j2"
,
"默认类型"
),
TRANS
(
"t3"
,
"短链接服务"
),
;
private
String
code
;
private
String
desc
;
IdConvertBase64Enum
(
String
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
public
String
getCode
()
{
return
"K"
+
code
;
}
private
static
final
Map
<
String
,
IdConvertBase64Enum
>
ENUM_MAP
=
new
HashMap
<>();
static
{
for
(
IdConvertBase64Enum
lengthEnum
:
values
()){
ENUM_MAP
.
put
(
lengthEnum
.
getCode
(),
lengthEnum
);
}
}
public
static
IdConvertBase64Enum
getByCode
(
String
code
)
{
if
(
code
==
null
)
{
return
null
;
}
return
ENUM_MAP
.
get
(
code
);
}
}
\ No newline at end of file
src/test/java/com/kjj/utils/IdMakeUtil.java
View file @
f7aa86cf
...
...
@@ -78,5 +78,14 @@ public class IdMakeUtil implements Authorization {
return
decodeId
;
}
public
static
String
encodingId
(
Long
id
,
IdConvertBase64Enum
base64Enum
)
{
if
(
id
==
null
||
base64Enum
==
null
||
base64Enum
.
getCode
().
length
()
!=
3
)
{
return
null
;
}
id
=
(
id
<<
3
)
^
7
;
String
encode
=
encoder
.
encodeToString
(
Long
.
toString
(
id
).
getBytes
());
String
replace
=
encode
.
replace
(
"="
,
""
);
return
base64Enum
.
getCode
()
+
(
encode
.
length
()
-
replace
.
length
())
+
replace
;
}
}
src/test/java/com/kjj/utils/JmeterAccountFile.java
View file @
f7aa86cf
package
com
.
kjj
.
utils
;
import
com.alibaba.fastjson.JSON
;
import
com.kjj.bean.jmterbean.OtoTokenCookie
;
import
com.kjj.config.BasicConfig
;
import
com.kjj.sql.KjyUserDB
;
import
com.kjj.sql.UserSqlFactory
;
...
...
@@ -19,9 +21,27 @@ public class JmeterAccountFile {
private
static
final
NetworkUtils
network
=
NetworkUtils
.
getInstance
();
public
static
void
main
(
String
[]
args
)
{
String
path
=
String
.
valueOf
(
JmeterAccountFile
.
class
.
getResource
(
"/"
));
accountFile
(
path
);
// String path = String.valueOf(JmeterAccountFile.class.getResource("/"));
// accountFile(path);
otoCookieMaker
();
}
/**
* 生成otoCookie,仅用于压力测试文件
*/
public
static
void
otoCookieMaker
()
{
OtoTokenCookie
otoTokenCookie
=
new
OtoTokenCookie
();
otoTokenCookie
.
setExpiredTime
(
System
.
currentTimeMillis
()
+
86400
*
1000
*
150L
);
otoTokenCookie
.
setPhoneNumber
(
"18909890978"
);
otoTokenCookie
.
setLoginId
(
IdMakeUtil
.
encodingId
(
21L
,
IdConvertBase64Enum
.
DEF
));
String
json
=
JSON
.
toJSONString
(
otoTokenCookie
);
String
otoToken
=
BlowfishUtils
.
encryptBlowfish
(
json
,
"02a16fs1b6a3"
);
System
.
out
.
println
(
otoToken
);
}
//仅用于生成直播账号Authkey文件
public
static
void
accountFile
(
String
path
)
{
BaseUtils
.
ssoLogin
();
// 保存路径
...
...
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