feat(consignment): 苏尔南寄卖接入打手端押金履约
打手可直接提报寄卖,关联 worker 与履约押金后指派交枪;后台去掉旧收集链接管理,提报审核与库存/工单流程对齐接单平台。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { Router } from 'express'
|
||||
|
||||
import {
|
||||
listWorkerConsignments,
|
||||
publishWorkerConsignment,
|
||||
} from '../../services/worker-platform/consignment-worker-service.js'
|
||||
import { sendRouteError } from '../../utils/http.js'
|
||||
import { getRequiredWorkerSession } from './session.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
/**
|
||||
* POST /api/v1/worker/consignment/publish
|
||||
* 打手在接单平台直接提报苏尔南手枪寄卖
|
||||
*/
|
||||
router.post('/consignment/publish', async (req, res) => {
|
||||
try {
|
||||
const session = getRequiredWorkerSession(req)
|
||||
const result = await publishWorkerConsignment(session.workerId, req.body || {})
|
||||
res.json({ ok: true, data: result })
|
||||
} catch (error) {
|
||||
sendRouteError(res, error, '提交寄卖失败', '[worker/consignment/publish]')
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* GET /api/v1/worker/consignment/my-items
|
||||
* 打手查看自己在接单平台寄卖的手枪列表与状态
|
||||
*/
|
||||
router.get('/consignment/my-items', async (req, res) => {
|
||||
try {
|
||||
const session = getRequiredWorkerSession(req)
|
||||
const result = await listWorkerConsignments(session.workerId)
|
||||
res.json({ ok: true, data: result })
|
||||
} catch (error) {
|
||||
sendRouteError(res, error, '获取我的寄卖列表失败', '[worker/consignment/my-items]')
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user