金币商城 · 接口文档

由路由表和控制器注释自动生成 · 前台页面 · 管理后台

金币商城(11)

POST /api/coinmall/checkin 需登录 jwt.auth

每日签到(连续签到双倍奖励;每天只能签一次)

无参数

200 {"message":"签到成功,+2 金币","data":{"granted":true,"task":"checkin","task_label":"每日签到","amount":2,"balance":2,"streak":1,"message":"签到成功,+2 金币"}}

200 {"message":"今日已签到,明天再来","data":{"granted":false,"task":"checkin","task_label":"每日签到","amount":0,"balance":2,"streak":null,"message":"今日已签到,明天再来"}}

GET /api/coinmall/goods 需登录 jwt.auth

兑换商品列表(仅上架)

参数类型位置必填说明
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认取扩展配置

200 {"data":{"list":[{"id":"1","name":"定制水杯","cover":"http://...","description":"好杯子","points":50,"shipping_fee":8,"shipping_fee_text":"8.00","stock":10,"sold_out":false,"exchanged_count":2,"sort":0,"status":"active"}],"current_page":1,"last_page":1,"total":1}}

GET /api/coinmall/goods/{id} 需登录 jwt.auth

兑换商品详情

参数类型位置必填说明
id int 路径 必填 商品ID

200 {"data":{"id":"1","name":"定制水杯","cover":"http://...","description":"好杯子","points":50,"shipping_fee":8,"shipping_fee_text":"8.00","stock":10,"sold_out":false,"exchanged_count":2,"sort":0,"status":"active"}}

404 {"msg":"商品不存在或已下架"}

GET /api/coinmall/orders 需登录 jwt.auth

我的兑换订单列表

参数类型位置必填说明
status string Query 否 可选:pending_pay/processing/shipped/completed/cancelled
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认取扩展配置

200 {"data":{"list":[{"id":"1","order_no":"JB2026...","status":"processing","status_label":"待自提","goods":{"name":"定制水杯","cover":"http://..."},"points_used":50,"shipping_fee":0,"created_at":"2026-10-13 21:00:00"}],"current_page":1,"last_page":1,"total":1}}

POST /api/coinmall/orders 需登录 jwt.auth

兑换下单(一单一物,扣金币和库存)

参数类型位置必填说明
goods_id int Body 必填 商品ID
fulfill_type string Body 必填 履约方式:self_pickup 自提 / express 邮寄
receiver_name string Body 否 收货人(邮寄必填)
receiver_phone string Body 否 收货人电话(邮寄必填)
province string Body 否 省(邮寄必填)
city string Body 否 市(邮寄必填)
district string Body 否 区(邮寄可选)
receiver_address string Body 否 详细地址(邮寄必填)

200 {"message":"兑换成功","data":{"id":"1","order_no":"JB20261013...","status":"pending_pay","status_label":"待付邮费","points_used":50,"shipping_fee":8,"shipping_fee_text":"8.00","verify_code":null,"balance":150,"need_pay":true}}

422 {"msg":"金币不足,还需 20 金币"}

422 {"msg":"商品已售罄"}

GET /api/coinmall/orders/{id} 需登录 jwt.auth

我的兑换订单详情

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"data":{"id":"1","order_no":"JB2026...","status":"processing","status_label":"待自提","verify_code":"823194","express_company":null,"express_no":null,"receiver_name":null}}

404 {"msg":"订单不存在"}

POST /api/coinmall/orders/{id}/cancel 需登录 jwt.auth

取消订单(未发货前可取消:退金币 + 已付邮费原路退)

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"message":"已取消,退回 50 金币","data":{"id":"1","status":"cancelled","status_label":"已取消","refunded_at":null}}

422 {"msg":"未发货前才能取消,当前状态不可取消"}

POST /api/coinmall/orders/{id}/pay 需登录 jwt.auth

创建邮费支付(微信 JSAPI),返回前端支付配置

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"data":{"order_no":"JB2026...","shipping_fee":8,"shipping_fee_text":"8.00","config":{"appId":"...","timeStamp":"...","nonceStr":"...","package":"prepay_id=...","signType":"RSA","paySign":"..."}}}

422 {"msg":"当前状态无需支付邮费"}

422 {"msg":"邮费已支付"}

GET /api/coinmall/orders/{id}/pay-status 需登录 jwt.auth

邮费支付状态查询(支付后前端轮询兜底)

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"data":{"status":"processing","status_label":"待发货"}}

GET /api/coinmall/transactions 需登录 jwt.auth

我的金币流水(倒序分页)

参数类型位置必填说明
limit int Query 否 可选,每页条数,默认取扩展配置
page int Query 否 可选,页码,默认1

200 {"data":{"list":[{"id":"3","user_id":"9477","task":"checkin","task_label":"每日签到","amount":2,"balance_after":2,"related_id":"0","remark":"每日签到(连续第 1 天)","created_at":"2026-10-13 21:30:00"}],"current_page":1,"last_page":1,"total":1}}

GET /api/coinmall/wallet 需登录 jwt.auth

