feat(consignment): 寄卖配置、内部匹配与打手端升级
This commit is contained in:
@@ -6,13 +6,46 @@ import {
|
||||
listWorkerConsignments,
|
||||
publishWorkerConsignment,
|
||||
submitWorkerConsignmentGiftEvidence,
|
||||
updateWorkerConsignmentSalePrice,
|
||||
} from '../../services/worker-platform/consignment-worker-service.js'
|
||||
import { fetchWorkerConsignmentContacts } from '../../services/worker-platform/consignment-contact-service.js'
|
||||
import { listWorkerConsignmentProfiles } from '../../services/worker-platform/consignment-profile-service.js'
|
||||
import { sendRouteError } from '../../utils/http.js'
|
||||
import { getRequiredWorkerSession, requireActiveWorker } from './session.js'
|
||||
|
||||
const router = Router()
|
||||
|
||||
/**
|
||||
* GET /api/v1/worker/consignment/profiles
|
||||
* 打手端寄卖页按已发布的分类配置动态生成 tab。
|
||||
*/
|
||||
router.get('/consignment/profiles', async (_req, res) => {
|
||||
try {
|
||||
const result = await listWorkerConsignmentProfiles()
|
||||
res.json({ ok: true, data: { profiles: result } })
|
||||
} catch (error) {
|
||||
sendRouteError(res, error, '获取寄卖配置失败', '[worker/consignment/profiles]')
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* PATCH /api/v1/worker/consignment/items/:submissionId/price
|
||||
* 打手修改在售寄卖售价(仅本人、未售出)。
|
||||
*/
|
||||
router.patch('/consignment/items/:submissionId/price', requireActiveWorker, async (req, res) => {
|
||||
try {
|
||||
const session = getRequiredWorkerSession(req)
|
||||
const result = await updateWorkerConsignmentSalePrice(
|
||||
session.workerId,
|
||||
String(req.params.submissionId || ''),
|
||||
req.body?.salePriceFen ?? req.body?.priceFen,
|
||||
)
|
||||
res.json({ ok: true, data: result })
|
||||
} catch (error) {
|
||||
sendRouteError(res, error, '修改寄卖售价失败', '[worker/consignment/price]')
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* GET /api/v1/worker/consignment/contacts
|
||||
* 打手发布寄卖时的「对接客服」下拉:只返回启用中的名单
|
||||
|
||||
Reference in New Issue
Block a user