| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TokenUtil;
|
| | | import com.yeshi.fanli.vo.msg.TokenVO;
|
| | |
|
| | | @Service
|
| | |
| | | tokenRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void updateByPrimaryKeySelective(TokenRecord record) {
|
| | | tokenRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | |
| | | @Override
|
| | | public TokenRecord getNearByTypeAndIdentify(String type, String identify) {
|
| | | return tokenRecordMapper.getNearByTypeAndIdentify(type, identify);
|
| | |
| | |
|
| | | @Override
|
| | | public TokenVO discernToken(String token, Long uid) throws TokenRecordException {
|
| | |
|
| | | // TODO token 验证
|
| | | // 解析口令
|
| | | String parseToken = TokenUtil.parseToken(token);
|
| | | if (StringUtil.isNullOrEmpty(parseToken)) |
| | | throw new TokenRecordException(1, "未发现口令");
|
| | | |
| | | TokenRecord rokenRecord = tokenRecordMapper.getByToken(token);
|
| | | if (rokenRecord == null)
|
| | | throw new TokenRecordException(1, "口令不存在");
|
| | |
|
| | | Long uidToken = rokenRecord.getUid();
|
| | | if (uid != null && uidToken != null && uid.longValue() == uidToken.longValue())
|
| | | throw new TokenRecordException(1, "不能自己赠送给自己");
|
| | | |
| | | Date now = new Date();
|
| | | Date endTimeToken = rokenRecord.getEndTime();
|
| | | Integer stateTtoken = rokenRecord.getState();
|
| | |
| | | TokenRecord rokenRecord = tokenRecordMapper.getByToken(token);
|
| | | if (rokenRecord == null)
|
| | | throw new TokenRecordException(1, "口令已失效");
|
| | |
|
| | | |
| | | Long uidToken = rokenRecord.getUid();
|
| | | if (uidToken != null && uid.longValue() == uidToken.longValue())
|
| | | throw new TokenRecordException(1, "不能自己赠送给自己");
|
| | | |
| | | Date now = new Date();
|
| | | Date endTimeToken = rokenRecord.getEndTime();
|
| | | if (endTimeToken != null && endTimeToken.getTime() < now.getTime())
|