openapi.yaml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. openapi: 3.0.3
  2. info:
  3. title: CFC 后台 API - 家庭优惠券特性契约
  4. description: |
  5. 家庭管理列表新增 couponCount 回填;统一优惠券页(Tabs:模板管理/发放记录/使用记录/转赠记录)复用既有 coupon 端点。
  6. 变更范围:POST /api/admin/families 响应新增 couponCount;其余端点为复用,无契约破坏。
  7. version: 1.0.0
  8. servers:
  9. - url: /api
  10. paths:
  11. /admin/families:
  12. post:
  13. summary: 家庭分页列表(含 couponCount 回填)
  14. operationId: getFamilies
  15. requestBody:
  16. required: false
  17. content:
  18. application/json:
  19. schema:
  20. type: object
  21. properties:
  22. page: { type: integer, default: 1 }
  23. size: { type: integer, default: 10 }
  24. name: { type: string, description: 家庭名称模糊搜索 }
  25. sort:
  26. type: array
  27. items:
  28. type: object
  29. properties:
  30. prop: { type: string }
  31. order: { type: string, enum: [asc, desc] }
  32. responses:
  33. '200':
  34. description: 家庭分页
  35. content:
  36. application/json:
  37. schema:
  38. $ref: '#/components/schemas/FamilyPage'
  39. /admin/coupon/list:
  40. post:
  41. summary: 优惠券模板分页列表(统一页-模板管理 Tab)
  42. operationId: couponList
  43. requestBody:
  44. required: false
  45. content:
  46. application/json:
  47. schema:
  48. type: object
  49. properties:
  50. page: { type: integer, default: 1 }
  51. size: { type: integer, default: 20 }
  52. keyword: { type: string }
  53. responses:
  54. '200':
  55. description: 模板分页
  56. content:
  57. application/json:
  58. schema:
  59. $ref: '#/components/schemas/CouponPage'
  60. /admin/coupon/grant-log:
  61. post:
  62. summary: 发券流水(统一页-发放记录 Tab,支持 familyId 过滤)
  63. operationId: couponGrantLog
  64. requestBody:
  65. required: false
  66. content:
  67. application/json:
  68. schema:
  69. type: object
  70. properties:
  71. familyId: { type: integer }
  72. couponId: { type: integer }
  73. grantType: { type: string }
  74. source: { type: string }
  75. responses:
  76. '200':
  77. description: 发券流水列表(含 familyName)
  78. content:
  79. application/json:
  80. schema:
  81. $ref: '#/components/schemas/GrantLogList'
  82. /admin/coupon/family-coupon-usage:
  83. post:
  84. summary: 家庭券使用记录(统一页-使用记录 Tab,支持 familyId 过滤)
  85. operationId: couponUsage
  86. requestBody:
  87. required: false
  88. content:
  89. application/json:
  90. schema:
  91. type: object
  92. properties:
  93. familyId: { type: integer }
  94. page: { type: integer, default: 1 }
  95. size: { type: integer, default: 20 }
  96. responses:
  97. '200':
  98. description: 使用记录分页
  99. content:
  100. application/json:
  101. schema:
  102. $ref: '#/components/schemas/CouponUsagePage'
  103. /admin/coupon/gift-transfers:
  104. post:
  105. summary: 会员券转赠记录(统一页-转赠记录 Tab,支持赠送方/接收方家庭过滤)
  106. operationId: couponGiftTransfers
  107. requestBody:
  108. required: false
  109. content:
  110. application/json:
  111. schema:
  112. type: object
  113. properties:
  114. giverFamilyId: { type: integer }
  115. receiverFamilyId: { type: integer }
  116. status: { type: string, enum: [GIFTED, USED, REVOKED] }
  117. couponId: { type: integer }
  118. page: { type: integer, default: 1 }
  119. size: { type: integer, default: 20 }
  120. responses:
  121. '200':
  122. description: 转赠记录分页
  123. content:
  124. application/json:
  125. schema:
  126. $ref: '#/components/schemas/GiftTransferPage'
  127. components:
  128. schemas:
  129. ApiResult:
  130. type: object
  131. required: [code, data]
  132. properties:
  133. code: { type: integer, description: 0=成功, 非0=错误码 }
  134. data: {}
  135. message: { type: string }
  136. Family:
  137. type: object
  138. properties:
  139. id: { type: integer }
  140. name: { type: string }
  141. inviteCode: { type: string }
  142. memberCount: { type: integer }
  143. reportCount: { type: integer }
  144. planCount: { type: integer }
  145. taskCount: { type: integer }
  146. couponCount:
  147. type: integer
  148. description: 新增:该家庭在 family_coupon 表的记录数
  149. FamilyPage:
  150. allOf:
  151. - $ref: '#/components/schemas/ApiResult'
  152. - type: object
  153. properties:
  154. data:
  155. type: object
  156. properties:
  157. records:
  158. type: array
  159. items:
  160. $ref: '#/components/schemas/Family'
  161. total: { type: integer }
  162. current: { type: integer }
  163. size: { type: integer }
  164. Coupon:
  165. type: object
  166. properties:
  167. id: { type: integer }
  168. name: { type: string }
  169. type: { type: string, enum: [FIXED, DISCOUNT] }
  170. value: { type: integer }
  171. discountRate: { type: integer }
  172. minSpend: { type: integer }
  173. applicableTo: { type: string }
  174. status: { type: string, enum: [ACTIVE, DISABLED] }
  175. CouponPage:
  176. allOf:
  177. - $ref: '#/components/schemas/ApiResult'
  178. - type: object
  179. properties:
  180. data:
  181. type: object
  182. properties:
  183. records:
  184. type: array
  185. items:
  186. $ref: '#/components/schemas/Coupon'
  187. total: { type: integer }
  188. GrantLog:
  189. type: object
  190. properties:
  191. id: { type: integer }
  192. familyId: { type: integer }
  193. couponId: { type: integer }
  194. grantType: { type: string }
  195. period: { type: string }
  196. quantity: { type: integer }
  197. source: { type: string }
  198. createdAt: { type: string, format: date-time }
  199. familyName: { type: string }
  200. GrantLogList:
  201. allOf:
  202. - $ref: '#/components/schemas/ApiResult'
  203. - type: object
  204. properties:
  205. data:
  206. type: array
  207. items:
  208. $ref: '#/components/schemas/GrantLog'
  209. CouponUsageItem:
  210. type: object
  211. properties:
  212. id: { type: integer }
  213. familyId: { type: integer }
  214. couponId: { type: integer }
  215. usedAt: { type: string, format: date-time }
  216. orderId: { type: integer }
  217. name: { type: string }
  218. type: { type: string }
  219. value: { type: integer }
  220. discountRate: { type: integer }
  221. minSpend: { type: integer }
  222. CouponUsagePage:
  223. allOf:
  224. - $ref: '#/components/schemas/ApiResult'
  225. - type: object
  226. properties:
  227. data:
  228. type: object
  229. properties:
  230. records:
  231. type: array
  232. items:
  233. $ref: '#/components/schemas/CouponUsageItem'
  234. total: { type: integer }
  235. GiftTransferItem:
  236. type: object
  237. properties:
  238. id: { type: integer }
  239. giverFamilyId: { type: integer }
  240. receiverFamilyId: { type: integer }
  241. couponId: { type: integer }
  242. status: { type: string }
  243. createdAt: { type: string, format: date-time }
  244. GiftTransferPage:
  245. allOf:
  246. - $ref: '#/components/schemas/ApiResult'
  247. - type: object
  248. properties:
  249. data:
  250. type: object
  251. properties:
  252. records:
  253. type: array
  254. items:
  255. $ref: '#/components/schemas/GiftTransferItem'
  256. total: { type: integer }
  257. current: { type: integer }
  258. size: { type: integer }