zoukankan      html  css  js  c++  java
  • 抢购代码留存

    //phpinfo();
    header("Content-type:text/html;charset=utf-8");
    include 'Mysql.class.php';
     $redis = new Redis();
     $redis->connect('127.0.0.1', 6379);
     $id = $_GET['id']?$_GET['id']:1;
     if($_GET["action"] == "add"){
         
         $mysql = new Mysql("localhost","root","root","qhb");
         $good = $mysql->getRow("select * from good where id=".$id);
         if(is_array($good) && $good['kucun']>0){
             for($i=0;$i<$good['kucun'];$i++){
                 $redis->lPush("good".$good['id'],1);
             }
             
         }

         echo "抢购写入缓存";

     }elseif($_GET['action'] = "qiang"){
         $len = $redis->Lsize("good".$id);
         if($len && $ll = $redis->lPop("good".$id)){
             $data = array(
                 'user_id'=>rand(),
                 'good_id'=>$id
             );
             $mysql = new Mysql("localhost","root","root","qhb");
             $mysql->insert("gouwuche",$data);
         }
     }
    ?>

  • 相关阅读:
    DVS6446教程链接
    今晚做的二值化和分割
    Sybase ETL
    QR码的结构
    cannot open file Default/configPkg/linker.cmd 错误
    QR 码的位置检测符
    QR Code
    C6000 OMAP DAVINCI的关系
    Davinci笔记 DSP子系统 VS ARM子系统
    ETL简介
  • 原文地址:https://www.cnblogs.com/ylcms/p/7345088.html
Copyright © 2011-2022 走看看