template

package
v0.0.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

@Time : 2019-05-08 17:09 @Author : frozenchen @File : cmd @Software: studio

@Time : 2019-05-09 16:41 @Author : frozenchen @File : conf @Software: studio

@Time : 2019-05-08 17:09 @Author : frozenchen @File : dao @Software: studio

@Time : 2019-05-09 14:33 @Author : frozenchen @File : gitignore @Software: studio

@Time : 2019-05-09 13:41 @Author : frozenchen @File : gomod @Software: studio

@Time : 2019-05-17 09:12 @Author : frozenchen @File : help @Software: studio

@Time : 2019-05-08 17:08 @Author : frozenchen @File : main @Software: studio

@Time : 2019-05-09 13:42 @Author : frozenchen @File : makefile @Software: studio

@Time : 2019-05-08 17:09 @Author : frozenchen @File : model @Software: studio

@Time : 2019-05-16 16:11 @Author : frozenchen @File : proto @Software: studio

@Time : 2019-05-08 17:09 @Author : frozenchen @File : server @Software: studio

@Time : 2019-05-08 17:09 @Author : frozenchen @File : service @Software: studio

Index

Constants

This section is empty.

Variables

View Source
var ConfDemo_template = `` /* 713-byte string literal not displayed */
View Source
var ConfFile_template = `` /* 512-byte string literal not displayed */
View Source
var Conf_template = `` /* 499-byte string literal not displayed */
View Source
var Dao_template = `` /* 495-byte string literal not displayed */
View Source
var Gitignore_template = `

`
View Source
var Go_mod = `` /* 156-byte string literal not displayed */
View Source
var Help_template = `` /* 660-byte string literal not displayed */
View Source
var HttpServer_template = `` /* 581-byte string literal not displayed */
View Source
var Main_srv = `` /* 659-byte string literal not displayed */
View Source
var Main_web = `` /* 870-byte string literal not displayed */
View Source
var Makefile_template = `` /* 130-byte string literal not displayed */
View Source
var Model_template = `/*
   @Time : {{.Time}}
   @Author : {{.Author}}
   @File : model
   @Software: {{.Appname}}
*/
package model

import (
	"fmt"
	"github.com/freezeChen/studio-library/zlog"
	"github.com/gin-gonic/gin"
	jsoniter "github.com/json-iterator/go"
	"net/http"
	"net/url"
)


type JsonResult struct {
	Code uint8       ` + "`" + `json:"code"` + "`" + `
	Msg  string      ` + "`" + `json:"msg"` + "`" + `
	Data interface{} ` + "`" + `json:"data,omitempty"` + "`" + `
}

func (self *JsonResult) Response(ctx *gin.Context) {
	var (
		params url.Values
	)

	//获取传入参数
	if ctx.Request.Method == "GET" {
		params = ctx.Request.URL.Query()
	} else {
		if err := ctx.Request.ParseMultipartForm(32 << 20); err == nil {
			params = ctx.Request.PostForm
		}
	}

	var p string
	for k, v := range params {
		p += fmt.Sprintf("|%s=%s", k, v[0])
	}

	//获取错误码对应文字
	if self.Code == 0 {
		self.Msg = "success"
		zlog.ApiInfof(p, "success")
	} else {
		if len(self.Msg) == 0 {
			self.Msg = "操作失败"
		}
		zlog.ApiErrorf(p, "错误:%s", self.Msg)
	}

	str, _ := jsoniter.ConfigCompatibleWithStandardLibrary.Marshal(self)
	ctx.Data(http.StatusOK, "application/json; charset=utf-8", str)
}

`
View Source
var Proto_template = `` /* 168-byte string literal not displayed */
View Source
var Service_handler_teplate = `` /* 363-byte string literal not displayed */
View Source
var Service_template = `` /* 297-byte string literal not displayed */
View Source
var Service_web_template = `` /* 353-byte string literal not displayed */

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL