Ejemplo n.º 1
0
func CreateFromSelectCommandAndHttpContext(Select *MysqlAst.SelectCommand, Ctx *kmgHttp.Context) *KmgPage {
	page := &KmgPage{}
	page.BaseUrl = Ctx.GetRequestUrl()
	page.CurrentPage = Ctx.InNum("Page")
	page.PageKeyName = "Page"
	page.init()
	return page.runSelectCommand(Select)
}
Ejemplo n.º 2
0
func Dispatcher(ctx *kmgHttp.Context, processorList []HttpProcessor) {
	apiName := ctx.InStr("n")
	if apiName == "" && EnterPointApiName != "" {
		if ctx.GetRequestUrl() == "/favicon.ico" {
			// 避免网站图标请求,占用大量资源.
			ctx.NotFound("api not found")
			return
		}
		apiName = EnterPointApiName
	}
	apiFunc, ok := controllerObjMap[apiName]
	if !ok {
		ctx.NotFound("api not found")
		return
	}

	apiFunc(ctx)
	return
}