新增问诊类型

This commit is contained in:
2023-04-11 11:10:02 +08:00
parent 3935c8827b
commit bb4dc3c710
4 changed files with 19 additions and 7 deletions
+13 -6
View File
@@ -11,6 +11,7 @@ use Extend\Prescription\Prescription;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Hyperf\DbConnection\Db;
use Hyperf\Utils\Coroutine\Concurrent;
use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Input\InputArgument;
@@ -40,12 +41,16 @@ class getProductCommand extends HyperfCommand
$prescription = new Prescription();
$page = 1;
$page_size = 10;
$result = $prescription->getProd(1, 10);
$page_size = 100;
$result = $prescription->getProd(1, 100);
if (!empty($result['rows'])){
$concurrent = new Concurrent(10);
foreach ($result['rows'] as $item) {
// 执行入库
$this->handleData($item);
$concurrent->create(function () use($item) {
// 执行入库
$this->handleData($item);
});
}
$count = ceil($result['count'] / $page * $page_size);
@@ -54,8 +59,10 @@ class getProductCommand extends HyperfCommand
for ($i = 2; $i < $count; $i++) {
$result = $prescription->getProd($i, $page_size);
foreach ($result['rows'] as $item) {
// 执行入库
$this->handleData($item);
$concurrent->create(function () use($item) {
// 执行入库
$this->handleData($item);
});
}
}
}