redis->executeCommand('SCARD', [$cacheKey]); noticeUtil::push("每三分钟执行一次吗", '15280215347'); if ($num <= 0) { echo "没有数量\n"; return false; } if ($num > 15) { noticeUtil::push("assign seat all 已经超过15家了,请及时解决", '15280215347'); } $list = Yii::$app->redis->executeCommand('SMEMBERS', [$cacheKey]); if (empty($list)) { echo "没有数量哦\n"; return false; } Yii::$app->redis->executeCommand('DEL', [$cacheKey]); Yii::$app->params['errorReport'] = 1; foreach ($list as $key => $bookSn) { $cgList = CgOrderClass::getAllByCondition(['book' => $bookSn, 'status' => 3], null, '*', null, true); if (empty($cgList)) { foreach ($cgList as $cg) { $connection = Yii::$app->db; $transaction = $connection->beginTransaction(); try { PurchaseOrderClass::assign($cg); $transaction->commit(); } catch (\Exception $exception) { $transaction->rollBack(); noticeUtil::push("部分门店待入库采购单,重新分配货位出错,原因:" . $exception->getMessage(), '15280215347'); } } } } } }