From 938c46fec97d40bd347eaeefcb6c391a06531e0c Mon Sep 17 00:00:00 2001 From: John Date: Wed, 29 Apr 2020 19:33:14 +0800 Subject: [PATCH] readme update --- .example/other/test.go | 86 ++++-------------------------------------- README.MD | 1 + README_ZH.MD | 1 + 3 files changed, 9 insertions(+), 79 deletions(-) diff --git a/.example/other/test.go b/.example/other/test.go index 45aedba3b..942332f4c 100644 --- a/.example/other/test.go +++ b/.example/other/test.go @@ -1,92 +1,20 @@ package main import ( - "github.com/gogf/gf/errors/gerror" + "fmt" "github.com/gogf/gf/frame/g" "github.com/gogf/gf/net/ghttp" ) -// ListsInput ListsInput -type ListsInput struct { - Page int `v:"min:1#page不能小于1"` - Limit int `v:"between:10,100#limit必须是10-100之间的整数"` - Search -} - -type ListRequest struct { - ListsInput -} - -// Search Search -type Search struct { - GoodsName string - GoodsSource string - FreeShipping string - MarketPrice struct { - Min int - Max int - IsInclude bool - } - GuidePrice struct { - Min int - Max int - IsInclude bool - } - AgreementPrice struct { - Min int - Max int - IsInclude bool - } - NormalProfitMargin struct { - Min int - Max int - IsInclude bool - } - ActivityProfitMargin struct { - Min int - Max int - IsInclude bool - } - Sales struct { - Cycle string - Quantity struct { - Min int - Max int - IsInclude bool - } - } - SalesReturn struct { - Cycle string - Quantity struct { - Min int - Max int - IsInclude bool - } - } - ChooseGoods struct { - Cycle string - Quantity struct { - Min int - Max int - IsInclude bool - } - } -} - -// Lists Lists -func Lists(r *ghttp.Request) { - var params *ListRequest - if err := r.Parse(¶ms); err != nil { - r.Response.WriteExit(gerror.Stack(err)) - } - - r.Response.Write(params) -} - func main() { s := g.Server() s.Group("/", func(group *ghttp.RouterGroup) { - group.POST("/test", Lists) + group.ALL("/", func(r *ghttp.Request) { + fmt.Println(r.GetBodyString()) + fmt.Println(r.Header) + r.Response.Write(r.GetBodyString()) + r.Response.Write(r.Header) + }) }) s.SetPort(8199) s.Run() diff --git a/README.MD b/README.MD index 67cc4e7e8..ad5edc87c 100644 --- a/README.MD +++ b/README.MD @@ -15,6 +15,7 @@ cache, logging, containers, timer, resource, validator, database orm, etc. Supporting web server integrated with router, cookie, session, middleware, logger, configure, template, https, hooks, rewrites and many more features. +> If you're a newbie to `Go`, you may consider `GoFrame` easy and great as `Laravel` in `PHP`, `SpringBoot` in `Java` or `Django` in `Python`. # Installation ``` diff --git a/README_ZH.MD b/README_ZH.MD index 38a9ef5be..769a33849 100644 --- a/README_ZH.MD +++ b/README_ZH.MD @@ -15,6 +15,7 @@ 并提供了Web服务开发的系列核心组件,如:Router、Cookie、Session、Middleware、服务注册、模板引擎等等, 支持热重启、热更新、域名绑定、TLS/HTTPS、Rewrite等特性。 +> 如果您初识`Go`语言,您可以将`GoFrame`类似于`PHP`中的`Laravel`, `Java`中的`SpringBoot`或者`Python`中的`Django`。 # 特点 * 模块化、松耦合设计;