抽奖次数bug fix

This commit is contained in:
GYJ 2024-12-14 15:05:34 +08:00
parent dec0a17935
commit 09952a245e
4 changed files with 13 additions and 5 deletions

View File

@ -151,7 +151,7 @@ public class DiscSpinningController {
//任务抽奖
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
Integer i = recordService.countDraw(userId);
if (i != null && i > drawCount) {
if (i != null && i >= drawCount) {
return Result.error("当日可抽奖次数已超限");
}
Orders orders = ordersService.selectOrdersByDay(userId);

View File

@ -36,7 +36,7 @@ public interface OrdersDao extends BaseMapper<Orders> {
Integer selectOrdersCountStatisticsByYear(Integer flag, String time, Integer status);
Integer selectOrdersCountStatisticsByDay(Long userId, Integer limit);
Integer selectOrdersCountStatisticsByDay(Long userId);
Orders selectOrdersByDay(Long userId);

View File

@ -563,7 +563,16 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
@Override
public Integer selectOrdersCountStatisticsByDay(Long userId, Integer limit) {
return baseMapper.selectOrdersCountStatisticsByDay(userId, limit);
Integer count = baseMapper.selectOrdersCountStatisticsByDay(userId);
if (count == null) {
return 0;
}
if (count <= limit) {
return count;
}
return limit;
}
@Override

View File

@ -292,7 +292,6 @@
AND record.order_id IS NULL
ORDER BY
orders.create_time
LIMIT #{limit}
</select>
<select id="selectOrdersByDay" resultType="com.sqx.modules.orders.entity.Orders">
@ -320,4 +319,4 @@
and create_time > #{time}
</if>
</select>
</mapper>
</mapper>