提交 69c59dcd authored 作者: renjiancai's avatar renjiancai

--no commit message

上级 218263f0
......@@ -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);
......
......@@ -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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论