v3-admin-credit-adjustments.yaml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. # 由 openapi/scripts/generate.php 生成,请勿手改;补充写到 overrides/v3-admin-credit-adjustments.yaml
  2. post:
  3. summary: 手工加减积分
  4. tags:
  5. - admin
  6. operationId: post_api_v3_admin_credit_adjustments
  7. description: |-
  8. 加到登录用户的积分余额(不过期)。负数为扣减,扣减后余额不能为负。
  9. 同一 `ref` 只入账一次:重复提交返回原来那条(200),新入账是 201。
  10. 实现:`V3\AdminCreditAdjustmentController@store`
  11. security:
  12. -
  13. bearerAuth: []
  14. requestBody:
  15. required: true
  16. content:
  17. application/json:
  18. schema:
  19. type: object
  20. properties:
  21. delta:
  22. type: integer
  23. description: '加减多少积分,非零,绝对值最大 1000000'
  24. user:
  25. type: string
  26. description: '用户 uuid、用户名或邮箱'
  27. note:
  28. type: string
  29. description: 原因(记进流水备注)
  30. ref:
  31. type: string
  32. description: 调整单号(uuid),防重复提交;不给由服务端生成
  33. required:
  34. - user
  35. - delta
  36. - note
  37. responses:
  38. 200:
  39. description: 成功
  40. content:
  41. application/json:
  42. schema:
  43. type: object
  44. properties:
  45. data:
  46. type: object
  47. properties:
  48. account_type:
  49. type: string
  50. enum:
  51. - user
  52. - guest
  53. account_id:
  54. type: string
  55. user:
  56. type: object
  57. properties:
  58. id: { type: string }
  59. nickName: { type: string }
  60. userName: { type: string }
  61. realName: { type: string }
  62. sn: { type: integer }
  63. avatar: { type: string }
  64. roles: { type: array, items: { type: string } }
  65. nullable: true
  66. delta:
  67. type: integer
  68. kind:
  69. type: string
  70. enum:
  71. - earn
  72. - spend
  73. - refund
  74. - adjust
  75. bucket:
  76. type: string
  77. enum:
  78. - free
  79. - earned
  80. source:
  81. type: string
  82. enum:
  83. - reading
  84. - editing
  85. - agent_run
  86. - admin
  87. ref:
  88. type: string
  89. day:
  90. type: string
  91. policy_version:
  92. type: integer
  93. client_ip:
  94. type: string
  95. nullable: true
  96. note:
  97. type: string
  98. nullable: true
  99. operator:
  100. type: object
  101. properties:
  102. id: { type: string }
  103. nickName: { type: string }
  104. userName: { type: string }
  105. realName: { type: string }
  106. sn: { type: integer }
  107. avatar: { type: string }
  108. roles: { type: array, items: { type: string } }
  109. nullable: true
  110. created_at:
  111. type: string
  112. updated_at:
  113. type: string
  114. meta:
  115. type: object
  116. properties:
  117. created:
  118. type: boolean
  119. description: 这次是否新入账
  120. earned_balance:
  121. type: integer
  122. description: 该用户调整后的积分余额
  123. 201:
  124. description: '新入账。响应体与 200 同形(200 是同一 ref 已经入账过,返回原来那条)'
  125. content:
  126. application/json:
  127. schema:
  128. type: object
  129. properties:
  130. data:
  131. type: object
  132. properties:
  133. account_type:
  134. type: string
  135. enum:
  136. - user
  137. - guest
  138. account_id:
  139. type: string
  140. user:
  141. type: object
  142. properties:
  143. id: { type: string }
  144. nickName: { type: string }
  145. userName: { type: string }
  146. realName: { type: string }
  147. sn: { type: integer }
  148. avatar: { type: string }
  149. roles: { type: array, items: { type: string } }
  150. nullable: true
  151. delta:
  152. type: integer
  153. kind:
  154. type: string
  155. enum:
  156. - earn
  157. - spend
  158. - refund
  159. - adjust
  160. bucket:
  161. type: string
  162. enum:
  163. - free
  164. - earned
  165. source:
  166. type: string
  167. enum:
  168. - reading
  169. - editing
  170. - agent_run
  171. - admin
  172. ref:
  173. type: string
  174. day:
  175. type: string
  176. policy_version:
  177. type: integer
  178. client_ip:
  179. type: string
  180. nullable: true
  181. note:
  182. type: string
  183. nullable: true
  184. operator:
  185. type: object
  186. properties:
  187. id: { type: string }
  188. nickName: { type: string }
  189. userName: { type: string }
  190. realName: { type: string }
  191. sn: { type: integer }
  192. avatar: { type: string }
  193. roles: { type: array, items: { type: string } }
  194. nullable: true
  195. created_at:
  196. type: string
  197. updated_at:
  198. type: string
  199. meta:
  200. type: object
  201. properties:
  202. created:
  203. type: boolean
  204. description: 这次是否新入账
  205. earned_balance:
  206. type: integer
  207. description: 该用户调整后的积分余额
  208. 401:
  209. $ref: '../../main.yaml#/components/responses/ProblemUnauthorized'
  210. 422:
  211. $ref: '../../main.yaml#/components/responses/ProblemValidation'