国产精品一区二区三区四区五区|国产精品另类激情久久久免费,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)前商品隊列的用戶情況

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

  }

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

  }

  2.4. 第二步就是關(guān)鍵所在機製性梗阻,用戶在進入商品詳情頁前先將當(dāng)前商品的庫存進行隊列存入redis如下:

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

  * @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}");

  /* 如果沒有會員進來隊列庫存 */

  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來異步的處理用戶點擊購買按鈕進行符合條件的數(shù)據(jù)進入購買的排隊隊列(如果當(dāng)前用戶沒在當(dāng)前產(chǎn)品用戶的隊列就進入排隊并且pop一個庫存隊列,如果在就拋出高效流通,):

如果您覺得 現(xiàn)在初始化里面定義后邊要使用的redis參數(shù) 這篇文章對您有用,請分享給您的好友有效性,謝謝
文章地址:http://61py.com/article/other/xzcshlmdyhbysydrediscs.html
解放雙手無盡可能,有問題添加天線貓微信
长泰县| 垣曲县| 怀仁县| 西安市| 印江| 兴海县| 平顺县| 临西县| 边坝县| 东乌| 玉林市| 崇文区| 和政县| 进贤县| 新密市| 三都| 紫阳县| 凤台县| 百色市| 德令哈市| 多伦县| 凌海市| 沙坪坝区| 织金县| 尉犁县| 洪湖市| 墨玉县| 沙湾县| 尖扎县| 临夏县| 宕昌县| 信宜市| 邢台市| 封丘县| 馆陶县| 滨州市| 石嘴山市| 昆山市| 周口市| 杨浦区| 佳木斯市|