返回顶部
关闭软件导航
位置:首页 > 资讯 > 其他>抢购商品前处理当前会员是否进入队列

  * 抢购商品前处理当前会员是否进入队列

  * @access public

  * @author bieanju

  */

  publicfunctiongoods_number_queue(){

  !$this->user_id && $this->ajaxReturn(array("status"=> "-1","msg"=> "请先登录"));

  $model= M("flash_sale");

  $where['goods_id'] = $this->goods_id;

  $goods_info= $model->where($where)->find();

  !$goods_info&& $this->error("对不起当前商品不存在或已下架!");

  /* redis 队列 */

  $redis= $this->connectRedis();

  /* 进入队列 */

  $goods_number_key= $redis->llen("{$this->goods_number_key}");

  if(!$redis->hGet("{$this->user_queue_key}", $this->user_id)) {

  $goods_number_key= $redis->lpop("{$this->goods_number_key}");

PHPweb批量更新文章

  }

  if($goods_number_key){

  // 判断用户是否已在队列

  if(!$redis->hGet("{$this->user_queue_key}"PHPweb批量删除关键词 , $this->user_id)) {

  // 插入抢购用户信息

PHPweb批量助手

  $userinfo= array(

  "user_id"=> $this->user_id,

  "create_time"=> time()

  );

  $redis->hSet("{$this->user_queue_key}", $this->user_id, serialize($userinfo));

  $this->ajaxReturn(array("status"=> "1"));

  }else{

  $modelCart= M("cart");

  $condition['user_id'] = $this->user_id;

  $condition['goods_id'] = $this->goods_id;

  $condition['prom_type'] = 1;

  $cartlist= $modelCart->where($condition)->count();

  if($cartlist> 0){

PHPweb批量添加栏目

  $this->ajaxReturn(array("status"=> "2"));

PHPweb批量上传内容

  }else{

  $this->ajaxReturn(array("status"=> "1"));

  }

  }

  }else{

  $this->ajaxReturn(array("status"=> "-1","msg"=> "系统繁忙,请重试!"));

  }

  }

如果您觉得 抢购商品前处理当前会员是否进入队列 这篇文章对您有用,请分享给您的好友,谢谢
文章地址:https://www.tianxianmao.com/article/other/qgspqcldqhysfjrdl.html
解放双手无尽可能,有问题添加天线猫微信