碎片商城 · 接口文档

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

碎片商城(14)

GET /api/fragmentmall/categories 需登录 jwt.auth

商品分类列表(仅启用)

无参数

200 {"data":[{"id":"1","name":"饮品","icon":"http://...","sort":0,"is_active":true}]}

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

今日签到

只能签服务端当天:过去不能补签,未来不能提前签,一人一天一次。当天配置了指定赠品就送该赠品碎片(个数未配则在该赠品随机区间内随机);没配置、或配置的赠品已下架/投放量用完(配置会被同步恢复默认随机)时,按权重随机一个可发放赠品、个数随机。

无参数

200 {"message":"签到成功","data":{"checkin_date":"2026-10-15","goods_id":"3","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","amount":2,"is_random":false,"fragment_owned":12}}

422 {"msg":"今日已签到,明天再来"}

422 {"msg":"今天没有可发放的碎片了"}

GET /api/fragmentmall/checkin/calendar 需登录 jwt.auth

签到日历(默认查当天所在的一周)

range=week 查锚定日期所在周(周一至周日),range=month 查锚定日期所在月;每天同时返回该天的发放配置(rule,null 表示默认随机)和我在该天的签到结果(checkin)。rule/checkin 里指定了赠品时一并返回赠品名称 gift_title、赠品图片 gift_image(完整地址)和碎片的单位 min_unit(amount 是碎片数,量词就用它;随机赠品/赠品已删时为空串)。

参数类型位置必填说明
range string Query 否 可选:week 该天所在周 / month 该天所在月,默认 week
date string Query 否 可选,锚定日期 Y-m-d,默认今天

200 {"data":{"range":"week","anchor":"2026-10-15","start_date":"2026-10-12","end_date":"2026-10-18","today":"2026-10-15","days":[{"date":"2026-10-15","week_day":4,"date_status":"today","rule":{"id":"1","checkin_date":"2026-10-15","goods_id":"3","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","amount":2,"is_random_goods":false,"is_random_amount":false},"checked_in":true,"checkin":{"id":"1","user_id":"1","checkin_date":"2026-10-15","goods_id":"3","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","amount":2,"is_random":false,"created_at":"2026-10-15 09:00:00"}}]}}

POST /api/fragmentmall/claim 需登录 jwt.auth

从动态领取碎片(同一条动态的点赞、评论各可领一次,商品随机、数量随机)

参数类型位置必填说明
post_id int Body 必填 动态ID
type string Body 必填 领取行为类型: like 点赞, comment 评论

200 {"message":"领取成功","data":{"goods_id":"1","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","type":"like","amount":3,"fragment_owned":4}}

404 {"msg":"动态不存在"}

422 {"msg":"该动态此行为已领取过碎片"}

422 {"msg":"今天没有可领取的碎片了"}

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

商品列表(仅上架,含当前用户已持有碎片数)

两套单位口径:min_unit=碎片的单位(碎片数用它计),product_unit=绑定商品的单位(取自 product_id,件数用它计);需碎片 fragment_need = 换算值 convert_value(1件商品需要多少碎片) × 起提数量 min_pickup_qty(商品件数);can_redeem = 投放剩余够起提 **且** 已持碎片 ≥ 需碎片。

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

200 {"data":{"list":[{"id":"1","gift_title":"咖啡礼品装","gift_image":"http://...","supplier_id":"3","product_id":"88","min_unit":"片","product_unit":"瓶","convert_value":2,"min_pickup_qty":5,"fragment_need":10,"fragment_owned":3,"shipping_fee":8,"shipping_fee_text":"8.00","total_quantity":200,"used_quantity":20,"remaining_quantity":180,"can_redeem":false,"category_id":"1","sort":0,"status":"active"}],"current_page":1,"last_page":1,"total":1}}

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

商品详情(上架/下架可见,含当前用户已持有碎片数;自提可选=绑定的启用中自提点)

can_redeem 同列表:投放剩余够起提 **且** 已持碎片 ≥ 需碎片(=换算值×起提数量)。起提数量 min_pickup_qty 按 product_unit(绑定商品自身的单位)计。

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

200 {"data":{"id":"1","gift_title":"咖啡礼品装","min_unit":"片","product_unit":"瓶","fragment_owned":3,"fragment_need":10,"can_redeem":false,"status":"active","pickup_points":[{"id":"1","name":"东门便利店","address":"XX路100号","contact":"王老板","phone":"13800000000","remark":"9:00-21:00","sort":0,"is_active":true}]}}

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

