feat : order
This commit is contained in:
@@ -83,6 +83,7 @@ class OrderGoodStockConsumer extends ConsumerMessage
|
||||
$this->skuArr = [];
|
||||
|
||||
$this->orderGoodArr = $this->orderGoodModel->getGoodIdsByOrderId($orderId);
|
||||
$this->log->debug('OrderGoodStockConsumer:'.json_encode($this->orderGoodArr));
|
||||
if (empty($this->orderGoodArr)) {
|
||||
$this->log->debug('OrderGoodStockConsumer:error:NoOrderGoodData:'.json_encode($orderId));
|
||||
return Result::ACK;
|
||||
|
||||
@@ -50,6 +50,6 @@ class OrderGood extends Model
|
||||
*/
|
||||
public function getGoodIdsByOrderId(int $orderId): array
|
||||
{
|
||||
return $this->where('order_id', $orderId)->select('sku_id')->selectRaw('SUM(`quantity`) as `quantity`')->get()->toArray();
|
||||
return $this->where('order_id', $orderId)->select('sku_id')->selectRaw('SUM(`quantity`) as `quantity`')->groupBy('sku_id')->get()->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user