feat(haichao): 新增聚水潭ERP集成功能

- 新增聚水潭回调接口及事件处理机制
- 添加聚水潭商品、订单、售后同步任务
- 实现聚水潭订单推送及售后状态同步
- 新增手动同步聚水潭商品功能
- 在各路由组添加聚水潭中间件支持
This commit is contained in:
2026-04-01 11:55:18 +08:00
parent 359e9eef48
commit 7e422335e4
30 changed files with 2601 additions and 37 deletions

View File

@@ -22,10 +22,12 @@ use app\services\product\shipping\ShippingTemplatesServices;
use app\services\product\sku\StoreProductAttrServices;
use app\services\product\sku\StoreProductAttrValueServices;
use app\services\product\sku\StoreProductRuleServices;
use app\jobs\product\ProductSyncErp;
use crmeb\services\FileService;
use crmeb\services\SpreadsheetExcelService;
use crmeb\services\UploadService;
use think\annotation\Inject;
use think\facade\Log;
/**
* Class StoreProduct
@@ -992,6 +994,39 @@ class StoreProduct extends AuthController
return $this->success('已加入消息队列进行同步');
}
public function sync_jst_product()
{
[$spuStr, $sync] = $this->request->postMore([
['spu_str', ""],
['sync', 0]
], true);
if (!$spuStr) {
return $this->fail('请输入ERP商品SPU');
}
$spus = array_unique(array_filter(explode(',', $spuStr)));
$traceId = uniqid('jst_', true);
Log::info('admin.manual.jst.product.sync.dispatch', [
'trace_id' => $traceId,
'admin_id' => $this->adminId,
'admin_type' => $this->adminType,
'supplier_id' => $this->supplierId,
'client_ip' => $this->request->ip(),
'count' => count($spus),
'spus' => $spus
]);
if ($sync) {
foreach ($spus as $spu) {
(new ProductSyncErp())->productFromErp($spu, (int)$this->supplierId);
}
return $this->success('同步完成');
} else {
foreach ($spus as $spu) {
ProductSyncErp::dispatchDo('productFromErp', [$spu, (int)$this->supplierId]);
}
return $this->success('正在同步中,请稍后查看');
}
}
/**
* 商品批量操作
* @param StoreProductBatchProcessServices $batchProcessServices