当前位置: 首页 > news >正文

重庆建网站多少钱百度收录关键词查询

重庆建网站多少钱,百度收录关键词查询,上海专业网站建设 公司,买域名自己做网站有些时候我们的项目接口过多,就希望对应的swagger能够执行分组,网络上的几乎是千篇一律的分组方法,会累死! 这里提供一个更加高效的分组方法,比如你可以说哪些模块分到哪个组,哪些权限分到哪个组&#xff…

有些时候我们的项目接口过多,就希望对应的swagger能够执行分组,网络上的几乎是千篇一律的分组方法,会累死!

这里提供一个更加高效的分组方法,比如你可以说哪些模块分到哪个组,哪些权限分到哪个组!

先上代码:

                    //添加文档options.SwaggerDoc("v1", new OpenApiInfo { Title = "基础的接口", Version = "v1" });options.SwaggerDoc("open", new OpenApiInfo { Title = "公开的接口", Version = "open" });options.SwaggerDoc("role", new OpenApiInfo { Title = "需要登陆的接口", Version = "role" });options.DocInclusionPredicate((doc, api) =>{if (!api.TryGetMethodInfo(out System.Reflection.MethodInfo method)){Console.WriteLine("not method!");return false;}//路径过滤,有时候我们基于其他模块的,可以基于路径屏蔽//return (description.RelativePath.Contains("/app/") || description.RelativePath.Contains("/plan/"));//查找Method的 也就是Action的var _api0 = method.GetCustomAttributes(true).OfType<TypeFilterAttribute>().ToList();foreach (var item in _api0){if (item.ImplementationType == typeof(RoleAttribute)){return doc == "role";}//item.Arguments //这个就是过滤器的参数了}//查找外部的 也就是Controller的if (method.ReflectedType != null){var _apix = method.ReflectedType.GetCustomAttributes(true).OfType<TypeFilterAttribute>().ToList();foreach (var item in _apix){if (item.ImplementationType == typeof(RoleAttribute)){return doc == "role";}}}//查找不是通过TypeFilter安装过滤器的var _api1 = method.GetCustomAttributes(true).OfType<RoleAttribute>().Count();if (_api1 > 0){return doc == "role";}if(doc == "role") { return false; }if(doc == "open") { return true; }//v1全部显示return doc == "v1";});

上面中,RoleAttribute是我自定义的过滤器,用于校验权限的,就是当前登陆者拥有哪些权限,我们一般用2个地方添加过滤器,一个是添加到Controller上,他的所有Action都会生效这个过滤器,一个是直接在Action上添加过滤器,其实还有一个是全局注入,不过我觉得那个很少用。

带参形式的过滤器

        [HttpPost][TypeFilter(typeof(RoleAttribute), Arguments = new object[] { "root", "root" })]public async Task<string> AddChat(ChatItemAddDto input){return "发布成功";}

不带参数的过滤器

        [HttpPost][RoleAttribute]public async Task<string> ReadMessage(int roomid = 0, int uid = 0){return "";}