我的金币钱包:余额、签到状态、今日任务进度

无参数

200 {"data":{"user_id":"9477","balance":4,"total_income":4,"total_expense":0,"checkin_streak":1,"checkin_last_date":"2026-10-13","updated_at":"2026-10-13 21:30:00","today_checked_in":true,"tasks":[{"task":"checkin","label":"每日签到","reward":2,"daily_limit":1,"done":1},{"task":"invite","label":"邀请新用户","reward":2,"daily_limit":5,"done":0}]}}

金币商城后台(19)

GET /api/coinmall-admin/goods 需登录 jwt.authcoinmall.admin

兑换商品列表(含下架,封面给入库原值+URL便于回填)

参数类型位置必填说明
keyword string Query 否 可选,名称模糊
status string Query 否 可选,active/inactive
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认15

200 {"data":{"list":[{"id":"1","name":"定制水杯","cover":"uploads/a.png","cover_url":"http://...","points":50,"shipping_fee":8,"shipping_fee_text":"8.00","stock":10,"exchanged_count":2,"sort":0,"status":"active"}],"current_page":1,"last_page":1,"total":1}}

POST /api/coinmall-admin/goods 需登录 jwt.authcoinmall.admin

发布兑换商品

参数类型位置必填说明
name string Body 必填 商品名称
cover string Body 否 可选,封面路径/URL(手填)
description string Body 否 可选,商品说明
points int Body 必填 兑换点(金币)
shipping_fee number Body 必填 邮费(元,可带两位小数,仅邮寄单收取)
stock int Body 必填 库存
sort int Body 否 可选,排序(升序)

200 {"message":"已发布","data":{"id":"1","name":"定制水杯","points":50}}

DELETE /api/coinmall-admin/goods/{id} 需登录 jwt.authcoinmall.admin

删除兑换商品(已有兑换订单的不能删,只能下架)

参数类型位置必填说明
id int 路径 必填 商品ID

200 {"message":"已删除"}

422 {"msg":"已有兑换订单,不能删除,请改为下架"}

PUT /api/coinmall-admin/goods/{id} 需登录 jwt.authcoinmall.admin

编辑兑换商品(只改传了的字段)

参数类型位置必填说明
id int 路径 必填 商品ID
name string Body 否 商品名称
cover string Body 否 封面路径/URL
description string Body 否 商品说明
points int Body 否 兑换点(金币)
shipping_fee number Body 否 邮费(元)
stock int Body 否 库存
sort int Body 否 排序

200 {"message":"已保存","data":{"id":"1"}}

404 {"msg":"商品不存在"}

PUT /api/coinmall-admin/goods/{id}/status 需登录 jwt.authcoinmall.admin

上架/下架兑换商品

参数类型位置必填说明
id int 路径 必填 商品ID
status string Body 必填 active 上架 / inactive 下架

200 {"message":"已下架","data":{"id":"1","status":"inactive"}}

GET /api/coinmall-admin/me 需登录 jwt.authcoinmall.admin

当前登录管理员

无参数

200 {"data":{"id":"9477","name":"测试管理员","isadmin":1}}

GET /api/coinmall-admin/orders 需登录 jwt.authcoinmall.admin

兑换订单列表(支持多条件筛选)

参数类型位置必填说明
status string Query 否 可选:pending_pay/processing/shipped/completed/cancelled
fulfill_type string Query 否 可选:self_pickup/express
goods_id int Query 否 可选,商品筛选
order_no string Query 否 可选,订单号精确
verify_code string Query 否 可选,核销码精确
keyword string Query 否 可选,模糊:订单号/用户ID/用户名/商品名
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认15

200 {"data":{"list":[{"id":"1","order_no":"JB2026...","status":"processing","status_label":"待自提","fulfill_type":"self_pickup","fulfill_label":"自提","points_used":50,"shipping_fee":0,"goods":{"name":"定制水杯"},"user":{"id":"8","name":"张三","avatar":""}}],"current_page":1,"last_page":1,"total":1}}

GET /api/coinmall-admin/orders/stats 需登录 jwt.authcoinmall.admin

订单状态统计(后台角标/卡片)

无参数

200 {"data":{"pending_pay":1,"processing":2,"shipped":0,"completed":10,"cancelled":1,"total":14}}

GET /api/coinmall-admin/orders/{id} 需登录 jwt.authcoinmall.admin

兑换订单详情(含收货人/快递/支付退款信息)

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"data":{"id":"1","order_no":"JB2026...","status":"processing","status_label":"待发货","receiver_name":"张三","receiver_phone":"138...","province":"广东省","city":"深圳市","receiver_address":"...","verify_code":null,"express_company":null,"express_no":null,"paid_at":"2026-10-13 21:00:00","refunded_at":null,"can_retry_refund":false}}

404 {"msg":"订单不存在"}

POST /api/coinmall-admin/orders/{id}/cancel 需登录 jwt.authcoinmall.admin

管理员取消订单(未发货前:退金币 + 回库存 + 已付邮费原路退)

