docs.go 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  1. // GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
  2. // This file was generated by swaggo/swag
  3. package docs
  4. import (
  5. "bytes"
  6. "encoding/json"
  7. "strings"
  8. "github.com/alecthomas/template"
  9. "github.com/swaggo/swag"
  10. )
  11. var doc = `{
  12. "schemes": {{ marshal .Schemes }},
  13. "swagger": "2.0",
  14. "info": {
  15. "description": "{{.Description}}",
  16. "title": "{{.Title}}",
  17. "termsOfService": "http://swagger.io/terms/",
  18. "contact": {
  19. "name": "API Support",
  20. "url": "http://www.swagger.io/support",
  21. "email": "support@swagger.io"
  22. },
  23. "license": {
  24. "name": "Apache 2.0",
  25. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
  26. },
  27. "version": "{{.Version}}"
  28. },
  29. "host": "{{.Host}}",
  30. "basePath": "{{.BasePath}}",
  31. "paths": {
  32. "/Auth/SignUp": {
  33. "post": {
  34. "description": "用户添加",
  35. "consumes": [
  36. "application/x-www-form-urlencoded"
  37. ],
  38. "produces": [
  39. "application/json"
  40. ],
  41. "tags": [
  42. "Auth"
  43. ],
  44. "summary": "用户添加",
  45. "parameters": [
  46. {
  47. "type": "string",
  48. "description": "用户名",
  49. "name": "userCode",
  50. "in": "formData",
  51. "required": true
  52. },
  53. {
  54. "type": "string",
  55. "description": "密码",
  56. "name": "password",
  57. "in": "formData",
  58. "required": true
  59. },
  60. {
  61. "type": "string",
  62. "description": "邮箱",
  63. "name": "email",
  64. "in": "formData"
  65. },
  66. {
  67. "type": "string",
  68. "description": "手机号",
  69. "name": "phone",
  70. "in": "formData"
  71. },
  72. {
  73. "type": "string",
  74. "description": "姓名",
  75. "name": "name",
  76. "in": "formData"
  77. }
  78. ],
  79. "responses": {
  80. "200": {
  81. "description": "OK",
  82. "schema": {
  83. "$ref": "#/definitions/controller.ResponseBase"
  84. }
  85. }
  86. }
  87. }
  88. },
  89. "/HrSensors/AddHrSensors": {
  90. "post": {
  91. "description": "添加商家公共心率设备",
  92. "consumes": [
  93. "application/x-www-form-urlencoded"
  94. ],
  95. "produces": [
  96. "application/json"
  97. ],
  98. "tags": [
  99. "HrSensors"
  100. ],
  101. "summary": "添加商家公共心率设备",
  102. "parameters": [
  103. {
  104. "type": "string",
  105. "description": "Token",
  106. "name": "token",
  107. "in": "formData",
  108. "required": true
  109. },
  110. {
  111. "type": "integer",
  112. "description": "商家ID",
  113. "name": "shopId",
  114. "in": "formData",
  115. "required": true
  116. },
  117. {
  118. "type": "integer",
  119. "description": "心率带Sn",
  120. "name": "sn",
  121. "in": "formData",
  122. "required": true
  123. },
  124. {
  125. "type": "string",
  126. "description": "场馆内编号 01 02",
  127. "name": "venueNo",
  128. "in": "formData"
  129. }
  130. ],
  131. "responses": {
  132. "200": {
  133. "description": "OK",
  134. "schema": {
  135. "$ref": "#/definitions/controller.ResponseBase"
  136. }
  137. }
  138. }
  139. }
  140. },
  141. "/HrSensors/AddPvtHrSensors": {
  142. "post": {
  143. "description": "添加会员私有心率设备",
  144. "consumes": [
  145. "application/x-www-form-urlencoded"
  146. ],
  147. "produces": [
  148. "application/json"
  149. ],
  150. "tags": [
  151. "HrSensors"
  152. ],
  153. "summary": "添加会员私有心率设备",
  154. "parameters": [
  155. {
  156. "type": "string",
  157. "description": "Token",
  158. "name": "token",
  159. "in": "formData",
  160. "required": true
  161. },
  162. {
  163. "type": "integer",
  164. "description": "商家ID",
  165. "name": "shopId",
  166. "in": "formData",
  167. "required": true
  168. },
  169. {
  170. "type": "integer",
  171. "description": "心率带Sn",
  172. "name": "sn",
  173. "in": "formData",
  174. "required": true
  175. },
  176. {
  177. "type": "integer",
  178. "description": "用户ID",
  179. "name": "userId",
  180. "in": "formData",
  181. "required": true
  182. }
  183. ],
  184. "responses": {
  185. "200": {
  186. "description": "OK",
  187. "schema": {
  188. "$ref": "#/definitions/controller.ResponseBase"
  189. }
  190. }
  191. }
  192. }
  193. },
  194. "/Test/UserAdd": {
  195. "post": {
  196. "description": "会员用户添加",
  197. "consumes": [
  198. "application/x-www-form-urlencoded"
  199. ],
  200. "produces": [
  201. "application/json"
  202. ],
  203. "tags": [
  204. "Test"
  205. ],
  206. "summary": "会员用户添加",
  207. "parameters": [
  208. {
  209. "type": "string",
  210. "description": "姓名",
  211. "name": "name",
  212. "in": "formData",
  213. "required": true
  214. }
  215. ],
  216. "responses": {
  217. "200": {
  218. "description": "OK",
  219. "schema": {
  220. "$ref": "#/definitions/controller.ResponseBase"
  221. }
  222. }
  223. }
  224. }
  225. },
  226. "/User/ShopCoachAdd": {
  227. "post": {
  228. "description": "商家教练添加",
  229. "consumes": [
  230. "application/x-www-form-urlencoded"
  231. ],
  232. "produces": [
  233. "application/json"
  234. ],
  235. "tags": [
  236. "User"
  237. ],
  238. "summary": "商家教练添加",
  239. "parameters": [
  240. {
  241. "type": "string",
  242. "description": "Token",
  243. "name": "token",
  244. "in": "formData",
  245. "required": true
  246. },
  247. {
  248. "type": "integer",
  249. "description": "店铺ID",
  250. "name": "shopId",
  251. "in": "formData",
  252. "required": true
  253. },
  254. {
  255. "type": "string",
  256. "description": "登陆用户名也是手机号",
  257. "name": "phone",
  258. "in": "formData",
  259. "required": true
  260. },
  261. {
  262. "type": "string",
  263. "description": "姓名",
  264. "name": "name",
  265. "in": "formData",
  266. "required": true
  267. },
  268. {
  269. "type": "string",
  270. "description": "密码",
  271. "name": "pwd",
  272. "in": "formData",
  273. "required": true
  274. },
  275. {
  276. "type": "integer",
  277. "description": "性别 1:男, 2:女",
  278. "name": "sex",
  279. "in": "formData",
  280. "required": true
  281. },
  282. {
  283. "type": "string",
  284. "description": "备注",
  285. "name": "memo",
  286. "in": "formData"
  287. }
  288. ],
  289. "responses": {
  290. "200": {
  291. "description": "OK",
  292. "schema": {
  293. "$ref": "#/definitions/controller.ResponseBase"
  294. }
  295. }
  296. }
  297. }
  298. },
  299. "/User/ShopCoachEdit": {
  300. "post": {
  301. "description": "商家教练基本信息修改",
  302. "consumes": [
  303. "application/x-www-form-urlencoded"
  304. ],
  305. "produces": [
  306. "application/json"
  307. ],
  308. "tags": [
  309. "User"
  310. ],
  311. "summary": "商家教练基本信息修改",
  312. "parameters": [
  313. {
  314. "type": "string",
  315. "description": "Token",
  316. "name": "token",
  317. "in": "formData",
  318. "required": true
  319. },
  320. {
  321. "type": "integer",
  322. "description": "教练ID",
  323. "name": "ssId",
  324. "in": "formData",
  325. "required": true
  326. },
  327. {
  328. "type": "string",
  329. "description": "手机号",
  330. "name": "phone",
  331. "in": "formData"
  332. },
  333. {
  334. "type": "string",
  335. "description": "密码",
  336. "name": "pwd",
  337. "in": "formData"
  338. },
  339. {
  340. "type": "string",
  341. "description": "姓名",
  342. "name": "name",
  343. "in": "formData"
  344. },
  345. {
  346. "type": "string",
  347. "description": "备注",
  348. "name": "memo",
  349. "in": "formData"
  350. },
  351. {
  352. "type": "integer",
  353. "description": "性别 1:男, 2:女",
  354. "name": "sex",
  355. "in": "formData",
  356. "required": true
  357. }
  358. ],
  359. "responses": {
  360. "200": {
  361. "description": "OK",
  362. "schema": {
  363. "$ref": "#/definitions/controller.ResponseBase"
  364. }
  365. }
  366. }
  367. }
  368. },
  369. "/User/ShopCoachListQuery": {
  370. "post": {
  371. "description": "会员用户列表(带分页)",
  372. "consumes": [
  373. "application/x-www-form-urlencoded"
  374. ],
  375. "produces": [
  376. "application/json"
  377. ],
  378. "tags": [
  379. "User"
  380. ],
  381. "summary": "会员用户列表(带分页)",
  382. "parameters": [
  383. {
  384. "type": "string",
  385. "description": "Token",
  386. "name": "token",
  387. "in": "formData",
  388. "required": true
  389. },
  390. {
  391. "type": "string",
  392. "description": "手机号",
  393. "name": "phone",
  394. "in": "formData"
  395. },
  396. {
  397. "type": "string",
  398. "description": "姓名",
  399. "name": "name",
  400. "in": "formData"
  401. },
  402. {
  403. "type": "string",
  404. "description": "当前条",
  405. "name": "start",
  406. "in": "formData",
  407. "required": true
  408. },
  409. {
  410. "type": "string",
  411. "description": "每页条数",
  412. "name": "tableMax",
  413. "in": "formData",
  414. "required": true
  415. }
  416. ],
  417. "responses": {
  418. "200": {
  419. "description": "OK",
  420. "schema": {
  421. "$ref": "#/definitions/controller.ShopUserInfo"
  422. }
  423. }
  424. }
  425. }
  426. },
  427. "/User/ShopCoachSimpleQuery": {
  428. "post": {
  429. "description": "本店会员用户基本信息查询",
  430. "consumes": [
  431. "application/x-www-form-urlencoded"
  432. ],
  433. "produces": [
  434. "application/json"
  435. ],
  436. "tags": [
  437. "User"
  438. ],
  439. "summary": "本店会员用户基本信息查询",
  440. "parameters": [
  441. {
  442. "type": "string",
  443. "description": "Token",
  444. "name": "token",
  445. "in": "formData",
  446. "required": true
  447. },
  448. {
  449. "type": "integer",
  450. "description": "商家ID",
  451. "name": "shopId",
  452. "in": "formData"
  453. }
  454. ],
  455. "responses": {
  456. "200": {
  457. "description": "OK",
  458. "schema": {
  459. "$ref": "#/definitions/controller.ShopCoachSimpleInfo"
  460. }
  461. }
  462. }
  463. }
  464. },
  465. "/User/ShopCoachStatusEdit": {
  466. "post": {
  467. "description": "商家教练状态修改",
  468. "consumes": [
  469. "application/x-www-form-urlencoded"
  470. ],
  471. "produces": [
  472. "application/json"
  473. ],
  474. "tags": [
  475. "User"
  476. ],
  477. "summary": "商家教练状态修改",
  478. "parameters": [
  479. {
  480. "type": "string",
  481. "description": "Token",
  482. "name": "token",
  483. "in": "formData",
  484. "required": true
  485. },
  486. {
  487. "type": "integer",
  488. "description": "教练ID",
  489. "name": "ssId",
  490. "in": "formData",
  491. "required": true
  492. },
  493. {
  494. "type": "integer",
  495. "description": "状态 1:启用\t 8:禁用 9:删除",
  496. "name": "status",
  497. "in": "formData",
  498. "required": true
  499. }
  500. ],
  501. "responses": {
  502. "200": {
  503. "description": "OK",
  504. "schema": {
  505. "$ref": "#/definitions/controller.ResponseBase"
  506. }
  507. }
  508. }
  509. }
  510. },
  511. "/User/ShopUserAdd": {
  512. "post": {
  513. "description": "会员用户添加",
  514. "consumes": [
  515. "application/x-www-form-urlencoded"
  516. ],
  517. "produces": [
  518. "application/json"
  519. ],
  520. "tags": [
  521. "User"
  522. ],
  523. "summary": "会员用户添加",
  524. "parameters": [
  525. {
  526. "type": "string",
  527. "description": "Token",
  528. "name": "token",
  529. "in": "formData",
  530. "required": true
  531. },
  532. {
  533. "type": "integer",
  534. "description": "店铺ID",
  535. "name": "shopId",
  536. "in": "formData",
  537. "required": true
  538. },
  539. {
  540. "type": "string",
  541. "description": "登陆用户名也是手机号",
  542. "name": "phone",
  543. "in": "formData",
  544. "required": true
  545. },
  546. {
  547. "type": "string",
  548. "description": "姓名",
  549. "name": "name",
  550. "in": "formData",
  551. "required": true
  552. },
  553. {
  554. "type": "integer",
  555. "description": "性别 1:男, 2:女",
  556. "name": "sex",
  557. "in": "formData",
  558. "required": true
  559. },
  560. {
  561. "type": "string",
  562. "description": "生日",
  563. "name": "birthday",
  564. "in": "formData",
  565. "required": true
  566. },
  567. {
  568. "type": "integer",
  569. "description": "身高",
  570. "name": "height",
  571. "in": "formData",
  572. "required": true
  573. },
  574. {
  575. "type": "string",
  576. "description": "体重 ",
  577. "name": "weight",
  578. "in": "formData",
  579. "required": true
  580. },
  581. {
  582. "type": "integer",
  583. "description": "静态心率",
  584. "name": "staticHr",
  585. "in": "formData"
  586. },
  587. {
  588. "type": "string",
  589. "description": "头像",
  590. "name": "head",
  591. "in": "formData"
  592. },
  593. {
  594. "type": "string",
  595. "description": "备注",
  596. "name": "memo",
  597. "in": "formData"
  598. }
  599. ],
  600. "responses": {
  601. "200": {
  602. "description": "OK",
  603. "schema": {
  604. "$ref": "#/definitions/controller.ResponseBase"
  605. }
  606. }
  607. }
  608. }
  609. },
  610. "/User/ShopUserEdit": {
  611. "post": {
  612. "description": "会员用户基本信息修改",
  613. "consumes": [
  614. "application/x-www-form-urlencoded"
  615. ],
  616. "produces": [
  617. "application/json"
  618. ],
  619. "tags": [
  620. "User"
  621. ],
  622. "summary": "会员用户基本信息修改",
  623. "parameters": [
  624. {
  625. "type": "string",
  626. "description": "Token",
  627. "name": "token",
  628. "in": "formData",
  629. "required": true
  630. },
  631. {
  632. "type": "integer",
  633. "description": "用户Id",
  634. "name": "userId",
  635. "in": "formData",
  636. "required": true
  637. },
  638. {
  639. "type": "string",
  640. "description": "手机号",
  641. "name": "phone",
  642. "in": "formData"
  643. },
  644. {
  645. "type": "string",
  646. "description": "姓名",
  647. "name": "name",
  648. "in": "formData"
  649. },
  650. {
  651. "type": "string",
  652. "description": "备注",
  653. "name": "memo",
  654. "in": "formData"
  655. },
  656. {
  657. "type": "string",
  658. "description": "生日",
  659. "name": "birthday",
  660. "in": "formData",
  661. "required": true
  662. },
  663. {
  664. "type": "integer",
  665. "description": "身高",
  666. "name": "height",
  667. "in": "formData",
  668. "required": true
  669. },
  670. {
  671. "type": "string",
  672. "description": "体重",
  673. "name": "weight",
  674. "in": "formData",
  675. "required": true
  676. },
  677. {
  678. "type": "integer",
  679. "description": "性别 1:男, 2:女",
  680. "name": "sex",
  681. "in": "formData",
  682. "required": true
  683. },
  684. {
  685. "type": "integer",
  686. "description": "静态心率",
  687. "name": "staticHr",
  688. "in": "formData"
  689. },
  690. {
  691. "type": "string",
  692. "description": "头像URL",
  693. "name": "head",
  694. "in": "formData"
  695. }
  696. ],
  697. "responses": {
  698. "200": {
  699. "description": "OK",
  700. "schema": {
  701. "$ref": "#/definitions/controller.ResponseBase"
  702. }
  703. }
  704. }
  705. }
  706. },
  707. "/User/ShopUserListQuery": {
  708. "post": {
  709. "description": "会员用户列表(带分页)",
  710. "consumes": [
  711. "application/x-www-form-urlencoded"
  712. ],
  713. "produces": [
  714. "application/json"
  715. ],
  716. "tags": [
  717. "User"
  718. ],
  719. "summary": "会员用户列表(带分页)",
  720. "parameters": [
  721. {
  722. "type": "string",
  723. "description": "Token",
  724. "name": "token",
  725. "in": "formData",
  726. "required": true
  727. },
  728. {
  729. "type": "string",
  730. "description": "手机号",
  731. "name": "phone",
  732. "in": "formData"
  733. },
  734. {
  735. "type": "string",
  736. "description": "姓名",
  737. "name": "name",
  738. "in": "formData"
  739. },
  740. {
  741. "type": "string",
  742. "description": "当前条",
  743. "name": "start",
  744. "in": "formData",
  745. "required": true
  746. },
  747. {
  748. "type": "string",
  749. "description": "每页条数",
  750. "name": "tableMax",
  751. "in": "formData",
  752. "required": true
  753. }
  754. ],
  755. "responses": {
  756. "200": {
  757. "description": "OK",
  758. "schema": {
  759. "$ref": "#/definitions/controller.ShopUserInfo"
  760. }
  761. }
  762. }
  763. }
  764. },
  765. "/User/ShopUserSimpleQuery": {
  766. "post": {
  767. "description": "本店会员用户基本信息查询",
  768. "consumes": [
  769. "application/x-www-form-urlencoded"
  770. ],
  771. "produces": [
  772. "application/json"
  773. ],
  774. "tags": [
  775. "User"
  776. ],
  777. "summary": "本店会员用户基本信息查询",
  778. "parameters": [
  779. {
  780. "type": "string",
  781. "description": "Token",
  782. "name": "token",
  783. "in": "formData",
  784. "required": true
  785. },
  786. {
  787. "type": "integer",
  788. "description": "商家ID",
  789. "name": "shopId",
  790. "in": "formData"
  791. }
  792. ],
  793. "responses": {
  794. "200": {
  795. "description": "OK",
  796. "schema": {
  797. "$ref": "#/definitions/controller.ShopUserSimpleInfo"
  798. }
  799. }
  800. }
  801. }
  802. },
  803. "/User/ShopUserStatusEdit": {
  804. "post": {
  805. "description": "会员用户状态修改",
  806. "consumes": [
  807. "application/x-www-form-urlencoded"
  808. ],
  809. "produces": [
  810. "application/json"
  811. ],
  812. "tags": [
  813. "User"
  814. ],
  815. "summary": "会员用户状态修改",
  816. "parameters": [
  817. {
  818. "type": "string",
  819. "description": "Token",
  820. "name": "token",
  821. "in": "formData",
  822. "required": true
  823. },
  824. {
  825. "type": "integer",
  826. "description": "用户ID",
  827. "name": "userId",
  828. "in": "formData",
  829. "required": true
  830. },
  831. {
  832. "type": "integer",
  833. "description": "状态 1:启用\t 8:禁用 9:删除",
  834. "name": "status",
  835. "in": "formData",
  836. "required": true
  837. }
  838. ],
  839. "responses": {
  840. "200": {
  841. "description": "OK",
  842. "schema": {
  843. "$ref": "#/definitions/controller.ResponseBase"
  844. }
  845. }
  846. }
  847. }
  848. }
  849. },
  850. "definitions": {
  851. "controller.ResponseBase": {
  852. "type": "object",
  853. "properties": {
  854. "code": {
  855. "type": "integer"
  856. },
  857. "memo": {
  858. "type": "string"
  859. }
  860. }
  861. },
  862. "controller.ShopCoachSimpleInfo": {
  863. "type": "object",
  864. "properties": {
  865. "code": {
  866. "type": "integer"
  867. },
  868. "memo": {
  869. "type": "string"
  870. },
  871. "rs": {
  872. "type": "string"
  873. }
  874. }
  875. },
  876. "controller.ShopUserInfo": {
  877. "type": "object",
  878. "properties": {
  879. "code": {
  880. "type": "integer"
  881. },
  882. "memo": {
  883. "type": "string"
  884. },
  885. "pageCount": {
  886. "type": "integer"
  887. },
  888. "rs": {
  889. "type": "string"
  890. }
  891. }
  892. },
  893. "controller.ShopUserSimpleInfo": {
  894. "type": "object",
  895. "properties": {
  896. "code": {
  897. "type": "integer"
  898. },
  899. "memo": {
  900. "type": "string"
  901. },
  902. "rs": {
  903. "type": "string"
  904. }
  905. }
  906. }
  907. },
  908. "securityDefinitions": {
  909. "ApiKeyAuth": {
  910. "type": "apiKey",
  911. "name": "Authorization",
  912. "in": "header"
  913. },
  914. "BasicAuth": {
  915. "type": "basic"
  916. },
  917. "OAuth2AccessCode": {
  918. "type": "oauth2",
  919. "flow": "accessCode",
  920. "authorizationUrl": "https://example.com/oauth/authorize",
  921. "tokenUrl": "https://example.com/oauth/token",
  922. "scopes": {
  923. "admin": " Grants read and write access to administrative information"
  924. }
  925. },
  926. "OAuth2Application": {
  927. "type": "oauth2",
  928. "flow": "application",
  929. "tokenUrl": "https://example.com/oauth/token",
  930. "scopes": {
  931. "admin": " Grants read and write access to administrative information",
  932. "write": " Grants write access"
  933. }
  934. },
  935. "OAuth2Implicit": {
  936. "type": "oauth2",
  937. "flow": "implicit",
  938. "authorizationUrl": "https://example.com/oauth/authorize",
  939. "scopes": {
  940. "admin": " Grants read and write access to administrative information",
  941. "write": " Grants write access"
  942. }
  943. },
  944. "OAuth2Password": {
  945. "type": "oauth2",
  946. "flow": "password",
  947. "tokenUrl": "https://example.com/oauth/token",
  948. "scopes": {
  949. "admin": " Grants read and write access to administrative information",
  950. "read": " Grants read access",
  951. "write": " Grants write access"
  952. }
  953. }
  954. }
  955. }`
  956. type swaggerInfo struct {
  957. Version string
  958. Host string
  959. BasePath string
  960. Schemes []string
  961. Title string
  962. Description string
  963. }
  964. // SwaggerInfo holds exported Swagger Info so clients can modify it
  965. var SwaggerInfo = swaggerInfo{
  966. Version: "1.0",
  967. Host: "",
  968. BasePath: "/v1",
  969. Schemes: []string{},
  970. Title: "web框架",
  971. Description: "web框架 API 文档",
  972. }
  973. type s struct{}
  974. func (s *s) ReadDoc() string {
  975. sInfo := SwaggerInfo
  976. sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
  977. t, err := template.New("swagger_info").Funcs(template.FuncMap{
  978. "marshal": func(v interface{}) string {
  979. a, _ := json.Marshal(v)
  980. return string(a)
  981. },
  982. }).Parse(doc)
  983. if err != nil {
  984. return doc
  985. }
  986. var tpl bytes.Buffer
  987. if err := t.Execute(&tpl, sInfo); err != nil {
  988. return doc
  989. }
  990. return tpl.String()
  991. }
  992. func init() {
  993. swag.Register(swag.Name, &s{})
  994. }