栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 数据挖掘与分析

锁定优惠券

锁定优惠券

在实现锁定优惠券的过程中:

1、锁定优惠券记录  将coupon_record 中当前用户的优惠券的状态由new改为lock
   
    
        update coupon_record set user_state = #{useState} where user_id = #{userId} and  user_state = "NEW"
        and id in
        
                #{id}

        
    
2、coupon_task表插入记录
  
    
        insert into coupon_task
            ( )
        values
        
            (#{item.couponRecordId},
            #{item.createrTime},
            #{item.lockState}
            )
        
    
3、发送延迟消息

配置rabbitMQ

mqconfig:
  # 延迟队列,不能被监听消费
  coupon_release_delay_queue: coupon.release.delay.queue
  # 延迟队列的消息过期后转发的队列
  coupon_release_queue: coupon.release.queue
  # 交换机
  coupon_event_exchange: coupon.event.exchange
  # 进入延迟队列的路由key
  coupon_release_delay_routing_key:
  coupon.release.delay.routing.key
  # 消息过期,进入释放死信队列的key
  coupon_release_routing_key:
  coupon.release.routing.key
  # 消息过期的时间,毫秒
  ttl: 15000

然后需要将以上配置信息读取到配置类里面

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/278697.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号