| | |
| | | package com.yeshi.makemoney.app.controller.client.api; |
| | | |
| | | import com.yeshi.makemoney.app.dto.user.LoginInfoDTO; |
| | | import com.yeshi.makemoney.app.entity.APPPlatform; |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserLoginRecord; |
| | |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.vip.VIPService; |
| | | import com.yeshi.makemoney.app.service.manager.PushManager; |
| | | import com.yeshi.makemoney.app.service.manager.VerifyCodeManager; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | | import com.yeshi.makemoney.app.utils.ImageUtil; |
| | |
| | | @Resource |
| | | private VerifyCodeManager verifyCodeManager; |
| | | |
| | | // @Reference(version = "1.0", check = false) |
| | | private BDeviceTokenService bDeviceTokenService; |
| | | @Resource |
| | | private PushManager pushManager; |
| | | |
| | | @Resource |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | |
| | | public void run() { |
| | | try { |
| | | //登录成功 |
| | | bDeviceTokenService.bindUid(acceptData.getSystem().name(), acceptData.getUtdId(), userInfo.getId() + ""); |
| | | pushManager.bindUid(acceptData.getSystem(), userInfo.getId(), acceptData.getPlatform() == APPPlatform.ios ? acceptData.getIdfa() : acceptData.getUtdId()); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | |
| | | public String logout(AcceptData acceptData, Long uid) { |
| | | try { |
| | | //解绑UID |
| | | bDeviceTokenService.unBindUid(acceptData.getSystem().name(), acceptData.getUtdId()); |
| | | pushManager.unBind(acceptData.getSystem(), acceptData.getPlatform() == APPPlatform.ios ? acceptData.getIdfa() : acceptData.getUtdId()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("unRegister") |
| | | public String unRegister(AcceptData acceptData, String vcode, String phone) { |
| | | public String unRegister(AcceptData acceptData, Long uid) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(vcode)) { |
| | | return JsonUtil.loadFalseResult("验证码不能为空"); |
| | | } |
| | | // if (StringUtil.isNullOrEmpty(vcode)) { |
| | | // return JsonUtil.loadFalseResult("验证码不能为空"); |
| | | // } |
| | | // |
| | | // if (StringUtil.isNullOrEmpty(phone)) { |
| | | // return JsonUtil.loadFalseResult("手机号不能为空"); |
| | | // } |
| | | // |
| | | // if (!verifyCodeManager.isPhoneCodeRight(acceptData.getSystem(), phone, vcode)) { |
| | | // return JsonUtil.loadFalseResult("验证码错误"); |
| | | // } |
| | | |
| | | if (StringUtil.isNullOrEmpty(phone)) { |
| | | return JsonUtil.loadFalseResult("手机号不能为空"); |
| | | } |
| | | |
| | | if (!verifyCodeManager.isPhoneCodeRight(acceptData.getSystem(), phone, vcode)) { |
| | | return JsonUtil.loadFalseResult("验证码错误"); |
| | | } |
| | | |
| | | UserInfo user = userInfoService.selectValidByPhone(acceptData.getSystem(), phone); |
| | | UserInfo user = userInfoService.getAvaiableUser(uid); |
| | | if (user == null) { |
| | | return JsonUtil.loadFalseResult("不存在绑定该手机号的用户"); |
| | | return JsonUtil.loadFalseResult("用户不存在或用户已被封禁"); |
| | | } |
| | | //注销 |
| | | userAccountService.unRegister(user.getId()); |
| | |
| | | @ResponseBody |
| | | @RequestMapping("uploadPushRegId") |
| | | public String uploadPushRegId(AcceptData acceptData, Long uid, String regId) { |
| | | |
| | | BPushDeviceToken deviceToken = new BPushDeviceToken(); |
| | | deviceToken.setAppCode(acceptData.getSystem().name()); |
| | | deviceToken.setDeviceId(acceptData.getUtdId()); |
| | | deviceToken.setBuildModel(acceptData.getDeviceType()); |
| | | deviceToken.setBuildVersion(acceptData.getOsVersion()); |
| | | deviceToken.setToken(regId); |
| | | deviceToken.setType(PushPlatform.jpush); |
| | | if (uid != null) { |
| | | deviceToken.setUid(uid + ""); |
| | | } |
| | | deviceToken.setVersionCode(acceptData.getVersion()); |
| | | |
| | | try { |
| | | bDeviceTokenService.save(deviceToken); |
| | | pushManager.saveToken(acceptData, uid, regId); |
| | | return JsonUtil.loadTrueResult(""); |
| | | } catch (BPushDeviceTokenException e) { |
| | | return JsonUtil.loadTrueResult(e.getMessage()); |
| | | return JsonUtil.loadFalseResult(e.getCode(), "业务出错"); |
| | | } catch (ParamsException e) { |
| | | return JsonUtil.loadTrueResult(e.getMessage()); |
| | | return JsonUtil.loadFalseResult(e.getCode(), "参数错误"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |