| | |
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.shop.BanLiShopOrder;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.user.UserAccountException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.exception.user.vip.UserVIPInfoException;
|
| | |
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.user.UserVipRateVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller("WXMPUserAccountController")
|
| | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserVIPInfoService userVIPInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserVipConfigService userVipConfigService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private BanLiShopOrderService banLiShopOrderService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | |
| | | /**
|
| | | * 通过邀请码获取用户信息
|
| | | *
|
| | |
| | | }
|
| | |
|
| | | String sessionKey = null;
|
| | | WXMPSessionInfo sessionInfo = (WXMPSessionInfo) session.getAttribute(UserController.WXMP_SESSION_INFO_KEY);
|
| | | WXMPSessionInfo sessionInfo = WXXCXUtil.getSessionInfo(Constant.WXMP_APP_INFO, code);
|
| | | if (sessionInfo == null) {
|
| | | out.print(JsonUtil.loadFalseResult(90000, "请重新登录"));
|
| | | return;
|
| | | } else {
|
| | | session.setAttribute(UserController.WXMP_SESSION_INFO_KEY, sessionInfo);
|
| | | }
|
| | |
|
| | | sessionKey = sessionInfo.getSessionKey();
|
| | |
| | |
|
| | | UserInfo lastUserInfo = null;
|
| | | if (!StringUtil.isNullOrEmpty(userData)) {
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
|
| | | String redisKey = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin,
|
| | | StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
|
| | | String data = redisManager.getCommonString(redisKey);
|
| | | if (!StringUtil.isNullOrEmpty(data)) {
|
| | | lastUserInfo = new Gson().fromJson(data, UserInfo.class);
|
| | |
| | | }
|
| | |
|
| | | @RequestMapping("wxLogin")
|
| | | public void wxLogin(WXMPAcceptData acceptData, String wxEncryptedData, String wxIv, String inviteCode,
|
| | | public void wxLogin(WXMPAcceptData acceptData, String wxEncryptedData, String wxIv, String inviteCode, String code,
|
| | | HttpServletRequest request, HttpSession session, PrintWriter out) {
|
| | | if (StringUtil.isNullOrEmpty(acceptData.getOpenId())) {
|
| | | out.print(JsonUtil.loadFalseResult("openId为空"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult("微信用户加密数据为空"));
|
| | | return;
|
| | | }
|
| | | WXMPSessionInfo sessionInfo = (WXMPSessionInfo) session.getAttribute(UserController.WXMP_SESSION_INFO_KEY);
|
| | | if (sessionInfo == null) {
|
| | | out.print(JsonUtil.loadFalseResult(90000, "请重新登录"));
|
| | | return;
|
| | | }
|
| | | WXMPSessionInfo sessionInfo = WXXCXUtil.getSessionInfo(Constant.WXMP_APP_INFO, code);
|
| | |
|
| | | String sessionKey = sessionInfo.getSessionKey();
|
| | | if (StringUtil.isNullOrEmpty(sessionKey)) {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin, StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
|
| | | String key = RedisKeyEnum.getRedisKey(RedisKeyEnum.wxmpUserLogin,
|
| | | StringUtil.Md5(acceptData.getAppId() + "-" + acceptData.getOpenId()));
|
| | |
|
| | | UserInfo user = new Gson().fromJson(redisManager.getCommonString(key), UserInfo.class);
|
| | | if (user == null) {
|
| | |
| | | userAccountService.updateUserSelective(update);
|
| | | }
|
| | | });
|
| | | break;
|
| | | return;
|
| | | case WXMPLoginResult.CODE_BIND_PHONE:
|
| | | // 需要绑定电话号码
|
| | | redisManager.saveObj(result.getUser(), key, 60 * 5);// 只缓存5分钟
|
| | |
| | | out.print(JsonUtil.loadFalseResult("openId为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | if(uid==null){
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("uid为空"));
|
| | | return;
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadFalseResult("微信信息为空"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | WXMPSessionInfo sessionInfo = (WXMPSessionInfo) session.getAttribute(UserController.WXMP_SESSION_INFO_KEY);
|
| | | if (sessionInfo == null) {
|
| | | out.print(JsonUtil.loadFalseResult(90000, "请重新登录"));
|
| | |
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 绑定电话号码 V1.5.3
|
| | | *
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 获取vip信息
|
| | | *
|
| | |
| | | vo.setNickName(userInfo.getNickName());
|
| | | vo.setPortrait(userInfo.getPortrait());
|
| | | vo.setHelpLink(userVipConfigService.getValueByKey("help_link_vip_h5"));
|
| | | vo.setCsdLink(configService.get("customer_service_link"));
|
| | | vo.setCsdLink(configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | |
|
| | | Date now = new Date();
|
| | | Date start = new Date(0);
|
| | |
| | | }
|
| | | vo.setFinishMoney(hongBaoV2CountService.getRewardMoneyBySelf(uid));
|
| | |
|
| | | |
| | | List<Integer> list = new ArrayList<Integer>();
|
| | | list.add(BanLiShopOrder.STATE_SUCCESS);
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | |
|
| | | vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
|
| | | vo.setFinishTeam(hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney));
|
| | | vo.setFinishHongBao(banLiShopOrderService.countByUidAndState(uid, list));
|
| | |
|
| | | |
| | | // 区分老用户和新用户
|
| | | String limtDate = userVipConfigService.getValueByKey("vip_execute_time");
|
| | | Date executeDate = null;
|
| | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("info", gson.toJson(vo));
|
| | | data.put("welfare", userVipConfigService.getValueByKey("vip_welfare"));
|
| | | data.put("welfare", JSONArray.fromObject(userVipConfigService.getValueByKey("vip_welfare")));
|
| | | if (!StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(gson.toJson(vo))));
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(vo)));
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(data)));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | list.add(BanLiShopOrder.STATE_SUCCESS);
|
| | | BigDecimal payMoney = new BigDecimal(userVipConfigService.getValueByKey("require_order_pay"));
|
| | |
|
| | | long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid, TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | long finishTeam = hongBaoV2CountService.countValidOrderTeamUserByUid(uid,
|
| | | TimeUtil.convertDateToTemp(Constant.VIP_ONLINE_TIME), payMoney);
|
| | | long finishHongBao = banLiShopOrderService.countByUidAndState(uid, list);
|
| | | BigDecimal finishMoney = hongBaoV2CountService.getRewardMoneyBySelf(uid);
|
| | |
|
| | |
| | | } catch (ParseException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | if (extra != null
|
| | | && (extra.getFirstLoginTime() == null || extra.getFirstLoginTime().getTime() < executeDate.getTime())) {
|
| | |
| | | out.print(JsonUtil.loadTrueResult("已申请"));
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping("logout")
|
| | | public void logout(WXMPAcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("uid为空"));
|
| | | return;
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | | }
|