GET /api/fragmentmall/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":"SP2026...","status":"processing","status_label":"待自提","goods":{"gift_title":"咖啡礼品装","min_unit":"片","product_unit":"瓶"},"fragment_used":10,"pickup_qty":5,"shipping_fee":0,"created_at":"2026-10-14 10:00:00"}],"current_page":1,"last_page":1,"total":1}}

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

兑换下单(一单一物,扣碎片和投放量;自提时必须选自提点库中该商品绑定的自提点)

参数类型位置必填说明
goods_id int Body 必填 商品ID
fulfill_type string Body 必填 履约方式:self_pickup 自提 / express 邮寄
pickup_point_id int Body 否 自提点ID(自提必填,只能选商品绑定的启用中自提点)
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":"SP20261014...","status":"pending_pay","status_label":"待付邮费","fragment_used":10,"shipping_fee":8,"shipping_fee_text":"8.00","verify_code":null,"balance":15,"need_pay":true}}

422 {"msg":"自提需选择自提点"}

422 {"msg":"该商品不支持所选自提点,请重新选择"}

422 {"msg":"自提点已停用,请重新选择"}

422 {"msg":"碎片不足,还需 20 个"}

422 {"msg":"赠品投放量不足"}

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

我的兑换订单详情

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

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

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

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

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

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

200 {"message":"已取消,退回 10 碎片","data":{"id":"1","status":"cancelled","status_label":"已取消"}}

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

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

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

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

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

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

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

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

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

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

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

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

我的碎片流水

amount 是碎片的增减数量(正=入账,负=支出),量词用 min_unit(碎片的单位)。

参数类型位置必填说明
type string Query 否 可选:grant 发放 / claim 领取 / checkin 签到 / redeem 兑换 / refund 退回
source_type string Query 否 可选:like 点赞 / comment 评论(仅筛选领取流水)
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认取扩展配置

200 {"data":{"list":[{"id":"1","goods_id":"1","gift_title":"咖啡礼品装","min_unit":"片","type":"claim","type_label":"领取","amount":3,"post_id":"100","source_type":"like","order_id":null,"remark":null,"created_at":"2026-10-14 10:00:00"}],"current_page":1,"last_page":1,"total":1}}

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

我的碎片汇总

items 里 current/total_collected/fragment_need 都是碎片数,量词用 min_unit(碎片的单位);min_pickup_qty 是兑换到的商品件数,量词用 product_unit(绑定商品自身的单位)。

无参数

200 {"data":{"total_fragments":25,"goods_count":2,"can_redeem_count":1,"items":[{"goods_id":"1","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","product_unit":"瓶","current":8,"total_collected":12,"fragment_need":10,"min_pickup_qty":5,"can_redeem":false}]}}

碎片商城后台(30)

GET /api/fragmentmall-admin/categories 需登录 jwt.authfragmentmall.admin

分类列表(含每个分类下商品数)

无参数

200 {"data":[{"id":"1","name":"日用品","icon":"","sort":0,"is_active":true,"goods_count":3}]}

POST /api/fragmentmall-admin/categories 需登录 jwt.authfragmentmall.admin

新建分类

参数类型位置必填说明
name string Body 必填 分类名称
icon string Body 否 可选,图标路径/URL(手填)
sort int Body 否 可选,排序(升序)
is_active int Body 否 可选,1启用 0停用,默认1

200 {"message":"已创建","data":{"id":"1","name":"日用品","icon":"","sort":0,"is_active":true}}

DELETE /api/fragmentmall-admin/categories/{id} 需登录 jwt.authfragmentmall.admin

删除分类(分类下有商品的不能删)

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

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

422 {"msg":"分类下存在商品,无法删除"}

PUT /api/fragmentmall-admin/categories/{id} 需登录 jwt.authfragmentmall.admin

编辑分类(只改传了的字段)

参数类型位置必填说明
id int 路径 必填 分类ID
name string Body 否 分类名称
icon string Body 否 图标路径/URL
sort int Body 否 排序
is_active int Body 否 1启用 0停用

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

404 {"msg":"分类不存在"}

GET /api/fragmentmall-admin/checkin/calendar 需登录 jwt.authfragmentmall.admin

签到日历(默认查当天所在的一周,带各天签到人数)