参数类型位置必填说明
id int 路径 必填 订单ID
remark string Body 否 可选,取消原因

200 {"message":"已取消,退回 50 金币","data":{"id":"1","status":"cancelled"}}

422 {"msg":"未发货前才能取消,当前状态不可取消"}

POST /api/coinmall-admin/orders/{id}/complete 需登录 jwt.authcoinmall.admin

完成订单(确认送达,待发货/待自提/已发货 -> 已完成)

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"message":"已完成","data":{"id":"1","status":"completed"}}

422 {"msg":"订单状态不可完成"}

POST /api/coinmall-admin/orders/{id}/refund-postage 需登录 jwt.authcoinmall.admin

邮费退款重试(取消后微信退款失败的订单)

参数类型位置必填说明
id int 路径 必填 订单ID

200 {"message":"邮费已原路退回","data":{"id":"1","refunded_at":"2026-10-13 21:30:00"}}

422 {"msg":"该订单无需退邮费"}

POST /api/coinmall-admin/orders/{id}/ship 需登录 jwt.authcoinmall.admin

邮寄订单发货(待发货 -> 已发货)

参数类型位置必填说明
id int 路径 必填 订单ID
express_company string Body 必填 快递公司
express_no string Body 必填 快递单号

200 {"message":"发货成功","data":{"id":"1","status":"shipped","express_company":"顺丰","express_no":"SF123"}}

422 {"msg":"订单状态不可发货"}

POST /api/coinmall-admin/orders/{id}/verify 需登录 jwt.authcoinmall.admin

自提核销(凭核销码,待自提 -> 已完成)

参数类型位置必填说明
verify_code string Body 必填 核销码

200 {"message":"核销成功","data":{"order_no":"JB2026...","status":"completed"}}

422 {"msg":"核销码无效或订单状态不可核销"}

GET /api/coinmall-admin/transactions 需登录 jwt.authcoinmall.admin

金币流水(全部用户)

参数类型位置必填说明
user_id int Query 否 可选,只看某个用户
task string Query 否 可选,任务类型:checkin/invite/post/like/comment/exchange/exchange_refund
start_date date Query 否 可选,起始日期,如 2026-10-01
end_date date Query 否 可选,结束日期,如 2026-10-31
limit int Query 否 可选,每页条数,默认15
page int Query 否 可选,页码,默认1

200 {"data":{"list":[{"id":"1","user_id":"9477","task":"checkin","task_label":"每日签到","amount":2,"balance_after":2,"related_id":"0","remark":"每日签到(连续第 1 天)","created_at":"2026-10-13 21:30:00","user":{"id":"9477","name":"测试管理员","avatar":""}}],"current_page":1,"last_page":1,"total":1}}

POST /api/coinmall-admin/trigger 需登录 jwt.authcoinmall.admin

触发一次任务事件

参数类型位置必填说明
user_id int Body 必填 用户 users.id(给谁发金币)
task string Body 必填 任务:checkin=签到 / invite=邀请 / post=发布动态 / like=点赞 / comment=评论
related_id int Body 否 可选,关联对象:邀请=新用户ID,发布/点赞=动态ID,评论=评论ID;传了同一对象不重复发

200 {"message":"点赞成功,+1 金币","data":{"granted":true,"task":"like","task_label":"点赞","amount":1,"balance":5,"streak":null,"message":"点赞成功,+1 金币","user":{"id":"9477","name":"测试管理员","avatar":""}}}

200 {"message":"今日点赞奖励已达上限(5 次)","data":{"granted":false,"task":"like","task_label":"点赞","amount":0,"balance":10,"streak":null,"message":"今日点赞奖励已达上限(5 次)","user":{"id":"9477","name":"测试管理员","avatar":""}}}

404 {"msg":"用户不存在"}

GET /api/coinmall-admin/users 需登录 jwt.authcoinmall.admin

搜索用户:按 users.id 或昵称关键词

参数类型位置必填说明
keyword string Query 必填 用户ID或昵称关键词

200 {"data":[{"id":"9477","name":"测试管理员","avatar":""}]}

GET /api/coinmall-admin/wallets 需登录 jwt.authcoinmall.admin

用户金币钱包列表

参数类型位置必填说明
user_id int Query 否 可选,只看某个用户
limit int Query 否 可选,每页条数,默认15
page int Query 否 可选,页码,默认1

200 {"data":{"list":[{"user_id":"9477","balance":4,"total_income":4,"total_expense":0,"checkin_streak":1,"checkin_last_date":"2026-10-13","updated_at":"2026-10-13 21:30:00","user":{"id":"9477","name":"测试管理员","avatar":""}}],"current_page":1,"last_page":1,"total":1}}

GET /api/coinmall-admin/wallets/summary 需登录 jwt.authcoinmall.admin

金币总览:钱包数、总余额、累计发放/消耗、今日发放、按任务统计

无参数

200 {"data":{"wallets":1,"total_balance":4,"total_income":4,"total_expense":0,"today_count":1,"today_amount":2,"by_task":[{"task":"checkin","label":"每日签到","count":1,"amount":2}]}}