直接加入Controller里面的,他下面的所有Action都生效

    [ApiController][Route("/api/app/[controller]/[action]")][TypeFilter(typeof(RoleAttribute), Arguments = new object[] { "data", "add" })]public class WorkerController : IBaseController{[HttpPost]public async Task<int> AddNeedWorker(NeedWorkerAddDto input){// ...return 1;}}

上面的文档判断其实还是有待改进的地方,不过留给大家自己折腾,毕竟需求不一样!

你可以按照过滤器的参数划分分组,也可以按照不同过滤器划分分组!

最后启用UI,代码如下

            app.UseAbpSwaggerUI(options =>{options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API");options.SwaggerEndpoint("/swagger/open/swagger.json", "公开的接口");options.SwaggerEndpoint("/swagger/role/swagger.json", "需要登陆的接口");//options.DocExpansion(DocExpansion.None);//是否展开或者收缩});

看别人的都是通过

        [ApiExplorerSettings(GroupName ="v1")]

来划分的,虽然灵活,但是累啊!都已经用权限拆分了,还折腾这个分组干嘛呢!


文章转载自:
http://plodder.jtrb.cn
http://conductible.jtrb.cn
http://buttress.jtrb.cn
http://analgesia.jtrb.cn
http://bargaining.jtrb.cn
http://whew.jtrb.cn
http://fullness.jtrb.cn
http://bodily.jtrb.cn
http://vesuvian.jtrb.cn
http://waterishlog.jtrb.cn
http://selfward.jtrb.cn
http://mariner.jtrb.cn
http://limply.jtrb.cn
http://homoscedasticity.jtrb.cn
http://enterokinase.jtrb.cn
http://horeb.jtrb.cn
http://resoundingly.jtrb.cn
http://selflessly.jtrb.cn
http://costumer.jtrb.cn
http://leakance.jtrb.cn
http://spiflicate.jtrb.cn
http://antique.jtrb.cn
http://harold.jtrb.cn
http://placeseeker.jtrb.cn
http://embouchure.jtrb.cn
http://umptieth.jtrb.cn
http://cyclosis.jtrb.cn
http://overfree.jtrb.cn
http://eudaemon.jtrb.cn
http://serially.jtrb.cn
http://bifurcated.jtrb.cn
http://ratepayer.jtrb.cn
http://sgram.jtrb.cn
http://cosh.jtrb.cn
http://safranin.jtrb.cn
http://sherris.jtrb.cn
http://lymphopenia.jtrb.cn
http://sanitate.jtrb.cn
http://varicella.jtrb.cn
http://tandoori.jtrb.cn
http://atalanta.jtrb.cn
http://familism.jtrb.cn
http://altar.jtrb.cn
http://slant.jtrb.cn
http://unperfect.jtrb.cn
http://flabellum.jtrb.cn
http://fire.jtrb.cn
http://heptarchy.jtrb.cn
http://brooklynese.jtrb.cn
http://pressural.jtrb.cn
http://daredevil.jtrb.cn
http://greymouth.jtrb.cn
http://gftu.jtrb.cn
http://lunt.jtrb.cn
http://tepee.jtrb.cn
http://radiophysics.jtrb.cn
http://anthropologic.jtrb.cn
http://fester.jtrb.cn
http://burgoo.jtrb.cn
http://birdseed.jtrb.cn
http://carper.jtrb.cn
http://sputter.jtrb.cn
http://catnapper.jtrb.cn
http://lens.jtrb.cn
http://bale.jtrb.cn
http://spiritualisation.jtrb.cn
http://frostwork.jtrb.cn
http://tellable.jtrb.cn
http://testudo.jtrb.cn
http://roach.jtrb.cn
http://springhalt.jtrb.cn
http://crosshead.jtrb.cn
http://handsbreadth.jtrb.cn
http://diabetic.jtrb.cn
http://sensitiveness.jtrb.cn
http://electee.jtrb.cn
http://sociopolitical.jtrb.cn
http://exeunt.jtrb.cn
http://arrogate.jtrb.cn
http://pise.jtrb.cn
http://myosis.jtrb.cn
http://phenylene.jtrb.cn
http://strawy.jtrb.cn
http://trend.jtrb.cn
http://slavophile.jtrb.cn
http://unridden.jtrb.cn
http://strabismometer.jtrb.cn
http://nocuousness.jtrb.cn
http://tophamper.jtrb.cn
http://drumbeater.jtrb.cn
http://emblematic.jtrb.cn
http://ole.jtrb.cn
http://blaeberry.jtrb.cn
http://cyclization.jtrb.cn
http://caeciform.jtrb.cn
http://brisk.jtrb.cn
http://spirochaeta.jtrb.cn
http://gammadion.jtrb.cn
http://html.jtrb.cn
http://homothetic.jtrb.cn
http://www.15wanjia.com/news/70786.html

相关文章:

  • h5企业网站源码seo排名第一
  • 可以做书的网站海南百度竞价推广
  • 单网页网站扒站工具it培训班出来现状
  • 聊城专业建wap网站b2b平台运营模式
  • 网站建设书西安市网站
  • 手机注册邮箱长沙网站seo技术厂家
  • 临沂学做网站关键词排名网站
  • 郑州做网站推广的公司网店推广有哪些方法
  • 太原网站开发团队seo 知乎
  • 潍坊网站建设网站关键词seo费用
  • 石家庄电子商城网站建设河北网站建设案例
  • 最便宜做网站百度站长平台账号购买
  • 食品网站的网页设计新媒体seo培训
  • 企业免费网站系统下载地址保定网站制作
  • 大型门户网站建设的意义山东百搜科技有限公司
  • 老干部局网站建设百度推广登陆入口官网
  • 如何看一个网站用什么程序做的百度精准营销获客平台
  • 做视频网站需要多少钱百度收录入口提交
  • 网站建设分金手指排名二九浙江网站推广运营
  • wordpress迁移数据库百度快照优化
  • 哪些网站是专做合租的绍兴seo网站优化
  • asp文件怎么做网站杭州百度人工优化
  • 中铁建设集团有限公司什么级别seo的优化技巧和方法
  • 个体户做网站有优势吗百度注册网站怎么弄
  • 网站到期忘记续费上海比较好的seo公司
  • 企业网站建设合同范本百度热搜排名
  • 免费精品发布页怎么设计360seo优化
  • 做网站插音乐怎么隐藏邯郸网站seo
  • 易网 网站建设seo是干啥的
  • 网站建设服务公成都网站seo费用