参数类型位置必填说明
range string Query 否 可选:week 该天所在周 / month 该天所在月,默认 week
date string Query 否 可选,锚定日期 Y-m-d,默认今天

200 {"data":{"range":"week","anchor":"2026-10-15","start_date":"2026-10-12","end_date":"2026-10-18","today":"2026-10-15","days":[{"date":"2026-10-15","week_day":4,"date_status":"today","rule":{"id":"1","checkin_date":"2026-10-15","goods_id":"3","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","amount":2,"is_random_goods":false,"is_random_amount":false},"checkin_count":8}]}}

GET /api/fragmentmall-admin/checkin/records 需登录 jwt.authfragmentmall.admin

签到记录列表

参数类型位置必填说明
start_date string Query 否 可选,起始日期 Y-m-d
end_date string Query 否 可选,结束日期 Y-m-d
user_id int Query 否 可选,用户筛选
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认15

200 {"data":{"list":[{"id":"1","user_id":"1","user":{"id":"1","name":"张三","avatar":"http://..."},"checkin_date":"2026-10-15","goods_id":"3","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","amount":2,"is_random":false,"created_at":"2026-10-15 09:00:00"}],"current_page":1,"last_page":1,"total":1}}

POST /api/fragmentmall-admin/checkin/rules 需登录 jwt.authfragmentmall.admin

设置某天的签到发放(已存在则覆盖)

goods_id 不传/传空 = 该天随机选赠品;amount 不传/传空 = 个数在该赠品的随机区间内随机。只能配今天及以后(过去不能补签)。赠品下架或投放量用完时不能选。

参数类型位置必填说明
checkin_date string Body 必填 日期 Y-m-d
goods_id int Body 否 指定赠品ID,不传=随机赠品
amount int Body 否 赠送碎片个数,不传=随机个数

200 {"message":"已保存","data":{"id":"1","checkin_date":"2026-10-16","goods_id":"3","gift_title":"咖啡礼品装","gift_image":"http://...","min_unit":"片","amount":2,"is_random_goods":false,"is_random_amount":false}}

422 {"msg":"不能配置过去的日期"}

422 {"msg":"该赠品已下架或投放量已用完,不能设为签到赠品"}

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

DELETE /api/fragmentmall-admin/checkin/rules/{id} 需登录 jwt.authfragmentmall.admin

删除某天的签到配置(该天恢复默认随机发放)

参数类型位置必填说明
id int 路径 必填 签到配置ID

200 {"message":"2026-10-16 已恢复默认随机发放"}

404 {"msg":"该天没有签到配置"}

GET /api/fragmentmall-admin/goods 需登录 jwt.authfragmentmall.admin

商品列表(含下架,图片给入库原值+URL便于回填)

min_unit=碎片的单位,product_unit=绑定商品自身的单位(按 product_id 取,商品不存在或未填单位时为空串)。

参数类型位置必填说明
keyword string Query 否 可选,赠品标题模糊
status string Query 否 可选,draft/active/inactive
category_id int Query 否 可选,分类筛选
supplier_id int Query 否 可选,供应商ID精确
product_id int Query 否 可选,商品ID精确
page int Query 否 可选,页码,默认1
limit int Query 否 可选,每页条数,默认15

200 {"data":{"list":[{"id":"1","gift_title":"定制水杯","supplier_id":"3","product_id":"88","min_unit":"片","product_unit":"箱","convert_value":5,"min_pickup_qty":2,"fragment_need":10,"total_quantity":100,"used_quantity":2,"shipping_fee":8,"shipping_fee_text":"8.00","daily_limit_per_user":0,"daily_total_limit":0,"claim_weight":1,"claim_amount_min":1,"claim_amount_max":3,"status":"active"}],"current_page":1,"last_page":1,"total":1}}

POST /api/fragmentmall-admin/goods 需登录 jwt.authfragmentmall.admin

发布兑换商品

