feat(integration): 實作並測試 POS 與販賣機訂單同步 API
主要變更: - 實作 POS 與販賣機訂單同步邏輯,支援多租戶與 Sanctum 驗證。 - 修正多租戶識別中間件與 Sanctum 驗證順序問題。 - 切換快取驅動至 Redis 以支援 Tenancy 標籤功能。 - 新增商品同步 API (Upsert) 及相關單元測試。 - 新增手動測試腳本 tests/manual/test_integration_api.sh。 - 前端新增銷售訂單來源篩選與欄位顯示。
This commit is contained in:
@@ -22,4 +22,20 @@ interface ProductServiceInterface
|
||||
* @return object|null
|
||||
*/
|
||||
public function findByExternalPosId(string $externalPosId);
|
||||
|
||||
/**
|
||||
* 透過多個外部 POS ID 查找產品。
|
||||
*
|
||||
* @param array $externalPosIds
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function findByExternalPosIds(array $externalPosIds);
|
||||
|
||||
/**
|
||||
* 透過多個 ERP 商品代碼查找產品(供販賣機 API 使用)。
|
||||
*
|
||||
* @param array $codes
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function findByCodes(array $codes);
|
||||
}
|
||||
|
||||
@@ -88,4 +88,26 @@ class ProductService implements ProductServiceInterface
|
||||
{
|
||||
return Product::where('external_pos_id', $externalPosId)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* 透過多個外部 POS ID 查找產品。
|
||||
*
|
||||
* @param array $externalPosIds
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function findByExternalPosIds(array $externalPosIds)
|
||||
{
|
||||
return Product::whereIn('external_pos_id', $externalPosIds)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 透過多個 ERP 商品代碼查找產品(供販賣機 API 使用)。
|
||||
*
|
||||
* @param array $codes
|
||||
* @return \Illuminate\Database\Eloquent\Collection
|
||||
*/
|
||||
public function findByCodes(array $codes)
|
||||
{
|
||||
return Product::whereIn('code', $codes)->get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user