diff --git a/commands/command.go b/commands/command.go index e57fe014..bc383c7f 100644 --- a/commands/command.go +++ b/commands/command.go @@ -18,6 +18,7 @@ import ( "github.com/astaxie/beego" beegoCache "github.com/astaxie/beego/cache" _ "github.com/astaxie/beego/cache/memcache" + "github.com/astaxie/beego/cache/redis" _ "github.com/astaxie/beego/cache/redis" "github.com/astaxie/beego/logs" @@ -326,6 +327,7 @@ func ResolveCommand(args []string) { beego.BConfig.WebConfig.StaticDir["/static"] = filepath.Join(conf.WorkingDirectory, "static") beego.BConfig.WebConfig.StaticDir["/uploads"] = uploads beego.BConfig.WebConfig.ViewsPath = conf.WorkingDir("views") + beego.BConfig.WebConfig.Session.SessionCookieSameSite = http.SameSiteNoneMode fonts := conf.WorkingDir("static", "fonts") diff --git a/commands/daemon/daemon.go b/commands/daemon/daemon.go index f9123b7e..7b62c6c3 100644 --- a/commands/daemon/daemon.go +++ b/commands/daemon/daemon.go @@ -45,7 +45,6 @@ func (d *Daemon) Start(s service.Service) error { func (d *Daemon) Run() { - commands.ResolveCommand(d.config.Arguments) commands.RegisterFunction() @@ -56,7 +55,7 @@ func (d *Daemon) Run() { beego.ErrorController(&controllers.ErrorController{}) - f,err := filepath.Abs(os.Args[0]) + f, err := filepath.Abs(os.Args[0]) if err != nil { f = os.Args[0] diff --git a/conf/enumerate.go b/conf/enumerate.go index a31eb3e6..89539ae9 100644 --- a/conf/enumerate.go +++ b/conf/enumerate.go @@ -4,11 +4,12 @@ package conf import ( "strings" - "github.com/astaxie/beego" - "strconv" - "path/filepath" - "os" "fmt" + "os" + "path/filepath" + "strconv" + + "github.com/astaxie/beego" ) // 登录用户的Session名 @@ -19,7 +20,8 @@ const CaptchaSessionName = "__captcha__" const RegexpEmail = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$" //允许用户名中出现点号 -const RegexpAccount = `^[a-zA-Z][a-zA-Z0-9\.-]{2,50}$` +// const RegexpAccount = `^[a-zA-Z][a-zA-Z0-9\.-]{2,50}$` +const RegexpAccount = `[a-zA-Z0-9\.-]{2,50}$` // PageSize 默认分页条数. const PageSize = 10 @@ -158,7 +160,7 @@ func GetExportProcessNum() int { if exportProcessNum <= 0 || exportProcessNum > 4 { exportProcessNum = 1 } - return exportProcessNum; + return exportProcessNum } //导出项目队列的并发数量 @@ -168,7 +170,7 @@ func GetExportLimitNum() int { if exportLimitNum < 0 { exportLimitNum = 1 } - return exportLimitNum; + return exportLimitNum } //等待导出队列的长度 @@ -210,7 +212,7 @@ func IsAllowUploadFileExt(ext string) bool { //重写生成URL的方法,加上完整的域名 func URLFor(endpoint string, values ...interface{}) string { baseUrl := beego.AppConfig.DefaultString("baseurl", "") - pathUrl := beego.URLFor(endpoint, values ...) + pathUrl := beego.URLFor(endpoint, values...) if baseUrl == "" { baseUrl = BaseUrl @@ -224,12 +226,12 @@ func URLFor(endpoint string, values ...interface{}) string { if !strings.HasPrefix(pathUrl, "/") && !strings.HasSuffix(baseUrl, "/") { return baseUrl + "/" + pathUrl } - return baseUrl + beego.URLFor(endpoint, values ...) + return baseUrl + beego.URLFor(endpoint, values...) } -func URLForNotHost(endpoint string,values ...interface{}) string { +func URLForNotHost(endpoint string, values ...interface{}) string { baseUrl := beego.AppConfig.DefaultString("baseurl", "") - pathUrl := beego.URLFor(endpoint, values ...) + pathUrl := beego.URLFor(endpoint, values...) if baseUrl == "" { baseUrl = "/" @@ -243,7 +245,7 @@ func URLForNotHost(endpoint string,values ...interface{}) string { if !strings.HasPrefix(pathUrl, "/") && !strings.HasSuffix(baseUrl, "/") { return baseUrl + "/" + pathUrl } - return baseUrl + beego.URLFor(endpoint, values ...) + return baseUrl + beego.URLFor(endpoint, values...) } func URLForWithCdnImage(p string) string { diff --git a/controllers/AccountController.go b/controllers/AccountController.go index eaf894e3..8db2f727 100644 --- a/controllers/AccountController.go +++ b/controllers/AccountController.go @@ -1,6 +1,10 @@ package controllers import ( + "crypto/hmac" + "crypto/sha1" + "encoding/base64" + "fmt" "net/url" "regexp" "strings" @@ -14,6 +18,7 @@ import ( "github.com/mindoc-org/mindoc/mail" "github.com/mindoc-org/mindoc/models" "github.com/mindoc-org/mindoc/utils" + "github.com/mindoc-org/mindoc/utils/dingtalk" ) // AccountController 用户登录与注册 @@ -33,6 +38,7 @@ func (c *AccountController) Prepare() { c.BaseController.Prepare() c.EnableXSRF = true c.Data["xsrfdata"] = template.HTML(c.XSRFFormHTML()) + c.Data["corpID"] = beego.AppConfig.String("dingtalk_corpid") if c.Ctx.Input.IsPost() { token := c.Ctx.Input.Query("_xsrf") if token == "" { @@ -132,6 +138,111 @@ func (c *AccountController) Login() { } } +// 钉钉登录 +func (c *AccountController) DingTalkLogin() { + c.Prepare() + + code := c.GetString("code") + if code == "" { + c.JsonResult(500, "获取身份信息失败", nil) + } + + appKey := beego.AppConfig.String("dingtalk_app_key") + appSecret := beego.AppConfig.String("dingtalk_app_secret") + tmpReader := beego.AppConfig.String("dingtalk_tmp_reader") + + if appKey == "" || appSecret == "" || tmpReader == "" { + c.JsonResult(500, "未开启钉钉自动登录功能", nil) + c.StopRun() + } + + dingtalkAgent := dingtalk.NewDingTalkAgent(appSecret, appKey) + err := dingtalkAgent.GetAccesstoken() + if err != nil { + beego.Warn("获取钉钉临时Token失败 ->", err) + c.JsonResult(500, "自动登录失败", nil) + c.StopRun() + } + + username, err := dingtalkAgent.GetUserNameByCode(code) + if err != nil { + beego.Warn("钉钉自动登录失败 ->", err) + c.JsonResult(500, "自动登录失败", nil) + c.StopRun() + } + + member, err := models.NewMember().TmpLogin(tmpReader) + if err == nil { + member.LastLoginTime = time.Now() + _ = member.Update("last_login_time") + + c.SetMember(*member) + c.LoggedIn(false) + } + c.JsonResult(0, "ok", username) +} + +// 临时登录 +func (c *AccountController) TmpLogin() { + if c.Member != nil { + c.Redirect(conf.URLFor("HomeController.Index"), 302) + } + + tmpToken := c.GetString("tmpToken") + if tmpToken == "" { + c.Redirect(conf.URLFor("AccountController.Login"), 302) + } + + tmp, err := base64.URLEncoding.DecodeString(tmpToken) + if err != nil { + c.Redirect(conf.URLFor("AccountController.Login"), 302) + } + + tmpToken = string(tmp) + var remember CookieRemember + // 如果 Cookie 中存在登录信息 + cookie, ok := c.GetSecureCookie(conf.GetAppKey(), "login") + if !ok { + cookie, ok = parseHelper(tmpToken) + } + + // 解析用户,并登录 + if ok { + if err := utils.Decode(cookie, &remember); err == nil { + if member, err := models.NewMember().Find(remember.MemberId); err == nil { + c.SetMember(*member) + c.LoggedIn(false) + c.StopRun() + } + } + } + c.Redirect(conf.URLFor("AccountController.Login"), 302) + +} + +func parseHelper(value string) (string, bool) { + + parts := strings.SplitN(value, "|", 3) + + if len(parts) != 3 { + return "", false + } + + vs := parts[0] + timestamp := parts[1] + sig := parts[2] + + h := hmac.New(sha1.New, []byte(conf.GetAppKey())) + fmt.Fprintf(h, "%s%s", vs, timestamp) + + if fmt.Sprintf("%02x", h.Sum(nil)) != sig { + return "", false + } + res, _ := base64.URLEncoding.DecodeString(vs) + return string(res), true + +} + // 登录成功后的操作,如重定向到原始请求页面 func (c *AccountController) LoggedIn(isPost bool) interface{} { diff --git a/controllers/DocumentController.go b/controllers/DocumentController.go index 3eadcc09..dbbba7c8 100644 --- a/controllers/DocumentController.go +++ b/controllers/DocumentController.go @@ -247,7 +247,7 @@ func (c *DocumentController) Edit() { if conf.GetUploadFileSize() > 0 { c.Data["UploadFileSize"] = conf.GetUploadFileSize() } else { - c.Data["UploadFileSize"] = "undefined"; + c.Data["UploadFileSize"] = "undefined" } } @@ -1258,7 +1258,7 @@ func (c *DocumentController) isReadable(identify, token string) *models.BookResu if book.BookPassword != "" { //判断已存在的密码是否正确 if password, ok := c.GetSession(identify).(string); !ok || !strings.EqualFold(password, book.BookPassword) { - body, err := c.ExecuteViewPathTemplate("document/document_password.tpl", map[string]string{"Identify": book.Identify}); + body, err := c.ExecuteViewPathTemplate("document/document_password.tpl", map[string]string{"Identify": book.Identify}) if err != nil { beego.Error("显示密码页面失败 ->", err) } diff --git a/go.mod b/go.mod index a87ea67d..a303c989 100644 --- a/go.mod +++ b/go.mod @@ -5,16 +5,14 @@ go 1.12 require ( github.com/PuerkitoBio/goquery v1.4.1 github.com/andybalholm/cascadia v1.2.0 // indirect - github.com/astaxie/beego v1.10.1 + github.com/astaxie/beego v1.12.3 github.com/boombuler/barcode v1.0.0 github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect - github.com/go-sql-driver/mysql v1.4.0 // indirect - github.com/gomodule/redigo/redis v0.0.0-20200429221454-e14091dffc1b // indirect github.com/howeyc/fsnotify v0.9.0 github.com/kardianos/service v1.1.0 github.com/lib/pq v1.7.0 // indirect github.com/lifei6671/gocaptcha v0.1.1 - github.com/mattn/go-sqlite3 v1.9.0 + github.com/mattn/go-sqlite3 v2.0.3+incompatible github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 // indirect diff --git a/go.sum b/go.sum index 39ded58c..6965a069 100644 --- a/go.sum +++ b/go.sum @@ -1,70 +1,227 @@ +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/Knetic/govaluate v3.0.0+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/PuerkitoBio/goquery v1.4.1 h1:smcIRGdYm/w7JSbcdeLHEMzxmsBQvl8lhf0dSw2nzMI= github.com/PuerkitoBio/goquery v1.4.1/go.mod h1:T9ezsOHcCrDCgA8aF1Cqr3sSYbO/xgdy8/R/XiIMAhA= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alicebob/gopher-json v0.0.0-20180125190556-5a6b3ba71ee6/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc= +github.com/alicebob/miniredis v2.5.0+incompatible/go.mod h1:8HZjEj4yU0dwhYHky+DxYx+6BMjkBbe5ONFIF1MXffk= github.com/andybalholm/cascadia v1.2.0 h1:vuRCkM5Ozh/BfmsaTm26kbjm0mIOM3yS5Ek/F5h18aE= github.com/andybalholm/cascadia v1.2.0/go.mod h1:YCyR8vOZT9aZ1CHEd8ap0gMVm2aFgxBp0T0eFw1RUQY= github.com/astaxie/beego v1.10.1 h1:M2ciUnyiZycuTpGEA+idJF0gX24h58EbPvGqjnO/DCg= github.com/astaxie/beego v1.10.1/go.mod h1:0R4++1tUqERR0WYFWdfkcrsyoVBCG4DgpDGokT3yb+U= +github.com/astaxie/beego v1.12.3 h1:SAQkdD2ePye+v8Gn1r4X6IKZM1wd28EyUOVQ3PDSOOQ= +github.com/astaxie/beego v1.12.3/go.mod h1:p3qIm0Ryx7zeBHLljmd7omloyca1s4yu1a8kM1FkpIA= +github.com/beego/goyaml2 v0.0.0-20130207012346-5545475820dd/go.mod h1:1b+Y/CofkYwXMUU0OhQqGvsY2Bvgr4j6jfT699wyZKQ= +github.com/beego/x2j v0.0.0-20131220205130-a0352aadc542/go.mod h1:kSeGC/p1AbBiEp5kat81+DSQrZenVBZXklMLaELspWU= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/boombuler/barcode v1.0.0 h1:s1TvRnXwL2xJRaccrdcBQMZxq6X7DvsMogtmJeHDdrc= github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/bradfitz/gomemcache v0.0.0-20180710155616-bc664df96737/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pOvUGt1D1lA5KjYhPBAN/3iWdP7xeFS9F0= github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= +github.com/casbin/casbin v1.7.0/go.mod h1:c67qKN6Oum3UF5Q1+BByfFxkwKvhwW57ITjqwtzR1KE= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58/go.mod h1:EOBUe0h4xcZ5GoxqC5SDxFQ8gwyZPKQoEzownBlhI80= +github.com/couchbase/go-couchbase v0.0.0-20200519150804-63f3cdb75e0d/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= +github.com/couchbase/gomemcached v0.0.0-20200526233749-ec430f949808/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= +github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= +github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGiisLwp9rITslkFNpZD5rz43tf41QFkTWY= github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/go-elasticsearch/v6 v6.8.5/go.mod h1:UwaDJsD3rWLM5rKNFzv9hgox93HoX8utj1kxD9aFUcI= +github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw= github.com/go-asn1-ber/asn1-ber v1.5.0 h1:/S4hO/AO6tLMlPX0oftGSOcdGJJN/MuYzfgWRMn199E= github.com/go-asn1-ber/asn1-ber v1.5.0/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/snappy v0.0.0-20170215233205-553a64147049/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/gomodule/redigo v2.0.0+incompatible h1:K/R+8tc58AaqLkqG2Ol3Qk+DR/TlNuhuh457pBFPtt0= +github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= github.com/gomodule/redigo/redis v0.0.0-20200429221454-e14091dffc1b h1:XAV1CHPRk+MUwbuzYHrCgq7mVq0Z0kcKNilDF4A8yys= github.com/gomodule/redigo/redis v0.0.0-20200429221454-e14091dffc1b/go.mod h1:0zioC1ElIFjAFjnYHA9Y8oeU9SHff86XhZgs2tpx9SU= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc= +github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/howeyc/fsnotify v0.9.0 h1:0gtV5JmOKH4A8SsFxG2BczSeXWWPvcMT0euZt5gDAxY= github.com/howeyc/fsnotify v0.9.0/go.mod h1:41HzSPxBGeFRQKEEwgh49TRw/nKBsYZ2cF1OzPjSJsA= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kardianos/service v1.1.0 h1:QV2SiEeWK42P0aEmGcsAgjApw/lRxkwopvT+Gu6t1/0= github.com/kardianos/service v1.1.0/go.mod h1:RrJI2xn5vve/r32U5suTbeaSGoMU6GbNPoj36CVYcHc= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/ledisdb/ledisdb v0.0.0-20200510135210-d35789ec47e6/go.mod h1:n931TsDuKuq+uX4v1fulaMbA/7ZLLhjc85h7chZGBCQ= +github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.7.0 h1:h93mCPfUSkaul3Ka/VG8uZdmW1uMHDGxzu0NWHuJmHY= github.com/lib/pq v1.7.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lifei6671/gocaptcha v0.1.1 h1:5cvU3w0bK8eJm1P6AiQoPuicoZVAgKKpREBxXF9IaHo= github.com/lifei6671/gocaptcha v0.1.1/go.mod h1:6QlTU2WzFhzqylAJWSo3OANfKCraGccJwbK01P5fFmI= github.com/mattn/go-sqlite3 v1.9.0 h1:pDRiWfl+++eC2FEFRy6jXmQlvp4Yh3z1MJKg4UeYM/4= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-sqlite3 v2.0.3+incompatible h1:gXHsfypPkaMZrKbD5209QV9jbUTJKjyR5WD3HYQSd+U= +github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/pelletier/go-toml v1.0.1/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/peterh/liner v1.0.1-0.20171122030339-3681c2a91233/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.7.0 h1:wCi7urQOGBsYcQROHqpUUX4ct84xp40t9R9JX0FuA/U= +github.com/prometheus/client_golang v1.7.0/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= +github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= +github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 h1:X+yvsM2yrEktyI+b2qND5gpH8YhURn0k8OCaeRnkINo= +github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644/go.mod h1:nkxAfR/5quYxwPZhyDxgasBMnRtBZd0FCEpawpjMUFg= github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/siddontang/go v0.0.0-20170517070808-cb568a3e5cc0/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= +github.com/siddontang/goredis v0.0.0-20150324035039-760763f78400/go.mod h1:DDcKzU3qCuvj/tPnimWSsZZzvk9qvkvrIL5naVBPh5s= +github.com/siddontang/rdb v0.0.0-20150307021120-fc89ed2e418d/go.mod h1:AMEsy7v5z92TR1JKMkLLoaOQk++LVnOKL3ScbJ8GNGA= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/ssdb/gossdb v0.0.0-20180723034631-88f6b59b84ec/go.mod h1:QBvMkMya+gXctz3kmljlUCu/yB3GZ6oee+dUozsezQE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/syndtr/goleveldb v0.0.0-20160425020131-cfa635847112/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/syndtr/goleveldb v0.0.0-20181127023241-353a9fca669c/go.mod h1:Z4AUp2Km+PwemOoO/VB5AOx9XSsIItzFjoJlOSiYmn0= +github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc= +github.com/yuin/gopher-lua v0.0.0-20171031051903-609c9cd26973/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9 h1:vEg9joUBmeBcK9iSJftGNf3coIG4HqZElCPehJsfAYM= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067 h1:KYGJGHOQy8oSi1fDlSpcZF0+juKwk/hEMv5SiwHogR0= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1 h1:ogLJMz+qpzav7lGMh10LMvAkM/fAoGlaiiHYiFYdm80= +golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ldap.v2 v2.5.1 h1:wiu0okdNfjlBzg6UWvd1Hn8Y+Ux17/u/4nlk4CQr6tU= gopkg.in/ldap.v2 v2.5.1/go.mod h1:oI0cpe/D7HRtBQl8aTg+ZmzFUAvu4lsv3eLXMLGFxWk= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/russross/blackfriday.v2 v2.0.0 h1:+FlnIV8DSQnT7NZ43hcVKcdJdzZoeCmJj4Ql8gq5keA= gopkg.in/russross/blackfriday.v2 v2.0.0/go.mod h1:6sSBNz/GtOm/pJTuh5UmBK2ZHfmnxGbl2NZg1UliSOI= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/main.go b/main.go index a8ff125b..6e653bcc 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( _ "github.com/astaxie/beego/session/memcache" _ "github.com/astaxie/beego/session/mysql" + _ "github.com/astaxie/beego/session/redis" "github.com/kardianos/service" _ "github.com/mattn/go-sqlite3" diff --git a/models/Errors.go b/models/Errors.go index d3f38dc1..1e45c28e 100644 --- a/models/Errors.go +++ b/models/Errors.go @@ -19,6 +19,8 @@ var ( ErrorMemberPasswordError = errors.New("用户密码错误") //ErrorMemberAuthMethodInvalid 不支持此认证方式 ErrMemberAuthMethodInvalid = errors.New("不支持此认证方式") + //ErrHTTPServerFail + ErrHTTPServerFail = errors.New("系统内部异常") //ErrLDAPConnect 无法连接到LDAP服务器 ErrLDAPConnect = errors.New("无法连接到LDAP服务器") //ErrLDAPFirstBind 第一次LDAP绑定失败 diff --git a/models/Member.go b/models/Member.go index 45ccd57d..1bbc7283 100644 --- a/models/Member.go +++ b/models/Member.go @@ -105,6 +105,17 @@ func (m *Member) Login(account string, password string) (*Member, error) { return member, ErrorMemberPasswordError } +// TmpLogin 用于钉钉临时登录 +func (m *Member) TmpLogin(account string) (*Member, error) { + o := orm.NewOrm() + member := &Member{} + err := o.Raw("select * from md_members where account = ? and status = 0 limit 1;", account).QueryRow(member) + if err != nil { + return member, ErrorMemberPasswordError + } + return member, nil +} + //ldapLogin 通过LDAP登陆 func (m *Member) ldapLogin(account string, password string) (*Member, error) { if beego.AppConfig.DefaultBool("ldap_enable", false) == false { @@ -168,27 +179,31 @@ func (m *Member) httpLogin(account, password string) (*Member, error) { return nil, ErrMemberAuthMethodInvalid } + tmpH := md5.New() + tmpH.Write([]byte(password)) + password = strings.ToUpper(hex.EncodeToString(tmpH.Sum(nil))) + val := url.Values{ "account": []string{account}, "password": []string{password}, "time": []string{strconv.FormatInt(time.Now().Unix(), 10)}, } h := md5.New() - h.Write([]byte(val.Encode() + beego.AppConfig.DefaultString("http_login_secret",""))) + h.Write([]byte(val.Encode() + beego.AppConfig.DefaultString("http_login_secret", ""))) val.Add("sn", hex.EncodeToString(h.Sum(nil))) resp, err := http.PostForm(urlStr, val) if err != nil { beego.Error("通过接口登录失败 -> ", urlStr, account, err) - return nil, err + return nil, ErrHTTPServerFail } defer resp.Body.Close() body, err := ioutil.ReadAll(resp.Body) if err != nil { beego.Error("读取接口返回值失败 -> ", urlStr, account, err) - return nil, err + return nil, ErrHTTPServerFail } beego.Info("HTTP 登录接口返回数据 ->", string(body)) @@ -196,7 +211,7 @@ func (m *Member) httpLogin(account, password string) (*Member, error) { if err := json.Unmarshal(body, &result); err != nil { beego.Error("解析接口返回值失败 -> ", urlStr, account, string(body)) - return nil, errors.New("解析接口返回值失败") + return nil, ErrHTTPServerFail } if code, ok := result["errcode"]; !ok || code.(float64) != 200 { @@ -204,7 +219,7 @@ func (m *Member) httpLogin(account, password string) (*Member, error) { if msg, ok := result["message"]; ok { return nil, errors.New(msg.(string)) } - return nil, errors.New("接口返回值格式不正确") + return nil, ErrHTTPServerFail } if m.MemberId <= 0 { member := NewMember() diff --git a/models/TeamMember.go b/models/TeamMember.go index 477f7062..52ad32d5 100644 --- a/models/TeamMember.go +++ b/models/TeamMember.go @@ -205,16 +205,16 @@ func (m *TeamMember) FindNotJoinMemberByAccount(teamId int, account string, limi } o := orm.NewOrm() - sql := `select member.member_id,member.account,team.team_member_id + sql := `select member.member_id,member.account,member.real_name,team.team_member_id from md_members as member left join md_team_member as team on team.team_id = ? and member.member_id = team.member_id - where member.account like ? AND team_member_id IS NULL + where member.account like ? or member.real_name like ? AND team_member_id IS NULL order by member.member_id desc limit ?;` members := make([]*Member, 0) - _, err := o.Raw(sql, teamId, "%"+account+"%", limit).QueryRows(&members) + _, err := o.Raw(sql, teamId, "%"+account+"%", "%"+account+"%", limit).QueryRows(&members) if err != nil { beego.Error("查询团队用户时出错 ->", err) @@ -227,7 +227,7 @@ limit ?;` for _, member := range members { item := KeyValueItem{} item.Id = member.MemberId - item.Text = member.Account + item.Text = member.Account + "(" + member.RealName + ")" items = append(items, item) } result.Result = items @@ -235,9 +235,9 @@ limit ?;` return &result, err } -func (m *TeamMember) FindByBookIdAndMemberId(bookId,memberId int) (*TeamMember, error) { +func (m *TeamMember) FindByBookIdAndMemberId(bookId, memberId int) (*TeamMember, error) { if bookId <= 0 || memberId <= 0 { - return nil,ErrInvalidParameter + return nil, ErrInvalidParameter } //一个用户可能在多个团队中,且一个项目可能有多个团队参与。因此需要查询用户最大权限。 sql := `select * @@ -247,11 +247,11 @@ and team.member_id = ? order by team.role_id asc limit 1;` o := orm.NewOrm() - err := o.Raw(sql,bookId,memberId).QueryRow(m) + err := o.Raw(sql, bookId, memberId).QueryRow(m) if err != nil { - beego.Error("查询用户项目所在团队失败 ->bookId=",bookId," memberId=", memberId, err) - return nil,err + beego.Error("查询用户项目所在团队失败 ->bookId=", bookId, " memberId=", memberId, err) + return nil, err } - return m,nil + return m, nil } diff --git a/routers/router.go b/routers/router.go index d4c497f5..44e743b4 100644 --- a/routers/router.go +++ b/routers/router.go @@ -9,6 +9,8 @@ func init() { beego.Router("/", &controllers.HomeController{}, "*:Index") beego.Router("/login", &controllers.AccountController{}, "*:Login") + beego.Router("/token", &controllers.AccountController{}, "get:TmpLogin") + beego.Router("/dingtalk_login", &controllers.AccountController{}, "*:DingTalkLogin") beego.Router("/logout", &controllers.AccountController{}, "*:Logout") beego.Router("/register", &controllers.AccountController{}, "*:Register") beego.Router("/find_password", &controllers.AccountController{}, "*:FindPassword") diff --git a/static/css/main.css b/static/css/main.css index 8e8d9913..da965f2d 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -1037,6 +1037,24 @@ textarea{ margin-left: 0; } } +.navbar-mobile { + display: inline-block; + padding: 10px 0; + font-size: 14px; + line-height: 30px; + color: #563d7c; +} +.navbar-mobile a { + padding-right: 5px; +} + +@media (min-width: 768px) { + .navbar-mobile { + display: none !important; + } +} + + diff --git a/static/js/dingtalk-jsapi.js b/static/js/dingtalk-jsapi.js new file mode 100644 index 00000000..8f0f7ea6 --- /dev/null +++ b/static/js/dingtalk-jsapi.js @@ -0,0 +1 @@ +(function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.dd=t():e.dd=t()})(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=707)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(180),i=n(2);t.ENV_ENUM=i.ENV_ENUM,t.ENV_ENUM_SUB=i.ENV_ENUM_SUB;var a=n(3);n(186),t.ddSdk=new a.Sdk(r.getENV(),o.log)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addWatchParamsDeal=function(e){var t=Object.assign({},e);return t.watch=!0,t},t.addDefaultCorpIdParamsDeal=function(e){var t=Object.assign({},e);return t.corpId="corpId",t},t.genDefaultParamsDealFn=function(e){var t=Object.assign({},e);return function(e){return Object.assign({},t,e)}},t.forceChangeParamsDealFn=function(e){var t=Object.assign({},e);return function(e){return Object.assign(e,t)}},t.genBoolResultDealFn=function(e){return function(t){var n=Object.assign({},t);return e.forEach(function(e){void 0!==n[e]&&(n[e]=!!n[e])}),n}},t.genBizStoreParamsDealFn=function(e){var t=Object.assign({},e);return"string"!=typeof t.params?(t.params=JSON.stringify(t),t):t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(3),o=n(3);t.ENV_ENUM=o.ENV_ENUM,t.APP_TYPE=o.APP_TYPE,t.ENV_ENUM_SUB=o.ENV_ENUM_SUB;var i,a=n(183);(function(e){e.singlePage="singlePage",e.miniApp="miniApp",e.miniWidget="miniWidget"})(i||(i={})),t.getUA=function(){var e="";try{"undefined"!=typeof navigator&&(e=navigator&&(navigator.userAgent||navigator.swuserAgent)||"")}catch(t){e=""}return e},t.getENV=function(){var e=t.getUA(),n=/iPhone|iPad|iPod|iOS/i.test(e),o=/Android/i.test(e),s=/Nebula/i.test(e),d=/DingTalk/i.test(e),u=/dd-web/i.test(e),c="object"==typeof nuva,l="object"==typeof dd&&"function"==typeof dd.dtBridge,f=l&&n||c&&n,v=d||a.default.isDingTalk,p=n&&v||a.default.isWeexiOS||f,_=o&&v||a.default.isWeexAndroid,E=s&&v||l,N=u,P=r.APP_TYPE.WEB;if(N)P=r.APP_TYPE.WEBVIEW_IN_MINIAPP;else if(E)P=r.APP_TYPE.MINI_APP;else if(a.default.isWeexiOS||a.default.isWeexAndroid)try{var M=weex.config.ddWeexEnv;P=M===i.miniWidget?r.APP_TYPE.WEEX_WIDGET:r.APP_TYPE.WEEX}catch(e){P=r.APP_TYPE.WEEX}var h,m="*",k=e.match(/AliApp\(\w+\/([a-zA-Z0-9.-]+)\)/);null===k&&(k=e.match(/DingTalk\/([a-zA-Z0-9.-]+)/));var b;k&&k[1]&&(b=k[1]);var g="";if("undefined"!=typeof name&&(g=name),g)try{var I=JSON.parse(g);I.hostVersion&&(b=I.hostVersion),m=I.language||navigator.language||"*",h=I.containerId}catch(e){}var y=!!h;y&&!b&&(k=e.match(/DingTalk\(([a-zA-Z0-9\.-]+)\)/))&&k[1]&&(b=k[1]);var A,S=r.ENV_ENUM_SUB.noSub;if(p)A=r.ENV_ENUM.ios;else if(_)A=r.ENV_ENUM.android;else if(y){var V=e.indexOf("Macintosh; Intel Mac OS")>-1;S=V?r.ENV_ENUM_SUB.mac:r.ENV_ENUM_SUB.win,A=r.ENV_ENUM.pc}else A=r.ENV_ENUM.notInDingTalk;return{platform:A,platformSub:S,version:b,appType:P,language:m}}},function(e,t,n){"use strict";function r(e,t){var n=e&&e.vs;return"object"==typeof n&&(n=n[t.platformSub]),n}Object.defineProperty(t,"__esModule",{value:!0});var o=n(189);t.APP_TYPE=o.APP_TYPE,t.LogLevel=o.LogLevel,t.isFunction=o.isFunction,t.compareVersion=o.compareVersion,t.ENV_ENUM=o.ENV_ENUM,t.ENV_ENUM_SUB=o.ENV_ENUM_SUB;var i=function(){function e(e,t){var n=this;this.configJsApiList=[],this.hadConfig=!1,this.p={},this.config$=new Promise(function(e,t){n.p.reject=t,n.p.resolve=e}),this.logQueue=[],this.devConfig={debug:!1},this.platformConfigMap={},this.invokeAPIConfigMapByMethod={},this.isBridgeDrity=!0,this.getExportSdk=function(){return n.exportSdk},this.setAPI=function(e,t){n.invokeAPIConfigMapByMethod[e]=t},this.setPlatform=function(e){n.isBridgeDrity=!0,n.platformConfigMap[e.platform]=e,e.platform===n.env.platform&&e.bridgeInit().catch(function(e){n.customLog(o.LogLevel.WARNING,["auto bridgeInit error",e||""])})},this.getPlatformConfigMap=function(){return n.platformConfigMap},this.deleteApiConfig=function(e,t){var r=n.invokeAPIConfigMapByMethod[e];r&&delete r[t]},this.invokeAPI=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i=!0),n.customLog(o.LogLevel.INFO,['==> "'+e+'" params: ',t]);var a=+new Date,s=a+"_"+Math.floor(1e3*Math.random());if(n.devConfig.onBeforeInvokeAPI)try{n.devConfig.onBeforeInvokeAPI({invokeId:s,method:e,params:t,startTime:a})}catch(e){n.customLog(o.LogLevel.ERROR,["call Hook:onBeforeInvokeAPI failed, reason:",e])}return!1===n.devConfig.isAuthApi&&(i=!1),n.bridgeInitFn().then(function(d){var u=n.invokeAPIConfigMapByMethod[e],c=n.devConfig.forceEnableDealApiFnMap&&n.devConfig.forceEnableDealApiFnMap[e]&&!0===n.devConfig.forceEnableDealApiFnMap[e](t),l=!c&&(!0===n.devConfig.isDisableDeal||n.devConfig.disbaleDealApiWhiteList&&-1!==n.devConfig.disbaleDealApiWhiteList.indexOf(e));if(u||!i){var f;if(u&&(f=u[n.env.platform]),f||!i){var v={};v=!l&&f&&f.paramsDeal&&o.isFunction(f.paramsDeal)?f.paramsDeal(t):Object.assign({},t);var p=function(e){return!l&&f&&f.resultDeal&&o.isFunction(f.resultDeal)?f.resultDeal(e):e};if(o.isFunction(v.onSuccess)){var _=v.onSuccess;v.onSuccess=function(e){_(p(e))}}return d(e,v).then(p,function(t){var a=n.hadConfig&&void 0===n.isReady&&-1!==n.configJsApiList.indexOf(e),s="object"==typeof t&&"string"==typeof t.errorCode&&t.errorCode===o.ERROR_CODE.no_permission,u="object"==typeof t&&"string"==typeof t.errorCode&&t.errorCode===o.ERROR_CODE.cancel,c=r(f,n.env),l=c&&n.env.version&&o.compareVersion(n.env.version,c),_=(n.env.platform===o.ENV_ENUM.ios||n.env.platform===o.ENV_ENUM.android)&&a&&s,E=n.env.platform===o.ENV_ENUM.pc&&a&&(l&&!u&&i||s);return _||E?n.config$.then(function(){return d(e,v).then(p)}):Promise.reject(t)}).then(function(r){if(n.devConfig.onAfterInvokeAPI)try{n.devConfig.onAfterInvokeAPI({invokeId:s,method:e,params:t,payload:r,isSuccess:!0,startTime:a,duration:+new Date-a})}catch(e){n.customLog(o.LogLevel.ERROR,["call Hook:onAfterInvokeAPI failed, reason:",e])}return n.customLog(o.LogLevel.INFO,['<== "'+e+'" success result: ',r]),r},function(r){if(n.devConfig.onAfterInvokeAPI)try{n.devConfig.onAfterInvokeAPI({invokeId:s,method:e,params:t,payload:r,startTime:a,duration:+new Date-a,isSuccess:!1})}catch(r){n.customLog(o.LogLevel.ERROR,["call Hook:onAfterInvokeAPI failed, reason:",r])}return n.customLog(o.LogLevel.WARNING,['<== "'+e+'" fail result: ',r]),Promise.reject(r)})}var E='"'+e+'" do not support the current platform ('+n.env.platform+")";return n.customLog(o.LogLevel.ERROR,[E]),Promise.reject({errorCode:o.ERROR_CODE.jsapi_internal_error,errorMessage:E})}var E="This API method is not configured for the platform ("+n.env.platform+")";return n.customLog(o.LogLevel.ERROR,[E]),Promise.reject({errorCode:o.ERROR_CODE.jsapi_internal_error,errorMessage:E})})},this.customLog=function(e,t){var r={level:e,text:t,time:new Date};if(!0===n.devConfig.debug)n.customLogInstance(r);else{n.logQueue.push(r);n.logQueue.length>10&&(n.logQueue=n.logQueue.slice(n.logQueue.length-10))}},this.clearLogQueue=function(){n.logQueue.forEach(function(e){n.customLogInstance(e)}),n.logQueue=[]},this.customLogInstance=t,this.env=e,this.bridgeInitFn=function(){if(n.bridgeInitFnPromise&&!n.isBridgeDrity)return n.bridgeInitFnPromise;n.isBridgeDrity=!1;var t=n.platformConfigMap[e.platform];if(t)n.bridgeInitFnPromise=t.bridgeInit().catch(function(e){return n.customLog(o.LogLevel.ERROR,["\b\b\b\b\bJsBridge initialization fails, jsapi will not work"]),Promise.reject(e)});else{var r="Do not support the current environment:"+e.platform;n.customLog(o.LogLevel.WARNING,[r]),n.bridgeInitFnPromise=Promise.reject(new Error(r))}return n.bridgeInitFnPromise};var i=function(e){void 0===e&&(e={}),n.devConfig=Object.assign(n.devConfig,e),!0===e.debug&&n.clearLogQueue(),e.extraPlatform&&n.setPlatform(e.extraPlatform)};this.exportSdk={config:function(t){void 0===t&&(t={});var r=!0;Object.keys(t).forEach(function(e){-1===["debug","usePromise"].indexOf(e)&&(r=!1)}),r?(n.customLog(o.LogLevel.WARNING,["This is a deprecated feature, recommend use dd.devConfig"]),i(t)):n.hadConfig?n.customLog(o.LogLevel.WARNING,["Config has been executed"]):(t.jsApiList&&(n.configJsApiList=t.jsApiList),n.hadConfig=!0,n.bridgeInitFn().then(function(r){var o=n.platformConfigMap[e.platform],i=t;o.authParamsDeal&&(i=o.authParamsDeal(i)),r(o.authMethod,i).then(function(e){n.isReady=!0,n.p.resolve(e)}).catch(function(e){n.isReady=!1,n.p.reject(e)})},function(){n.customLog(o.LogLevel.ERROR,['\b\b\b\b\bJsBridge initialization failed and "dd.config" failed to call'])}))},devConfig:i,ready:function(e){!1===n.hadConfig?(n.customLog(o.LogLevel.WARNING,["You don 't use a dd.config, so you don't need to wrap dd.ready, recommend remove dd.ready"]),n.bridgeInitFn().then(function(){e()})):n.config$.then(function(t){e()})},error:function(e){n.config$.catch(function(t){e(t)})},on:function(t,r){n.bridgeInitFn().then(function(){n.platformConfigMap[e.platform].event.on(t,r)})},off:function(t,r){n.bridgeInitFn().then(function(){n.platformConfigMap[e.platform].event.off(t,r)})},env:e,checkJsApi:function(t){void 0===t&&(t={});var i={};return t.jsApiList&&t.jsApiList.forEach(function(t){var a=n.invokeAPIConfigMapByMethod[t];if(a){var s=a[e.platform],d=r(s,e);d&&e.version&&o.compareVersion(e.version,d)&&(i[t]=!0)}i[t]||(i[t]=!1)}),Promise.resolve(i)},_invoke:function(e,t){return void 0===t&&(t={}),n.invokeAPI(e,t,!1)}}}return e}();t.Sdk=i},function(e,t,n){(function(t,n){e.exports=n()})(0,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=579)}({179:function(e,t,n){"use strict";var r=n(181);e.exports=r},181:function(e,t,n){"use strict";var r=n(183),o=n(184),i=n(182),a=n(185),s=new i,d=!1,u="",c=null,l={},f=/{.*}/;try{var v=window.name.match(f);if(v&&v[0])var l=JSON.parse(v[0])}catch(e){l={}}l.hostOrigin&&".dingtalk.com"===l.hostOrigin.split(":")[1].slice(0-".dingtalk.com".length)&&l.containerId&&(d=!0,u=l.hostOrigin,c=l.containerId);var p={},_=new Promise(function(e,t){p._resolve=e,p._reject=t}),E={},N=null;window.top!==window&&(N=window.top,p._resolve()),E[a.SYS_INIT]=function(e){N=e.frameWindow,p._resolve(),e.respond({})},window.addEventListener("message",function(e){var t=e.data,n=e.origin;if(n===u)if("response"===t.type&&t.msgId){var r=t.msgId,i=s.getMsyById(r);i&&i.receiveResponse(t.body,!t.success)}else if("event"===t.type&&t.msgId){var r=t.msgId,i=s.getMsyById(r);i&&i.receiveEvent(t.eventName,t.body)}else if("request"===t.type&&t.msgId){var i=new o(e.source,n,t);E[i.methodName]&&E[i.methodName](i)}}),t.invokeAPI=function(e,t){var n=new r(c,e,t);return d&&_.then(function(){N&&N.postMessage(n.getPayload(),u),s.addPending(n)}),n};var P=null;t.addEventListener=function(e,n){P||(P=t.invokeAPI(a.SYS_EVENT,{})),P.addEventListener(e,n)},t.removeEventListener=function(e,t){P&&P.removeEventListener(e,t)}},182:function(e,t,n){"use strict";var r=function(){this.pendingMsgs={}};r.prototype.addPending=function(e){this.pendingMsgs[e.id]=e;var t=function(){delete this.pendingMsgs[e.id],e.removeEventListener("_finish",t)}.bind(this);e.addEventListener("_finish",t)},r.prototype.getMsyById=function(e){return this.pendingMsgs[e]},e.exports=r},183:function(e,t,n){"use strict";var r=n(574),o=n(573),i=0,a=Math.floor(1e3*Math.random()),s=function(){return 1e3*(1e3*a+Math.floor(1e3*Math.random()))+ ++i%1e3},d={code:408,reason:"timeout"},u={TIMEOUT:"_timeout",FINISH:"_finish"},c={timeout:-1},l=function(e,t,n,r){this.id=s(),this.methodName=t,this.containerId=e,this.option=o({},c,r);var n=n||{};this._p={},this.result=new Promise(function(e,t){this._p._resolve=e,this._p._reject=t}.bind(this)),this.callbacks={},this.plainMsg=this._handleMsg(n),this._eventsHandle={},this._timeoutTimer=null,this._initTimeout(),this.isFinish=!1};l.prototype._initTimeout=function(){this._clearTimeout(),this.option.timeout>0&&(this._timeoutTimer=setTimeout(function(){this.receiveEvent(u.TIMEOUT),this.receiveResponse(d,!0)}.bind(this),this.option.timeout))},l.prototype._clearTimeout=function(){clearTimeout(this._timeoutTimer)},l.prototype._handleMsg=function(e){var t={};return Object.keys(e).forEach(function(n){var o=e[n];"function"==typeof o&&"on"===n.slice(0,2)?this.callbacks[n]=o:t[n]=r(o)}.bind(this)),t},l.prototype.getPayload=function(){return{msgId:this.id,containerId:this.containerId,methodName:this.methodName,body:this.plainMsg,type:"request"}},l.prototype.receiveEvent=function(e,t){if(this.isFinish&&e!==u.FINISH)return!1;e!==u.FINISH&&e!==u.TIMEOUT&&this._initTimeout(),Array.isArray(this._eventsHandle[e])&&this._eventsHandle[e].forEach(function(e){try{e(t)}catch(e){console.error(t)}});var n="on"+e.charAt(0).toUpperCase()+e.slice(1);return this.callbacks[n]&&this.callbacks[n](t),!0},l.prototype.addEventListener=function(e,t){if(!e||"function"!=typeof t)throw"eventName is null or handle is not a function, addEventListener fail";Array.isArray(this._eventsHandle[e])||(this._eventsHandle[e]=[]),this._eventsHandle[e].push(t)},l.prototype.removeEventListener=function(e,t){if(!e||!t)throw"eventName is null or handle is null, invoke removeEventListener fail";if(Array.isArray(this._eventsHandle[e])){var n=this._eventsHandle[e].indexOf(t);-1!==n&&this._eventsHandle[e].splice(n,1)}},l.prototype.receiveResponse=function(e,t){if(!0===this.isFinish)return!1;this._clearTimeout();var t=!!t;return t?this._p._reject(e):this._p._resolve(e),setTimeout(function(){this.receiveEvent(u.FINISH)}.bind(this),0),this.isFinish=!0,!0},e.exports=l},184:function(e,t,n){"use strict";var r=function(e,t,n){if(this._msgId=n.msgId,this.frameWindow=e,this.methodName=n.methodName,this.clientOrigin=t,this.containerId=n.containerId,this.params=n.body,!this._msgId)throw"msgId not exist";if(!this.frameWindow)throw"frameWindow not exist";if(!this.methodName)throw"methodName not exits";if(!this.clientOrigin)throw"clientOrigin not exist";this.hasResponded=!1};r.prototype.respond=function(e,t){var t=!!t;if(!0!==this.hasResponded){var n={type:"response",success:!t,body:e,msgId:this._msgId};this.frameWindow.postMessage(n,this.clientOrigin),this.hasResponded=!0}},r.prototype.emit=function(e,t){var n={type:"event",eventName:e,body:t,msgId:this._msgId};this.frameWindow.postMessage(n,this.clientOrigin)},e.exports=r},185:function(e,t,n){"use strict";e.exports={SYS_EVENT:"SYS_openAPIContainerInitEvent",SYS_INIT:"SYS_openAPIContainerInit"}},4:function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},572:function(e,t,n){(function(e,n){function r(e,t){return e.set(t[0],t[1]),e}function o(e,t){return e.add(t),e}function i(e,t){for(var n=-1,r=e.length;++n-1}function g(e,t){var n=this.__data__,r=W(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}function I(e){var t=-1,n=e?e.length:0;for(this.clear();++t-1&&e%1==0&&e-1&&e%1==0&&e<=Ve}function ke(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function be(e){return!!e&&"object"==typeof e}function ge(e){return!!ke(e)&&(he(e)||c(e)?Pt:tt).test(_e(e))}function Ie(e){return"string"==typeof e||!Lt(e)&&be(e)&&Nt.call(e)==xe}function ye(e){var t=pe(e);if(!t&&!Pe(e))return z(e);var n=le(e),r=!!n,o=n||[],i=o.length;for(var a in e)!B(e,a)||r&&("length"==a||fe(a,i))||t&&"constructor"==a||o.push(a);return o}var Ae=200,Se="__lodash_hash_undefined__",Ve=9007199254740991,Ue="[object Arguments]",Oe="[object Boolean]",je="[object Date]",$e="[object Function]",we="[object GeneratorFunction]",De="[object Map]",Ce="[object Number]",Te="[object Object]",We="[object RegExp]",Re="[object Set]",xe="[object String]",Fe="[object Symbol]",Le="[object ArrayBuffer]",Be="[object DataView]",ze="[object Float32Array]",qe="[object Float64Array]",Ye="[object Int8Array]",Je="[object Int16Array]",Ge="[object Int32Array]",He="[object Uint8Array]",Xe="[object Uint8ClampedArray]",Ke="[object Uint16Array]",Qe="[object Uint32Array]",Ze=/[\\^$.*+?()[\]{}|]/g,et=/\w*$/,tt=/^\[object .+?Constructor\]$/,nt=/^(?:0|[1-9]\d*)$/,rt={};rt[Ue]=rt["[object Array]"]=rt[Le]=rt[Be]=rt[Oe]=rt[je]=rt[ze]=rt[qe]=rt[Ye]=rt[Je]=rt[Ge]=rt[De]=rt[Ce]=rt[Te]=rt[We]=rt[Re]=rt[xe]=rt[Fe]=rt[He]=rt[Xe]=rt[Ke]=rt[Qe]=!0,rt["[object Error]"]=rt[$e]=rt["[object WeakMap]"]=!1;var ot={function:!0,object:!0},it=ot[typeof t]&&t&&!t.nodeType?t:void 0,at=ot[typeof e]&&e&&!e.nodeType?e:void 0,st=at&&at.exports===it?it:void 0,dt=u(it&&at&&"object"==typeof n&&n),ut=u(ot[typeof self]&&self),ct=u(ot[typeof window]&&window),lt=u(ot[typeof this]&&this),ft=dt||ct!==(lt&<.window)&&ct||ut||lt||Function("return this")(),vt=Array.prototype,pt=Object.prototype,_t=Function.prototype.toString,Et=pt.hasOwnProperty,Nt=pt.toString,Pt=RegExp("^"+_t.call(Et).replace(Ze,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Mt=st?ft.Buffer:void 0,ht=ft.Symbol,mt=ft.Uint8Array,kt=Object.getOwnPropertySymbols,bt=Object.create,gt=pt.propertyIsEnumerable,It=vt.splice,yt=Object.getPrototypeOf,At=Object.keys,St=oe(ft,"DataView"),Vt=oe(ft,"Map"),Ut=oe(ft,"Promise"),Ot=oe(ft,"Set"),jt=oe(ft,"WeakMap"),$t=oe(Object,"create"),wt=_e(St),Dt=_e(Vt),Ct=_e(Ut),Tt=_e(Ot),Wt=_e(jt),Rt=ht?ht.prototype:void 0,xt=Rt?Rt.valueOf:void 0;v.prototype.clear=p,v.prototype.delete=_,v.prototype.get=E,v.prototype.has=N,v.prototype.set=P,M.prototype.clear=h,M.prototype.delete=m,M.prototype.get=k,M.prototype.has=b,M.prototype.set=g,I.prototype.clear=y,I.prototype.delete=A,I.prototype.get=S,I.prototype.has=V,I.prototype.set=U,O.prototype.clear=j,O.prototype.delete=$,O.prototype.get=w,O.prototype.has=D,O.prototype.set=C;var Ft=function(e){return function(e){return null==e?void 0:e.length}}();kt||(ae=function(){return[]}),(St&&se(new St(new ArrayBuffer(1)))!=Be||Vt&&se(new Vt)!=De||Ut&&"[object Promise]"!=se(Ut.resolve())||Ot&&se(new Ot)!=Re||jt&&"[object WeakMap]"!=se(new jt))&&(se=function(e){var t=Nt.call(e),n=t==Te?e.constructor:void 0,r=n?_e(n):void 0;if(r)switch(r){case wt:return Be;case Dt:return De;case Ct:return"[object Promise]";case Tt:return Re;case Wt:return"[object WeakMap]"}return t});var Lt=Array.isArray,Bt=Mt?function(e){return e instanceof Mt}:function(e){return function(){return!1}}();e.exports=x}).call(t,n(577)(e),n(4))},573:function(e,t,n){function r(e,t,n){var r=e[t];h.call(e,t)&&d(r,n)&&(void 0!==n||t in e)||(e[t]=n)}function o(e,t,n,o){n||(n={});for(var i=-1,a=t.length;++i-1&&e%1==0&&e-1&&e%1==0&&e<=_}function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var v=n(575),p=n(576),_=9007199254740991,E="[object Function]",N="[object GeneratorFunction]",P=/^(?:0|[1-9]\d*)$/,M=Object.prototype,h=M.hasOwnProperty,m=M.toString,k=M.propertyIsEnumerable,b=!k.call({valueOf:1},"valueOf"),g=function(e){return function(e){return null==e?void 0:e.length}}(),I=function(e){return p(function(t,n){var r=-1,o=n.length,i=o>1?n[o-1]:void 0,s=o>2?n[2]:void 0;for(i=e.length>3&&"function"==typeof i?(o--,i):void 0,s&&a(n[0],n[1],s)&&(i=o<3?void 0:i,o=1),t=Object(t);++r-1&&e%1==0&&e-1&&e%1==0&&e<=_}function f(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function v(e){return!!e&&"object"==typeof e}function p(e){return d(e)?r(e):o(e)}var _=9007199254740991,E="[object Arguments]",N="[object Function]",P="[object GeneratorFunction]",M=/^(?:0|[1-9]\d*)$/,h=Object.prototype,m=h.hasOwnProperty,k=h.toString,b=h.propertyIsEnumerable,g=function(e,t){return function(n){return e(t(n))}}(Object.keys,Object),I=Array.isArray;e.exports=p},576:function(e,t){function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function r(e,t){return t=b(void 0===t?e.length-1:t,0),function(){for(var r=arguments,o=-1,i=b(r.length-t,0),a=Array(i);++o0;)o=a.shift(),i=s.shift();return n?(i||0)>=(o||0):(i||0)>(o||0)},t.language=o.language,t.version=o.version},function(e,t,n){"use strict";function r(e,t,n){var r="Web"===n.platform,i="iOS"===n.platform,a="android"===n.platform,s=a||i,d=function(){return r?window.navigator.userAgent.toLowerCase():""}(),u=function(){var e={};if(r){var t=window.name;try{var n=JSON.parse(t);e.containerId=n.containerId,e.version=n.hostVersion,e.language=n.language||"*"}catch(e){}}return e}(),c=function(){return s?"DingTalk"===n.appName||"com.alibaba.android.rimet"===n.appName:d.indexOf("dingtalk")>-1||!!u.containerId}(),l=function(){if(r){if(u.version)return u.version;var e=d.match(/aliapp\(\w+\/([a-zA-Z0-9.-]+)\)/);null===e&&(e=d.match(/dingtalk\/([a-zA-Z0-9.-]+)/));return e&&e[1]||"Unknown"}return n.appVersion}(),f=!!u.containerId,v=/iphone|ipod|ios/.test(d),p=/ipad/.test(d),_=d.indexOf("android")>-1,E=d.indexOf("mac")>-1&&f,N=d.indexOf("win")>-1&&f,P=!E&&!N&&f,M=f,h="";return h=c?v||i?o.PLATFORM.IOS:_||a?o.PLATFORM.ANDROID:p?o.PLATFORM.IPAD:E?o.PLATFORM.MAC:N?o.PLATFORM.WINDOWS:P?o.PLATFORM.BROWSER:o.PLATFORM.UNKNOWN:o.PLATFORM.UNKNOWN,{isDingTalk:c,isWebiOS:v,isWebAndroid:_,isWeexiOS:i,isWeexAndroid:a,isDingTalkPCMac:E,isDingTalkPCWeb:P,isDingTalkPCWindows:N,isDingTalkPC:M,runtime:e,framework:t,platform:h,version:l,isWeex:s}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(11);t.default=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(184),o=n(182),i=n(11),a=r.default().split("."),s=a[0],d=a[1],u=function(){var e={};switch(d){case i.FRAMEWORK.VUE:var t=weex.config,n=t.env;e.platform=n.platform,i.RUNTIME.WEEX===s&&(e.appVersion=n.appVersion,e.appName=n.appName);break;case i.FRAMEWORK.RAX:i.RUNTIME.WEEX===s&&(e.platform=navigator.platform,e.appName=navigator.appName,e.appVersion=navigator.appVersion);break;case i.FRAMEWORK.UNKNOWN:i.RUNTIME.WEB===s&&(e.platform=i.RUNTIME.WEB),i.RUNTIME.UNKNOWN===s&&(e.platform=i.RUNTIME.UNKNOWN)}return e}(),c=o.default(s,d,u);t.default=c},function(e,t,n){"use strict";function r(e,t){for(var n=e.length,r=0,o=!0;ro[i])return!0}return!0}Object.defineProperty(t,"__esModule",{value:!0}),t.isFunction=r,t.compareVersion=o;(function(e){e.cancel="-1",e.not_exist="1",e.no_permission="7",e.jsapi_internal_error="22"})(t.ERROR_CODE||(t.ERROR_CODE={}));(function(e){e.pc="pc",e.android="android",e.ios="ios",e.notInDingTalk="notInDingTalk"})(t.ENV_ENUM||(t.ENV_ENUM={}));(function(e){e.mac="mac",e.win="win",e.noSub="noSub"})(t.ENV_ENUM_SUB||(t.ENV_ENUM_SUB={}));(function(e){e.WEB="WEB",e.MINI_APP="MINI_APP",e.WEEX="WEEX",e.WEBVIEW_IN_MINIAPP="WEBVIEW_IN_MINIAPP",e.WEEX_WIDGET="WEEX_WIDGET"})(t.APP_TYPE||(t.APP_TYPE={}));(function(e){e[e.INFO=1]="INFO",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR"})(t.LogLevel||(t.LogLevel={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(2),i=n(3),a=n(5),s=n(9),d=n(176),u=n(6),c=n(8),l=n(10);r.ddSdk.setPlatform({platform:o.ENV_ENUM.android,bridgeInit:function(){var e=o.getENV();return e.appType===i.APP_TYPE.MINI_APP?Promise.resolve(a.default):e.appType===i.APP_TYPE.WEBVIEW_IN_MINIAPP?Promise.resolve(s.default):e.appType===i.APP_TYPE.WEEX?u.androidWeexBridge():d.h5AndroidbridgeInit().then(function(){return d.default})},authMethod:"runtime.permission.requestJsApis",event:{on:function(e,t){var n=o.getENV();switch(n.appType){case i.APP_TYPE.WEB:case i.APP_TYPE.WEBVIEW_IN_MINIAPP:c.on(e,t);break;case i.APP_TYPE.WEEX:l.on(e,t);break;default:throw new Error("Not support global event in the platfrom: "+n.appType)}},off:function(e,t){var n=o.getENV();switch(n.appType){case i.APP_TYPE.WEB:case i.APP_TYPE.WEBVIEW_IN_MINIAPP:c.off(e,t);break;case i.APP_TYPE.WEEX:l.off(e,t);break;default:throw new Error("Not support global event in the platfrom: "+n.appType)}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(193),n(190),n(192)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(2),i=n(3),a=n(5),s=n(9),d=n(177),u=n(6),c=n(8),l=n(10);r.ddSdk.setPlatform({platform:o.ENV_ENUM.ios,bridgeInit:function(){var e=o.getENV();return e.appType===i.APP_TYPE.MINI_APP?Promise.resolve(a.default):e.appType===i.APP_TYPE.WEBVIEW_IN_MINIAPP?Promise.resolve(s.default):e.appType===i.APP_TYPE.WEEX?u.iosWeexBridge():d.h5IosBridgeInit().then(function(){return d.default})},authMethod:"runtime.permission.requestJsApis",event:{on:function(e,t){var n=o.getENV();switch(n.appType){case i.APP_TYPE.WEB:case i.APP_TYPE.WEBVIEW_IN_MINIAPP:c.on(e,t);break;case i.APP_TYPE.WEEX:l.on(e,t);break;default:throw new Error("Not support global event in the platfrom: "+n.appType)}},off:function(e,t){var n=o.getENV();switch(n.appType){case i.APP_TYPE.WEB:case i.APP_TYPE.WEBVIEW_IN_MINIAPP:c.off(e,t);break;case i.APP_TYPE.WEEX:l.off(e,t);break;default:throw new Error("Not support global event in the platfrom: "+n.appType)}}}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(2),i=n(178),a=n(5),s=n(3),d=n(179);r.ddSdk.setPlatform({platform:o.ENV_ENUM.pc,bridgeInit:function(){switch(o.getENV().appType){case s.APP_TYPE.MINI_APP:return Promise.resolve(a.default);default:return i.h5PcBridgeInit().then(function(){return i.default})}},authMethod:"config",authParamsDeal:function(e){var t=Object.assign({},e);return t.url=window.location.href.split("#")[0],t},event:{on:function(e,t){if(o.getENV().appType===s.APP_TYPE.WEB)return d.on(e,t)},off:function(e,t){if(o.getENV().appType===s.APP_TYPE.WEB)return d.off(e,t)}}})},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){_&&v&&(_=!1,v.length?p=v.concat(p):E=-1,p.length&&s())}function s(){if(!_){var e=o(a);_=!0;for(var t=p.length;t;){for(v=p,p=[];++E1)for(var n=1;n=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(196),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,n(7))},,function(e,t,n){"use strict";var r=n(175),o=n(665),i=Object.assign(r,o.apiObj);e.exports=i},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(12),o=n(13),i=n(14),a=n(15),s=n(16),d=n(17),u=n(18),c=n(19),l=n(20),f=n(21),v=n(22),p=n(23),_=n(24),E=n(25),N=n(26),P=n(27),M=n(28),h=n(29),m=n(30),k=n(31),b=n(32),g=n(33),I=n(34),y=n(35),A=n(36),S=n(37),V=n(38),U=n(39),O=n(40),j=n(41),$=n(42),w=n(43),D=n(44),C=n(45),T=n(46),W=n(47),R=n(48),x=n(49),F=n(50),L=n(51),B=n(52),z=n(53),q=n(54),Y=n(55),J=n(56),G=n(57),H=n(58),X=n(59),K=n(60),Q=n(61),Z=n(62),ee=n(63),te=n(64),ne=n(65),re=n(66),oe=n(67),ie=n(68),ae=n(69),se=n(70),de=n(71),ue=n(72),ce=n(73),le=n(74),fe=n(75),ve=n(76),pe=n(77),_e=n(78),Ee=n(79),Ne=n(80),Pe=n(81),Me=n(82),he=n(83),me=n(84),ke=n(85),be=n(86),ge=n(87),Ie=n(88),ye=n(89),Ae=n(90),Se=n(91),Ve=n(92),Ue=n(93),Oe=n(94),je=n(95),$e=n(96),we=n(97),De=n(98),Ce=n(99),Te=n(100),We=n(101),Re=n(102),xe=n(103),Fe=n(104),Le=n(105),Be=n(106),ze=n(107),qe=n(108),Ye=n(109),Je=n(110),Ge=n(111),He=n(112),Xe=n(113),Ke=n(114),Qe=n(115),Ze=n(116),et=n(117),tt=n(118),nt=n(119),rt=n(120),ot=n(121),it=n(122),at=n(123),st=n(124),dt=n(125),ut=n(126),ct=n(127),lt=n(128),ft=n(129),vt=n(130),pt=n(131),_t=n(132),Et=n(133),Nt=n(134),Pt=n(135),Mt=n(136),ht=n(137),mt=n(138),kt=n(139),bt=n(140),gt=n(141),It=n(142),yt=n(143),At=n(144),St=n(145),Vt=n(146),Ut=n(147),Ot=n(148),jt=n(149),$t=n(150),wt=n(151),Dt=n(152),Ct=n(153),Tt=n(154),Wt=n(155),Rt=n(156),xt=n(157),Ft=n(158),Lt=n(159),Bt=n(160),zt=n(161),qt=n(162),Yt=n(163),Jt=n(164),Gt=n(165),Ht=n(166),Xt=n(167),Kt=n(168),Qt=n(169),Zt=n(170),en=n(171),tn=n(172),nn=n(173);t.apiObj={biz:{ATMBle:{beaconPicker:r.beaconPicker$,faceManager:o.faceManager$,punchModePicker:i.punchModePicker$},alipay:{pay:a.pay$},calendar:{chooseDateTime:s.chooseDateTime$,chooseHalfDay:d.chooseHalfDay$,chooseInterval:u.chooseInterval$,chooseOneDay:c.chooseOneDay$},chat:{chooseConversationByCorpId:l.chooseConversationByCorpId$,collectSticker:f.collectSticker$,createSceneGroup:v.createSceneGroup$,getRealmCid:p.getRealmCid$,locationChatMessage:_.locationChatMessage$,openSingleChat:E.openSingleChat$,pickConversation:N.pickConversation$,sendEmotion:P.sendEmotion$,toConversation:M.toConversation$},clipboardData:{setData:h.setData$},conference:{videoConfCall:m.videoConfCall$},contact:{choose:k.choose$,chooseMobileContacts:b.chooseMobileContacts$,complexPicker:g.complexPicker$,createGroup:I.createGroup$,departmentsPicker:y.departmentsPicker$,externalComplexPicker:A.externalComplexPicker$,externalEditForm:S.externalEditForm$,setRule:V.setRule$},cspace:{chooseSpaceDir:U.chooseSpaceDir$,delete:O.delete$,preview:j.preview$,saveFile:$.saveFile$},customContact:{choose:w.choose$,multipleChoose:D.multipleChoose$},ding:{create:C.create$,post:T.post$},event:{notifyWeex:W.notifyWeex$},intent:{fetchData:R.fetchData$},iot:{bind:x.bind$,bindMeetingRoom:F.bindMeetingRoom$,getDeviceProperties:L.getDeviceProperties$,invokeThingService:B.invokeThingService$,queryMeetingRoomList:z.queryMeetingRoomList$,setDeviceProperties:q.setDeviceProperties$,unbind:Y.unbind$},map:{locate:J.locate$,search:G.search$,view:H.view$},media:{compressVideo:X.compressVideo$},microApp:{openApp:K.openApp$},navigation:{close:Q.close$,goBack:Z.goBack$,hideBar:ee.hideBar$,quit:te.quit$,replace:ne.replace$,setIcon:re.setIcon$,setLeft:oe.setLeft$,setMenu:ie.setMenu$,setRight:ae.setRight$,setTitle:se.setTitle$},realm:{subscribe:de.subscribe$,unsubscribe:ue.unsubscribe$},shortCut:{addShortCut:ce.addShortCut$},store:{closeUnpayOrder:le.closeUnpayOrder$,createOrder:fe.createOrder$,getPayUrl:ve.getPayUrl$,inquiry:pe.inquiry$},telephone:{call:_e.call$,checkBizCall:Ee.checkBizCall$,quickCallList:Ne.quickCallList$,showCallMenu:Pe.showCallMenu$},user:{checkPassword:Me.checkPassword$,get:he.get$},util:{chosen:me.chosen$,datepicker:ke.datepicker$,datetimepicker:be.datetimepicker$,decrypt:ge.decrypt$,downloadFile:Ie.downloadFile$,encrypt:ye.encrypt$,isLocalFileExist:Ae.isLocalFileExist$,multiSelect:Se.multiSelect$,open:Ve.open$,openLink:Ue.openLink$,openLocalFile:Oe.openLocalFile$,openModal:je.openModal$,openSlidePanel:$e.openSlidePanel$,presentWindow:we.presentWindow$,previewImage:De.previewImage$,previewVideo:Ce.previewVideo$,scan:Te.scan$,scanCard:We.scanCard$,setScreenBrightnessAndKeepOn:Re.setScreenBrightnessAndKeepOn$,share:xe.share$,startDocSign:Fe.startDocSign$,systemShare:Le.systemShare$,timepicker:Be.timepicker$,uploadAttachment:ze.uploadAttachment$,uploadImage:qe.uploadImage$,uploadImageFromCamera:Ye.uploadImageFromCamera$,ut:Je.ut$},verify:{openBindIDCard:Ge.openBindIDCard$,startAuth:He.startAuth$}},channel:{permission:{requestAuthCode:Xe.requestAuthCode$}},device:{accelerometer:{clearShake:Ke.clearShake$,watchShake:Qe.watchShake$},audio:{download:Ze.download$,onPlayEnd:et.onPlayEnd$,onRecordEnd:tt.onRecordEnd$,pause:nt.pause$,play:rt.play$,resume:ot.resume$,startRecord:it.startRecord$,stop:at.stop$,stopRecord:st.stopRecord$,translateVoice:dt.translateVoice$},base:{getInterface:ut.getInterface$,getPhoneInfo:ct.getPhoneInfo$,getUUID:lt.getUUID$,getWifiStatus:ft.getWifiStatus$},connection:{getNetworkType:vt.getNetworkType$},geolocation:{checkPermission:pt.checkPermission$,get:_t.get$,start:Et.start$,status:Nt.status$,stop:Pt.stop$},launcher:{checkInstalledApps:Mt.checkInstalledApps$,launchApp:ht.launchApp$},nfc:{nfcRead:mt.nfcRead$,nfcStop:kt.nfcStop$,nfcWrite:bt.nfcWrite$},notification:{actionSheet:gt.actionSheet$,alert:It.alert$,confirm:yt.confirm$,extendModal:At.extendModal$,hidePreloader:St.hidePreloader$,modal:Vt.modal$,prompt:Ut.prompt$,showPreloader:Ot.showPreloader$,toast:jt.toast$,vibrate:$t.vibrate$},screen:{insetAdjust:wt.insetAdjust$,resetView:Dt.resetView$,rotateView:Ct.rotateView$}},net:{bjGovApn:{loginGovNet:Tt.loginGovNet$}},runtime:{message:{fetch:Wt.fetch$,post:Rt.post$},permission:{requestAuthCode:xt.requestAuthCode$,requestOperateAuthCode:Ft.requestOperateAuthCode$}},ui:{input:{plain:Lt.plain$},nav:{close:Bt.close$,getCurrentId:zt.getCurrentId$,go:qt.go$,preload:Yt.preload$,recycle:Jt.recycle$},progressBar:{setColors:Gt.setColors$},pullToRefresh:{disable:Ht.disable$,enable:Xt.enable$,stop:Kt.stop$},webViewBounce:{disable:Qt.disable$,enable:Zt.enable$}},util:{domainStorage:{getItem:en.getItem$,removeItem:tn.removeItem$,setItem:nn.setItem$}}}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(199)}])}); \ No newline at end of file diff --git a/utils/dingtalk/dingtalk.go b/utils/dingtalk/dingtalk.go new file mode 100644 index 00000000..b4631dee --- /dev/null +++ b/utils/dingtalk/dingtalk.go @@ -0,0 +1,107 @@ +package dingtalk + +import ( + "crypto/hmac" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/http" + "net/url" +) + +// DingTalkAgent 用于钉钉交互 +type DingTalkAgent struct { + AppSecret string + AppKey string + AccessToken string +} + +// NewDingTalkAgent 钉钉交互构造函数 +func NewDingTalkAgent(appSecret, appKey string) *DingTalkAgent { + return &DingTalkAgent{ + AppSecret: appSecret, + AppKey: appKey, + } +} + +// GetUserNameByCode 通过临时code获取当前用户信息 +func (d *DingTalkAgent) GetUserNameByCode(code string) (string, error) { + urlEndpoint, err := url.Parse("https://oapi.dingtalk.com/user/getuserinfo") + if err != nil { + return "", err + } + + query := url.Values{} + query.Set("access_token", d.AccessToken) + query.Set("code", code) + + urlEndpoint.RawQuery = query.Encode() + urlPath := urlEndpoint.String() + + resp, err := http.Get(urlPath) + if err != nil { + return "", err + } + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return "", err + } + + // 解析钉钉返回数据 + var rdata map[string]interface{} + err = json.Unmarshal(body, &rdata) + if err != nil { + return "", err + } + + errcode := rdata["errcode"].(float64) + if errcode != 0 { + return "", errors.New(fmt.Sprintf("登录错误: %.0f, %s", errcode, rdata["errmsg"].(string))) + } + + username := rdata["name"].(string) + return username, nil +} + +// GetAccesstoken 获取钉钉请求Token +func (d *DingTalkAgent) GetAccesstoken() (err error) { + + url := fmt.Sprintf("https://oapi.dingtalk.com/gettoken?appkey=%s&appsecret=%s", d.AppKey, d.AppSecret) + resp, err := http.Get(url) + if err != nil { + return err + } + body, err := ioutil.ReadAll(resp.Body) + if err != nil { + return err + } + + var i map[string]interface{} + err = json.Unmarshal(body, &i) + if err != nil { + return err + } + + if i["errcode"].(float64) == 0 { + d.AccessToken = i["access_token"].(string) + return nil + } + return errors.New("accesstoken获取错误:" + i["errmsg"].(string)) +} + +func (d *DingTalkAgent) encodeSHA256(message string) string { + // 钉钉签名算法实现 + h := hmac.New(sha256.New, []byte(d.AppSecret)) + h.Write([]byte(message)) + sum := h.Sum(nil) // 二进制流 + tmpMsg := base64.StdEncoding.EncodeToString(sum) + + uv := url.Values{} + uv.Add("0", tmpMsg) + message = uv.Encode()[2:] + + return message +} diff --git a/views/account/login.tpl b/views/account/login.tpl index 9aaf2a47..854bef0f 100644 --- a/views/account/login.tpl +++ b/views/account/login.tpl @@ -86,6 +86,47 @@ + + +
@@ -40,6 +53,7 @@ {{.Model.BookName}}
+ 首页