参数类型位置必填说明
category_id int Body 否 可选,分类ID,0或不传=未分类
supplier_id int Body 必填 供应商ID(手填)
product_id int Body 必填 商品ID(手填)
gift_title string Body 必填 赠品标题
gift_image string Body 否 可选,赠品图片路径/URL(手填)
gift_description string Body 否 可选,赠品描述
min_unit string Body 必填 碎片的单位(片/袋/箱,只用来计量碎片;商品的单位取自 product_id 对应商品自身的单位)
convert_value int Body 必填 换算值:1件商品需要多少碎片
min_pickup_qty int Body 必填 起提数量(单次兑换最小商品件数,按绑定商品的单位)
total_quantity int Body 必填 可兑换总件数(平台投放量,按绑定商品的单位)
shipping_fee number Body 必填 邮费(元,可带两位小数,仅邮寄单收取,0=包邮)
daily_limit_per_user int Body 否 可选,每人每天随机领取上限(按次数),0=不限,默认0
daily_total_limit int Body 否 可选,每天全平台被领上限(按次数),0=不限,默认0
claim_weight int Body 否 可选,随机领取权重,默认1,0=不参与随机
claim_amount_min int Body 否 可选,单次领取随机碎片下限,默认1
claim_amount_max int Body 否 可选,单次领取随机碎片上限,默认3
pickup_point_ids int[] Body 否 可选,绑定的自提点ID数组(自提只能选绑定内的)
status string Body 否 可选,active上架 / inactive下架 / draft草稿,默认active
sort int Body 否 可选,排序(升序)

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

422 {"msg":"可兑换总件数不能小于起提数量"}

422 {"msg":"领取数量上限需大于等于下限"}

422 {"msg":"自提点不存在"}

DELETE /api/fragmentmall-admin/goods/{id} 需登录 jwt.authfragmentmall.admin

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

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

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

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

PUT /api/fragmentmall-admin/goods/{id} 需登录 jwt.authfragmentmall.admin

编辑兑换商品(只改传了的字段,已兑换数不可改)

参数类型位置必填说明
id int 路径 必填 商品ID
category_id int Body 否 分类ID
supplier_id int Body 否 供应商ID
product_id int Body 否 商品ID
gift_title string Body 否 赠品标题
gift_image string Body 否 赠品图片路径/URL
gift_description string Body 否 赠品描述
min_unit string Body 否 碎片的单位(只用来计量碎片)
convert_value int Body 否 换算值(1件商品需要多少碎片)
min_pickup_qty int Body 否 起提数量(商品件数,按绑定商品的单位)
total_quantity int Body 否 可兑换总件数
shipping_fee number Body 否 邮费(元,可带两位小数)
daily_limit_per_user int Body 否 每人每天随机领取上限(按次数),0=不限
daily_total_limit int Body 否 每天全平台被领上限(按次数),0=不限
claim_weight int Body 否 随机领取权重,0=不参与随机
claim_amount_min int Body 否 单次领取随机碎片下限
claim_amount_max int Body 否 单次领取随机碎片上限
pickup_point_ids int[] Body 否 绑定的自提点ID数组(传空数组=清空绑定)
sort int Body 否 排序

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

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

422 {"msg":"可兑换总件数不能小于已兑换数+起提数量"}

422 {"msg":"领取数量上限需大于等于下限"}

422 {"msg":"自提点不存在"}

PUT /api/fragmentmall-admin/goods/{id}/status 需登录 jwt.authfragmentmall.admin

上架/下架兑换商品

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

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

422 {"msg":"剩余投放量不足起提数量,无法启用"}

POST /api/fragmentmall-admin/grant 需登录 jwt.authfragmentmall.admin

给用户发放一次碎片

参数类型位置必填说明
user_id int Body 必填 用户 users.id(给谁发碎片)
goods_id int Body 必填 商品ID(发哪种赠品的碎片,余额按商品分开记账)
amount int Body 必填 发放数量
remark string Body 否 可选,备注

200 {"message":"已发放 10 碎片","data":{"granted":true,"message":"已发放 10 碎片","amount":10,"balance":10,"goods_id":"1","gift_title":"定制水杯","remark":"","user":{"id":"9477","name":"测试管理员","avatar":""}}}

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

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

GET /api/fragmentmall-admin/me 需登录 jwt.authfragmentmall.admin

当前登录管理员

无参数

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

GET /api/fragmentmall-admin/orders 需登录 jwt.authfragmentmall.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":"SP2026...","status":"processing","status_label":"待自提","fulfill_type":"self_pickup","fulfill_label":"自提","fragment_used":10,"shipping_fee":0,"goods":{"gift_title":"定制水杯"},"user":{"id":"8","name":"张三","avatar":""}}],"current_page":1,"last_page":1,"total":1}}

GET /api/fragmentmall-admin/orders/stats 需登录 jwt.authfragmentmall.admin

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

无参数

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

GET /api/fragmentmall-admin/orders/{id} 需登录 jwt.authfragmentmall.admin

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

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

