| | |
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgRedPackGiveContentDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | |
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TokenUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.vo.msg.TokenVO;
|
| | |
|
| | | @Service
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public TokenVO discernToken(String token, Long uid) throws TokenRecordException {
|
| | | public TokenVO discernToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
|
| | | // 解析口令
|
| | | String parseToken = TokenUtil.parseToken(token);
|
| | | if (StringUtil.isNullOrEmpty(parseToken))
|
| | |
| | | throw new TokenRecordException(1, "口令已失效");
|
| | | }
|
| | | } else if (tokenType == TokenTypeEnum.redPack) {
|
| | | if(!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | throw new TokenRecordException(1, "请升级到最新版");
|
| | | |
| | | |
| | | type = 13;
|
| | | RedPackGiveRecord giveRecord = redPackGiveRecordService.selectByPrimaryKey(Long.parseLong(identify));
|
| | | if (giveRecord == null)
|
| | |
| | |
|
| | |
|
| | | @Override
|
| | | public String receiveToken(String token, Long uid) throws TokenRecordException {
|
| | | public String receiveToken(String token, Long uid, AcceptData acceptData) throws TokenRecordException {
|
| | | if (uid == null || uid <= 0)
|
| | | throw new TokenRecordException(1, "用户未登录");
|
| | |
|
| | |
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.redPack) {
|
| | | if(!VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
|
| | | throw new TokenRecordException(1, "请升级到最新版");
|
| | | |
| | | try {
|
| | | msg = "领取红包成功,请到[我的-红包]中查看";
|
| | | // 领取红包、更新记录
|
| | |
| | | return;
|
| | | Date date = new Date();
|
| | | for (TokenRecord tokenRecord: list) {
|
| | | Integer state = tokenRecord.getState();
|
| | | if (state != null && state == 0) |
| | | continue;
|
| | | |
| | | tokenRecord.setState(1);
|
| | | tokenRecord.setUpdateTime(date);
|
| | | tokenRecordMapper.updateByPrimaryKeySelective(tokenRecord);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public void invalidByRedPack(Long id) {
|
| | | if (id == null)
|
| | | return;
|
| | | |
| | | List<String> list = new ArrayList<String>();
|
| | | list.add(TokenTypeEnum.redPack.name());
|
| | | tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
|
| | | }
|
| | | |
| | | @Override
|
| | | public void invalidByCoupon(Long id) {
|
| | | if (id == null)
|
| | | return;
|
| | | |
| | | List<String> list = new ArrayList<String>();
|
| | | list.add(TokenTypeEnum.freeCoupon.name());
|
| | | list.add(TokenTypeEnum.rebatePercentCoupon.name());
|
| | | tokenRecordMapper.invalidByTypeAndIdentify(list, id.toString());
|
| | | }
|
| | | }
|