Documentation
¶
Index ¶
- Variables
- func Addslashes(str string) string
- func BlogKeyWord(s string) string
- func ClientIP(request *http.Request) string
- func CreateSign(str string) string
- func Delete_extra_space(s string) string
- func Exists(path string) bool
- func FormatFromUnixTime(t int64) string
- func FormatFromUnixTimeShort(t int64) string
- func GetInt64(i interface{}, d int64) int64
- func GetInt64FromMap(dm map[string]interface{}, key string, dft int64) int64
- func GetInt64FromStringMap(dm map[string]string, key string, dft int64) int64
- func GetLoginUser(request *http.Request) *viewsmodels.ObjLoginuser
- func GetString(str interface{}, d string) string
- func GetStringFromMap(dm map[string]interface{}, key string, dft string) string
- func GetStringFromStringMap(dm map[string]string, key string, dft string) string
- func H(po *PageOptions) string
- func Ip4toInt(ip string) int64
- func IsHuBuLaOSS() bool
- func IsMobile(header *http.Request) (isMobile bool)
- func LoginSession(c iris.Context) *viewsmodels.AdminSession
- func LoginSessionGet(c iris.Context, sessionname string) (bool, *viewsmodels.AdminSession, error)
- func LoginSessionSet(c iris.Context, sessionname string, sessionvalue *viewsmodels.AdminSession)
- func Mobile(r *http.Request) bool
- func NextDayDuration() time.Duration
- func NowUnix() int
- func ParseTime(str string) (time.Time, error)
- func PasswordSalt(pass, salt string) string
- func PasswordVerify(password, pass, salt string) bool
- func PathAutoOrMobile(r *http.Request, b bool, cookieMobile string, indexoradmin string, ...) string
- func PathExists(path string) bool
- func PathMobile(r *http.Request, indexoradmin string, model string) string
- func PrintKeyWord(ch <-chan string) string
- func QQLevePic(leve *QQSeveralPic) string
- func Random(max int) int
- func Redirect(writer http.ResponseWriter, url string)
- func SessionSet(c iris.Context, sessionname string, sessionvalue interface{})
- func SetLoginuser(writer http.ResponseWriter, loginuser *viewsmodels.ObjLoginuser)
- func SqlBuHan(buhan string) (v map[string]string)
- func SqlHaoduan400(haoduan string) (v map[string]string)
- func SqlHaoduanSJH(haoduan string) (v map[string]string)
- func SqlJiLiHao(jilihao string) (v map[string]string)
- func SqlJiaGe(jiage string) (v map[string]string)
- func SqlJiaoDuo(jiaoduo string) (v map[string]string)
- func SqlNianDai(niandai string) (v map[string]string)
- func SqlOrder(order string) (v map[string]string)
- func SqlShengRi(shengri string) (v map[string]string)
- func SqlTeZheng(tezheng string) (v map[string]string)
- func Sqlyuju(biaoming string, keyValue string) string
- func Stripslashes(str string) string
- func Tree(list []*models.ADemo) string
- func YYLevePic(leve *YYSeveralPic) string
- type Error
- type PageOptions
- type QQSeveralPic
- type SqlReturn
- type SqlWhere
- type YYSeveralPic
Constants ¶
This section is empty.
Variables ¶
var Seg jiebago.Segmenter
var (
Sess = sessions.New(sessions.Config{Cookie: cookieNameForSessionID})
)
Functions ¶
func Addslashes ¶
Addslashes 函数返回在预定义字符之前添加反斜杠的字符串。 预定义字符是: 单引号(') 双引号(") 反斜杠(\)
func Delete_extra_space ¶
函数名:delete_extra_space(s string) string 功 能:删除字符串中多余的空格(含tab),有多个空格时,仅保留一个空格,同时将字符串中的tab换为空格 参 数:s string:原始字符串 返回值:string:删除多余空格后的字符串 创建时间:2018年12月3日 修订信息:
func FormatFromUnixTime ¶
FormatFromUnixTime 将unix时间戳格式化为yyyymmdd H:i:s格式字符串
func FormatFromUnixTimeShort ¶
FormatFromUnixTimeShort 将unix时间戳格式化为yyyymmdd格式字符串
func GetInt64FromMap ¶
从map中得到指定的key
func GetInt64FromStringMap ¶
从map中得到指定的key
func GetLoginUser ¶
func GetLoginUser(request *http.Request) *viewsmodels.ObjLoginuser
从cookie中得到当前登录的用户
func GetStringFromMap ¶
从map中得到指定的key
func GetStringFromStringMap ¶
从map中得到指定的key
func IsHuBuLaOSS ¶
func IsHuBuLaOSS() bool
func LoginSessionGet ¶
func LoginSessionGet(c iris.Context, sessionname string) (bool, *viewsmodels.AdminSession, error)
获取
func LoginSessionSet ¶
func LoginSessionSet(c iris.Context, sessionname string, sessionvalue *viewsmodels.AdminSession)
用户登录 session 填充
func PathAutoOrMobile ¶
func PathAutoOrMobile(r *http.Request, b bool, cookieMobile string, indexoradmin string, model string) string
http.Request 是否启用自适应方式默认flase cookie设备信息 前台或者后台 模块路径
func PathExists ¶
判断文件或文件夹是否存在 存在为true 如果返回的错误为nil,说明文件或文件夹存在 如果返回的错误类型使用os.IsNotExist()判断为true,说明文件或文件夹不存在
使用os.IsExist()判断为true,说明文件或文件夹存在
如果返回的错误为其它类型,则不确定是否在存在
func PathMobile ¶
判断pc还是移动设备,进行模板路径拼接,不考虑自适应模板
func QQLevePic ¶
func QQLevePic(leve *QQSeveralPic) string
func SessionSet ¶
func SessionSet(c iris.Context, sessionname string, sessionvalue interface{})
通用 session 填充
func SetLoginuser ¶
func SetLoginuser(writer http.ResponseWriter, loginuser *viewsmodels.ObjLoginuser)
将登录的用户信息设置到cookie中
func Stripslashes ¶
stripslashes() 函数删除由 addslashes() 函数添加的反斜杠。
func YYLevePic ¶
func YYLevePic(leve *YYSeveralPic) string
Types ¶
type PageOptions ¶
type PageOptions struct { FirstPageText string //首页文字 默认"首页" LastPageText string //尾页文字 默认"尾页" PrePageText string //上一页文字 默认"上一页" NextPageText string //下一页文字 默认"下一页" Currentpage int64 //当前页 ,默认1 每次分页,必须在前台设置新的页数,不设置始终默认1.在控制器中使用方式:cp, _ := this.GetInt("pno") po.Currentpage = int(cp) LinkItemCount int64 //生成A标签的个数 默认10个 PageSize int64 //页面大小,默认20 TotalPage int64 //总页码 ParamName string //参数名称 默认是page Href string //A标签的链接地址 ---------[不需要设置] EnableFirstLastLink bool //是否启用首尾连接 默认false 建议开启 EnablePreNexLink bool //是否启用上一页,下一页连接 默认false 建议开启 }
分页标签信息
func DealUri ¶
func DealUri(po *PageOptions, uri string) *PageOptions
*
- 处理url,目的是保存参数
- ParamName string //参数名称 默认是pno
第二步 处理 PageOptions.Href A标签的链接地址
func GetPages ¶
func GetPages(sqlwhere *SqlWhere, totalCount int64) (po *PageOptions)
第一步 传入总条数 totalCount 返回分页标签信息 *PageOptions
type QQSeveralPic ¶
func QQLeveToSeveral ¶
func QQLeveToSeveral(leve int64) *QQSeveralPic
type SqlReturn ¶
type SqlReturn struct { Page int64 //当前页 `json:"page"` PageSize int64 //每页条数 TotalCount int64 //总条数 TotalPage int64 //总页码 Data []interface{} `json:"data"` //数据 Href string //A标签的链接地址 ---------[不需要设置] Str template.HTML //分页 }
GetAll 列表查询返回的结构体 返回总记录条数,总页数,以及当前请求的数据RawSeter
type SqlWhere ¶
type SqlWhere struct { TableName string //表名 -----------------[必填] Conditions map[string]interface{} //条件 Fields []string //字段 OrderBy string //排序 Currentpage int64 //当前页 ,默认1 每次分页,必须在前台设置新的页数,不设置始终默认1.在控制器中使用方式:cp, _ := this.GetInt("pno") po.Currentpage = int(cp) PageSize int64 //页面大小,默认20 Uri string }
GetAll 列表查询传入的结构体
type YYSeveralPic ¶
type YYSeveralPic struct { Quanzhang int64 Denglong int64 Huangguan int64 Dunpai int64 Zhuanshi int64 Shuye int64 }
func YYLeveToSeveral ¶
func YYLeveToSeveral(leve int64) *YYSeveralPic