feat: stock

This commit is contained in:
2025-02-10 18:03:58 +08:00
parent c91b7c96d8
commit 387c01f91b
6 changed files with 253 additions and 1 deletions

View File

@@ -42,4 +42,14 @@ class OrderGood extends Model
const string CREATED_AT = 'create_time';
const string UPDATED_AT = 'update_time';
/**
* 根据订单获取商品id
* @param int $orderId
* @return array
*/
public function getGoodIdsByOrderId(int $orderId): array
{
return $this->where('order_id', $orderId)->select('sku_id','SUM(`quantity`) as `quantity`')->get()->toArray();
}
}