调整获取微信手机号接口
This commit is contained in:
parent
7cfb55124c
commit
43da5265ff
|
|
@ -113,8 +113,8 @@ public class UserController {
|
|||
@PostMapping("/mnpMobile")
|
||||
public Object mnpMobile(@RequestBody Map<String, String> params) {
|
||||
Assert.notNull(params.get("code"), "code参数缺失");
|
||||
Map<String, Object> map = iUserService.mnpMobile(params.get("code").trim());
|
||||
return AjaxResult.success(map);
|
||||
iUserService.mnpMobile(params.get("code").trim());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,7 @@ public interface IUserService {
|
|||
*
|
||||
* @author fzr
|
||||
* @param code 获取手机号的Code
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> mnpMobile(String code);
|
||||
void mnpMobile(String code);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.mdd.common.mapper.system.SystemConfigMapper;
|
|||
import com.mdd.common.mapper.user.UserAuthMapper;
|
||||
import com.mdd.common.mapper.user.UserMapper;
|
||||
import com.mdd.common.utils.*;
|
||||
import com.mdd.front.LikeFrontThreadLocal;
|
||||
import com.mdd.front.service.IUserService;
|
||||
import com.mdd.front.vo.user.UserCenterVo;
|
||||
import com.mdd.front.vo.user.UserInfoVo;
|
||||
|
|
@ -243,10 +244,9 @@ public class UserServiceImpl implements IUserService {
|
|||
*
|
||||
* @author fzr
|
||||
* @param code 获取手机号的Code
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> mnpMobile(String code) {
|
||||
public void mnpMobile(String code) {
|
||||
Map<String, String> config = ConfigUtil.get("mp_channel");
|
||||
WxMaService wxMaService = new WxMaServiceImpl();
|
||||
WxMaDefaultConfigImpl wxConfig = new WxMaDefaultConfigImpl();
|
||||
|
|
@ -257,10 +257,12 @@ public class UserServiceImpl implements IUserService {
|
|||
try {
|
||||
WxMaPhoneNumberInfo wxMaPhoneNumberInfo = wxMaService.getUserService().getNewPhoneNoInfo(code);
|
||||
|
||||
Map<String, Object> response = new LinkedHashMap<>();
|
||||
response.put("countryCode", wxMaPhoneNumberInfo.getCountryCode());
|
||||
response.put("phoneNumber", wxMaPhoneNumberInfo.getPhoneNumber());
|
||||
return response;
|
||||
Integer userId = LikeFrontThreadLocal.getUserId();
|
||||
User user = new User();
|
||||
user.setId(userId);
|
||||
user.setMobile(wxMaPhoneNumberInfo.getPhoneNumber());
|
||||
user.setCreateTime(System.currentTimeMillis() / 1000);
|
||||
userMapper.updateById(user);
|
||||
} catch (WxErrorException e) {
|
||||
throw new OperateException(e.getError().getErrorCode() + ", " + e.getError().getErrorMsg());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue