utils

package
v0.0.0-...-1ea22bd Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

*

  • Project Name:wechat-robot
  • File Name:signs.go
  • Package Name:utils
  • Date:2019年07月16日 14:36
  • Function:
  • Copyright (c) 2019, Jason.Wang All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlatMap

func FlatMap(prefix string, mapData map[string]interface{}) map[string]interface{}

将一个map[string]interface打平

func Format

func Format(time *time.Time, format string) string

func FormatS

func FormatS(time time.Time, format string) string

func Get

func Get(url string, params map[string]string) ([]byte, error)

func GetFilePath

func GetFilePath(fileName string) string

func GetSign

func GetSign(srcdata interface{}, bizkey string) string

GetSign get the sign info

func GetSignEncode

func GetSignEncode(srcdata interface{}, bizkey string) string

func GetSignEncodeToUpper

func GetSignEncodeToUpper(srcdata interface{}, bizkey string) string

func GetTodayTime

func GetTodayTime() time.Time

GetTodayTime 返回今天零点的time

func GetTodayYM

func GetTodayYM(sep string) string

GetTodayYM 得到以sep为分隔符的年、月字符串(今天所属于的月份)

func GetTodayYMD

func GetTodayYMD(sep string) string

GetTodayYMD 得到以sep为分隔符的年、月、日字符串(今天)

func GetTomorrowYMD

func GetTomorrowYMD(sep string) string

GetTomorrowYMD 得到以sep为分隔符的年、月、日字符串(明天)

func GetYesterdayTime

func GetYesterdayTime() time.Time

GetYesterdayTime 返回昨天零点的time

func GetYesterdayYMD

func GetYesterdayYMD(sep string) string

GetYesterdayYMD 得到以sep为分隔符的年、月、日字符串(昨天)

func ParseTpl

func ParseTpl(tpl string, data map[string]interface{}) string

将tpl中的占位符 替换为真实值 ${data.0.att1}

func Post

func Post(url string, params map[string]string) ([]byte, error)

func PostBody

func PostBody(url string, data []byte) ([]byte, error)

body提交二进制数据

func PostFile

func PostFile(uri string, params map[string]string, paramName, path string) (*http.Request, error)

func SetStructByJSON

func SetStructByJSON(obj interface{}, mapData map[string]interface{}) error

SetStructByJSON 由json对象生成 struct

func Split

func Split(val string, sep string) []string

func StrToIntMonth

func StrToIntMonth(month string) int

StrToIntMonth 字符串月份转整数月份

func Struct2Map

func Struct2Map(content interface{}) map[string]string

func Struct2map

func Struct2map(content interface{}, bizKey string) string

func Struct2mapEncode

func Struct2mapEncode(content interface{}, bizKey string) string

func TimeFromExcelTime

func TimeFromExcelTime(excelTime float64, date1904 bool) time.Time

func ValidateGetUrl

func ValidateGetUrl(ctx *gin.Context, token string) bool

func ValidateUrl

func ValidateUrl(ctx *gin.Context, token string) bool

检查url中的参数

Types

This section is empty.

Jump to

Keyboard shortcuts

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