调试微信支付,已发现可能是绑定时微信openid获取不正确
parent
f513c18d3c
commit
ab75d446bc
|
|
@ -257,7 +257,14 @@ public class SegChkLoginController {
|
|||
// log.error("getLoginInfo fail: getLoginInfo fail");
|
||||
return AjaxResult.error("getLoginInfo fail: getLoginInfo fail");
|
||||
}
|
||||
|
||||
Claims claims = null;
|
||||
try {
|
||||
claims = getClaims(getToken(request));
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
claims = null;
|
||||
}
|
||||
SegchkUserWechat segchkUserWechat = new SegchkUserWechat();
|
||||
segchkUserWechat.setUserId(Long.valueOf(bindParams.getUserId()));
|
||||
segchkUserWechat.setOpenid(weChatAppletLoginResponse.getOpenid());
|
||||
|
|
@ -272,11 +279,13 @@ public class SegChkLoginController {
|
|||
// 产生token
|
||||
String token = registerServiceApi.createToke(CommonConstant.APPLET_LOGIN_KEY, Long.valueOf(bindParams.getUserId()), Long.valueOf(bindParams.getProviderId()), Integer.valueOf(bindParams.getUserLevel()));
|
||||
// String token = snowflakeIdWorker.nextId()+"";
|
||||
Claims claims = new Claims();
|
||||
claims.setUserId(Long.valueOf(bindParams.getUserId()));
|
||||
claims.setOpenId(weChatAppletLoginResponse.getOpenid());
|
||||
claims.setProviderId(Long.valueOf(bindParams.getProviderId()));
|
||||
claims.setUserLevel(Integer.valueOf(bindParams.getUserLevel()));
|
||||
if(claims == null) {
|
||||
claims = new Claims();
|
||||
claims.setUserId(Long.valueOf(bindParams.getUserId()));
|
||||
claims.setOpenId(weChatAppletLoginResponse.getOpenid());
|
||||
claims.setProviderId(Long.valueOf(bindParams.getProviderId()));
|
||||
claims.setUserLevel(Integer.valueOf(bindParams.getUserLevel()));
|
||||
}
|
||||
// 将用户的token进行缓存
|
||||
redisService.setCacheObject(token, claims);
|
||||
return AjaxResult.success("绑定成功", token);
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ public class SegchkDefaultUserController extends BaseController
|
|||
// 如果用户未登录,则要求用户使用手机号登录注册
|
||||
return AjaxResult.error(300, "请先登录注册");
|
||||
}
|
||||
if (claims.getUserLevel() != 2){
|
||||
return AjaxResult.error(400, "非会员用户不可以收藏");
|
||||
}
|
||||
segchkUserCollect.setUserId(claims.getUserId());
|
||||
segchkUserCollect.setProviderId(claims.getProviderId());
|
||||
logger.debug("add_user_collect with: {}", segchkUserCollect.toString());
|
||||
|
|
@ -190,6 +193,9 @@ public class SegchkDefaultUserController extends BaseController
|
|||
userId = getClaims(getToken(request)).getUserId();
|
||||
return AjaxResult.error(300, "请先登录注册");
|
||||
}
|
||||
if(claims.getUserLevel() != 2){
|
||||
return AjaxResult.error(400, "未会员用户不允许预约!");
|
||||
}
|
||||
segchkUserLikego.setUserId(claims.getUserId());
|
||||
segchkUserLikego.setProviderId(claims.getProviderId());
|
||||
}
|
||||
|
|
@ -428,6 +434,9 @@ public class SegchkDefaultUserController extends BaseController
|
|||
// 如果用户未登录,则要求用户使用手机号登录注册
|
||||
return AjaxResult.error(300, "请先登录注册");
|
||||
}
|
||||
if (claims.getUserLevel() != 2){
|
||||
return AjaxResult.error(400, "非会员用户不允许提交评价");
|
||||
}
|
||||
}
|
||||
logger.debug("addComment with: {}", segchkServiceCommentUserReq.toString());
|
||||
return toAjax(segchkUserIndexService.insertSegchkServiceComment(segchkServiceCommentUserReq));
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ yzytest:
|
|||
login:
|
||||
smshost: http://api.ksd106.com:8088/SMSSend.aspx
|
||||
smssign:
|
||||
smstest: false
|
||||
smstest: true
|
||||
smsplatid: 3
|
||||
|
||||
segchk:
|
||||
|
|
|
|||
|
|
@ -825,7 +825,7 @@ Authorization: Bearer {{token1}}
|
|||
"userId": "503",
|
||||
"providerId": "2",
|
||||
"userLevel": "2",
|
||||
"code": "001kiv000uUEsM11G5000vLWKN2kiv0m"
|
||||
"code": "0312qnFa1cUYQB0X05Ja151Isp12qnFw"
|
||||
}
|
||||
|
||||
### 测试token取值
|
||||
|
|
|
|||
|
|
@ -112,5 +112,17 @@ public class WeChatCustomerLink implements Serializable {
|
|||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WeChatCustomerLink{" +
|
||||
"id=" + id +
|
||||
", unionId='" + unionId + '\'' +
|
||||
", openId='" + openId + '\'' +
|
||||
", appletOpenId='" + appletOpenId + '\'' +
|
||||
", providerId='" + providerId + '\'' +
|
||||
", userId=" + userId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -678,7 +678,8 @@ public class SegchkUserIndexServiceImpl implements ISegchkUserIndexService
|
|||
return CommonResponse.build(null, -10);
|
||||
}*/
|
||||
WeChatCustomerLink weChatCustomerLink = segchkUserIndexMapper.getUserWechatOpenId(userId);
|
||||
if (weChatCustomerLink!=null && ObjectUtils.isEmpty(weChatCustomerLink.getOpenId())){
|
||||
logger.debug("wechatAppletPay get WeChatCustomerLink: {}", weChatCustomerLink.toString());
|
||||
if (ObjectUtils.isEmpty(weChatCustomerLink) || ObjectUtils.isEmpty(weChatCustomerLink.getOpenId())){
|
||||
logger.error("wechatAppletPay fail due to wechat error not auth....");
|
||||
return CommonResponse.build(null, -10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,9 +70,12 @@ public class WeChatAppletUtils {
|
|||
*/
|
||||
public static WeChatAppletLoginResponse getLoginInfo(String code, WechatSetting wechatSetting) {
|
||||
logger.debug("getLoginInfo and code:{} \r\n wechatSetting:{}", code, wechatSetting);
|
||||
WeChatAppletLoginResponse weChatAppletLoginResponse = wechatSetting.getType() == 999999
|
||||
? new WeChatAppletLoginResponse(code, code, code)
|
||||
: JSON.parseObject(WechatUtils.executeHttpGet(String.format(GET_LOGIN_INFO_URL, wechatSetting.getAppId(), wechatSetting.getAppSecret(), code)), WeChatAppletLoginResponse.class);
|
||||
// WeChatAppletLoginResponse weChatAppletLoginResponse = wechatSetting.getType() == 999999
|
||||
// ? new WeChatAppletLoginResponse(code, code, code)
|
||||
// : JSON.parseObject(WechatUtils.executeHttpGet(String.format(GET_LOGIN_INFO_URL, wechatSetting.getAppId(), wechatSetting.getAppSecret(), code)), WeChatAppletLoginResponse.class);
|
||||
WeChatAppletLoginResponse weChatAppletLoginResponse = null;
|
||||
JSONObject jsonObject = JSON.parseObject(WechatUtils.executeHttpGet(String.format(GET_LOGIN_INFO_URL, wechatSetting.getAppId(), wechatSetting.getAppSecret(), code)));
|
||||
logger.warn("getLoginInfo get WeChatAppletLoginResponse: {}", jsonObject.toJSONString());
|
||||
if (Objects.isNull(weChatAppletLoginResponse)) {
|
||||
logger.error("getLoginInfo fail : weChatAppletLoginResponse is null");
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ public class WechatUtils {
|
|||
return prepayResult;
|
||||
} else {
|
||||
if (!StringUtils.isEmpty(prepayResult.getErr_code_des())) {
|
||||
logger.error("getPrepay Fail and returnmsg:{} \r\n errormsg:{} ", prepayResult.getReturn_msg(), prepayResult.getErr_code_des());
|
||||
logger.error("getPrepay Fail and errcode:{} \r\n returnmsg:{} \r\n errormsg:{} ", prepayResult.getReturn_msg(), prepayResult.getErr_code(), prepayResult.getErr_code_des());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ public class PrepayResult {
|
|||
*/
|
||||
@JsonIgnore
|
||||
public boolean isError() {
|
||||
return "FAIL".equals(this.return_code);
|
||||
return "FAIL".equals(this.return_code) || "FAIL".equals(this.result_code);
|
||||
}
|
||||
|
||||
public String getReturn_code() {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectSegchkStoreSaleList" parameterType="SegchkServiceAndSaleWebReq" resultMap="SegchkServiceAndSaleWebRespResult">
|
||||
select date_format( mod_time, '%Y%m' ) as static_month
|
||||
, date_format(any_value(mod_time), '%Y-%m-01') as query_mon
|
||||
, count(1) as static_count from segchk_user_charge where provider_id = #{providerId} and ret_flag = 1 and mod_time <![CDATA[ >= ]]> NOW() - interval #{staticMonth} - 1 month group by date_format( mod_time, '%Y%m' ) order by date_format( mod_time, '%Y%m' ) desc
|
||||
, count(1) as static_count from segchk_user_charge where provider_id = #{providerId} and ret_flag = 1 and mod_time <![CDATA[ >= ]]> NOW() - interval
|
||||
<choose>
|
||||
<when test="staticMonth == null">3</when>
|
||||
<when test="staticMonth == 0">3</when>
|
||||
<otherwise>#{staticMonth} - 1</otherwise>
|
||||
</choose> month group by date_format( mod_time, '%Y%m' ) order by date_format( mod_time, '%Y%m' ) desc
|
||||
</select>
|
||||
|
||||
<select id="selectSegchkStoreSaleDetails" parameterType="SegchkServiceAndSaleWebReq" resultMap="SegchkServiceAndSaleDetailWebRespResult">
|
||||
|
|
|
|||
|
|
@ -376,7 +376,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from
|
||||
(select comment_id, star_level, content_text, mod_time, provider_id, store_id from segchk_service_comment where provider_id = #{providerId} and store_id = #{storeId}
|
||||
<!-- 取当月的所有评价记录,测试时可以先去掉-->
|
||||
<!-- and DATE_FORMAT( mod_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' ) -->
|
||||
<if test="remark != null and remark != ''">
|
||||
and DATE_FORMAT( mod_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
|
||||
</if>
|
||||
order by mod_time desc ) comment
|
||||
left join
|
||||
(
|
||||
|
|
@ -414,7 +416,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
, date_format(any_value(mod_time), '%Y-%m-01') as query_mon
|
||||
, count(1) as static_count from segchk_service_chk where provider_id = #{providerId} and store_id = #{storeId} and mod_time <![CDATA[ >= ]]> NOW() - interval
|
||||
<choose>
|
||||
<when test="staticMonth != null"> #{staticMonth} - 1 </when>
|
||||
<when test="staticMonth != null and staticMonth != ''"> #{staticMonth} - 1 </when>
|
||||
<otherwise> 12 - 1 </otherwise>
|
||||
</choose>
|
||||
month group by date_format( mod_time, '%Y%m' ) order by date_format( mod_time, '%Y%m' ) desc
|
||||
|
|
@ -423,7 +425,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<select id="selectSegchkStoreSaleList" parameterType="SegchkServiceAndSaleWebReq" resultMap="SegchkServiceAndSaleWebRespResult">
|
||||
select date_format( mod_time, '%Y%m' ) as static_month
|
||||
, date_format(any_value(mod_time), '%Y-%m-01') as query_mon
|
||||
, count(1) as static_count from segchk_user_charge where provider_id = #{providerId} and store_id = #{storeId} and ret_flag = 1 and mod_time <![CDATA[ >= ]]> NOW() - interval #{staticMonth} - 1 month group by date_format( mod_time, '%Y%m' ) order by date_format( mod_time, '%Y%m' ) desc
|
||||
, count(1) as static_count from segchk_user_charge where provider_id = #{providerId} and store_id = #{storeId} and ret_flag = 1 and mod_time <![CDATA[ >= ]]> NOW() - interval
|
||||
<choose>
|
||||
<when test="staticMonth != null and staticMonth != ''">#{staticMonth} - 1</when>
|
||||
<otherwise>12 - 1</otherwise>
|
||||
</choose>
|
||||
month group by date_format( mod_time, '%Y%m' ) order by date_format( mod_time, '%Y%m' ) desc
|
||||
</select>
|
||||
|
||||
<select id="selectSegchkStoreSaleDetails" parameterType="SegchkServiceAndSaleWebReq" resultMap="SegchkServiceAndSaleDetailWebRespResult">
|
||||
|
|
|
|||
Loading…
Reference in New Issue