| | |
| | | import com.google.gson.stream.JsonWriter;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.exception.user.UserInfoExtraException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyDetailService;
|
| | |
| | | vo.setBindingWX(true);
|
| | | } else
|
| | | vo.setBindingWX(false);
|
| | |
|
| | | UserInfoExtra extra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | // 如果绑定了微信而且未开通自动提现就先开通自动提现
|
| | | if (extra.getAutoExtract() == null && !StringUtil.isNullOrEmpty(user.getWxUnionId())) {
|
| | | UserInfoExtra update = new UserInfoExtra();
|
| | | update.setId(extra.getId());
|
| | | update.setAutoExtract(true);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(update);// 设置自动提现开启
|
| | | extra.setAutoExtract(true);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | if (extra != null && extra.getAutoExtract() != null && extra.getAutoExtract() == true)
|
| | | vo.setAutoExtract(true);
|
| | | else
|
| | | vo.setAutoExtract(false);
|
| | |
|
| | | vo.setAutoExtract(false);
|
| | | vo.setAutoExtractHelpUrl(configService.get(ConfigKeyEnum.autoExtractHelpUrl.getKey()));
|
| | | vo.setOpenAutoExtractMsg("自动提现必须要微信授权,当账户中的余额≥2元时,系统在保障你资金安全的情况下,以微信红包的形式完成提现");
|
| | | vo.setCloseAutoExtractMsg("关闭自动提现后,60天以内将不自动提现,60天后系统将会自动开启,敬请知晓");
|
| | |
| | | */
|
| | | @RequestMapping("autoExtract")
|
| | | public void autoExtract(AcceptData acceptData, Long uid, Integer type, PrintWriter out) {
|
| | | if (type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("请上传type"));
|
| | | return;
|
| | | }
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用戶未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | UserInfoExtra userExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | UserInfo user = userInfoService.selectByPKey(uid);
|
| | | if (user == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用戶不存在"));
|
| | | return;
|
| | | }
|
| | | if (type == 1)// 开启
|
| | | {
|
| | | if (userExtra.getAutoExtract() == null || userExtra.getAutoExtract() == false) {
|
| | | if (StringUtil.isNullOrEmpty(user.getWxUnionId()))// 尚未綁定微信
|
| | | {
|
| | | out.print(JsonUtil.loadFalseResult("未綁定微信"));
|
| | | return;
|
| | | }
|
| | | // 设置自动提现
|
| | | UserInfoExtra update = new UserInfoExtra();
|
| | | update.setId(userExtra.getId());
|
| | | update.setAutoExtract(true);
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(update);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | return;
|
| | | } else {
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | return;
|
| | | }
|
| | | } else {// 关闭
|
| | | UserInfoExtra update = new UserInfoExtra();
|
| | | update.setId(userExtra.getId());
|
| | | update.setAutoExtract(false);
|
| | | update.setCloseTimeExtract(new Date());
|
| | | try {
|
| | | userInfoExtraService.saveUserInfoExtra(update);
|
| | | } catch (UserInfoExtraException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | return;
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadFalseResult("该功能已下架"));
|
| | | }
|
| | |
|
| | | }
|