|
|
@@ -24,18 +24,18 @@ func NewWebUI(addr string) (*WebUI, error) {
|
|
|
mux := http.NewServeMux()
|
|
|
|
|
|
fs := http.FileServer(http.FS(sub))
|
|
|
- mux.Handle("/static/css/", fs) /////////////// 页面样式
|
|
|
- mux.Handle("/static/js/", fs) /////////////// 页面脚本
|
|
|
-
|
|
|
- mux.HandleFunc("/login", loginHandler) // 登录接口
|
|
|
- mux.HandleFunc("/logout", logoutHandler) // 注销接口
|
|
|
- mux.HandleFunc("/getIMEI", getIMEIHandler)
|
|
|
+ mux.Handle("/static/css/", fs) ////////////// 页面样式
|
|
|
+ mux.Handle("/static/js/", fs) ////////////// 页面脚本
|
|
|
+ /////////////////////////////////////////////////////
|
|
|
+ mux.HandleFunc("/login", loginHandler) // 登录接口
|
|
|
+ mux.HandleFunc("/logout", logoutHandler) // 注销接口
|
|
|
+ mux.HandleFunc("/getIMEI", getIMEIHandler) // 设备的ID
|
|
|
|
|
|
return &WebUI{fs: sub, addr: addr, mux: mux}, nil
|
|
|
}
|
|
|
|
|
|
func (ui *WebUI) Start() error {
|
|
|
- StartSessionCleaner() // session过期自动回收
|
|
|
+ startSessionCleaner() // session过期自动回收
|
|
|
ui.mux.HandleFunc("/", ui.rootHandler)
|
|
|
return http.ListenAndServe(ui.addr, ui.mux)
|
|
|
}
|