提交 068e04a1 作者: panda

删除多余System.out.println

上级 e0d40d30
......@@ -42,9 +42,7 @@ import java.util.Arrays;
* <p>
* <code>
* if (BCrypt.checkpw(candidate_password, stored_hash))<br />
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It matches");<br />
* else<br />
* &nbsp;&nbsp;&nbsp;&nbsp;System.out.println("It does not match");<br />
* </code>
* <p>
* The gensalt() method takes an optional parameter (log_rounds)
......
......@@ -15,6 +15,7 @@ import com.mmc.iuav.user.model.vo.WxLoginVO;
import com.mmc.iuav.user.model.vo.WxMsgVO;
import com.mmc.iuav.user.service.WxService;
import com.mmc.iuav.user.util.WxApiUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
......@@ -32,6 +33,7 @@ import java.util.concurrent.TimeUnit;
* @Date: 2023/5/16 13:44
*/
@Service
@Slf4j
public class WxServiceImpl implements WxService {
@Autowired
private UserSystemConstant userSystemConstant;
......@@ -68,7 +70,6 @@ public class WxServiceImpl implements WxService {
String accessTokenMsg = HttpsRequestUtil.httpsGet(getAccessTokenUrl, null);
JSONObject tokenResult = JSONObject.parseObject(accessTokenMsg);
if (accessTokenMsg.indexOf("access_token") == -1) {
System.out.println("获取小程序access_token有误:" + tokenResult);
return null;
}
accessToken = tokenResult.getString("access_token");
......@@ -90,7 +91,7 @@ public class WxServiceImpl implements WxService {
String accessTokenMsg = HttpsRequestUtil.httpsGet(getAccessTokenUrl, null);
JSONObject tokenResult = JSONObject.parseObject(accessTokenMsg);
if (accessTokenMsg.indexOf("access_token") == -1) {
System.out.println("获取公众号access_token有误:" + tokenResult);
log.info("获取公众号access_token有误:{}",tokenResult);
return null;
}
accessToken = tokenResult.getString("access_token");
......@@ -112,14 +113,10 @@ public class WxServiceImpl implements WxService {
this.subScribeUser(map);
} else if (WxConstant.unsubscribe.equals(event)) {
// 取消关注事件
System.out.println("############################");
System.out.println("###########取消关注############");
System.out.println("############################");
String openId = map.get("FromUserName");
userSubInfoDao.removeUserSubInfo(openId);
}
} catch (Exception e) {
System.out.println("接收消息异常" + e.getMessage());
return "error";
}
return "success";
......@@ -167,10 +164,6 @@ public class WxServiceImpl implements WxService {
// 用户是否订阅该公众号标识,值为0时,代表此用户没有关注该公众号,拉取不到其余信息。
Integer subscribe = obj.getInteger("subscribe");
if (subscribe != null && subscribe == 1) {
System.out.println("###########access_token##########");
System.out.println(accessToken);
System.out.println("###########用户信息##########");
System.out.println(jsonStr);
UserSubInfoDO user = new UserSubInfoDO();
user.setOpenId(openid);
user.setUnionId(obj.getString("unionid"));
......@@ -179,7 +172,7 @@ public class WxServiceImpl implements WxService {
userSubInfoDao.updateUserSubInfo(user);
return;
} else {
System.out.println("未订阅公众号,无法拉取信息。");
log.info("未订阅公众号,无法拉取信息。");
return;
}
}catch (Exception e){
......@@ -190,19 +183,14 @@ public class WxServiceImpl implements WxService {
@Override
public ResultBody sendSubTemplateMsg(WxMsgVO ws) {
System.out.println("###########开始发送公众号消息##########");
String accessToken = null;
try {
accessToken = this.getSubAccessToken();
System.out.println("accesstoken:" + accessToken);
String url = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + accessToken;
String param = ws.buildMsgJson();
System.out.println("参数:" + param);
String result = HttpHelper.httpPost(url, param);
System.out.println("###########结束发送公众号消息##########");
System.out.println(result);
} catch (Exception e) {
System.out.println("accessToken获取失败:" + e.getMessage());
log.error("accessToken获取失败:{}", e.getMessage());
return ResultBody.error(ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultCode(),
ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultMsg() + e.getMessage());
}
......@@ -231,7 +219,6 @@ public class WxServiceImpl implements WxService {
@Override
public ResultBody sendAppletMsg(AppletMsgVO appletMsgVO) {
System.out.println("###########开始发送-小程序-用户端消息##########");
String accessToken = this.getAccessToken();
if (StringUtils.isBlank(accessToken)){
return ResultBody.error(ResultEnum.WX_ACCESS_TOKEN_ERROR.getResultCode(),
......@@ -241,12 +228,10 @@ public class WxServiceImpl implements WxService {
String url = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=" + accessToken;
appletMsgVO.setData(WxApiUtil.buildMsgJson(appletMsgVO.getData()));
String param = JSONObject.toJSONString(appletMsgVO);
System.out.println("参数:" + param);
HttpHelper.httpPost(url, param);
} catch (Exception e){
System.out.println("系统异常:" + e.getMessage());
log.error("系统异常:{}" ,e.getMessage());
}
System.out.println("###########结束发送-小程序-消息##########");
return ResultBody.success();
}
......@@ -280,7 +265,6 @@ public class WxServiceImpl implements WxService {
String url = "https://api.weixin.qq.com/wxa/business/getuserphonenumber?access_token=" + accessToken;
String res = HttpHelper.httpPost(url, param.toString());
JSONObject result = JSONObject.parseObject(res);
System.out.println("用户授权手机号:" + res);
if (result.getString("errcode").equals("0")) {
String phone_info = result.getString("phone_info");
JSONObject phoneInfoObject = JSONObject.parseObject(phone_info);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论