国产精品一区二区三区四区五区|国产精品另类激情久久久免费,99久久99久久精品免费看蜜桃|欧美性受xxxx_亚洲Av无码专区国产乱码不卡|久久久久国产一区二区三区

返回頂部
關(guān)閉軟件導(dǎo)航
位置:首頁 > 資訊 > 其他>現(xiàn)在初始化里面定義后邊要使用的redis參數(shù)

  //現(xiàn)在初始化里面定義后邊要使用的redis參數(shù)

  public function_initialize(){

PHPweb批量更新文章

  parent::_initialize();

  $goods_id = I("goods_id",'0','intval');

  if($goods_id){

  $this->goods_id = $goods_id;

  $this->user_queue_key = "goods_".$goods_id."_user";//當(dāng)前商品隊(duì)列的用戶情況

  $this->goods_number_key = "goods".$goods_id;//當(dāng)前商品的庫存隊(duì)列

  }

  $this->user_id = $this->user_id ? $this->user_id : $_SESSION['uid'];

  }

  2.4. 第二步就是關(guān)鍵所在堅實基礎,用戶在進(jìn)入商品詳情頁前先將當(dāng)前商品的庫存進(jìn)行隊(duì)列存入redis如下:

  * 訪問產(chǎn)品前先將當(dāng)前產(chǎn)品庫存隊(duì)列

  * @access public

  * @author bieanju

  */

  publicfunction_before_detail(){

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

  $where['start_time'] = array("lt"PHPweb批量添加產(chǎn)品,time());

  $where['end_time'] = array("gt",time());

  $goods= M("goods")->where($where)->field('goods_num,start_timePHPweb批量刪除關(guān)鍵詞 ,end_time')->find();

  !$goods&& $this->error("當(dāng)前秒殺已結(jié)束PHPweb批量上傳內(nèi)容 !");

  if($goods['goods_num'] > $goods['order_num']){

  $redis= $this->connectRedis();

  $getUserRedis= $redis->hGetAll("{$this->user_queue_key}");

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

  /* 如果沒有會員進(jìn)來隊(duì)列庫存 */

  if(!count($getUserRedis) && !$gnRedis){

  for($i= 0; $i< $goods['goods_num']; $i++) {

  $redis->lpush("{$this->goods_number_key}"PHPweb批量助手 , 1);

  }

  }

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

  if(!$resetRedis){

  $this->error("系統(tǒng)繁忙,請稍后搶購PHPweb批量添加欄目等地!");

  }

  }else{

  $this->error("當(dāng)前產(chǎn)品已經(jīng)秒殺完最為顯著!");

  }

  }

  接下來要做的就是用ajax來異步的處理用戶點(diǎn)擊購買按鈕進(jìn)行符合條件的數(shù)據(jù)進(jìn)入購買的排隊(duì)隊(duì)列(如果當(dāng)前用戶沒在當(dāng)前產(chǎn)品用戶的隊(duì)列就進(jìn)入排隊(duì)并且pop一個(gè)庫存隊(duì)列,如果在就拋出規定,):

如果您覺得 現(xiàn)在初始化里面定義后邊要使用的redis參數(shù) 這篇文章對您有用,請分享給您的好友高質量,謝謝
文章地址:http://www.61py.com/article/other/xzcshlmdyhbysydrediscs.html
解放雙手無盡可能,有問題添加天線貓微信