docs.go 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046
  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. "/Test/UserListQuery": {
  227. "post": {
  228. "description": "会员用户查询",
  229. "consumes": [
  230. "application/x-www-form-urlencoded"
  231. ],
  232. "produces": [
  233. "application/json"
  234. ],
  235. "tags": [
  236. "Test"
  237. ],
  238. "summary": "会员用户查询",
  239. "responses": {
  240. "200": {
  241. "description": "OK",
  242. "schema": {
  243. "$ref": "#/definitions/controller.UserList"
  244. }
  245. }
  246. }
  247. }
  248. },
  249. "/User/ShopCoachAdd": {
  250. "post": {
  251. "description": "商家教练添加",
  252. "consumes": [
  253. "application/x-www-form-urlencoded"
  254. ],
  255. "produces": [
  256. "application/json"
  257. ],
  258. "tags": [
  259. "User"
  260. ],
  261. "summary": "商家教练添加",
  262. "parameters": [
  263. {
  264. "type": "string",
  265. "description": "Token",
  266. "name": "token",
  267. "in": "formData",
  268. "required": true
  269. },
  270. {
  271. "type": "integer",
  272. "description": "店铺ID",
  273. "name": "shopId",
  274. "in": "formData",
  275. "required": true
  276. },
  277. {
  278. "type": "string",
  279. "description": "登陆用户名也是手机号",
  280. "name": "phone",
  281. "in": "formData",
  282. "required": true
  283. },
  284. {
  285. "type": "string",
  286. "description": "姓名",
  287. "name": "name",
  288. "in": "formData",
  289. "required": true
  290. },
  291. {
  292. "type": "string",
  293. "description": "密码",
  294. "name": "pwd",
  295. "in": "formData",
  296. "required": true
  297. },
  298. {
  299. "type": "integer",
  300. "description": "性别 1:男, 2:女",
  301. "name": "sex",
  302. "in": "formData",
  303. "required": true
  304. },
  305. {
  306. "type": "string",
  307. "description": "备注",
  308. "name": "memo",
  309. "in": "formData"
  310. }
  311. ],
  312. "responses": {
  313. "200": {
  314. "description": "OK",
  315. "schema": {
  316. "$ref": "#/definitions/controller.ResponseBase"
  317. }
  318. }
  319. }
  320. }
  321. },
  322. "/User/ShopCoachEdit": {
  323. "post": {
  324. "description": "商家教练基本信息修改",
  325. "consumes": [
  326. "application/x-www-form-urlencoded"
  327. ],
  328. "produces": [
  329. "application/json"
  330. ],
  331. "tags": [
  332. "User"
  333. ],
  334. "summary": "商家教练基本信息修改",
  335. "parameters": [
  336. {
  337. "type": "string",
  338. "description": "Token",
  339. "name": "token",
  340. "in": "formData",
  341. "required": true
  342. },
  343. {
  344. "type": "integer",
  345. "description": "教练ID",
  346. "name": "ssId",
  347. "in": "formData",
  348. "required": true
  349. },
  350. {
  351. "type": "string",
  352. "description": "手机号",
  353. "name": "phone",
  354. "in": "formData"
  355. },
  356. {
  357. "type": "string",
  358. "description": "密码",
  359. "name": "pwd",
  360. "in": "formData"
  361. },
  362. {
  363. "type": "string",
  364. "description": "姓名",
  365. "name": "name",
  366. "in": "formData"
  367. },
  368. {
  369. "type": "string",
  370. "description": "备注",
  371. "name": "memo",
  372. "in": "formData"
  373. },
  374. {
  375. "type": "integer",
  376. "description": "性别 1:男, 2:女",
  377. "name": "sex",
  378. "in": "formData",
  379. "required": true
  380. }
  381. ],
  382. "responses": {
  383. "200": {
  384. "description": "OK",
  385. "schema": {
  386. "$ref": "#/definitions/controller.ResponseBase"
  387. }
  388. }
  389. }
  390. }
  391. },
  392. "/User/ShopCoachListQuery": {
  393. "post": {
  394. "description": "会员用户列表(带分页)",
  395. "consumes": [
  396. "application/x-www-form-urlencoded"
  397. ],
  398. "produces": [
  399. "application/json"
  400. ],
  401. "tags": [
  402. "User"
  403. ],
  404. "summary": "会员用户列表(带分页)",
  405. "parameters": [
  406. {
  407. "type": "string",
  408. "description": "Token",
  409. "name": "token",
  410. "in": "formData",
  411. "required": true
  412. },
  413. {
  414. "type": "string",
  415. "description": "手机号",
  416. "name": "phone",
  417. "in": "formData"
  418. },
  419. {
  420. "type": "string",
  421. "description": "姓名",
  422. "name": "name",
  423. "in": "formData"
  424. },
  425. {
  426. "type": "string",
  427. "description": "当前条",
  428. "name": "start",
  429. "in": "formData",
  430. "required": true
  431. },
  432. {
  433. "type": "string",
  434. "description": "每页条数",
  435. "name": "tableMax",
  436. "in": "formData",
  437. "required": true
  438. }
  439. ],
  440. "responses": {
  441. "200": {
  442. "description": "OK",
  443. "schema": {
  444. "$ref": "#/definitions/controller.ShopUserInfo"
  445. }
  446. }
  447. }
  448. }
  449. },
  450. "/User/ShopCoachSimpleQuery": {
  451. "post": {
  452. "description": "本店会员用户基本信息查询",
  453. "consumes": [
  454. "application/x-www-form-urlencoded"
  455. ],
  456. "produces": [
  457. "application/json"
  458. ],
  459. "tags": [
  460. "User"
  461. ],
  462. "summary": "本店会员用户基本信息查询",
  463. "parameters": [
  464. {
  465. "type": "string",
  466. "description": "Token",
  467. "name": "token",
  468. "in": "formData",
  469. "required": true
  470. },
  471. {
  472. "type": "integer",
  473. "description": "商家ID",
  474. "name": "shopId",
  475. "in": "formData"
  476. }
  477. ],
  478. "responses": {
  479. "200": {
  480. "description": "OK",
  481. "schema": {
  482. "$ref": "#/definitions/controller.ShopCoachSimpleInfo"
  483. }
  484. }
  485. }
  486. }
  487. },
  488. "/User/ShopCoachStatusEdit": {
  489. "post": {
  490. "description": "商家教练状态修改",
  491. "consumes": [
  492. "application/x-www-form-urlencoded"
  493. ],
  494. "produces": [
  495. "application/json"
  496. ],
  497. "tags": [
  498. "User"
  499. ],
  500. "summary": "商家教练状态修改",
  501. "parameters": [
  502. {
  503. "type": "string",
  504. "description": "Token",
  505. "name": "token",
  506. "in": "formData",
  507. "required": true
  508. },
  509. {
  510. "type": "integer",
  511. "description": "教练ID",
  512. "name": "ssId",
  513. "in": "formData",
  514. "required": true
  515. },
  516. {
  517. "type": "integer",
  518. "description": "状态 1:启用\t 8:禁用 9:删除",
  519. "name": "status",
  520. "in": "formData",
  521. "required": true
  522. }
  523. ],
  524. "responses": {
  525. "200": {
  526. "description": "OK",
  527. "schema": {
  528. "$ref": "#/definitions/controller.ResponseBase"
  529. }
  530. }
  531. }
  532. }
  533. },
  534. "/User/ShopUserAdd": {
  535. "post": {
  536. "description": "会员用户添加",
  537. "consumes": [
  538. "application/x-www-form-urlencoded"
  539. ],
  540. "produces": [
  541. "application/json"
  542. ],
  543. "tags": [
  544. "User"
  545. ],
  546. "summary": "会员用户添加",
  547. "parameters": [
  548. {
  549. "type": "string",
  550. "description": "Token",
  551. "name": "token",
  552. "in": "formData",
  553. "required": true
  554. },
  555. {
  556. "type": "integer",
  557. "description": "店铺ID",
  558. "name": "shopId",
  559. "in": "formData",
  560. "required": true
  561. },
  562. {
  563. "type": "string",
  564. "description": "登陆用户名也是手机号",
  565. "name": "phone",
  566. "in": "formData",
  567. "required": true
  568. },
  569. {
  570. "type": "string",
  571. "description": "姓名",
  572. "name": "name",
  573. "in": "formData",
  574. "required": true
  575. },
  576. {
  577. "type": "integer",
  578. "description": "性别 1:男, 2:女",
  579. "name": "sex",
  580. "in": "formData",
  581. "required": true
  582. },
  583. {
  584. "type": "string",
  585. "description": "生日",
  586. "name": "birthday",
  587. "in": "formData",
  588. "required": true
  589. },
  590. {
  591. "type": "integer",
  592. "description": "身高",
  593. "name": "height",
  594. "in": "formData",
  595. "required": true
  596. },
  597. {
  598. "type": "string",
  599. "description": "体重 ",
  600. "name": "weight",
  601. "in": "formData",
  602. "required": true
  603. },
  604. {
  605. "type": "integer",
  606. "description": "静态心率",
  607. "name": "staticHr",
  608. "in": "formData"
  609. },
  610. {
  611. "type": "string",
  612. "description": "头像",
  613. "name": "head",
  614. "in": "formData"
  615. },
  616. {
  617. "type": "string",
  618. "description": "备注",
  619. "name": "memo",
  620. "in": "formData"
  621. }
  622. ],
  623. "responses": {
  624. "200": {
  625. "description": "OK",
  626. "schema": {
  627. "$ref": "#/definitions/controller.ResponseBase"
  628. }
  629. }
  630. }
  631. }
  632. },
  633. "/User/ShopUserEdit": {
  634. "post": {
  635. "description": "会员用户基本信息修改",
  636. "consumes": [
  637. "application/x-www-form-urlencoded"
  638. ],
  639. "produces": [
  640. "application/json"
  641. ],
  642. "tags": [
  643. "User"
  644. ],
  645. "summary": "会员用户基本信息修改",
  646. "parameters": [
  647. {
  648. "type": "string",
  649. "description": "Token",
  650. "name": "token",
  651. "in": "formData",
  652. "required": true
  653. },
  654. {
  655. "type": "integer",
  656. "description": "用户Id",
  657. "name": "userId",
  658. "in": "formData",
  659. "required": true
  660. },
  661. {
  662. "type": "string",
  663. "description": "手机号",
  664. "name": "phone",
  665. "in": "formData"
  666. },
  667. {
  668. "type": "string",
  669. "description": "姓名",
  670. "name": "name",
  671. "in": "formData"
  672. },
  673. {
  674. "type": "string",
  675. "description": "备注",
  676. "name": "memo",
  677. "in": "formData"
  678. },
  679. {
  680. "type": "string",
  681. "description": "生日",
  682. "name": "birthday",
  683. "in": "formData",
  684. "required": true
  685. },
  686. {
  687. "type": "integer",
  688. "description": "身高",
  689. "name": "height",
  690. "in": "formData",
  691. "required": true
  692. },
  693. {
  694. "type": "string",
  695. "description": "体重",
  696. "name": "weight",
  697. "in": "formData",
  698. "required": true
  699. },
  700. {
  701. "type": "integer",
  702. "description": "性别 1:男, 2:女",
  703. "name": "sex",
  704. "in": "formData",
  705. "required": true
  706. },
  707. {
  708. "type": "integer",
  709. "description": "静态心率",
  710. "name": "staticHr",
  711. "in": "formData"
  712. },
  713. {
  714. "type": "string",
  715. "description": "头像URL",
  716. "name": "head",
  717. "in": "formData"
  718. }
  719. ],
  720. "responses": {
  721. "200": {
  722. "description": "OK",
  723. "schema": {
  724. "$ref": "#/definitions/controller.ResponseBase"
  725. }
  726. }
  727. }
  728. }
  729. },
  730. "/User/ShopUserListQuery": {
  731. "post": {
  732. "description": "会员用户列表(带分页)",
  733. "consumes": [
  734. "application/x-www-form-urlencoded"
  735. ],
  736. "produces": [
  737. "application/json"
  738. ],
  739. "tags": [
  740. "User"
  741. ],
  742. "summary": "会员用户列表(带分页)",
  743. "parameters": [
  744. {
  745. "type": "string",
  746. "description": "Token",
  747. "name": "token",
  748. "in": "formData",
  749. "required": true
  750. },
  751. {
  752. "type": "string",
  753. "description": "手机号",
  754. "name": "phone",
  755. "in": "formData"
  756. },
  757. {
  758. "type": "string",
  759. "description": "姓名",
  760. "name": "name",
  761. "in": "formData"
  762. },
  763. {
  764. "type": "string",
  765. "description": "当前条",
  766. "name": "start",
  767. "in": "formData",
  768. "required": true
  769. },
  770. {
  771. "type": "string",
  772. "description": "每页条数",
  773. "name": "tableMax",
  774. "in": "formData",
  775. "required": true
  776. }
  777. ],
  778. "responses": {
  779. "200": {
  780. "description": "OK",
  781. "schema": {
  782. "$ref": "#/definitions/controller.ShopUserInfo"
  783. }
  784. }
  785. }
  786. }
  787. },
  788. "/User/ShopUserSimpleQuery": {
  789. "post": {
  790. "description": "本店会员用户基本信息查询",
  791. "consumes": [
  792. "application/x-www-form-urlencoded"
  793. ],
  794. "produces": [
  795. "application/json"
  796. ],
  797. "tags": [
  798. "User"
  799. ],
  800. "summary": "本店会员用户基本信息查询",
  801. "parameters": [
  802. {
  803. "type": "string",
  804. "description": "Token",
  805. "name": "token",
  806. "in": "formData",
  807. "required": true
  808. },
  809. {
  810. "type": "integer",
  811. "description": "商家ID",
  812. "name": "shopId",
  813. "in": "formData"
  814. }
  815. ],
  816. "responses": {
  817. "200": {
  818. "description": "OK",
  819. "schema": {
  820. "$ref": "#/definitions/controller.ShopUserSimpleInfo"
  821. }
  822. }
  823. }
  824. }
  825. },
  826. "/User/ShopUserStatusEdit": {
  827. "post": {
  828. "description": "会员用户状态修改",
  829. "consumes": [
  830. "application/x-www-form-urlencoded"
  831. ],
  832. "produces": [
  833. "application/json"
  834. ],
  835. "tags": [
  836. "User"
  837. ],
  838. "summary": "会员用户状态修改",
  839. "parameters": [
  840. {
  841. "type": "string",
  842. "description": "Token",
  843. "name": "token",
  844. "in": "formData",
  845. "required": true
  846. },
  847. {
  848. "type": "integer",
  849. "description": "用户ID",
  850. "name": "userId",
  851. "in": "formData",
  852. "required": true
  853. },
  854. {
  855. "type": "integer",
  856. "description": "状态 1:启用\t 8:禁用 9:删除",
  857. "name": "status",
  858. "in": "formData",
  859. "required": true
  860. }
  861. ],
  862. "responses": {
  863. "200": {
  864. "description": "OK",
  865. "schema": {
  866. "$ref": "#/definitions/controller.ResponseBase"
  867. }
  868. }
  869. }
  870. }
  871. }
  872. },
  873. "definitions": {
  874. "controller.ResponseBase": {
  875. "type": "object",
  876. "properties": {
  877. "code": {
  878. "type": "integer"
  879. },
  880. "memo": {
  881. "type": "string"
  882. }
  883. }
  884. },
  885. "controller.ShopCoachSimpleInfo": {
  886. "type": "object",
  887. "properties": {
  888. "code": {
  889. "type": "integer"
  890. },
  891. "memo": {
  892. "type": "string"
  893. },
  894. "rs": {
  895. "type": "string"
  896. }
  897. }
  898. },
  899. "controller.ShopUserInfo": {
  900. "type": "object",
  901. "properties": {
  902. "code": {
  903. "type": "integer"
  904. },
  905. "memo": {
  906. "type": "string"
  907. },
  908. "pageCount": {
  909. "type": "integer"
  910. },
  911. "rs": {
  912. "type": "string"
  913. }
  914. }
  915. },
  916. "controller.ShopUserSimpleInfo": {
  917. "type": "object",
  918. "properties": {
  919. "code": {
  920. "type": "integer"
  921. },
  922. "memo": {
  923. "type": "string"
  924. },
  925. "rs": {
  926. "type": "string"
  927. }
  928. }
  929. },
  930. "controller.UserList": {
  931. "type": "object",
  932. "properties": {
  933. "code": {
  934. "type": "integer"
  935. },
  936. "memo": {
  937. "type": "string"
  938. },
  939. "rs": {
  940. "type": "array",
  941. "items": {
  942. "type": "object"
  943. }
  944. }
  945. }
  946. }
  947. },
  948. "securityDefinitions": {
  949. "ApiKeyAuth": {
  950. "type": "apiKey",
  951. "name": "Authorization",
  952. "in": "header"
  953. },
  954. "BasicAuth": {
  955. "type": "basic"
  956. },
  957. "OAuth2AccessCode": {
  958. "type": "oauth2",
  959. "flow": "accessCode",
  960. "authorizationUrl": "https://example.com/oauth/authorize",
  961. "tokenUrl": "https://example.com/oauth/token",
  962. "scopes": {
  963. "admin": " Grants read and write access to administrative information"
  964. }
  965. },
  966. "OAuth2Application": {
  967. "type": "oauth2",
  968. "flow": "application",
  969. "tokenUrl": "https://example.com/oauth/token",
  970. "scopes": {
  971. "admin": " Grants read and write access to administrative information",
  972. "write": " Grants write access"
  973. }
  974. },
  975. "OAuth2Implicit": {
  976. "type": "oauth2",
  977. "flow": "implicit",
  978. "authorizationUrl": "https://example.com/oauth/authorize",
  979. "scopes": {
  980. "admin": " Grants read and write access to administrative information",
  981. "write": " Grants write access"
  982. }
  983. },
  984. "OAuth2Password": {
  985. "type": "oauth2",
  986. "flow": "password",
  987. "tokenUrl": "https://example.com/oauth/token",
  988. "scopes": {
  989. "admin": " Grants read and write access to administrative information",
  990. "read": " Grants read access",
  991. "write": " Grants write access"
  992. }
  993. }
  994. }
  995. }`
  996. type swaggerInfo struct {
  997. Version string
  998. Host string
  999. BasePath string
  1000. Schemes []string
  1001. Title string
  1002. Description string
  1003. }
  1004. // SwaggerInfo holds exported Swagger Info so clients can modify it
  1005. var SwaggerInfo = swaggerInfo{
  1006. Version: "1.0",
  1007. Host: "",
  1008. BasePath: "/v1",
  1009. Schemes: []string{},
  1010. Title: "web框架",
  1011. Description: "web框架 API 文档",
  1012. }
  1013. type s struct{}
  1014. func (s *s) ReadDoc() string {
  1015. sInfo := SwaggerInfo
  1016. sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1)
  1017. t, err := template.New("swagger_info").Funcs(template.FuncMap{
  1018. "marshal": func(v interface{}) string {
  1019. a, _ := json.Marshal(v)
  1020. return string(a)
  1021. },
  1022. }).Parse(doc)
  1023. if err != nil {
  1024. return doc
  1025. }
  1026. var tpl bytes.Buffer
  1027. if err := t.Execute(&tpl, sInfo); err != nil {
  1028. return doc
  1029. }
  1030. return tpl.String()
  1031. }
  1032. func init() {
  1033. swag.Register(swag.Name, &s{})
  1034. }