Exemplo n.º 1
0
 /**
  *
  */
 public function putRedisToDb()
 {
     while ($this->redis->lLen($this->redisKey) > 0) {
         for ($i = 0; $i < 2000; $i++) {
             $orderSn = $this->redis->rpoplpush($this->redisKey, 'orderSnOne');
             $orderSnArray[] = $orderSn;
         }
         $omsOrderModel = new PlatformEbayOrder(Yii::$app->omsDb, $orderSnArray);
         $orderBaseArray = $omsOrderModel->getOrderBase();
     }
 }
Exemplo n.º 2
0
 public function actionRun()
 {
     $redis = (new RedisHandler())->redis;
     $categoryRedis = new CategoryRedis($redis);
     $categoryRedis->redis->del($categoryRedis->redisDescriptionKey);
     $categoryRedis->redis->del($categoryRedis->redisParentChildKey);
     $ebayRedisOrder = new EbayRedisOrder($redis);
     $ebayRedisOrder->delRedisOrderSn();
     $ebayRedisOrder->setRedisOrderSn();
     $AliRedisOrder = new AliRedisOrder($redis);
     $AliRedisOrder->delRedisOrderSn();
     $AliRedisOrder->setRedisOrderSn();
     $AmzRedisOrder = new AmzRedisOrder($redis);
     $AmzRedisOrder->delRedisOrderSn();
     $AmzRedisOrder->setRedisOrderSn();
     echo $redis->lLen($ebayRedisOrder->redisKey) . "\r\n";
     echo $redis->lLen($AliRedisOrder->redisKey) . "\r\n";
     echo $redis->lLen($AmzRedisOrder->redisKey) . "\r\n";
     exit;
     $startTime = $this->microtimeFloat();
     $orderSnArray = [];
     for ($i = 0; $i < 2000; $i++) {
         $orderSn = $redis->rpoplpush("orderSn", 'orderSnOne');
         $orderSnArray[] = $orderSn;
     }
     $endTime = $this->microtimeFloat();
     echo $endTime - $startTime;
     echo "\r\n";
     $omsOrderModel = new PlatformEbayOrder(Yii::$app->omsDb, $orderSnArray);
     $orderBaseArray = $omsOrderModel->getOrderBase();
     $endTime = $this->microtimeFloat();
     echo $endTime - $startTime;
     echo "\r\n";
     $insertOrderModel = new InsertOrder();
     $insertOrderModel->insertOrderBase($orderBaseArray);
     $endTime = $this->microtimeFloat();
     echo $endTime - $startTime;
     echo "\r\n";
     exit;
 }