新增获取商品库存对接、修正实际付款金额返回值

This commit is contained in:
2023-03-15 14:44:39 +08:00
parent 55991b6987
commit cff132c5d4
10 changed files with 582 additions and 95 deletions
+66
View File
@@ -0,0 +1,66 @@
<?php
declare(strict_types=1);
namespace App\Command;
use App\Model\Product;
use Extend\Prescription\Prescription;
use Hyperf\Command\Command as HyperfCommand;
use Hyperf\Command\Annotation\Command;
use Psr\Container\ContainerInterface;
/**
* 更新商品库存
*/
#[Command]
class getProductStockCommand extends HyperfCommand
{
public function __construct(protected ContainerInterface $container)
{
parent::__construct('getProductStock:command');
}
public function configure()
{
parent::configure();
$this->setDescription('获取处方平台商品库存数据');
}
public function handle()
{
$this->line("商品库存更新开始");
try {
// 获取商品
$params = array();
$product = Product::getPage($params);
if (empty($product['data'])){
$this->line("商品库存更新成功,无可更新库存商品");
return;
}
$prescription = new Prescription();
foreach ($product['data'] as $item){
if (!empty($item['product_pharmacy_code'])){
}
$result = $prescription->getProdStock($item['product_pharmacy_code']);
dump($result);die;
}
} catch (\Exception $e) {
$this->line("商品库存更新失败:" . $e->getMessage());
}
$this->line("商品库存更新成功");
}
}