Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
sc_media
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
sc_media
Commits
69c59dcd
提交
69c59dcd
authored
5月 05, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
218263f0
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
24 行增加
和
14 行删除
+24
-14
ArticleLibraryController.java
...ource/bg/controller/content/ArticleLibraryController.java
+11
-3
UserController.java
.../com/zrqx/resource/bg/controller/user/UserController.java
+13
-11
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/content/ArticleLibraryController.java
浏览文件 @
69c59dcd
...
...
@@ -251,12 +251,16 @@ public class ArticleLibraryController {
String
openid
=
jsonobj_token
.
getJSONObject
(
"data"
).
getString
(
"openid"
);
//获取发布内容文章id
String
url_aid
=
"https://api.om.qq.com/articlev2/clientpubpic?access_token="
+
token
+
"&openid="
+
openid
+
"&title="
+
form
.
getTitle
()+
"&content="
+
form
.
getText
()+
"&category="
+
form
.
getType
()+
"&cover_pic="
+
form
.
getCover
()+
"&cover_type="
+
form
.
getCover_type
()+
""
;
url_aid
=
url_aid
.
replaceAll
(
" "
,
"%20"
);
String
info
=
HttpClientUtil
.
doPost
(
url_aid
,
"utf-8"
);
//{"code":0,"data":{"article_id":"20190418A06JIK","transaction_id":8130865293090544362},"msg":"SUCCESS"}
if
(
info
==
null
){
throw
new
BaseException
(
ResponseCodeEnum
.
FAIL
);
}
JSONObject
info_code
=
JSON
.
parseObject
(
info
);
//获取code值
String
code_aid
=
info_code
.
getString
(
"code"
);
if
(
code_aid
.
equals
(
"40015
"
)){
if
(
!
code_aid
.
equals
(
"0
"
)){
throw
new
BaseException
(-
7
,
"不合法的access_token"
);
//由于access_token拥有较短的有效期,当access_token超时后,可以使用refresh_token进行刷新,refresh_token有效期为30天,当refresh_token失效之后,需要用户重新授权
/* String refresh_token = jsonobj_token.getJSONObject("data").getString("refresh_token");
...
...
@@ -285,13 +289,17 @@ public class ArticleLibraryController {
//获取账号名称
String
user_id
=
jsonobj_token
.
getString
(
"user_id"
);
//获取发布内容文章id
String
url_aid
=
"http://mp.163.com/wemedia/article/status/api/oauth2/publish.do?access_token="
+
token
+
"&title="
+
form
.
getTitle
()+
"&content="
+
form
.
getText
()+
"&user_classify="
+
form
.
getType
()+
"&cover="
+
form
.
getCover
()+
"&original=true"
;
String
url_aid
=
"http://mp.163.com/wemedia/article/status/api/oauth2/publish.do?access_token="
+
token
+
"&title="
+
form
.
getTitle
()+
"&content="
+
form
.
getText
()+
"&user_classify="
+
form
.
getType
()+
"&cover="
+
form
.
getCover
()+
"&pic_url="
+
form
.
getCover_type
()+
"&original=true"
;
url_aid
=
url_aid
.
replaceAll
(
" "
,
"%20"
);
String
info
=
HttpClientUtil
.
doPost
(
url_aid
,
"utf-8"
);
if
(
info
==
null
){
throw
new
BaseException
(
ResponseCodeEnum
.
FAIL
);
}
JSONObject
jsonobj_aid
=
JSON
.
parseObject
(
info
);
//{"code": 1,"msg":"操作成功 ","data": {"docId": "D123456705ABCD89"}}
//获取code值
String
code
=
jsonobj_aid
.
getString
(
"code"
);
if
(!
code
.
equals
(
1
)){
if
(!
code
.
equals
(
"1"
)){
throw
new
BaseException
(-
7
,
"获取文章id失败!"
);
}
list
.
add
(
user_id
);
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/user/UserController.java
浏览文件 @
69c59dcd
...
...
@@ -79,19 +79,9 @@ public class UserController {
if
(
code
==
null
||
redisCode
==
null
||
!
code
.
toLowerCase
().
equals
(
redisCode
.
toLowerCase
())){
throw
new
BaseException
(
"验证码有误"
);
}
stringRedisTemplate
.
delete
(
uuid
);
}
stringRedisTemplate
.
delete
(
uuid
);
User
user
=
userSerivce
.
login
(
name
);
//查看账号是否冻结
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
((
new
Date
().
getTime
()-
format
.
parse
(
user
.
getFreezetime
().
toString
()).
getTime
()>
6
*
60
*
1000
)){
user
.
setFreezetime
(
null
);
userSerivce
.
updateByCriteria
(
user
);
}
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
15
){
user
.
setFreezetime
(
new
Date
());
throw
new
BaseException
(
"您的账号已冻结,密码输入次数超过15次,请10分钟以后在再来登录"
);
}
if
(
user
==
null
){
throw
new
BaseException
(
"账号或密码错误"
);
}
...
...
@@ -101,6 +91,18 @@ public class UserController {
if
(
password
==
null
||
!
password
.
toLowerCase
().
equals
(
user
.
getPassword
().
toLowerCase
())){
throw
new
BaseException
(
"账号或密码错误"
);
}
//查看账号是否冻结
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
if
(
user
.
getFreezetime
()!=
null
&&
!
user
.
getFreezetime
().
equals
(
""
)){
if
((
new
Date
().
getTime
()-
format
.
parse
(
user
.
getFreezetime
().
toString
()).
getTime
()>
6
*
60
*
1000
)){
user
.
setFreezetime
(
null
);
userSerivce
.
updateByCriteria
(
user
);
}
}
if
(
StringUtils
.
isNotBlank
(
errorCount
)
&&
Integer
.
parseInt
(
errorCount
)
>=
15
){
user
.
setFreezetime
(
new
Date
());
throw
new
BaseException
(
"您的账号已冻结,密码输入次数超过15次,请10分钟以后在再来登录"
);
}
user
.
setPassword
(
null
);
user
.
setToken
(
UUIDUtil
.
getUUID
());
user
.
setIp
(
CusAccessObjectUtil
.
getIpAddress
(
request
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论