首绑支付宝发放现金红包奖励
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.sqx.modules.app.controller.app;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.ApiAccessLimitUtil;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
@@ -11,7 +11,6 @@ import com.sqx.modules.app.annotation.LoginUser;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.service.AppService;
|
||||
import com.sqx.modules.app.service.UserService;
|
||||
import com.sqx.modules.message.entity.MessageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@@ -76,7 +75,7 @@ public class AppController {
|
||||
@ResponseBody
|
||||
public Result updateUserImageUrl(@RequestAttribute("userId") Long userId, String zhiFuBao, String zhiFuBaoName) {
|
||||
int count = userService.count(new QueryWrapper<UserEntity>()
|
||||
.ne( "user_id", userId)
|
||||
.ne("user_id", userId)
|
||||
.eq("zhi_fu_bao_name", zhiFuBaoName)
|
||||
.eq("zhi_fu_bao", zhiFuBao));
|
||||
|
||||
@@ -86,11 +85,23 @@ public class AppController {
|
||||
if (!ApiAccessLimitUtil.isAccessAllowed(userId.toString(), "updateZFB", 3, "month")) {
|
||||
return Result.error("每月仅支持修改三次,请联系管理员");
|
||||
}
|
||||
UserEntity old = userService.getById(userId);
|
||||
String accountNo = old.getZhiFuBao();
|
||||
String accountName = old.getZhiFuBaoName();
|
||||
boolean isFirstBind = false;
|
||||
if (StrUtil.isEmpty(accountNo) && StrUtil.isEmpty(accountName)) {
|
||||
isFirstBind = true;
|
||||
}
|
||||
UserEntity userEntity = new UserEntity();
|
||||
userEntity.setZhiFuBao(zhiFuBao);
|
||||
userEntity.setZhiFuBaoName(zhiFuBaoName);
|
||||
userEntity.setUserId(userId);
|
||||
userService.updateById(userEntity);
|
||||
old.setZhiFuBao(userEntity.getZhiFuBao());
|
||||
old.setZhiFuBaoName(userEntity.getZhiFuBaoName());
|
||||
boolean bool = userService.updateById(userEntity);
|
||||
if (bool && isFirstBind) {
|
||||
userService.firstBindAwardsMoney(old);
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@@ -227,4 +227,6 @@ public interface UserService extends IService<UserEntity> {
|
||||
|
||||
int updateUserClientIdIsNull(String clientid);
|
||||
|
||||
void firstBindAwardsMoney(UserEntity entity);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.sqx.modules.app.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -42,6 +45,7 @@ import com.sqx.modules.app.utils.JwtUtils;
|
||||
import com.sqx.modules.app.utils.UserConstantInterface;
|
||||
import com.sqx.modules.common.entity.CommonInfo;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.discSpinning.service.DiscSpinningService;
|
||||
import com.sqx.modules.file.utils.Md5Utils;
|
||||
import com.sqx.modules.invite.service.InviteService;
|
||||
import com.sqx.modules.message.entity.MessageInfo;
|
||||
@@ -61,13 +65,17 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import weixin.popular.api.SnsAPI;
|
||||
import weixin.popular.util.JsonUtil;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
/**
|
||||
@@ -88,68 +96,72 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
@Autowired
|
||||
private JwtUtils jwtUtils;
|
||||
private int number = 1;
|
||||
@Autowired
|
||||
private InviteService inviteService;
|
||||
@Autowired
|
||||
@Autowired
|
||||
private InviteService inviteService;
|
||||
@Autowired
|
||||
private UserMoneyService userMoneyService;
|
||||
@Autowired
|
||||
@Autowired
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
@Autowired
|
||||
@Autowired
|
||||
private UserVipService userVipService;
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock=new ReentrantReadWriteLock(true);
|
||||
@Autowired
|
||||
private CommonInfoService commonRepository;
|
||||
@Autowired
|
||||
private DiscSpinningService discSpinningService;
|
||||
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
|
||||
|
||||
@Override
|
||||
public Result authenticationRegister(JSONObject jsonObject, HttpServletRequest request){
|
||||
public Result authenticationRegister(JSONObject jsonObject, HttpServletRequest request) {
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
String apiKey = request.getHeader("apiKey");
|
||||
if(StringUtils.isEmpty(apiKey)){
|
||||
if (StringUtils.isEmpty(apiKey)) {
|
||||
return Result.error("请求错误,请检查参数后重试!");
|
||||
}else if(StringUtils.isNotEmpty(apiKey)){
|
||||
} else if (StringUtils.isNotEmpty(apiKey)) {
|
||||
String value = commonInfoService.findOne(861).getValue();
|
||||
if(!apiKey.equals(value)){
|
||||
if (!apiKey.equals(value)) {
|
||||
return Result.error("请求错误,请检查参数后重试!");
|
||||
}
|
||||
}
|
||||
String phone = jsonObject.getString("phone");
|
||||
if(StringUtils.isEmpty(phone)){
|
||||
if (StringUtils.isEmpty(phone)) {
|
||||
return Result.error("phone参数不能为空");
|
||||
}
|
||||
String money = jsonObject.getString("money");
|
||||
if(StringUtils.isEmpty(money)){
|
||||
if (StringUtils.isEmpty(money)) {
|
||||
return Result.error("money参数不能为空");
|
||||
}
|
||||
String idempotentId = jsonObject.getString("idempotentId");
|
||||
if(StringUtils.isEmpty(idempotentId)){
|
||||
if (StringUtils.isEmpty(idempotentId)) {
|
||||
return Result.error("idempotentId参数不能为空");
|
||||
}
|
||||
String sign = jsonObject.getString("sign");
|
||||
if(StringUtils.isEmpty(sign)){
|
||||
if (StringUtils.isEmpty(sign)) {
|
||||
return Result.error("sign参数不能为空");
|
||||
}
|
||||
String apiSecret = commonInfoService.findOne(862).getValue();
|
||||
String signs = MD5Util.md5Encrypt32Upper(phone+money+apiSecret);
|
||||
if(!signs.equals(sign)){
|
||||
String signs = MD5Util.md5Encrypt32Upper(phone + money + apiSecret);
|
||||
if (!signs.equals(sign)) {
|
||||
return Result.error("sign参数错误!");
|
||||
}
|
||||
MessageInfo messageInfo = messageService.getOne(new QueryWrapper<MessageInfo>().eq("state", 10).eq("platform", idempotentId));
|
||||
if(messageInfo!=null){
|
||||
if (messageInfo != null) {
|
||||
//请求已经处理过了
|
||||
Map<String,String> result=new HashMap<>();
|
||||
result.put("phone",messageInfo.getTitle());
|
||||
result.put("userType",messageInfo.getContent());
|
||||
return Result.success().put("data",result);
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("phone", messageInfo.getTitle());
|
||||
result.put("userType", messageInfo.getContent());
|
||||
return Result.success().put("data", result);
|
||||
}
|
||||
messageInfo=new MessageInfo();
|
||||
messageInfo = new MessageInfo();
|
||||
messageInfo.setState("10");
|
||||
messageInfo.setPlatform(idempotentId);
|
||||
messageInfo.setTitle(phone);
|
||||
UserEntity userEntity = queryByPhone(phone);
|
||||
if(userEntity!=null){
|
||||
if (userEntity != null) {
|
||||
//老用户
|
||||
userMoneyService.updateMoney(1, userEntity.getUserId(),Double.parseDouble(money));
|
||||
userMoneyService.updateMoney(1, userEntity.getUserId(), Double.parseDouble(money));
|
||||
//inviteMoneyDao.updateInviteMoneySum(money,userId);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
@@ -165,9 +177,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
|
||||
messageInfo.setContent("2");
|
||||
}else{
|
||||
} else {
|
||||
//新用户
|
||||
userEntity=new UserEntity();
|
||||
userEntity = new UserEntity();
|
||||
userEntity.setPhone(phone);
|
||||
userEntity.setUserName(userEntity.getPhone().replaceAll("(\\d{3})\\d*([0-9a-zA-Z]{4})", "$1****$2"));
|
||||
userEntity.setPassword(DigestUtils.sha256Hex(userEntity.getPhone()));
|
||||
@@ -179,7 +191,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
baseMapper.updateById(userEntity);
|
||||
|
||||
//赠送金币
|
||||
userMoneyService.updateMoney(1, userEntity.getUserId(),Double.parseDouble(money));
|
||||
userMoneyService.updateMoney(1, userEntity.getUserId(), Double.parseDouble(money));
|
||||
//inviteMoneyDao.updateInviteMoneySum(money,userId);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
@@ -195,40 +207,39 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
|
||||
//发送短信
|
||||
sendMsg(phone,"newUser",phone);
|
||||
sendMsg(phone, "newUser", phone);
|
||||
messageInfo.setContent("1");
|
||||
}
|
||||
messageService.save(messageInfo);
|
||||
Map<String,String> result=new HashMap<>();
|
||||
result.put("phone",messageInfo.getTitle());
|
||||
result.put("userType",messageInfo.getContent());
|
||||
return Result.success().put("data",result);
|
||||
}catch (Exception e){
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("phone", messageInfo.getTitle());
|
||||
result.put("userType", messageInfo.getContent());
|
||||
return Result.success().put("data", result);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("认证注册用户出错:"+e.getMessage(),e);
|
||||
}finally {
|
||||
log.error("认证注册用户出错:" + e.getMessage(), e);
|
||||
} finally {
|
||||
reentrantReadWriteLock.writeLock().unlock();
|
||||
}
|
||||
return Result.error("系统繁忙,请稍后再试!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result getNewUserRed(Long userId){
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
public Result getNewUserRed(Long userId) {
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
UserEntity userEntity = baseMapper.selectById(userId);
|
||||
if(userEntity.getIsNewUser()!=null && userEntity.getIsNewUser()==1){
|
||||
if (userEntity.getIsNewUser() != null && userEntity.getIsNewUser() == 1) {
|
||||
return Result.error("您已经领取过了!");
|
||||
}
|
||||
userEntity.setIsNewUser(1);
|
||||
baseMapper.updateById(userEntity);
|
||||
String value = commonInfoService.findOne(837).getValue();
|
||||
if(StringUtils.isNotEmpty(value)){
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
BigDecimal money = new BigDecimal(value);
|
||||
userMoneyService.updateMoney(1,userId,money.doubleValue());
|
||||
UserMoneyDetails userMoneyDetails=new UserMoneyDetails();
|
||||
userMoneyService.updateMoney(1, userId, money.doubleValue());
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setUserId(userId);
|
||||
userMoneyDetails.setTitle("[新用户红包]");
|
||||
userMoneyDetails.setContent("增加金币:" + money);
|
||||
@@ -241,13 +252,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
}
|
||||
return Result.success();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
log.error("新用户领取红包出错:"+e.getMessage(),e);
|
||||
}finally {
|
||||
reentrantReadWriteLock.writeLock().unlock();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("新用户领取红包出错:" + e.getMessage(), e);
|
||||
} finally {
|
||||
reentrantReadWriteLock.writeLock().unlock();
|
||||
}
|
||||
return Result.error("系统繁忙,请稍后再试!");
|
||||
return Result.error("系统繁忙,请稍后再试!");
|
||||
|
||||
}
|
||||
|
||||
@@ -293,7 +304,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserEntity queryByInvitationCode(String invitationCode){
|
||||
public UserEntity queryByInvitationCode(String invitationCode) {
|
||||
return baseMapper.selectOne(new QueryWrapper<UserEntity>().eq("invitation_code", invitationCode));
|
||||
}
|
||||
|
||||
@@ -370,13 +381,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
map.put("unionid", "-1");
|
||||
}
|
||||
String value = commonInfoService.findOne(237).getValue();
|
||||
if("是".equals(value)){
|
||||
if ("是".equals(value)) {
|
||||
if (userEntity == null || StringUtils.isEmpty(userEntity.getPhone())) {
|
||||
map.put("flag", "1");
|
||||
} else {
|
||||
map.put("flag", "2");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
map.put("flag", "2");
|
||||
}
|
||||
return Result.success("登陆成功").put("data", map);
|
||||
@@ -417,7 +428,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
} else {
|
||||
//判断是否在app登陆过 手机号是否有账号
|
||||
UserEntity userByMobile = null;
|
||||
if(StringUtils.isNotEmpty(userInfo1.getPhone())){
|
||||
if (StringUtils.isNotEmpty(userInfo1.getPhone())) {
|
||||
userByMobile = queryByPhone(userInfo1.getPhone());
|
||||
}
|
||||
if (userByMobile != null) {
|
||||
@@ -428,11 +439,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
return Result.error("账号已被封禁,请联系客服处理!");
|
||||
}
|
||||
} else {
|
||||
if(StringUtils.isEmpty(userInfo1.getInviterCode())){
|
||||
if (StringUtils.isEmpty(userInfo1.getInviterCode())) {
|
||||
userInfo1.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
if(userEntity!=null && StringUtils.isEmpty(userInfo1.getQdCode())){
|
||||
if (userEntity != null && StringUtils.isEmpty(userInfo1.getQdCode())) {
|
||||
userInfo1.setQdCode(userEntity.getQdCode());
|
||||
}
|
||||
//没有则生成新账号
|
||||
@@ -445,8 +456,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
baseMapper.insert(userInfo1);
|
||||
userInfo1.setInvitationCode(InvitationCodeUtil.toSerialCode(userInfo1.getUserId()));
|
||||
baseMapper.updateById(userInfo1);
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo1.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo1.getUserId(), userEntity);
|
||||
}
|
||||
// userMoneyService.selectUserMoneyByUserId(userInfo1.getUserId());
|
||||
}
|
||||
@@ -458,7 +469,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
|
||||
|
||||
@Override
|
||||
public Result wxBindMobile(String phone, String code, String wxOpenId, String token, String platform, Integer sysPhone,String inviterCode,String qdCode) {
|
||||
public Result wxBindMobile(String phone, String code, String wxOpenId, String token, String platform, Integer sysPhone, String inviterCode, String qdCode) {
|
||||
Msg byPhoneAndCode = msgDao.findByPhoneAndCode(phone, code);
|
||||
if (byPhoneAndCode == null) {
|
||||
return Result.error("验证码错误");
|
||||
@@ -489,11 +500,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
//小程序没有登陆过
|
||||
userInfo = new UserEntity();
|
||||
userInfo.setQdCode(qdCode);
|
||||
if(StringUtils.isEmpty(inviterCode)){
|
||||
inviterCode=commonInfoService.findOne(88).getValue();
|
||||
if (StringUtils.isEmpty(inviterCode)) {
|
||||
inviterCode = commonInfoService.findOne(88).getValue();
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(inviterCode);
|
||||
if(userEntity!=null && StringUtils.isEmpty(userInfo.getQdCode())){
|
||||
if (userEntity != null && StringUtils.isEmpty(userInfo.getQdCode())) {
|
||||
userInfo.setQdCode(userEntity.getQdCode());
|
||||
}
|
||||
userInfo.setInviterCode(inviterCode);
|
||||
@@ -518,8 +529,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userInfo.setRate(new BigDecimal(commonInfoService.findOne(420).getValue()));
|
||||
userInfo.setTwoRate(new BigDecimal(commonInfoService.findOne(421).getValue()));
|
||||
baseMapper.insert(userInfo);
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
||||
}
|
||||
}
|
||||
UserEntity userEntity = queryByWxOpenId(userInfo.getWxOpenId());
|
||||
@@ -527,7 +538,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result iosBindMobile(String phone, String code, String appleId, String platform, Integer sysPhone,String inviterCode,String qdCode) {
|
||||
public Result iosBindMobile(String phone, String code, String appleId, String platform, Integer sysPhone, String inviterCode, String qdCode) {
|
||||
Msg byPhoneAndCode = msgDao.findByPhoneAndCode(phone, code);
|
||||
if (byPhoneAndCode == null) {
|
||||
return Result.error("验证码错误");
|
||||
@@ -546,11 +557,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
} else {
|
||||
userInfo = new UserEntity();
|
||||
userInfo.setQdCode(qdCode);
|
||||
if(StringUtils.isEmpty(inviterCode)){
|
||||
inviterCode=commonInfoService.findOne(88).getValue();
|
||||
if (StringUtils.isEmpty(inviterCode)) {
|
||||
inviterCode = commonInfoService.findOne(88).getValue();
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(inviterCode);
|
||||
if(userEntity!=null && StringUtils.isEmpty(userInfo.getQdCode())){
|
||||
if (userEntity != null && StringUtils.isEmpty(userInfo.getQdCode())) {
|
||||
userInfo.setQdCode(userEntity.getQdCode());
|
||||
}
|
||||
userInfo.setAppleId(appleId);
|
||||
@@ -566,8 +577,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userInfo.setRate(new BigDecimal(commonInfoService.findOne(420).getValue()));
|
||||
userInfo.setTwoRate(new BigDecimal(commonInfoService.findOne(421).getValue()));
|
||||
baseMapper.insert(userInfo);
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
||||
}
|
||||
}
|
||||
UserEntity userEntity = queryByAppleId(userInfo.getAppleId());
|
||||
@@ -576,31 +587,31 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
|
||||
|
||||
@Override
|
||||
public Result phoneLogin(String phone){
|
||||
public Result phoneLogin(String phone) {
|
||||
UserEntity userInfo = queryByPhone(phone);
|
||||
if(userInfo!=null){
|
||||
if(userInfo.getStatus().equals(2)){
|
||||
return Result.error(500,"账号已被禁用,请联系客服处理!");
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getStatus().equals(2)) {
|
||||
return Result.error(500, "账号已被禁用,请联系客服处理!");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
userInfo.setUpdateTime(sdf.format(new Date()));
|
||||
baseMapper.updateById(userInfo);
|
||||
return getResult(userInfo);
|
||||
}else{
|
||||
return Result.error(201,"请绑定密码!");
|
||||
} else {
|
||||
return Result.error(201, "请绑定密码!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Result bindMobile(String phone,String platform, Integer sysPhone,String inviterCode,String qdCode) {
|
||||
public Result bindMobile(String phone, String platform, Integer sysPhone, String inviterCode, String qdCode) {
|
||||
UserEntity userInfo = new UserEntity();
|
||||
userInfo.setQdCode(qdCode);
|
||||
if(StringUtils.isEmpty(inviterCode)){
|
||||
inviterCode=commonInfoService.findOne(88).getValue();
|
||||
if (StringUtils.isEmpty(inviterCode)) {
|
||||
inviterCode = commonInfoService.findOne(88).getValue();
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(inviterCode);
|
||||
if(userEntity!=null && StringUtils.isEmpty(userInfo.getQdCode())){
|
||||
if (userEntity != null && StringUtils.isEmpty(userInfo.getQdCode())) {
|
||||
userInfo.setQdCode(userEntity.getQdCode());
|
||||
}
|
||||
userInfo.setInviterCode(inviterCode);
|
||||
@@ -615,15 +626,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userInfo.setRate(new BigDecimal(commonInfoService.findOne(420).getValue()));
|
||||
userInfo.setTwoRate(new BigDecimal(commonInfoService.findOne(421).getValue()));
|
||||
baseMapper.insert(userInfo);
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
||||
}
|
||||
return getResult(userInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result wxAppLogin(String wxOpenId, String token) {
|
||||
UserEntity userEntity = queryByWxOpenId(wxOpenId);
|
||||
@@ -652,7 +661,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result dyLogin(String code,String anonymous_code) {
|
||||
public Result dyLogin(String code, String anonymous_code) {
|
||||
String appid = commonInfoService.findOne(805).getValue();
|
||||
String secret = commonInfoService.findOne(806).getValue();
|
||||
// 配置请求参数
|
||||
@@ -666,26 +675,26 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
log.info(wxResult);
|
||||
JSONObject jsonObject = JSONObject.parseObject(wxResult);
|
||||
String err_no = jsonObject.getString("err_no");
|
||||
if(!"0".equals(err_no)){
|
||||
if (!"0".equals(err_no)) {
|
||||
return Result.error(jsonObject.getString("err_tips"));
|
||||
}
|
||||
JSONObject data = jsonObject.getJSONObject("data");
|
||||
String openid = data.getString("openid");
|
||||
|
||||
if(StringUtils.isEmpty(openid)) {
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
openid = data.getString("anonymous_openid");
|
||||
}
|
||||
UserEntity userEntity = queryByDyOpenId(openid);
|
||||
Map<String,String> resultMap=new HashMap<>();
|
||||
resultMap.put("dyOpenId",openid);
|
||||
Map<String, String> resultMap = new HashMap<>();
|
||||
resultMap.put("dyOpenId", openid);
|
||||
String value = commonInfoService.findOne(814).getValue();
|
||||
if("是".equals(value)){
|
||||
if ("是".equals(value)) {
|
||||
if (userEntity == null || StringUtils.isEmpty(userEntity.getPhone())) {
|
||||
resultMap.put("flag", "1");
|
||||
} else {
|
||||
resultMap.put("flag", "2");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
resultMap.put("flag", "2");
|
||||
}
|
||||
return Result.success("登陆成功").put("data", resultMap);
|
||||
@@ -709,7 +718,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
} else {
|
||||
//判断是否在app登陆过 手机号是否有账号
|
||||
UserEntity userByMobile = null;
|
||||
if(StringUtils.isNotEmpty(userInfo1.getPhone())){
|
||||
if (StringUtils.isNotEmpty(userInfo1.getPhone())) {
|
||||
userByMobile = queryByPhone(userInfo1.getPhone());
|
||||
}
|
||||
if (userByMobile != null) {
|
||||
@@ -720,7 +729,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
return Result.error("账号已被封禁,请联系客服处理!");
|
||||
}
|
||||
} else {
|
||||
if(StringUtils.isEmpty(userInfo1.getInviterCode())){
|
||||
if (StringUtils.isEmpty(userInfo1.getInviterCode())) {
|
||||
userInfo1.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
@@ -728,7 +737,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userInfo1.setCreateTime(date);
|
||||
userInfo1.setPlatform("抖音");
|
||||
userInfo1.setStatus(1);
|
||||
if(StringUtils.isNotEmpty(userInfo1.getPhone())){
|
||||
if (StringUtils.isNotEmpty(userInfo1.getPhone())) {
|
||||
userInfo1.setPassword(DigestUtils.sha256Hex(userInfo1.getPhone()));
|
||||
}
|
||||
userInfo1.setRate(new BigDecimal(commonInfoService.findOne(420).getValue()));
|
||||
@@ -736,8 +745,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
baseMapper.insert(userInfo1);
|
||||
userInfo1.setInvitationCode(InvitationCodeUtil.toSerialCode(userInfo1.getUserId()));
|
||||
baseMapper.updateById(userInfo1);
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo1.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo1.getUserId(), userEntity);
|
||||
}
|
||||
// userMoneyService.selectUserMoneyByUserId(userInfo1.getUserId());
|
||||
}
|
||||
@@ -753,7 +762,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
String appid = commonInfoService.findOne(828).getValue();
|
||||
String secret = commonInfoService.findOne(829).getValue();
|
||||
// 配置请求参数
|
||||
HashMap<String,String> param = new HashMap<>();
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put("app_id", appid);
|
||||
param.put("app_secret", secret);
|
||||
param.put("js_code", code);
|
||||
@@ -762,7 +771,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
log.info(ksResult);
|
||||
JSONObject jsonObject = JSONObject.parseObject(ksResult);
|
||||
String result = jsonObject.getString("result");
|
||||
if(!"1".equals(result)){
|
||||
if (!"1".equals(result)) {
|
||||
return Result.error("登录失败!");
|
||||
}
|
||||
|
||||
@@ -770,17 +779,17 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
String openid = jsonObject.getString("open_id");
|
||||
|
||||
UserEntity userEntity = queryByDyOpenId(openid);
|
||||
Map<String,String> resultMap=new HashMap<>();
|
||||
resultMap.put("ksOpenId",openid);
|
||||
resultMap.put("session_key",session_key);
|
||||
Map<String, String> resultMap = new HashMap<>();
|
||||
resultMap.put("ksOpenId", openid);
|
||||
resultMap.put("session_key", session_key);
|
||||
String value = commonInfoService.findOne(830).getValue();
|
||||
if("是".equals(value)){
|
||||
if ("是".equals(value)) {
|
||||
if (userEntity == null || StringUtils.isEmpty(userEntity.getPhone())) {
|
||||
resultMap.put("flag", "1");
|
||||
} else {
|
||||
resultMap.put("flag", "2");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
resultMap.put("flag", "2");
|
||||
}
|
||||
return Result.success("登陆成功").put("data", resultMap);
|
||||
@@ -804,7 +813,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
} else {
|
||||
//判断是否在app登陆过 手机号是否有账号
|
||||
UserEntity userByMobile = null;
|
||||
if(StringUtils.isNotEmpty(userInfo1.getPhone())){
|
||||
if (StringUtils.isNotEmpty(userInfo1.getPhone())) {
|
||||
userByMobile = queryByPhone(userInfo1.getPhone());
|
||||
}
|
||||
if (userByMobile != null) {
|
||||
@@ -815,7 +824,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
return Result.error("账号已被封禁,请联系客服处理!");
|
||||
}
|
||||
} else {
|
||||
if(StringUtils.isEmpty(userInfo1.getInviterCode())){
|
||||
if (StringUtils.isEmpty(userInfo1.getInviterCode())) {
|
||||
userInfo1.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
}
|
||||
UserEntity userEntity = queryByInvitationCode(userInfo1.getInviterCode());
|
||||
@@ -823,7 +832,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userInfo1.setCreateTime(date);
|
||||
userInfo1.setPlatform("快手");
|
||||
userInfo1.setStatus(1);
|
||||
if(StringUtils.isNotEmpty(userInfo1.getPhone())){
|
||||
if (StringUtils.isNotEmpty(userInfo1.getPhone())) {
|
||||
userInfo1.setPassword(DigestUtils.sha256Hex(userInfo1.getPhone()));
|
||||
}
|
||||
userInfo1.setRate(new BigDecimal(commonInfoService.findOne(420).getValue()));
|
||||
@@ -831,8 +840,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
baseMapper.insert(userInfo1);
|
||||
userInfo1.setInvitationCode(InvitationCodeUtil.toSerialCode(userInfo1.getUserId()));
|
||||
baseMapper.updateById(userInfo1);
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo1.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo1.getUserId(), userEntity);
|
||||
}
|
||||
// userMoneyService.selectUserMoneyByUserId(userInfo1.getUserId());
|
||||
}
|
||||
@@ -843,37 +852,37 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result registerCode(String phone, String msg, String platform, Integer sysPhone,String password,
|
||||
String inviterCode,String wxId,String qdCode) {
|
||||
public Result registerCode(String phone, String msg, String platform, Integer sysPhone, String password,
|
||||
String inviterCode, String wxId, String qdCode) {
|
||||
//校验手机号是否存在
|
||||
UserEntity userInfo = queryByPhone(phone);
|
||||
if (userInfo != null) {
|
||||
if(StringUtils.isNotEmpty(password)){
|
||||
if (StringUtils.isNotEmpty(password)) {
|
||||
//密码登录
|
||||
if(StringUtils.isEmpty(userInfo.getPassword())){
|
||||
if (StringUtils.isEmpty(userInfo.getPassword())) {
|
||||
return Result.error("当前账号未绑定密码,请前往忘记密码中进行重置!");
|
||||
}
|
||||
if(!userInfo.getPassword().equals(DigestUtils.sha256Hex(password))){
|
||||
if (!userInfo.getPassword().equals(DigestUtils.sha256Hex(password))) {
|
||||
return Result.error("账号或密码不正确!");
|
||||
}
|
||||
}else if(StringUtils.isNotEmpty(msg)){
|
||||
} else if (StringUtils.isNotEmpty(msg)) {
|
||||
//验证码登录
|
||||
Msg msg1 = msgDao.findByPhoneAndCode(phone, msg);
|
||||
if(msg1==null){
|
||||
if (msg1 == null) {
|
||||
return Result.error("验证码不正确!");
|
||||
}
|
||||
msgDao.deleteById(msg1.getId());
|
||||
}else{
|
||||
} else {
|
||||
return Result.error("登录失败,请刷新页面重试!");
|
||||
}
|
||||
if (userInfo.getStatus().equals(2)) {
|
||||
return Result.error("账号已被禁用,请联系客服处理!");
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
if(StringUtils.isNotEmpty(wxId) && StringUtils.isNotEmpty(userInfo.getWxId()) && !wxId.equals(userInfo.getWxId())){
|
||||
if (StringUtils.isNotEmpty(wxId) && StringUtils.isNotEmpty(userInfo.getWxId()) && !wxId.equals(userInfo.getWxId())) {
|
||||
return Result.error("当前手机号已经绑定过了,请更换其他手机号!");
|
||||
}
|
||||
if(StringUtils.isNotEmpty(wxId)){
|
||||
if (StringUtils.isNotEmpty(wxId)) {
|
||||
userInfo.setWxId(wxId);
|
||||
}
|
||||
userInfo.setUpdateTime(sdf.format(new Date()));
|
||||
@@ -884,7 +893,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (StringUtils.isEmpty(platform)) {
|
||||
return Result.error("手机号未注册!");
|
||||
}
|
||||
if(StringUtils.isEmpty(msg)){
|
||||
if (StringUtils.isEmpty(msg)) {
|
||||
return Result.error("验证码不能为空!");
|
||||
}
|
||||
Msg msg1 = null;
|
||||
@@ -895,22 +904,22 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
}
|
||||
userInfo = new UserEntity();
|
||||
UserEntity userEntity=null;
|
||||
if(StringUtils.isNotEmpty(inviterCode)){
|
||||
UserEntity userEntity = null;
|
||||
if (StringUtils.isNotEmpty(inviterCode)) {
|
||||
userEntity = queryByInvitationCode(inviterCode);
|
||||
if(userEntity==null){
|
||||
if (userEntity == null) {
|
||||
return Result.error("邀请码不正确!");
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
userInfo.setInviterCode(commonInfoService.findOne(88).getValue());
|
||||
userEntity = queryByInvitationCode(userInfo.getInviterCode());
|
||||
}
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String time = simpleDateFormat.format(new Date());
|
||||
if(StringUtils.isNotEmpty(wxId)){
|
||||
if (StringUtils.isNotEmpty(wxId)) {
|
||||
userInfo.setWxId(wxId);
|
||||
}
|
||||
if(StringUtils.isEmpty(qdCode)){
|
||||
if (StringUtils.isEmpty(qdCode)) {
|
||||
qdCode = userEntity.getQdCode();
|
||||
}
|
||||
userInfo.setQdCode(qdCode);
|
||||
@@ -919,9 +928,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
userInfo.setPlatform(platform);
|
||||
userInfo.setCreateTime(time);
|
||||
userInfo.setSysPhone(sysPhone);
|
||||
if(StringUtils.isNotBlank(password)){
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
userInfo.setPassword(DigestUtils.sha256Hex(password));
|
||||
}else{
|
||||
} else {
|
||||
userInfo.setPassword(DigestUtils.sha256Hex(phone));
|
||||
}
|
||||
userInfo.setStatus(1);
|
||||
@@ -935,8 +944,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (msg1 != null) {
|
||||
msgDao.deleteById(msg1.getId());
|
||||
}
|
||||
if(userEntity!=null){
|
||||
inviteService.saveBody(userInfo.getUserId(),userEntity);
|
||||
if (userEntity != null) {
|
||||
inviteService.saveBody(userInfo.getUserId(), userEntity);
|
||||
}
|
||||
return getResult(userInfo);
|
||||
}
|
||||
@@ -980,8 +989,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Result login(String phone, String pwd) {
|
||||
UserEntity userEntity = queryByPhone(phone);
|
||||
@@ -1014,7 +1021,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
|
||||
|
||||
@Override
|
||||
public Result sendMsg(String phone, String state,String pwd) {
|
||||
public Result sendMsg(String phone, String state, String pwd) {
|
||||
int code = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
System.out.println("sendMsg code is " + code);
|
||||
SmsSingleSenderResult result = null;
|
||||
@@ -1028,14 +1035,14 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (userByPhone != null && StringUtils.isNotEmpty(userByPhone.getAppleId())) {
|
||||
return Result.error("当前手机号已被其他苹果账号绑定");
|
||||
}
|
||||
}else if("login".equals(state)){
|
||||
} else if ("login".equals(state)) {
|
||||
UserEntity userByPhone = queryByPhone(phone);
|
||||
if(userByPhone!=null){
|
||||
if (userByPhone != null) {
|
||||
return Result.error("当前手机号已注册!");
|
||||
}
|
||||
}else if("forget".equals(state)){
|
||||
} else if ("forget".equals(state)) {
|
||||
UserEntity userByPhone = queryByPhone(phone);
|
||||
if(userByPhone==null){
|
||||
if (userByPhone == null) {
|
||||
return Result.error("手机号未注册!");
|
||||
}
|
||||
}
|
||||
@@ -1044,16 +1051,16 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
if (three == null || "1".equals(three.getValue())) {
|
||||
//腾讯云短信发送
|
||||
return sendMsgTencent(phone, state, code);
|
||||
} else if("2".equals(three.getValue())){
|
||||
} else if ("2".equals(three.getValue())) {
|
||||
//阿里云短信发送
|
||||
return sendMsgAlibaba(phone, state,code);
|
||||
}else{
|
||||
return sendMsgDXB(phone,state,code,pwd);
|
||||
return sendMsgAlibaba(phone, state, code);
|
||||
} else {
|
||||
return sendMsgDXB(phone, state, code, pwd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Result sendMsgAlibaba(String phone,String state, int code) {
|
||||
private Result sendMsgAlibaba(String phone, String state, int code) {
|
||||
|
||||
CommonInfo three = commonInfoService.findOne(85);
|
||||
String accessKeyId = three.getValue();
|
||||
@@ -1073,19 +1080,19 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
String value;
|
||||
switch (state) {
|
||||
case "login":
|
||||
value=commonInfoService.findOne(82).getValue();
|
||||
value = commonInfoService.findOne(82).getValue();
|
||||
break;
|
||||
case "forget":
|
||||
value=commonInfoService.findOne(83).getValue();
|
||||
value = commonInfoService.findOne(83).getValue();
|
||||
break;
|
||||
case "bindWx":
|
||||
value=commonInfoService.findOne(84).getValue();
|
||||
value = commonInfoService.findOne(84).getValue();
|
||||
break;
|
||||
case "bindIos":
|
||||
value=commonInfoService.findOne(84).getValue();
|
||||
value = commonInfoService.findOne(84).getValue();
|
||||
break;
|
||||
default:
|
||||
value=commonInfoService.findOne(82).getValue();
|
||||
value = commonInfoService.findOne(82).getValue();
|
||||
break;
|
||||
}
|
||||
request.putQueryParameter("TemplateCode", value);
|
||||
@@ -1210,13 +1217,13 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
|
||||
private Result sendMsgDXB(String phone, String state, int code,String pwd) {
|
||||
private Result sendMsgDXB(String phone, String state, int code, String pwd) {
|
||||
CommonInfo three = commonInfoService.findOne(238);
|
||||
CommonInfo four = commonInfoService.findOne(239);
|
||||
CommonInfo name = commonInfoService.findOne(81);
|
||||
String testUsername = three.getValue(); //在短信宝注册的用户名
|
||||
String testPassword = four.getValue(); //在短信宝注册的密码
|
||||
String value="";
|
||||
String value = "";
|
||||
switch (state) {
|
||||
case "register":
|
||||
value = "【" + name.getValue() + "】验证码: " + code + ",此验证码可用于登录或注册,10分钟内有效,如非您本人操作,可忽略本条消息";
|
||||
@@ -1228,7 +1235,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
value = "【" + name.getValue() + "】验证码: " + code + ",您正在执行绑定手机号操作,10分钟内有效,如非您本人操作,可忽略本条消息";
|
||||
break;
|
||||
case "newUser":
|
||||
value = "【" + name.getValue() + "】新用户账号注册成功,账号:"+phone+",密码:"+pwd+",请及时登录并修改密码!";
|
||||
value = "【" + name.getValue() + "】新用户账号注册成功,账号:" + phone + ",密码:" + pwd + ",请及时登录并修改密码!";
|
||||
break;
|
||||
default:
|
||||
value = "【" + name.getValue() + "】验证码: " + code + ",此验证码可用于登录或注册,10分钟内有效,如非您本人操作,可忽略本条消息";
|
||||
@@ -1240,7 +1247,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
httpArg.append("m=").append(phone).append("&");
|
||||
httpArg.append("c=").append(Md5Utils.encodeUrlString(value, "UTF-8"));
|
||||
String result = Md5Utils.request("https://api.smsbao.com/sms", httpArg.toString());
|
||||
log.error("短信包返回值:"+result);
|
||||
log.error("短信包返回值:" + result);
|
||||
if ("0".equals(result)) {
|
||||
Msg byPhone = msgDao.findByPhone(phone);
|
||||
if (byPhone != null) {
|
||||
@@ -1261,18 +1268,18 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
} else {
|
||||
// return ResultUtil.error(6, result.errMsg);
|
||||
if("30".equals(result)){
|
||||
return Result.error( "错误密码");
|
||||
}else if("40".equals(result)){
|
||||
return Result.error( "账号不存在");
|
||||
}else if("41".equals(result)){
|
||||
return Result.error( "余额不足");
|
||||
}else if("43".equals(result)){
|
||||
return Result.error( "IP地址限制");
|
||||
}else if("50".equals(result)){
|
||||
return Result.error( "内容含有敏感词");
|
||||
}else if("51".equals(result)){
|
||||
return Result.error( "手机号码不正确");
|
||||
if ("30".equals(result)) {
|
||||
return Result.error("错误密码");
|
||||
} else if ("40".equals(result)) {
|
||||
return Result.error("账号不存在");
|
||||
} else if ("41".equals(result)) {
|
||||
return Result.error("余额不足");
|
||||
} else if ("43".equals(result)) {
|
||||
return Result.error("IP地址限制");
|
||||
} else if ("50".equals(result)) {
|
||||
return Result.error("内容含有敏感词");
|
||||
} else if ("51".equals(result)) {
|
||||
return Result.error("手机号码不正确");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1305,9 +1312,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
@Override
|
||||
public UserEntity selectUserById(Long userId) {
|
||||
UserEntity userEntity = baseMapper.selectById(userId);
|
||||
if(userEntity!=null){
|
||||
if (userEntity != null) {
|
||||
UserVip userVip = userVipService.selectUserVipByUserId(userId);
|
||||
if(userVip!=null){
|
||||
if (userVip != null) {
|
||||
userEntity.setMember(userVip.getIsVip());
|
||||
userEntity.setEndTime(userVip.getEndTime());
|
||||
}
|
||||
@@ -1319,10 +1326,10 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
@Override
|
||||
public PageUtils selectUserPage(Integer page, Integer limit, String search, Integer sex, String platform,
|
||||
String sysPhone, Integer status, Integer member, String inviterCode, String userName,
|
||||
String invitationCode, String startTime, String endTime,String qdCode,String sysUserName,Integer vipType) {
|
||||
String invitationCode, String startTime, String endTime, String qdCode, String sysUserName, Integer vipType) {
|
||||
Page<UserEntity> pages = new Page<>(page, limit);
|
||||
return new PageUtils(baseMapper.selectUserPage(pages, search, sex, platform, sysPhone, status, member,
|
||||
inviterCode, userName, invitationCode, startTime, endTime,qdCode,sysUserName,vipType));
|
||||
inviterCode, userName, invitationCode, startTime, endTime, qdCode, sysUserName, vipType));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1337,29 +1344,29 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public int queryUserCount(int type,String date,String platform,String qdCode) {
|
||||
public int queryUserCount(int type, String date, String platform, String qdCode) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
|
||||
if(date==null||date==""){
|
||||
if (date == null || date == "") {
|
||||
date = simpleDateFormat.format(new Date());
|
||||
}
|
||||
return baseMapper.queryUserCount(type, date,platform,qdCode);
|
||||
return baseMapper.queryUserCount(type, date, platform, qdCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Double queryPayMoney(int type,String qdCode) {
|
||||
public Double queryPayMoney(int type, String qdCode) {
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
|
||||
String date = simpleDateFormat.format(new Date());
|
||||
return baseMapper.queryPayMoney(type, date,qdCode);
|
||||
return baseMapper.queryPayMoney(type, date, qdCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<Map<String, Object>> queryCourseOrder(Page<Map<String, Object>> iPage,int type, String date,Long sysUserId) {
|
||||
return baseMapper.queryCourseOrder(iPage,type, date,sysUserId);
|
||||
public IPage<Map<String, Object>> queryCourseOrder(Page<Map<String, Object>> iPage, int type, String date, Long sysUserId) {
|
||||
return baseMapper.queryCourseOrder(iPage, type, date, sysUserId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int userMessage( String date, int type,String qdCode,Integer vipType) {
|
||||
return baseMapper.userMessage(date, type,qdCode,vipType);
|
||||
public int userMessage(String date, int type, String qdCode, Integer vipType) {
|
||||
return baseMapper.userMessage(date, type, qdCode, vipType);
|
||||
}
|
||||
|
||||
|
||||
@@ -1434,8 +1441,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectInviteUserList(Integer page,Integer limit,String userName,String phone){
|
||||
return Result.success().put("data",baseMapper.selectInviteUserList(new Page<>(page,limit),userName,phone));
|
||||
public Result selectInviteUserList(Integer page, Integer limit, String userName, String phone) {
|
||||
return Result.success().put("data", baseMapper.selectInviteUserList(new Page<>(page, limit), userName, phone));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1453,13 +1460,47 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectUserOnLineCount(String qdCode){
|
||||
return Result.success().put("data",baseMapper.selectUserOnLineCount(qdCode));
|
||||
public Result selectUserOnLineCount(String qdCode) {
|
||||
return Result.success().put("data", baseMapper.selectUserOnLineCount(qdCode));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateUserClientIdIsNull(String clientid){
|
||||
public int updateUserClientIdIsNull(String clientid) {
|
||||
return baseMapper.updateUserClientIdIsNull(clientid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void firstBindAwardsMoney(UserEntity entity) {
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
CommonInfo one = commonRepository.findOne(920);
|
||||
BigDecimal money = new BigDecimal(one.getValue());
|
||||
userMoneyService.updateMoney(1, entity.getUserId(), money.doubleValue());
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setUserId(entity.getUserId());
|
||||
userMoneyDetails.setTitle("[首绑支付宝]");
|
||||
userMoneyDetails.setContent("现金红包奖励:" + money + "元");
|
||||
// 充值
|
||||
userMoneyDetails.setType(1);
|
||||
// 任务领取
|
||||
userMoneyDetails.setClassify(7);
|
||||
userMoneyDetails.setMoney(money);
|
||||
userMoneyDetails.setCreateTime(DateUtil.format(new Date(System.currentTimeMillis() - 1000), "yyyy-MM-dd HH:mm:ss"));
|
||||
userMoneyDetails.setMoneyType(1);
|
||||
boolean ret = userMoneyDetailsService.save(userMoneyDetails);
|
||||
if (ret) {
|
||||
ThreadUtil.execAsync(()->{
|
||||
discSpinningService.withdrawAsync(entity, money.doubleValue(), "[首绑支付宝]");
|
||||
},true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("首绑支付宝发放奖励异常,用户信息:{}", JSONUtil.toJsonStr(entity));
|
||||
log.error("首绑支付宝发放奖励异常:", e);
|
||||
throw new RuntimeException("首绑奖励失败");
|
||||
} finally {
|
||||
reentrantReadWriteLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user