每日签到(连续签到双倍奖励;每天只能签一次)
无参数
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":"今日已签到,明天再来"}}
兑换商品列表(仅上架)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
兑换商品详情
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"商品不存在或已下架"}
我的兑换订单列表
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
兑换下单(一单一物,扣金币和库存)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"商品已售罄"}
我的兑换订单详情
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"订单不存在"}
取消订单(未发货前可取消:退金币 + 已付邮费原路退)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 订单ID |
200 {"message":"已取消,退回 50 金币","data":{"id":"1","status":"cancelled","status_label":"已取消","refunded_at":null}}
422 {"msg":"未发货前才能取消,当前状态不可取消"}
创建邮费支付(微信 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":"邮费已支付"}
邮费支付状态查询(支付后前端轮询兜底)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 订单ID |
200 {"data":{"status":"processing","status_label":"待发货"}}
我的金币流水(倒序分页)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
我的金币钱包:余额、签到状态、今日任务进度
无参数
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}]}}
兑换商品列表(含下架,封面给入库原值+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}}
发布兑换商品
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
删除兑换商品(已有兑换订单的不能删,只能下架)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 商品ID |
200 {"message":"已删除"}
422 {"msg":"已有兑换订单,不能删除,请改为下架"}
编辑兑换商品(只改传了的字段)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"商品不存在"}
上架/下架兑换商品
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 商品ID |
| status | string | Body | 必填 | active 上架 / inactive 下架 |
200 {"message":"已下架","data":{"id":"1","status":"inactive"}}
当前登录管理员
无参数
200 {"data":{"id":"9477","name":"测试管理员","isadmin":1}}
兑换订单列表(支持多条件筛选)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
订单状态统计(后台角标/卡片)
无参数
200 {"data":{"pending_pay":1,"processing":2,"shipped":0,"completed":10,"cancelled":1,"total":14}}
兑换订单详情(含收货人/快递/支付退款信息)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"订单不存在"}
管理员取消订单(未发货前:退金币 + 回库存 + 已付邮费原路退)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 订单ID |
| remark | string | Body | 否 | 可选,取消原因 |
200 {"message":"已取消,退回 50 金币","data":{"id":"1","status":"cancelled"}}
422 {"msg":"未发货前才能取消,当前状态不可取消"}
完成订单(确认送达,待发货/待自提/已发货 -> 已完成)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 订单ID |
200 {"message":"已完成","data":{"id":"1","status":"completed"}}
422 {"msg":"订单状态不可完成"}
邮费退款重试(取消后微信退款失败的订单)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| id | int | 路径 | 必填 | 订单ID |
200 {"message":"邮费已原路退回","data":{"id":"1","refunded_at":"2026-10-13 21:30:00"}}
422 {"msg":"该订单无需退邮费"}
邮寄订单发货(待发货 -> 已发货)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"订单状态不可发货"}
自提核销(凭核销码,待自提 -> 已完成)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| verify_code | string | Body | 必填 | 核销码 |
200 {"message":"核销成功","data":{"order_no":"JB2026...","status":"completed"}}
422 {"msg":"核销码无效或订单状态不可核销"}
金币流水(全部用户)
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
触发一次任务事件
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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":"用户不存在"}
搜索用户:按 users.id 或昵称关键词
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| keyword | string | Query | 必填 | 用户ID或昵称关键词 |
200 {"data":[{"id":"9477","name":"测试管理员","avatar":""}]}
用户金币钱包列表
| 参数 | 类型 | 位置 | 必填 | 说明 |
|---|---|---|---|---|
| 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}}
金币总览:钱包数、总余额、累计发放/消耗、今日发放、按任务统计
无参数
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}]}}