200 {"data":{"id":"1","order_no":"SP2026...","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/fragmentmall-admin/orders/{id}/cancel 需登录 jwt.authfragmentmall.admin

管理员取消订单(未发货前:退碎片 + 回投放量 + 已付邮费原路退)

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

200 {"message":"已取消,退回 10 碎片","data":{"id":"1","status":"cancelled"}}

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

POST /api/fragmentmall-admin/orders/{id}/complete 需登录 jwt.authfragmentmall.admin

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

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

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

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

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

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

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

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

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

POST /api/fragmentmall-admin/orders/{id}/ship 需登录 jwt.authfragmentmall.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/fragmentmall-admin/orders/{id}/verify 需登录 jwt.authfragmentmall.admin

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

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

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

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

GET /api/fragmentmall-admin/pickup-points 需登录 jwt.authfragmentmall.admin

自提点列表(含每个自提点绑定的商品数)

无参数

200 {"data":[{"id":"1","name":"东门便利店","address":"XX路100号","contact":"王老板","phone":"13800000000","remark":"营业时间 9:00-21:00","sort":0,"is_active":true,"goods_count":2}]}

POST /api/fragmentmall-admin/pickup-points 需登录 jwt.authfragmentmall.admin

新建自提点

参数类型位置必填说明
name string Body 必填 自提点名称
address string Body 必填 自提地址
contact string Body 否 可选,联系人
phone string Body 否 可选,联系电话
remark string Body 否 可选,备注(自提时间等)
sort int Body 否 可选,排序(升序)
is_active int Body 否 可选,1启用 0停用,默认1

200 {"message":"已创建","data":{"id":"1","name":"东门便利店","address":"XX路100号","contact":"王老板","phone":"13800000000","remark":"","sort":0,"is_active":true}}

DELETE /api/fragmentmall-admin/pickup-points/{id} 需登录 jwt.authfragmentmall.admin

删除自提点(有商品绑定或有订单使用的不能删)

参数类型位置必填说明
id int 路径 必填 自提点ID

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

422 {"msg":"已有商品绑定该自提点,无法删除"}

PUT /api/fragmentmall-admin/pickup-points/{id} 需登录 jwt.authfragmentmall.admin

编辑自提点(只改传了的字段)

参数类型位置必填说明
id int 路径 必填 自提点ID
name string Body 否 自提点名称
address string Body 否 自提地址
contact string Body 否 联系人
phone string Body 否 联系电话
remark string Body 否 备注
sort int Body 否 排序
is_active int Body 否 1启用 0停用

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

404 {"msg":"自提点不存在"}

GET /api/fragmentmall-admin/product-unit 需登录 jwt.authfragmentmall.admin

查绑定商品自身的计量单位(后台建商品时先探单位:起提数量、投放量按它计)

商品不存在和商品没填单位都返回 unit 空串,用 exists 区分:false=商品库里没这个ID,true 且空=商品自身没填计量单位。

参数类型位置必填说明
product_id int Query 必填 商品ID(showshop_products.id)

200 {"data":{"product_id":"88","exists":true,"unit":"箱"}}

200 {"data":{"product_id":"999999","exists":false,"unit":""}}

422 {"msg":"请填写商品ID"}

POST /api/fragmentmall-admin/trigger 需登录 jwt.authfragmentmall.admin

触发一次点赞/评论领取

参数类型位置必填说明
user_id int Body 必填 用户 users.id(给谁领碎片)
post_id int Body 必填 动态 posts.id
type string Body 必填 行为:like=点赞 / comment=评论(同一条动态每种行为各可领一次)

200 {"message":"领取成功","data":{"ok":true,"code":200,"message":"领取成功","data":{"goods_id":"3","gift_title":"定制水杯","gift_image":"/storage/uploads/cup.png","min_unit":"片","type":"like","amount":2,"fragment_owned":7},"source_type":"like","source_label":"点赞","post_id":"88","user":{"id":"9477","name":"测试管理员","avatar":""}}}

200 {"message":"该动态此行为已领取过碎片","data":{"ok":false,"code":422,"message":"该动态此行为已领取过碎片","data":null,"source_type":"like","source_label":"点赞","post_id":"88","user":{"id":"9477","name":"测试管理员","avatar":""}}}

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

404 {"msg":"动态不存在"}

GET /api/fragmentmall-admin/users 需登录 jwt.authfragmentmall.admin

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

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

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