|
@@ -27,6 +27,7 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.security.spec.ECField;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -103,14 +104,21 @@ public class WxUserServiceImpl extends ServiceImpl<IWxUserMapper, WxUser> implem
|
|
|
this.updateById(wxUser);
|
|
|
}
|
|
|
|
|
|
+ static HashMap<String,Integer> reCount = new HashMap<>();
|
|
|
+
|
|
|
@Override
|
|
|
- public Object getPhone(String code) {
|
|
|
+ public Object getPhone(String code,Integer reCount) {
|
|
|
try {
|
|
|
String token = wxService.getToken();
|
|
|
if(StringUtils.isBlank(token)){
|
|
|
throw new BusinessException(ResultCode.WX_PHONE_ERROR);
|
|
|
}
|
|
|
JSONObject jsonObject = wxClient.getPhone(token, new WxGetPhoneParam(code));
|
|
|
+ if(jsonObject.getInteger("errcode") != null && jsonObject.getInteger("errcode") == 40001 && reCount < 2){
|
|
|
+ reCount ++;
|
|
|
+ wxService.delToken();
|
|
|
+ return getPhone(code,reCount);
|
|
|
+ }
|
|
|
JSONObject phoneObj = (JSONObject) jsonObject.get("phone_info");
|
|
|
if(phoneObj==null){
|
|
|
throw new BusinessException(ResultCode.WX_PHONE_ERROR);
|