Documentation ¶
Index ¶
- Constants
- Variables
- func DownloadFile(fileName string, url string) (err error)
- func GenerateToken(clientID string, clientSecret string) (ti oauth2.TokenInfo, err error)
- func Get(apiURL string, params url.Values) (rs []byte, err error)
- func GetLongDateString(date string, Hours int64) (dateString string, err error)
- func GetMinuteDiffer(start_time, end_time string) int64
- func GetRandomString(l int) string
- func HttpGet(apiURL string, params url.Values) (rs []byte, err error)
- func HttpPostBody(apiURL string, params url.Values, body string) (rs []byte, err error)
- func HttpPostFile(filename string, apiURL string, params url.Values) (rs []byte, err error)
- func PathExists(path string) (bool, error)
- func RemoveRepeatedElement(arr []string) (newArr []string)
- func Round(f float64, n int) float64
- func RunMode(CurrentMode string)
- func SubString(source string, start int, end int) string
- func Substr(str string, start int, length int) string
- func ToFloat64(ori []byte) (re float64)
- func XlsxFileReader(mimeFile multipart.File) (*xlsx.File, error)
- type Session
- type SessionMgr
- func (mgr *SessionMgr) CheckCookieValid(w http.ResponseWriter, r *http.Request) string
- func (mgr *SessionMgr) EndSession(w http.ResponseWriter, r *http.Request)
- func (mgr *SessionMgr) EndSessionBy(sessionID string)
- func (mgr *SessionMgr) GC()
- func (mgr *SessionMgr) GetLastAccessTime(sessionID string) time.Time
- func (mgr *SessionMgr) GetSessionIDList() []string
- func (mgr *SessionMgr) GetSessionVal(sessionID string, key interface{}) (interface{}, bool)
- func (mgr *SessionMgr) NewSessionID() string
- func (mgr *SessionMgr) SetSessionVal(sessionID string, key interface{}, value interface{}, w http.ResponseWriter)
- func (mgr *SessionMgr) StartSession(w http.ResponseWriter, r *http.Request) string
- type Size
- type TokenUser
Constants ¶
View Source
const ( LongDateFormat = "2006-01-02 15:04:05" ShortDateFormat = "2006-01-02" )
Variables ¶
View Source
var Agentid = ""
View Source
var Corpid = ""
View Source
var CurrentMode = "DEV"
View Source
var MONGODB = "mongodb://root:root@192.168.2.173:27017/"
View Source
var PORT = 7999
View Source
var Secret = ""
View Source
var TokenManager *manage.Manager
Functions ¶
func GenerateToken ¶
func GetLongDateString ¶
获取日期格式
func HttpPostBody ¶
网络请求POST body
func HttpPostFile ¶
网络请求POST multipart(二进制上传)
func PathExists ¶
Types ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
—————————————————————————— 会话
type SessionMgr ¶
type SessionMgr struct {
// contains filtered or unexported fields
}
Session会话管理
var GlobalsessionMgr *SessionMgr = nil //session管理器
func NewSessionMgr ¶
func NewSessionMgr(cookieName string, maxLifeTime int64) *SessionMgr
创建会话管理器(cookieName:在浏览器中cookie的名字;maxLifeTime:最长生命周期)
func (*SessionMgr) CheckCookieValid ¶
func (mgr *SessionMgr) CheckCookieValid(w http.ResponseWriter, r *http.Request) string
判断Cookie的合法性(每进入一个页面都需要判断合法性)
func (*SessionMgr) EndSession ¶
func (mgr *SessionMgr) EndSession(w http.ResponseWriter, r *http.Request)
结束Session
func (*SessionMgr) GetLastAccessTime ¶
func (mgr *SessionMgr) GetLastAccessTime(sessionID string) time.Time
更新最后访问时间
func (*SessionMgr) GetSessionIDList ¶
func (mgr *SessionMgr) GetSessionIDList() []string
得到sessionID列表
func (*SessionMgr) GetSessionVal ¶
func (mgr *SessionMgr) GetSessionVal(sessionID string, key interface{}) (interface{}, bool)
得到session里面的值
func (*SessionMgr) SetSessionVal ¶
func (mgr *SessionMgr) SetSessionVal(sessionID string, key interface{}, value interface{}, w http.ResponseWriter)
设置session里面的值
func (*SessionMgr) StartSession ¶
func (mgr *SessionMgr) StartSession(w http.ResponseWriter, r *http.Request) string
在开始页面登陆页面,开始Session
Click to show internal directories.
Click to hide internal directories.