修改更新商品库存
This commit is contained in:
parent
f577c6c3cd
commit
ca6351ca2e
@ -58,6 +58,10 @@ class getProductCommand extends HyperfCommand
|
|||||||
if ($result['count'] > $page * $page_size) {
|
if ($result['count'] > $page * $page_size) {
|
||||||
for ($i = 2; $i < $count; $i++) {
|
for ($i = 2; $i < $count; $i++) {
|
||||||
$result = $prescription->getProd($i, $page_size);
|
$result = $prescription->getProd($i, $page_size);
|
||||||
|
if (!isset($result['rows'])){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($result['rows'] as $item) {
|
foreach ($result['rows'] as $item) {
|
||||||
$concurrent->create(function () use($item) {
|
$concurrent->create(function () use($item) {
|
||||||
// 执行入库
|
// 执行入库
|
||||||
|
|||||||
@ -55,7 +55,7 @@ class getProductStockCommand extends HyperfCommand
|
|||||||
for ($i = 2; $i <= $product['last_page']; $i++) {
|
for ($i = 2; $i <= $product['last_page']; $i++) {
|
||||||
// 获取商品
|
// 获取商品
|
||||||
$params = array();
|
$params = array();
|
||||||
$product = Product::getPage($params,['*'],1,10);
|
$product = Product::getPage($params,['*'],$i,10);
|
||||||
if (empty($product['data'])){
|
if (empty($product['data'])){
|
||||||
$this->line("商品库存更新成功,无可更新库存商品");
|
$this->line("商品库存更新成功,无可更新库存商品");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -158,4 +158,14 @@ class Product extends Model
|
|||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
* @param array $data
|
||||||
|
* @return \Hyperf\Database\Model\Model|Product
|
||||||
|
*/
|
||||||
|
public static function addProduct(array $data): \Hyperf\Database\Model\Model|Product
|
||||||
|
{
|
||||||
|
return self::create($data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user