123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- // @APIVersion 1.0.0
- // @Title 弘则手机端管理后台接口
- // @Description 这是弘则手机端管理后台接口api文档,统一出、入参;出参格式:{"code":200,"data":{},"msg":"操作成功","errMsg":"开发人员查看的错误信息"},code是业务响应码,200 代表正常返回;400 代表业务处理失败,前端同学需要做额外逻辑处理;401 代表token异常,用户需要重新静默授权,获取最新的token;403代表用户需要进行绑定操作,需要跳转到输入账号密码绑定页面。同时如果出现其他返回值(没有在约定范围内),那么及时联系后端同事;msg是用来提示前端同学,一般只在code为 400 的情况下才会展示给用户去看;data是业务返回数据,给前端做逻辑处理。
- // 除了微信静默授权接口,其他所有接口请求都必须在header中携带token
- // @Contact astaxie@gmail.com
- // @TermsOfServiceUrl http://beego.me/
- // @License Apache 2.0
- // @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
- package routers
- import (
- "github.com/beego/beego/v2/server/web/filter/cors"
- "hongze/hongze_mobile_admin/controllers"
- "hongze/hongze_mobile_admin/controllers/business_trip"
- "hongze/hongze_mobile_admin/controllers/roadshow"
- "hongze/hongze_mobile_admin/controllers/yb"
- "github.com/beego/beego/v2/server/web"
- )
- func init() {
- //解决跨域问题
- web.InsertFilter("*", web.BeforeRouter, cors.Allow(&cors.Options{
- AllowAllOrigins: true,
- AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
- AllowHeaders: []string{"Origin", "Authorization", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
- ExposeHeaders: []string{"Content-Length", "Access-Control-Allow-Origin", "Access-Control-Allow-Headers", "Content-Type"},
- AllowCredentials: true,
- }))
- ns := web.NewNamespace("/h5adminapi",
- web.NSNamespace("/wechat",
- web.NSInclude(
- &controllers.WeChatCommon{},
- ),
- ),
- web.NSNamespace("/admin",
- web.NSInclude(
- &controllers.AdminCommon{},
- ),
- ),
- web.NSNamespace("/admin_wx",
- web.NSInclude(
- &controllers.AdminWxController{},
- ),
- ),
- web.NSNamespace("/approval",
- web.NSInclude(
- &controllers.ApprovalCommon{},
- ),
- ),
- web.NSNamespace("/message",
- web.NSInclude(
- &controllers.MessageCommon{},
- ),
- ),
- web.NSNamespace("/company_contract",
- web.NSInclude(
- &controllers.CompanyContractCommon{},
- ),
- ),
- web.NSNamespace("/contract",
- web.NSInclude(
- &controllers.ContractCommon{},
- ),
- ),
- web.NSNamespace("/contract_approval",
- web.NSInclude(
- &controllers.ContractApprovalCommon{},
- ),
- ),
- web.NSNamespace("/seal",
- web.NSInclude(
- &controllers.SealCommon{},
- ),
- ),
- web.NSNamespace("/seal_approval",
- web.NSInclude(
- &controllers.SealApprovalCommon{},
- ),
- ),
- web.NSNamespace("/resource",
- web.NSInclude(
- &controllers.ResourceCommon{},
- ),
- ),
- web.NSNamespace("/roadshow",
- web.NSInclude(
- &roadshow.CalendarController{},
- ),
- ),
- web.NSNamespace("/yb",
- web.NSInclude(
- &yb.CommunityQuestionController{},
- &yb.CommunityQuestionCommentController{},
- ),
- ),
- web.NSNamespace("/taglib",
- web.NSInclude(
- &controllers.VarietyTagController{},
- ),
- ),
- web.NSNamespace("/business_trip",
- web.NSInclude(
- &business_trip.BusinessTrip{},
- ),
- ),
- web.NSNamespace("/system",
- web.NSInclude(
- &controllers.SystemCommon{},
- ),
- ),
- web.NSNamespace("/custom",
- web.NSInclude(
- &controllers.CompanySellerController{},
- ),
- ),
- )
- web.AddNamespace(ns)
- }
|