public function handleAllQueueData() { $count = 0; $logSrv = \mysoft\erp\logs\ErpApiLogFactory::createDbLog('config', 'analysis'); while (TRUE) { $mdfStatus = $this->execQueue(); if ($count == 50) { $logSrv->batchLogging($this->handleSaveData($this->caches), 'pv'); //每50个插入一次,重置计数器 $count = 0; $this->caches = []; } if ($mdfStatus['code'] == '1') { //队列为空,退出 if (count($this->caches) > 0) { $logSrv->batchLogging($this->handleSaveData($this->caches), 'pv'); } break; } if ($mdfStatus['code'] == '2') { //执行出错,如何处理 continue; } $count++; } }
public function __construct($orgcode) { $this->_orgcode = $orgcode; //数据日志为异步写,同时写DB和ES日志 //$this->_log = ErpApiLogFactory::createDb2EsLog($orgcode); $this->_log = ErpApiLogFactory::createDbLog($orgcode); }