Compare commits

...

31 Commits

Author SHA1 Message Date
hoteas e49164fa81 使用go mod 2022-03-13 01:12:29 +08:00
hoteas 8265e24add 使用go mod 2022-03-13 01:00:59 +08:00
hoteas 283985df52 删除无关代码 2022-03-13 00:26:01 +08:00
hoteas 95adca04bd 删除无关代码 2022-03-13 00:24:36 +08:00
hoteas 87039524a7 政企超链接开始集成 2022-03-12 23:52:42 +08:00
hoteas 66cd21c35f 政企超链接开始集成 2022-03-12 23:52:25 +08:00
hoteas 7e64131931 政企超链接开始集成 2022-03-06 23:55:14 +08:00
hoteas e30d40cfbb 政企超链接开始集成 2022-03-04 00:06:26 +08:00
hoteas 751ed0003d 政企超链接开始集成 2022-03-04 00:06:04 +08:00
hoteas 6d9f89a1d4 政企超链接开始集成 2022-03-03 21:23:57 +08:00
hoteas bc329be03b 政企超链接开始集成 2022-03-02 18:19:15 +08:00
hoteas 4597a0a50d 政企超链接开始集成 2022-03-02 12:14:07 +08:00
hoteas 3dda86d170 政企超链接开始集成 2022-02-28 19:37:52 +08:00
hoteas d847da7591 政企超链接开始集成 2022-02-28 19:08:48 +08:00
hoteas e1eca90835 政企超链接开始集成 2022-02-28 09:59:05 +08:00
hoteas 9283b8c284 政企超链接开始集成 2022-02-28 08:53:38 +08:00
hoteas d8d9afa4d2 政企超链接开始集成 2022-02-24 06:26:36 +08:00
hoteas 4d3829c345 简阳版本 2022-02-19 21:38:35 +08:00
hoteas a23037a437 简阳版本 2022-02-19 21:38:17 +08:00
hoteas 181295e54e 更新研发 2022-02-17 04:10:53 +08:00
hoteas 8cc2499e21 更新研发 2022-02-14 19:11:38 +08:00
hoteas a2c49452b4 更新研发 2022-02-14 19:10:58 +08:00
hoteas ebf0df5ca8 更新研发 2022-01-27 23:41:40 +08:00
hoteas 73bf691ccc 更新研发 2022-01-26 11:45:17 +08:00
hoteas b2e9701826 更新研发 2022-01-23 05:13:19 +08:00
hoteas 789b0a14d1 更新研发 2022-01-22 16:12:02 +08:00
hoteas 3ee64fcd8c 更新研发 2022-01-20 07:15:14 +08:00
hoteas 527503b0d9 企业画像 2022-01-19 05:38:49 +08:00
hoteas a95b2fccd7 更新研发 2022-01-17 04:47:39 +08:00
hoteas 7e2abb43e3 权限模块开发 2022-01-12 17:33:20 +08:00
hoteas 48fd753a96 权限模块开发 2022-01-10 13:23:39 +08:00
64 changed files with 485 additions and 4932 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
/.idea/* /.idea/*
.idea .idea
/example/config/app.json
+21 -7
View File
@@ -1,11 +1,11 @@
package hotime package hotime
import ( import (
. "./cache" . "code.hoteas.com/golang/hotime/cache"
"./code" "code.hoteas.com/golang/hotime/code"
. "./common" . "code.hoteas.com/golang/hotime/common"
. "./db" . "code.hoteas.com/golang/hotime/db"
. "./log" . "code.hoteas.com/golang/hotime/log"
"database/sql" "database/sql"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"io" "io"
@@ -420,8 +420,14 @@ func (that *Application) handler(w http.ResponseWriter, req *http.Request) {
header.Set("Cache-Control", "no-cache") header.Set("Cache-Control", "no-cache")
} }
if strings.Index(path, ".m3u8") != -1 { t := strings.LastIndex(path, ".")
header.Add("Content-Type", "audio/mpegurl") if t != -1 {
tt := path[t:]
if MimeMaps[tt] != "" {
header.Add("Content-Type", MimeMaps[tt])
}
} }
//w.Write(data) //w.Write(data)
@@ -529,14 +535,19 @@ func Init(config string) Application {
appIns.SetCache() appIns.SetCache()
appIns.MakeCode = &code.MakeCode{} appIns.MakeCode = &code.MakeCode{}
codeConfig := appIns.Config.GetMap("codeConfig") codeConfig := appIns.Config.GetMap("codeConfig")
appIns.MakeCodeRouter = Router{}
if codeConfig != nil { if codeConfig != nil {
for k, _ := range codeConfig { for k, _ := range codeConfig {
if appIns.Config.GetInt("mode") == 2 { if appIns.Config.GetInt("mode") == 2 {
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), &appIns.Db, true) appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), &appIns.Db, true)
appIns.MakeCodeRouter[k] = Proj{}
} else if appIns.Config.GetInt("mode") == 3 { } else if appIns.Config.GetInt("mode") == 3 {
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), &appIns.Db, false) appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), &appIns.Db, false)
appIns.MakeCodeRouter[k] = Proj{}
} else { } else {
appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), nil, false) appIns.MakeCode.Db2JSON(k, codeConfig.GetString(k), nil, false)
appIns.MakeCodeRouter[k] = Proj{}
} }
//接入动态代码层 //接入动态代码层
if appIns.Router == nil { if appIns.Router == nil {
@@ -615,6 +626,9 @@ func SetSqliteDB(appIns *Application, config Map) {
func setMakeCodeLintener(name string, appIns *Application) { func setMakeCodeLintener(name string, appIns *Application) {
appIns.SetConnectListener(func(context *Context) bool { appIns.SetConnectListener(func(context *Context) bool {
if len(context.RouterString) < 2 || appIns.MakeCodeRouter[context.RouterString[0]] == nil {
return true
}
if len(context.RouterString) > 1 && context.RouterString[0] == name { if len(context.RouterString) > 1 && context.RouterString[0] == name {
if context.RouterString[1] == "hotime" && context.RouterString[2] == "login" { if context.RouterString[1] == "hotime" && context.RouterString[2] == "login" {
return true return true
+1 -1
View File
@@ -1,7 +1,7 @@
package cache package cache
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
"errors" "errors"
) )
+1 -1
View File
@@ -1,7 +1,7 @@
package cache package cache
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
"database/sql" "database/sql"
"encoding/json" "encoding/json"
"strings" "strings"
+1 -1
View File
@@ -1,7 +1,7 @@
package cache package cache
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
"strings" "strings"
"sync" "sync"
"time" "time"
+1 -1
View File
@@ -1,7 +1,7 @@
package cache package cache
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
"github.com/garyburd/redigo/redis" "github.com/garyburd/redigo/redis"
"strings" "strings"
"time" "time"
+1 -1
View File
@@ -1,7 +1,7 @@
package cache package cache
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
) )
type CacheIns interface { type CacheIns interface {
+25 -11
View File
@@ -1,7 +1,7 @@
package hotime package hotime
import ( import (
. "../hotime/common" . "code.hoteas.com/golang/hotime/common"
"strings" "strings"
) )
@@ -75,16 +75,20 @@ var TptProject = Proj{
} }
//索引管理,便于检索以及权限 //索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" { if inData.GetString("index") != "" {
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]}) if inData.Get("parent_id") != nil {
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")}) Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + "," parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
childNodes := that.Db.Select(that.RouterString[1], "id,`index``", Map{"index[~]": "," + that.RouterString[2] + ","}) childNodes := that.Db.Select(that.RouterString[1], "id,`index``", Map{"index[~]": "," + that.RouterString[2] + ","})
for _, v := range childNodes { for _, v := range childNodes {
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1) v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")}) that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
}
} else {
delete(inData, "index")
} }
} }
@@ -177,7 +181,8 @@ var TptProject = Proj{
} }
this.Session(hotimeName+"_id", user.GetCeilInt("id")) this.Session(hotimeName+"_id", user.GetCeilInt("id"))
this.Session(hotimeName+"_name", name) this.Session(hotimeName+"_name", name)
this.Display(0, this.SessionId) delete(user, "password")
this.Display(0, user)
}, },
"logout": func(this *Context) { "logout": func(this *Context) {
hotimeName := this.RouterString[0] hotimeName := this.RouterString[0]
@@ -208,7 +213,16 @@ var TptProject = Proj{
continue continue
} }
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" { if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
//是角色表则取下角色值
if column.GetString("link") == "role" {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,auth,"+column.GetString("value"), Map{"id": v})
} else {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
}
} }
} }
+8 -2
View File
@@ -1,7 +1,7 @@
package code package code
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
) )
var Config = Map{ var Config = Map{
@@ -14,7 +14,13 @@ var Config = Map{
//{"label": "测试表格", "table": "table", "icon": "el-icon-suitcase"}, //{"label": "测试表格", "table": "table", "icon": "el-icon-suitcase"},
//{"label": "系统管理", "name": "setting", "icon": "el-icon-setting", //{"label": "系统管理", "name": "setting", "icon": "el-icon-setting",
// "menus": []Map{ // "menus": []Map{
// {"label": "用户管理", "table": "user"}, // {"label": "用户管理", "table": "user",
// "default": {
// "path": "info",
// "id": "1"
// },
// "auth": ["show","edit","info","add","delete"],
// },
// {"label": "组织管理", "table": "organization"}, // {"label": "组织管理", "table": "organization"},
// {"label": "地区管理", "table": "area"}, // {"label": "地区管理", "table": "area"},
// {"label": "角色管理", "table": "role"}, // {"label": "角色管理", "table": "role"},
+24 -12
View File
@@ -1,8 +1,8 @@
package code package code
import ( import (
. "../common" . "code.hoteas.com/golang/hotime/common"
"../db" "code.hoteas.com/golang/hotime/db"
"errors" "errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
@@ -141,7 +141,7 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
that.TableConfig[v.GetString("name")] = Map{ that.TableConfig[v.GetString("name")] = Map{
"label": v.GetString("label"), "label": v.GetString("label"),
"table": v.GetString("name"), "table": v.GetString("name"),
"auth": []string{"add", "delete", "edit", "info"}, "auth": []string{"show", "add", "delete", "edit", "info"},
"columns": []Map{}, "columns": []Map{},
"search": []Map{ "search": []Map{
@@ -171,8 +171,8 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
} }
idSlice = append(idSlice, tableInfo) idSlice = append(idSlice, tableInfo)
for _, info := range tableInfo { for _, info1 := range tableInfo {
info := DeepCopyMap(info1).(Map)
if info.GetString("label") == "" { if info.GetString("label") == "" {
info["label"] = info.GetString("name") info["label"] = info.GetString("name")
} }
@@ -193,11 +193,17 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
//"add": false, "info": false, "edit": false, "list": true, //"add": false, "info": false, "edit": false, "list": true,
//"must": false, //"must": false,
} }
//备注以空格隔开,空格后的是其他备注 //备注以空格隔开,空格后的是其他备注
indexNum := strings.Index(info.GetString("label"), ":") indexNum := strings.Index(info.GetString("label"), " ")
if indexNum > 0 { if indexNum > -1 {
coloum["label"] = info.GetString("label")[:indexNum] coloum["label"] = info.GetString("label")[:indexNum]
} }
//去除数据信息,是用:号分割的
indexNum = strings.Index(coloum.GetString("label"), ":")
if indexNum > -1 {
coloum["label"] = coloum.GetString("label")[:indexNum]
}
for _, ColumnName := range ColumnNameType { for _, ColumnName := range ColumnNameType {
if (ColumnName.Strict && coloum.GetString("name") == ColumnName.Name) || if (ColumnName.Strict && coloum.GetString("name") == ColumnName.Name) ||
@@ -311,7 +317,6 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
//生成id,判断数据库是否有改变,以保证数据库和配置文件匹配唯一 //生成id,判断数据库是否有改变,以保证数据库和配置文件匹配唯一
id := Md5(ObjToStr(idSlice)) id := Md5(ObjToStr(idSlice))
if id == that.Config.GetString("id") { if id == that.Config.GetString("id") {
if isMake { //有生成包文件 if isMake { //有生成包文件
fmt.Println("有新的业务代码生成,请重新运行") fmt.Println("有新的业务代码生成,请重新运行")
@@ -326,7 +331,7 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
isMenusGet := false //判断是否被目录收录 isMenusGet := false //判断是否被目录收录
for indexKey, _ := range that.IndexMenus { for indexKey, _ := range that.IndexMenus {
indexCode := strings.Index(indexKey, fk) indexCode := strings.Index(indexKey, fk)
if indexCode == 0 { if indexCode == 0 || indexCode == 4 {
isMenusGet = false isMenusGet = false
continue continue
} }
@@ -352,7 +357,7 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
//if tablePrefixCode != -1 { //if tablePrefixCode != -1 {
for ck, _ := range that.TableColumns { for ck, _ := range that.TableColumns {
//判断不止一个前缀相同 //判断不止一个前缀相同
if strings.Index(ck, prefixName) == 0 && ck != fk { if (strings.Index(ck, prefixName) == 0 || strings.Index(prefixName, ck) == 4) && ck != fk {
isNewPrefix = true isNewPrefix = true
break break
} }
@@ -372,8 +377,15 @@ func (that *MakeCode) Db2JSON(name string, path string, db *db.HoTimeDB, makeCod
} }
//没有新前缀 //没有新前缀
if that.IndexMenus[prefixName] != nil { if that.IndexMenus[prefixName] != nil {
that.IndexMenus.GetMap(prefixName)["menus"] = append(that.IndexMenus.GetMap(prefixName).GetSlice("menus"), menuIns) if that.IndexMenus[prefixName+"/"+fk] == nil {
that.IndexMenus[prefixName+"/"+fk] = menuIns that.IndexMenus.GetMap(prefixName)["menus"] = append(that.IndexMenus.GetMap(prefixName).GetSlice("menus"), menuIns)
that.IndexMenus[prefixName+"/"+fk] = menuIns
} else {
for k, v := range menuIns {
that.IndexMenus.GetMap(prefixName + "/" + fk)[k] = v
}
}
} else { } else {
that.Config["menus"] = append(that.Config.GetSlice("menus"), mMenu) //注入配置 that.Config["menus"] = append(that.Config.GetSlice("menus"), mMenu) //注入配置
+4 -4
View File
@@ -3,8 +3,8 @@ package code
var InitTpt = `package {{name}} var InitTpt = `package {{name}}
import ( import (
. "../../../hotime" . "code.hoteas.com/golang/hotime"
. "../../../hotime/common" . "code.hoteas.com/golang/hotime/common"
) )
var ID = "{{id}}" var ID = "{{id}}"
@@ -69,8 +69,8 @@ var Project = Proj{
var CtrTpt = `package {{name}} var CtrTpt = `package {{name}}
import ( import (
. "../../../hotime" . "code.hoteas.com/golang/hotime"
. "../../../hotime/common" . "code.hoteas.com/golang/hotime/common"
"strings" "strings"
) )
+9
View File
@@ -135,6 +135,15 @@ func ObjToFloat64(obj interface{}, e ...*Error) float64 {
err = errors.New("没有合适的转换对象!") err = errors.New("没有合适的转换对象!")
} }
} }
if math.IsNaN(v) {
err = errors.New("float64 is NaN")
v = 0
}
if math.IsInf(v, 0) {
err = errors.New("float64 is Inf")
v = 0
}
if len(e) != 0 { if len(e) != 0 {
e[0].SetError(err) e[0].SetError(err)
} }
+3 -3
View File
@@ -1,9 +1,9 @@
package hotime package hotime
import ( import (
. "./cache" . "code.hoteas.com/golang/hotime/cache"
. "./common" . "code.hoteas.com/golang/hotime/common"
. "./db" . "code.hoteas.com/golang/hotime/db"
"encoding/json" "encoding/json"
"net/http" "net/http"
) )
+2 -2
View File
@@ -1,8 +1,8 @@
package db package db
import ( import (
"../cache" "code.hoteas.com/golang/hotime/cache"
. "../common" . "code.hoteas.com/golang/hotime/common"
"database/sql" "database/sql"
"encoding/json" "encoding/json"
"errors" "errors"
+138
View File
@@ -0,0 +1,138 @@
package aliyun
import (
. "code.hoteas.com/golang/hotime/common"
"fmt"
"io/ioutil"
"net/http"
//"fmt"
)
type Company struct {
ApiCode string
Url string
}
func (this *Company) Init(apiCode string) {
//"06c6a07e89dd45c88de040ee1489eef7"
this.ApiCode = apiCode
this.Url = "http://api.81api.com"
}
// GetCompanyBaseInfo 获取企业基础信息
func (this *Company) GetCompanyOtherAll(name string) Map {
res := Map{}
data, e := this.GetCompanyPatentsInfo(name) //获取专利信息
if e != nil {
fmt.Println(e)
} else {
res["PatentsInfo"] = data.GetMap("data")
}
data, e = this.GetCompanyOtherCopyrightsInfo(name) //获取其他专利
if e != nil {
fmt.Println(e)
} else {
res["OtherCopyrightsInfo"] = data.GetMap("data")
}
data, e = this.GetCompanyTrademarksInfo(name) //获取商标
if e != nil {
fmt.Println(e)
} else {
res["TrademarksInfo"] = data.GetMap("data")
}
data, e = this.GetCompanySoftwareCopyrightsInfo(name) //获取软著
if e != nil {
fmt.Println(e)
} else {
res["SoftwareCopyrightsInfo"] = data.GetMap("data")
}
data, e = this.GetCompanyProfileTags(name) //获取大数据标签
if e != nil {
fmt.Println(e)
} else {
res["ProfileTags"] = data.GetSlice("data")
}
return res
}
// GetCompanyBaseInfo 获取企业基础信息
func (this *Company) GetCompanyBaseInfo(name string) (Map, error) {
url := "/getCompanyBaseInfo/"
body, err := this.basePost(url, name)
return ObjToMap(body), err
}
// GetCompanyPatentsInfo 获取专利信息
func (this *Company) GetCompanyPatentsInfo(name string) (Map, error) {
url := "/getCompanyPatentsInfo/"
body, err := this.basePost(url, name)
return ObjToMap(body), err
}
// 获取商标信息
func (this *Company) GetCompanyTrademarksInfo(name string) (Map, error) {
url := "/getCompanyTrademarksInfo/"
body, err := this.basePost(url, name)
return ObjToMap(body), err
}
// 获取软著信息
func (this *Company) GetCompanySoftwareCopyrightsInfo(name string) (Map, error) {
url := "/getCompanySoftwareCopyrightsInfo/"
body, err := this.basePost(url, name)
return ObjToMap(body), err
}
// 获取其他著作信息
func (this *Company) GetCompanyOtherCopyrightsInfo(name string) (Map, error) {
url := "/getCompanyOtherCopyrightsInfo/"
body, err := this.basePost(url, name)
return ObjToMap(body), err
}
// 获取大数据标签
func (this *Company) GetCompanyProfileTags(name string) (Map, error) {
url := "/getCompanyProfileTags/"
body, err := this.basePost(url, name)
return ObjToMap(body), err
}
func (this *Company) basePost(url string, name string) (string, error) {
client := &http.Client{}
reqest, err := http.NewRequest("GET", this.Url+url+name+"/?isRaiseErrorCode=1", nil)
if err != nil {
fmt.Println("Fatal error ", err.Error())
return "", err
}
reqest.Header.Add("Authorization", "APPCODE "+this.ApiCode)
response, err := client.Do(reqest)
defer response.Body.Close()
if err != nil {
fmt.Println("Fatal error ", err.Error())
return "", err
}
body, err := ioutil.ReadAll(response.Body)
if err != nil {
return "", err
}
res := string(body)
fmt.Println(res)
return res, err
}
var DefaultCompany Company
func init() {
DefaultCompany = Company{}
}
+58
View File
@@ -0,0 +1,58 @@
package baidu
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
)
type BaiduMap struct {
Ak string
Url string
}
func (this *BaiduMap) Init(Ak string) {
//"ak=ZeT902EZvVgIoGVWEFK3osUm"
this.Ak = Ak
this.Url = "https://api.map.baidu.com/place/v2/suggestion?output=json" + "&ak=" + Ak
//query
}
// GetPosition 获取定位列表
func (this *BaiduMap) GetPosition(name string, region string) (string, error) {
client := &http.Client{}
if region == "" {
region = "全国"
}
reqest, err := http.NewRequest("GET", this.Url+"&query="+url.PathEscape(name)+"&region="+url.PathEscape(region), nil)
if err != nil {
fmt.Println("Fatal error ", err.Error())
return "", err
}
response, err := client.Do(reqest)
defer response.Body.Close()
if err != nil {
fmt.Println("Fatal error ", err.Error())
return "", err
}
body, err := ioutil.ReadAll(response.Body)
if err != nil {
return "", err
}
//fmt.Println(string(body))
return string(body), err
}
var DefaultBaiDuMap BaiduMap
func init() {
DefaultBaiDuMap = BaiduMap{}
}
+1 -1
View File
@@ -1,8 +1,8 @@
package download package download
import ( import (
. "../../common"
"bytes" "bytes"
. "code.hoteas.com/golang/hotime/common"
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
+103
View File
@@ -0,0 +1,103 @@
package tencent
import (
. "code.hoteas.com/golang/hotime/common"
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"fmt"
"io"
"io/ioutil"
"net/http"
gourl "net/url"
"strings"
"time"
)
func calcAuthorization(source string, secretId string, secretKey string) (auth string, datetime string, err error) {
timeLocation, _ := time.LoadLocation("Etc/GMT")
datetime = time.Now().In(timeLocation).Format("Mon, 02 Jan 2006 15:04:05 GMT")
signStr := fmt.Sprintf("x-date: %s\nx-source: %s", datetime, source)
// hmac-sha1
mac := hmac.New(sha1.New, []byte(secretKey))
mac.Write([]byte(signStr))
sign := base64.StdEncoding.EncodeToString(mac.Sum(nil))
auth = fmt.Sprintf("hmac id=\"%s\", algorithm=\"hmac-sha1\", headers=\"x-date x-source\", signature=\"%s\"",
secretId, sign)
return auth, datetime, nil
}
func urlencode(params map[string]string) string {
var p = gourl.Values{}
for k, v := range params {
p.Add(k, v)
}
return p.Encode()
}
func GetCompany(secretId, secretKey, name string) Map {
// 云市场分配的密钥Id
//secretId := "xxxx"
//// 云市场分配的密钥Key
//secretKey := "xxxx"
source := "market"
// 签名
auth, datetime, _ := calcAuthorization(source, secretId, secretKey)
// 请求方法
method := "GET"
// 请求头
headers := map[string]string{"X-Source": source, "X-Date": datetime, "Authorization": auth}
// 查询参数
queryParams := make(map[string]string)
queryParams["keyword"] = name
// body参数
bodyParams := make(map[string]string)
// url参数拼接
url := "https://service-3jnh3ku8-1256140209.gz.apigw.tencentcs.com/release/business4/geet"
if len(queryParams) > 0 {
url = fmt.Sprintf("%s?%s", url, urlencode(queryParams))
}
bodyMethods := map[string]bool{"POST": true, "PUT": true, "PATCH": true}
var body io.Reader = nil
if bodyMethods[method] {
body = strings.NewReader(urlencode(bodyParams))
headers["Content-Type"] = "application/x-www-form-urlencoded"
}
client := &http.Client{
Timeout: 5 * time.Second,
}
request, err := http.NewRequest(method, url, body)
if err != nil {
fmt.Println(err)
return nil
}
for k, v := range headers {
request.Header.Set(k, v)
}
response, err := client.Do(request)
if err != nil {
fmt.Println(err)
return nil
}
defer response.Body.Close()
bodyBytes, err := ioutil.ReadAll(response.Body)
if err != nil {
fmt.Println(err)
return nil
}
res := string(bodyBytes)
fmt.Println(res)
return ObjToMap(res)
}
+25
View File
@@ -13,6 +13,31 @@ var credential = common.NewCredential(
"GNXgjdN4czA9ya0FNMApVJzTmsmU0KSN", "GNXgjdN4czA9ya0FNMApVJzTmsmU0KSN",
) )
func OCRCOMPANY(base64Str string) string {
cpf := profile.NewClientProfile()
cpf.HttpProfile.Endpoint = "ocr.tencentcloudapi.com"
client, _ := ocr.NewClient(credential, "ap-guangzhou", cpf)
request := ocr.NewBizLicenseOCRRequest()
//request.ImageUrl = common.StringPtr("https://img0.baidu.com/it/u=2041013181,3227632688&fm=26&fmt=auto")
request.ImageBase64 = common.StringPtr(base64Str)
response, err := client.BizLicenseOCR(request)
if _, ok := err.(*errors.TencentCloudSDKError); ok {
fmt.Println("An API error has returned: %s", err)
return ""
}
if err != nil {
fmt.Println("An API error has returned: %s", err)
return ""
}
//fmt.Printf("%s", response.ToJsonString())
return response.ToJsonString()
}
func OCR(base64Str string) string { func OCR(base64Str string) string {
cpf := profile.NewClientProfile() cpf := profile.NewClientProfile()
+1 -1
View File
@@ -1,7 +1,7 @@
package upload package upload
import ( import (
. "../../common" . "code.hoteas.com/golang/hotime/common"
"errors" "errors"
"io" "io"
"mime/multipart" "mime/multipart"
-53
View File
@@ -1,53 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
)
var adminCtr = Ctr{
"token": func(this *Context) {
this.Display(0, this.SessionId)
},
"test": func(this *Context) {
this.Session("id", this.SessionId)
},
//自带的登录
"login": func(this *Context) {
name := this.Req.FormValue("name")
pwd := this.Req.FormValue("password")
if len(name) < 2 ||
len(pwd) < 3 {
this.Display(3, "数据校验不通过")
}
where := Map{"password": Md5(pwd)}
if len(name) == 11 {
where["phone"] = name
} else {
where["name"] = name
}
admin := this.Db.Get("admin", "*", Map{"AND": where})
if admin == nil {
this.Display(4, "账户密码错误")
return
}
this.Session("id", admin.GetCeilInt("id"))
admin["password"] = nil
this.Display(0, admin)
},
"info": func(this *Context) {
admin := this.Db.Get("admin", "*", Map{"id": this.Session("id").ToInt()})
if admin == nil {
this.Display(2, "登录失效,请重新登录")
return
}
admin["password"] = nil
this.Display(0, admin)
},
}
-29
View File
@@ -1,29 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
)
// Project 管理端项目
var Project = Proj{
//"user": UserCtr,
"product_spot_check": product_spot_checkCtr,
"product": productCtr,
"admin": adminCtr,
"sms": Sms,
"material": materialCtr,
"material_inout": material_inoutCtr,
"produce_product": produce_productCtr,
"produce": produceCtr,
"product_line": product_lineCtr,
}
//生成随机码的4位随机数
func getCode() string {
//res := ""
//for i := 0; i < 4; i++ {
res := ObjToStr(RandX(1000, 9999))
//}
return res
}
-213
View File
@@ -1,213 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"strings"
"time"
)
var materialCtr = Ctr{
"info": func(that *Context) {
data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()})
str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db)
where := Map{"id": that.RouterString[2]}
if len(inData) == 1 {
inData["id"] = where["id"]
where = Map{"AND": inData}
} else if len(inData) > 1 {
where["OR"] = inData
where = Map{"AND": where}
}
re := that.Db.Get(that.RouterString[1], str, where)
if re == nil {
that.Display(4, "找不到对应信息")
return
}
for k, v := range re {
column := that.MakeCode.TableColumns[that.RouterString[1]][k]
if column == nil {
continue
}
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
}
}
that.Display(0, re)
},
"add": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
name := that.Req.FormValue("name")
img := that.Req.FormValue("img")
validity := ObjToInt(that.Req.FormValue("validity"))
num := ObjToInt(that.Req.FormValue("num"))
rule := that.Req.FormValue("rule")
content := that.Req.FormValue("content")
description := that.Req.FormValue("description")
if name == "" || rule == "" {
that.Display(3, "参数不足,请补充参数")
return
}
data := Map{
"name": name,
"img": img,
"rule": rule,
"admin_id": adminID,
"count": 0,
"used": 0,
"saved": 0,
"num": num,
"validity": validity,
"description": description,
"content": content,
"create_time": time.Now().Unix(),
"modify_time": time.Now().Unix(),
}
id := that.Db.Insert("material", data)
if id == 0 {
that.Display(4, "添加材料失败,请重新添加")
return
}
data["id"] = id
that.Display(0, data)
},
"update": func(that *Context) {
inData := that.MakeCode.Edit(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "没有找到要更新的数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","})
for _, v := range childNodes {
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
}
}
re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]})
if re == 0 {
that.Display(4, "更新数据失败")
return
}
that.Display(0, re)
},
"inout": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
data := ObjToMap(that.Req.FormValue("data"))
texts := data.GetSlice("text")
textData := []Map{}
for k, _ := range texts {
v := texts.GetString(k)
if len(v) < 4 {
continue
}
vs := that.Db.Select("material", "name,id,content,rule,num", Map{"content[~]": v[:len(v)/2]})
for _, v1 := range vs {
if len(textData) == 0 {
textData = append(textData, v1)
}
for _, vt := range textData {
if v1.GetString("id") != vt.GetString("id") {
add := true
for _, vt1 := range textData {
if vt1.GetCeilInt("id") == v1.GetCeilInt("id") {
add = false
break
}
}
if add {
v1["count"] = 1
textData = append(textData, v1)
}
} else {
vt["count"] = vt.GetCeilInt("count") + 1
}
}
}
}
qrcode := data.GetSlice("qrcode")
for k, _ := range qrcode {
v := qrcode.GetString(k)
if len(v) < 4 {
continue
}
vs := that.Db.Select("material", "name,id,content,rule,num", Map{"content[~]": v[:len(v)/2]})
for _, v1 := range vs {
if len(textData) == 0 {
textData = append(textData, v1)
}
for _, vt := range textData {
if v1.GetString("id") != vt.GetString("id") {
v1["count"] = 1
textData = append(textData, v1)
} else {
vt["count"] = vt.GetCeilInt("count") + 1
}
}
}
}
that.Display(0, textData)
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
page := ObjToInt(that.Req.FormValue("page"))
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
if page < 1 {
page = 1
}
if pageSize <= 0 {
pageSize = 10
}
leftJoin := Map{"[><]admin": "material.admin_id=admin.id"}
columnStr := "material.id,material.name,material.img,material.count,material.used,material.saved,material.admin_id,admin.name AS admin_name,material.modify_time,material.state"
where := Map{"ORDER": "modify_time DESC"}
count := that.Db.Count("material", where)
reData := that.Db.Page(page, pageSize).
PageSelect("material", leftJoin, columnStr, where)
that.Display(0, Map{"count": count, "data": reData})
},
}
-188
View File
@@ -1,188 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"strings"
"time"
)
var material_inoutCtr = Ctr{
"info": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
id := ObjToInt(that.Req.FormValue("id"))
if id == 0 {
that.Display(3, "请求参数不足,请检查参数")
return
}
re := that.Db.Get("material_inout", "*", Map{"id": id})
if re == nil {
that.Display(4, "找不到对应信息")
return
}
that.Display(0, re)
},
"add": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
img := that.Req.FormValue("img")
rule := that.Req.FormValue("rule")
materialId := ObjToInt(that.Req.FormValue("material_id"))
produceId := ObjToInt(that.Req.FormValue("produce_id"))
count := ObjToInt(that.Req.FormValue("num"))
state := ObjToInt(that.Req.FormValue("state"))
content := that.Req.FormValue("content")
description := that.Req.FormValue("description")
if rule == "" || materialId == 0 || count == 0 {
that.Display(3, "参数不足,请补充参数")
return
}
count1 := count
if state > 0 {
count = -count
}
produce_material := that.Db.Get("produce_material", "id", Map{"AND": Map{"produce_id": produceId, "material_id": materialId}})
if produce_material == nil {
that.Db.Insert("produce_material", Map{"produce_id": produceId,
"create_time": time.Now().Unix(),
"modify_time": time.Now().Unix(),
"admin_id": adminID,
"material_id": materialId})
}
if state == 0 {
that.Db.Update("material", Map{"count[#]": "count+" + ObjToStr(count), "saved[#]": "saved+" + ObjToStr(count)}, Map{"id": materialId})
} else {
that.Db.Update("material", Map{"count[#]": "count" + ObjToStr(count), "used[#]": "used+" + ObjToStr(-count)}, Map{"id": materialId})
}
material := that.Db.Get("material", "*", Map{"id": materialId})
data := Map{
"img": img,
"rule": rule,
"admin_id": adminID,
"material_id": materialId,
"count": count1,
"saved": material.GetCeilInt("count"),
"create_time": time.Now().Unix(),
"modify_time": time.Now().Unix(),
"produce_id": produceId,
"description": description,
"content": content,
"state": state,
}
id := that.Db.Insert("material_inout", data)
if id == 0 {
that.Display(4, "添加出入库记录失败,请重新添加")
return
}
data["id"] = id
that.Display(0, data)
},
"update": func(that *Context) {
inData := that.MakeCode.Edit(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "没有找到要更新的数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","})
for _, v := range childNodes {
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
}
}
re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]})
if re == 0 {
that.Display(4, "更新数据失败")
return
}
that.Display(0, re)
},
"remove": func(that *Context) {
inData := that.MakeCode.Delete(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "请求参数不足")
return
}
re := int64(0)
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil {
re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","})
} else {
re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]})
}
if re == 0 {
that.Display(4, "删除数据失败")
return
}
that.Display(0, "删除成功")
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
page := ObjToInt(that.Req.FormValue("page"))
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
materialId := ObjToInt(that.Req.FormValue("id"))
if page < 1 {
page = 1
}
if pageSize <= 0 {
pageSize = 10
}
columnStr := "material_inout.id,material_inout.material_id,material.name,material_inout.img,material_inout.count,material_inout.saved,material_inout.admin_id,admin.name AS admin_name,material_inout.modify_time,material_inout.state"
leftJoin := Map{"[><]material": "material_inout.material_id=material.id",
"[><]admin": "material_inout.admin_id=admin.id",
}
where := Map{"ORDER": "modify_time DESC"}
if materialId != 0 {
where["material_id"] = materialId
}
count := that.Db.Count("material_inout", where)
reData := that.Db.Page(page, pageSize).
PageSelect("material_inout", leftJoin, columnStr, where)
that.Display(0, Map{"count": count, "data": reData})
},
}
-201
View File
@@ -1,201 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"strings"
)
var produceCtr = Ctr{
"info": func(that *Context) {
data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()})
str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db)
where := Map{"id": that.RouterString[2]}
if len(inData) == 1 {
inData["id"] = where["id"]
where = Map{"AND": inData}
} else if len(inData) > 1 {
where["OR"] = inData
where = Map{"AND": where}
}
re := that.Db.Get(that.RouterString[1], str, where)
if re == nil {
that.Display(4, "找不到对应信息")
return
}
for k, v := range re {
column := that.MakeCode.TableColumns[that.RouterString[1]][k]
if column == nil {
continue
}
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
}
}
that.Display(0, re)
},
"add": func(that *Context) {
inData := that.MakeCode.Add(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "请求参数不足")
return
}
re := that.Db.Insert(that.RouterString[1], inData)
if re == 0 {
that.Display(4, "无法插入对应数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = index.GetString("index") + ObjToStr(re) + ","
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
} else if inData.GetString("index") != "" {
inData["index"] = "," + ObjToStr(re) + ","
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
}
that.Display(0, re)
},
"update": func(that *Context) {
inData := that.MakeCode.Edit(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "没有找到要更新的数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","})
for _, v := range childNodes {
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
}
}
re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]})
if re == 0 {
that.Display(4, "更新数据失败")
return
}
that.Display(0, re)
},
"remove": func(that *Context) {
inData := that.MakeCode.Delete(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "请求参数不足")
return
}
re := int64(0)
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil {
re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","})
} else {
re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]})
}
if re == 0 {
that.Display(4, "删除数据失败")
return
}
that.Display(0, "删除成功")
},
"check": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
data := ObjToMap(that.Req.FormValue("data"))
texts := data.GetSlice("text")
textData := []Map{}
for k, _ := range texts {
v := texts.GetString(k)
if len(v) < 3 {
continue
}
vs := that.Db.Select("produce", Map{"[>]product": "produce.product_id=product.id"}, "produce.name,produce.id,produce.product_id,product.name AS product_name,product.rule_check,product.rule_spot_check", Map{"produce.sn[~]": v[:len(v)/2+1]})
for _, v1 := range vs {
if len(textData) == 0 {
textData = append(textData, v1)
}
for _, vt := range textData {
if v1.GetString("id") != vt.GetString("id") {
add := true
for _, vt1 := range textData {
if vt1.GetCeilInt("id") == v1.GetCeilInt("id") {
add = false
break
}
}
if add {
v1["count"] = 1
textData = append(textData, v1)
}
} else {
vt["count"] = vt.GetCeilInt("count") + 1
}
}
}
}
qrcode := data.GetSlice("qrcode")
for k, _ := range qrcode {
v := qrcode.GetString(k)
if len(v) < 3 {
continue
}
vs := that.Db.Select("produce", Map{"[>]product": "produce.product_id=product.id"}, "produce.name,produce.id,produce.product_id,product.name AS product_name,product.rule_check,product.rule_spot_check", Map{"produce.sn[~]": v[:len(v)/2+1]})
for _, v1 := range vs {
if len(textData) == 0 {
textData = append(textData, v1)
}
for _, vt := range textData {
if v1.GetString("id") != vt.GetString("id") {
v1["count"] = 1
textData = append(textData, v1)
} else {
vt["count"] = vt.GetCeilInt("count") + 1
}
}
}
}
that.Display(0, textData)
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
columnStr := "produce.id,produce.sn,produce.name,produce.state,produce.product_id,product.name AS product_name"
where := Map{"produce.state[!]": 0, "ORDER": "produce.modify_time DESC"}
reData := that.Db.Select("produce", Map{"[>]product": "produce.product_id=product.id"}, columnStr, where)
that.Display(0, reData)
},
}
-96
View File
@@ -1,96 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"time"
)
var produce_productCtr = Ctr{
"info": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
id := ObjToInt(that.Req.FormValue("id"))
sn := that.Req.FormValue("sn")
if id == 0 && sn == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
where := Map{}
if id != 0 {
where["produce_product.id"] = id
} else {
where["produce_product.sn"] = sn
}
re := that.Db.Get("produce_product",
Map{"[><]product": "produce_product.product_id=product.id",
"[><]produce": "produce_product.produce_id=produce.id",
},
"produce_product.id,produce_product.product_id,product.name AS product_name,"+
"produce_product.modify_time,produce_product.state,product.rule_spot_check,produce_product.produce_id,produce.name AS produce_name", where)
if re == nil {
that.Display(4, "找不到对应信息")
return
}
that.Display(0, re)
},
"add": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
sn := that.Req.FormValue("sn")
product_id := ObjToInt(that.Req.FormValue("product_id"))
produce_id := ObjToInt(that.Req.FormValue("produce_id"))
product_line_id := ObjToInt(that.Req.FormValue("product_line_id"))
//state := ObjToInt(that.Req.FormValue("state"))
//rule_check := that.Req.FormValue("rule_check")
//description := that.Req.FormValue("description")
if sn == "" {
that.Display(3, "参数不足,请补充参数")
return
}
data := Map{
"sn": sn,
"product_id": product_id,
"produce_id": produce_id,
"create_time": time.Now().Unix(),
"modify_time": time.Now().Unix(),
}
data1 := ObjToMap(data.ToJsonString())
data1["product_line_id"] = product_line_id
id := that.Db.Insert("produce_product", data1)
if id == 0 {
that.Display(4, "添加新成品失败,请重新添加")
return
}
//data["id"] = id
//data["rule"] = rule_check
//data["produce_product_id"] = id
//data["state"] = state
//data["description"] = description
//id = that.Db.Insert("product_check", data)
//if id == 0 {
// that.Display(4, "添加质检失败,请重新添加")
// return
//}
that.Display(0, data)
},
}
-138
View File
@@ -1,138 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"time"
)
var productCtr = Ctr{
"info": func(that *Context) {
data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()})
str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db)
where := Map{"id": that.RouterString[2]}
if len(inData) == 1 {
inData["id"] = where["id"]
where = Map{"AND": inData}
} else if len(inData) > 1 {
where["OR"] = inData
where = Map{"AND": where}
}
re := that.Db.Get(that.RouterString[1], str, where)
if re == nil {
that.Display(4, "找不到对应信息")
return
}
for k, v := range re {
column := that.MakeCode.TableColumns[that.RouterString[1]][k]
if column == nil {
continue
}
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
}
}
that.Display(0, re)
},
"add": func(that *Context) {
inData := that.MakeCode.Add(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "请求参数不足")
return
}
re := that.Db.Insert(that.RouterString[1], inData)
if re == 0 {
that.Display(4, "无法插入对应数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = index.GetString("index") + ObjToStr(re) + ","
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
} else if inData.GetString("index") != "" {
inData["index"] = "," + ObjToStr(re) + ","
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
}
that.Display(0, re)
},
"update": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
id := ObjToInt(that.Req.FormValue("id"))
//抽检更新
ruleSpotCheck := that.Req.FormValue("rule_spot_check")
if ruleSpotCheck != "" {
spotCheckPercentage := ObjToInt(that.Req.FormValue("spot_check_percentage"))
if id == 0 || ruleSpotCheck == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
re := that.Db.Update("product", Map{"rule_spot_check": ruleSpotCheck, "spot_check_percentage": spotCheckPercentage, "modify_time": time.Now().Unix()}, Map{"id": id})
if re == 0 {
that.Display(4, "更新失败,无法更新抽检参数")
return
}
} else {
//质检更新
ruleCheck := that.Req.FormValue("rule_check")
if id == 0 || ruleCheck == "" {
that.Display(3, "请求参数不足,请检查参数")
return
}
re := that.Db.Update("product", Map{"rule_check": ruleCheck, "modify_time": time.Now().Unix()}, Map{"id": id})
if re == 0 {
that.Display(4, "更新失败,无法更新质检参数")
return
}
}
that.Display(0, "更新成功")
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
page := ObjToInt(that.Req.FormValue("page"))
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
if page < 1 {
page = 1
}
if pageSize <= 0 {
pageSize = 10
}
leftJoin := Map{"[><]admin": "product.admin_id=admin.id"}
columnStr := "product.id,product.name,product.img,product.count,product.used,product.saved,product.spot_check_count,product.admin_id,admin.name AS admin_name,product.modify_time,product.state"
where := Map{"ORDER": "modify_time DESC"}
count := that.Db.Count("product", where)
reData := that.Db.Page(page, pageSize).
PageSelect("product", leftJoin, columnStr, where)
that.Display(0, Map{"count": count, "data": reData})
},
}
-146
View File
@@ -1,146 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"strings"
)
var product_lineCtr = Ctr{
"info": func(that *Context) {
data := that.Db.Get("admin", "*", Map{"id": that.Session("admin_id").ToCeilInt()})
str, inData := that.MakeCode.Info(that.RouterString[1], data, that.Db)
where := Map{"id": that.RouterString[2]}
if len(inData) == 1 {
inData["id"] = where["id"]
where = Map{"AND": inData}
} else if len(inData) > 1 {
where["OR"] = inData
where = Map{"AND": where}
}
re := that.Db.Get(that.RouterString[1], str, where)
if re == nil {
that.Display(4, "找不到对应信息")
return
}
for k, v := range re {
column := that.MakeCode.TableColumns[that.RouterString[1]][k]
if column == nil {
continue
}
if (column["list"] == nil || column.GetBool("list")) && column.GetString("link") != "" {
re[column.GetString("link")] = that.Db.Get(column.GetString("link"), "id,"+column.GetString("value"), Map{"id": v})
}
}
that.Display(0, re)
},
"add": func(that *Context) {
inData := that.MakeCode.Add(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "请求参数不足")
return
}
re := that.Db.Insert(that.RouterString[1], inData)
if re == 0 {
that.Display(4, "无法插入对应数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = index.GetString("index") + ObjToStr(re) + ","
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
} else if inData.GetString("index") != "" {
inData["index"] = "," + ObjToStr(re) + ","
that.Db.Update(that.RouterString[1], Map{"index": inData["index"]}, Map{"id": re})
}
that.Display(0, re)
},
"update": func(that *Context) {
inData := that.MakeCode.Edit(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "没有找到要更新的数据")
return
}
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetString("index") != "" {
Index := that.Db.Get(that.RouterString[1], "`index`", Map{"id": that.RouterString[2]})
parentIndex := that.Db.Get(that.RouterString[1], "`index`", Map{"id": inData.Get("parent_id")})
inData["index"] = parentIndex.GetString("index") + that.RouterString[2] + ","
childNodes := that.Db.Select(that.RouterString[1], "id,`index`", Map{"index[~]": "," + that.RouterString[2] + ","})
for _, v := range childNodes {
v["index"] = strings.Replace(v.GetString("index"), Index.GetString("index"), inData.GetString("index"), -1)
that.Db.Update(that.RouterString[1], Map{"index": v["index"]}, Map{"id": v.GetCeilInt("id")})
}
}
re := that.Db.Update(that.RouterString[1], inData, Map{"id": that.RouterString[2]})
if re == 0 {
that.Display(4, "更新数据失败")
return
}
that.Display(0, re)
},
"remove": func(that *Context) {
inData := that.MakeCode.Delete(that.RouterString[1], that.Req)
if inData == nil {
that.Display(3, "请求参数不足")
return
}
re := int64(0)
//索引管理,便于检索以及权限
if inData.Get("parent_id") != nil && inData.GetSlice("index") != nil {
re = that.Db.Delete(that.RouterString[1], Map{"index[~]": "," + that.RouterString[2] + ","})
} else {
re = that.Db.Delete(that.RouterString[1], Map{"id": that.RouterString[2]})
}
if re == 0 {
that.Display(4, "删除数据失败")
return
}
that.Display(0, "删除成功")
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
//page := ObjToInt(that.Req.FormValue("page"))
//pageSize := ObjToInt(that.Req.FormValue("pageSize"))
//
//if page < 1 {
// page = 1
//}
//if pageSize <= 0 {
// pageSize = 10
//}
//leftJoin := Map{"[><]admin": "product.admin_id=admin.id"}
where := Map{"state": 0, "ORDER": "modify_time DESC"}
//count := that.Db.Count("product", where)
reData := that.Db.Select("product_line", "*", where)
that.Display(0, reData)
},
}
-138
View File
@@ -1,138 +0,0 @@
package app
import (
. "../../../hotime"
. "../../../hotime/common"
"time"
)
var product_spot_checkCtr = Ctr{
"info": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
id := ObjToInt(that.Req.FormValue("id"))
if id == 0 {
that.Display(3, "请求参数不足,请检查参数")
return
}
re := that.Db.Get("product_spot_check",
Map{"[><]product": "product_spot_check.product_id=product.id",
"[><]produce": "product_spot_check.produce_id=produce.id",
},
"id,img,product_id,product.name AS product_name,admin_id,"+
"modify_time,state,rule,produce_id,produce.name AS produce_name", Map{"id": id})
if re == nil {
that.Display(4, "找不到对应信息")
return
}
that.Display(0, re)
},
"add": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
//img := that.Req.FormValue("img")
sn := that.Req.FormValue("sn")
rule := that.Req.FormValue("rule_spot_check")
description := that.Req.FormValue("description")
produceProductId := ObjToInt(that.Req.FormValue("produce_product_id"))
//count := ObjToInt(that.Req.FormValue("count"))
state := ObjToInt(that.Req.FormValue("state"))
if rule == "" || produceProductId == 0 {
that.Display(3, "参数不足,请补充参数")
return
}
produceProduct := that.Db.Get("produce_product", "*", Map{"id": produceProductId})
if produceProduct == nil {
that.Display(4, "找不到成品记录,无法进行抽检")
return
}
//判断是否已经抽检了
alreadyCheck := that.Db.Get("product_spot_check", "id", Map{"produce_product_id": produceProductId})
if alreadyCheck == nil {
that.Db.Update("product", Map{"spot_check_count[#]": "spot_check_count+1"},
Map{"id": produceProduct.GetCeilInt("product_id")})
that.Db.Update("produce", Map{"spot_check_count[#]": "spot_check_count+1"},
Map{"id": produceProduct.GetCeilInt("produce_id")})
}
data := Map{
"sn": sn,
"rule": rule,
"admin_id": adminID,
"create_time": time.Now().Unix(),
"modify_time": time.Now().Unix(),
"product_id": produceProduct.GetCeilInt("product_id"),
"produce_id": produceProduct.GetCeilInt("produce_id"),
"produce_product_id": produceProductId,
"description": description,
"state": state,
}
id := that.Db.Insert("product_spot_check", data)
if id == 0 {
that.Display(4, "添加抽检记录失败,请重新添加")
return
}
data["id"] = id
that.Display(0, data)
},
"search": func(that *Context) {
adminID := that.Session("id").ToInt()
if adminID == 0 {
that.Display(2, "登录失效,请重新登录")
return
}
page := ObjToInt(that.Req.FormValue("page"))
pageSize := ObjToInt(that.Req.FormValue("pageSize"))
productId := ObjToInt(that.Req.FormValue("id"))
if page < 1 {
page = 1
}
if pageSize <= 0 {
pageSize = 10
}
columnStr := "product_spot_check.id,product_spot_check.product_id,product_spot_check.sn,product.name,product_spot_check.img,product_spot_check.admin_id,admin.name AS admin_name,product_spot_check.modify_time,product_spot_check.state"
leftJoin := Map{"[><]product": "product_spot_check.product_id=product.id",
"[><]admin": "product_spot_check.admin_id=admin.id",
}
where := Map{"ORDER": "id DESC"}
if productId != 0 {
where["product_id"] = productId
}
count := that.Db.Count("product_spot_check", where)
reData := that.Db.Page(page, pageSize).
PageSelect("product_spot_check", leftJoin, columnStr, where)
that.Display(0, Map{"count": count, "data": reData})
},
}
-33
View File
@@ -1,33 +0,0 @@
package app
import (
. "../../../hotime"
"../../dri/ddsms"
)
var Sms = Ctr{
//只允许微信验证过的或者登录成功的发送短信
"send": func(this *Context) {
//if this.Session("uid").Data == nil && this.Session("wechatInfo").Data == nil {
// this.Display(2, "没有授权")
// return
//}
if len(this.Req.FormValue("token")) != 32 {
this.Display(2, "没有授权")
return
}
phone := this.Req.FormValue("phone")
if len(phone) < 11 {
this.Display(3, "手机号格式错误")
return
}
code := getCode()
this.Session("phone", phone)
this.Session("code", code)
ddsms.DefaultDDY.SendYZM(phone, this.Config.GetString("smsLogin"), map[string]string{"code": code})
this.Display(0, "发送成功")
},
}
BIN
View File
Binary file not shown.
File diff suppressed because it is too large Load Diff
+10 -3
View File
@@ -1,4 +1,5 @@
{ {
"avatarPath": "avatar/2006/01/02/",
"cache": { "cache": {
"db": { "db": {
"db": false, "db": false,
@@ -24,7 +25,7 @@
"db": { "db": {
"mysql": { "mysql": {
"host": "192.168.6.253", "host": "192.168.6.253",
"name": "myhs", "name": "iedc_dev",
"password": "dasda8454456", "password": "dasda8454456",
"port": "3306", "port": "3306",
"prefix": "", "prefix": "",
@@ -42,8 +43,14 @@
"4": "数据处理异常", "4": "数据处理异常",
"5": "数据结果异常" "5": "数据结果异常"
}, },
"imgPath": "img/2006/01/02/",
"mode": 3, "mode": 3,
"port": "8080", "port": "8081",
"sessionName": "HOTIME", "sessionName": "HOTIME",
"tpt": "tpt" "smsKey": "b0eb4bf0198b9983cffcb85b69fdf4fa",
"smsLogin": "【政企超链接】您的验证码为:{code},请在5分钟内使用,切勿将验证码泄露于他人,如非本人操作请忽略。",
"tpt": "tpt",
"wechatAppID": "wx2edb802f5c3ae1ae",
"wechatAppSecret": "4ff97e523c3de6bad47051b568522386",
"wxFilePath": "wxfile/2006/01/02/"
} }
Binary file not shown.
+3 -18
View File
@@ -1,9 +1,8 @@
package main package main
import ( import (
"../../hotime" "code.hoteas.com/golang/hotime"
"../dri/ddsms" //"code.hoteas.com/golang/hotime/dri/aliyun"
"./app"
"fmt" "fmt"
"time" "time"
) )
@@ -13,19 +12,5 @@ func main() {
fmt.Println(date, date.Unix()) fmt.Println(date, date.Unix())
//fmt.Println("0123456"[1:7]) //fmt.Println("0123456"[1:7])
appIns := hotime.Init("config/config.json") appIns := hotime.Init("config/config.json")
//RESTfull接口适配 appIns.Run(hotime.Router{})
appIns.SetConnectListener(func(context *hotime.Context) bool {
return true
})
//makeCode := code.MakeCode{}
//fmt.Println(common.ObjToStr(makeCode.Db2JSON("admin","test",appIns.Db)))
if ddsms.DefaultDDY.ApiKey == "" {
ddsms.DefaultDDY.Init(appIns.Config.GetString("smsKey"))
}
appIns.Run(hotime.Router{
"app": app.Project,
})
} }
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
.left-nav-home-bar{background:#2c3759!important}.left-nav-home-bar,.left-nav-home-bar i{color:#fff!important}.el-submenu .el-menu-item{height:40px;line-height:40px}.el-menu .el-submenu__title{height:46px;line-height:46px}.left-nav-home-bar i{margin-bottom:6px!important}.el-menu-item-group__title{padding:0 0 0 20px}.head-left[data-v-297b6686],.head-right[data-v-297b6686]{display:flex;justify-content:center;flex-direction:column}.head-right[data-v-297b6686]{align-items:flex-end}.el-upload{height:100px;width:100px}.el-upload img[data-v-012633a9]{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;display:block}.el-upload i[data-v-012633a9]{font-size:40px;margin:30% 31%;display:block}.form-file-item .upload-file .el-upload{width:100px;height:auto;line-height:0;background-color:transparent}.form-file-item .el-button--small{height:32px}.el-input-number--mini{width:100px;margin-right:5px}.el-input-number--mini .el-input{width:100px!important}.basic-form{width:400px}.basic-form .el-input,.basic-form .el-select{width:84px;margin-right:5px}.form-file-item{margin-bottom:5px}.form-file-item .el-upload{width:60px;height:60px;line-height:60px}.form-file-item .file-item .name{width:100px}.form-file-item .name{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.form-list .form-common-item{display:flex;margin-bottom:5px}.form-common-item .name,.form-common-item .value{width:88px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select-list .select-list-item{display:flex;margin-bottom:5px}.select-list-item .name{width:76px}.select-list-item .name,.select-list-item .value{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select-list-item .value{width:77px}.select-wrap{text-align:left;margin-bottom:5px}.select-wrap .select-add-name{display:inline-block;width:87px;text-align:right}.select-wrap .el-input{width:84px}.el-input__inner{padding-left:10px;padding-right:5px}.el-upload{height:60px;width:60px;background:#eee;overflow:hidden}
@@ -1 +0,0 @@
.not-show-tab-label .el-tabs__header,.not-show-tab-search{display:none}
@@ -1 +0,0 @@
.el-upload{height:100px;width:100px}.el-upload img[data-v-012633a9]{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;display:block}.el-upload i[data-v-012633a9]{font-size:40px;margin:30% 31%;display:block}.form-file-item .upload-file .el-upload{width:100px;height:auto;line-height:0;background-color:transparent}.form-file-item .el-button--small{height:32px}.el-input-number--mini{width:100px;margin-right:5px}.el-input-number--mini .el-input{width:100px!important}.basic-form{width:400px}.basic-form .el-input,.basic-form .el-select{width:84px;margin-right:5px}.form-file-item{margin-bottom:5px}.form-file-item .el-upload{width:60px;height:60px;line-height:60px}.form-file-item .file-item .name{width:100px}.form-file-item .name{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.form-list .form-common-item{display:flex;margin-bottom:5px}.form-common-item .name,.form-common-item .value{width:88px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select-list .select-list-item{display:flex;margin-bottom:5px}.select-list-item .name{width:76px}.select-list-item .name,.select-list-item .value{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select-list-item .value{width:77px}.select-wrap{text-align:left;margin-bottom:5px}.select-wrap .select-add-name{display:inline-block;width:87px;text-align:right}.select-wrap .el-input{width:84px}.el-input__inner{padding-left:10px;padding-right:5px}.el-upload{height:60px;width:60px;background:#eee;overflow:hidden}
@@ -1 +0,0 @@
body[data-v-581864d3],dd[data-v-581864d3],dl[data-v-581864d3],form[data-v-581864d3],h1[data-v-581864d3],h2[data-v-581864d3],h3[data-v-581864d3],h4[data-v-581864d3],h5[data-v-581864d3],h6[data-v-581864d3],html[data-v-581864d3],ol[data-v-581864d3],p[data-v-581864d3],pre[data-v-581864d3],tbody[data-v-581864d3],textarea[data-v-581864d3],tfoot[data-v-581864d3],thead[data-v-581864d3],ul[data-v-581864d3]{margin:0;font-size:14px;font-family:Microsoft YaHei}dl[data-v-581864d3],ol[data-v-581864d3],ul[data-v-581864d3]{padding:0}li[data-v-581864d3]{list-style:none}input[data-v-581864d3]{border:none;outline:none;font-family:Microsoft YaHei;background-color:#fff}a[data-v-581864d3]{font-family:Microsoft YaHei;text-decoration:none}[data-v-581864d3]{margin:0;padding:0}.login[data-v-581864d3]{position:relative;width:100%;height:100%;background-color:#353d56}.login-item[data-v-581864d3]{position:absolute;top:calc(50% - 244px);left:calc(50% - 244px);width:488px;height:488px;padding:80px 0 152px 0;box-sizing:border-box;background-size:468px 468px}.login-item .left-title[data-v-581864d3]{display:inline-block;width:236px;height:100%;border-right:2px solid #88919e;text-align:center;padding-top:68px;box-sizing:border-box}.login-item .left-title p[data-v-581864d3]{font-size:30px;line-height:50px;color:#fff}.login-item .right-content[data-v-581864d3]{display:inline-block;vertical-align:top;padding-left:42px;box-sizing:border-box}.login-item .right-content .login-title[data-v-581864d3]{font-size:16px;color:#fff}.errorMsg[data-v-581864d3]{width:100%;height:34px;line-height:34px;color:red;font-size:14px;overflow:hidden}.login-item .right-content .inputWrap[data-v-581864d3]{width:204px;height:36px;line-height:36px;color:#99a3b2;font-size:14px;border-bottom:3px solid #98a2b1;margin-bottom:10px}.login-item .right-content .inputWrap input[data-v-581864d3]{background-color:transparent;color:#99a3b2}.login-btn[data-v-581864d3]{width:88px;height:36px;text-align:center;line-height:36px;font-size:14px;color:#fff;background-color:#4f619b;border-radius:18px;margin-top:60px;cursor:pointer}
@@ -1 +0,0 @@
.form-file-item .upload-file .el-upload{width:100px;height:auto;line-height:0;background-color:transparent}.form-file-item .el-button--small{height:32px}.el-input-number--mini{width:100px;margin-right:5px}.el-input-number--mini .el-input{width:100px!important}.basic-form{width:400px}.basic-form .el-input,.basic-form .el-select{width:84px;margin-right:5px}.form-file-item{margin-bottom:5px}.form-file-item .el-upload{width:60px;height:60px;line-height:60px}.form-file-item .file-item .name{width:100px}.form-file-item .name{width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.form-list .form-common-item{display:flex;margin-bottom:5px}.form-common-item .name,.form-common-item .value{width:88px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select-list .select-list-item{display:flex;margin-bottom:5px}.select-list-item .name{width:76px}.select-list-item .name,.select-list-item .value{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.select-list-item .value{width:77px}.select-wrap{text-align:left;margin-bottom:5px}.select-wrap .select-add-name{display:inline-block;width:87px;text-align:right}.select-wrap .el-input{width:84px}.el-input__inner{padding-left:10px;padding-right:5px}.el-upload,.el-upload-list--picture-card .el-upload-list__item{height:60px;width:60px}.el-upload-list__item.is-success.focusing .el-icon-close-tip{display:none!important}.el-upload{height:100px;width:100px;background:#eee;overflow:hidden}.file-upload .el-upload{background:transparent;width:100%;height:auto;text-align:left;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.file-upload .el-upload .el-button{margin-right:10px}.el-upload img[data-v-4b440c12]{height:100%;width:100%;-o-object-fit:cover;object-fit:cover;display:block}.el-upload i[data-v-4b440c12]{font-size:40px;margin:30% 31%;display:block}
@@ -1 +0,0 @@
h3[data-v-28af1b93]{margin:40px 0 0}ul[data-v-28af1b93]{list-style-type:none;padding:0}li[data-v-28af1b93]{display:inline-block;margin:0 10px}a[data-v-28af1b93]{color:#42b983}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.
Binary file not shown.
-3
View File
@@ -1,3 +0,0 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="favicon.ico"><title></title><style>body{
margin: 0px;
}</style><link href="css/chunk-2b8aef56.7087d841.css" rel="prefetch"><link href="css/chunk-38db7d04.2b6ce0ac.css" rel="prefetch"><link href="css/chunk-5c99f384.31e35517.css" rel="prefetch"><link href="css/chunk-60f282ff.83752cba.css" rel="prefetch"><link href="css/chunk-a74869b6.c460e209.css" rel="prefetch"><link href="css/chunk-d1a9ebe6.5cc24c46.css" rel="prefetch"><link href="js/chunk-28c289a1.0ed6fefe.js" rel="prefetch"><link href="js/chunk-2b8aef56.8330998b.js" rel="prefetch"><link href="js/chunk-2c065dd6.d9c3e429.js" rel="prefetch"><link href="js/chunk-38db7d04.18ee879a.js" rel="prefetch"><link href="js/chunk-58db4e7f.c298e695.js" rel="prefetch"><link href="js/chunk-5c99f384.be52d852.js" rel="prefetch"><link href="js/chunk-60f282ff.cbb91cc0.js" rel="prefetch"><link href="js/chunk-78ba61e2.520b239c.js" rel="prefetch"><link href="js/chunk-a74869b6.01e5db7b.js" rel="prefetch"><link href="js/chunk-d1a9ebe6.fba0f501.js" rel="prefetch"><link href="css/app.5e2eb449.css" rel="preload" as="style"><link href="js/app.c87636c4.js" rel="preload" as="script"><link href="css/app.5e2eb449.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but hotime doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="js/app.c87636c4.js"></script></body></html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-2c065dd6"],{1:function(t,e){},2934:function(t,e,n){"use strict";n.d(e,"e",function(){return o}),n.d(e,"d",function(){return a}),n.d(e,"b",function(){return s}),n.d(e,"c",function(){return u}),n.d(e,"a",function(){return c}),n.d(e,"f",function(){return d});var e=n("b0c0"),r=n("b775"),e=n("4328"),i=n.n(e);function o(t,e){return Object(r.b)({url:t,method:"GET",params:e})}function a(t,e){return Object(r.b)({url:t,method:"GET",params:e})}function s(t,e){return Object(r.b)({url:t,method:"DELETE",data:i.a.stringify(e)})}function u(t,e){return Object(r.b)({url:t,method:"PUT",data:i.a.stringify(e)})}function c(t,e){return Object(r.b)({url:t,method:"POST",data:i.a.stringify(e)})}function d(t){var e=new FormData;return e.append("file",t,t.name),Object(r.b)({url:"file",headers:{"Content-Type":"multipart/form-data"},method:"POST",data:e})}},"83c5":function(t,e,n){"use strict";n("159b");e.a={list:{},constructor:function(){this.list={}},$on:function(t,e){this.list[t]=this.list[t]||[],this.list[t].push(e)},$emit:function(t,e){this.list[t]&&this.list[t].forEach(function(t){t(e)})},$off:function(t){this.list[t]&&delete this.list[t]}}},b775:function(t,e,n){"use strict";n.d(e,"a",function(){return u});var r=n("d3b7"),i=n("bc3a"),r=n.n(i),i=n("4328"),o=n.n(i),a=n("2bea"),s=n("56d7"),u="";r.a.defaults.withCredentials=!0,r.a.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8";r=r.a.create({baseURL:u,timeout:2e4});r.interceptors.request.use(function(t){return"get"===t.method&&(t.paramsSerializer=function(t){return o.a.stringify(t,{arrayFormat:"repeat"})}),t.withCredentials=!0,t},function(t){Promise.reject(t)}),r.interceptors.response.use(function(t){return 2!==t.data.statu?t.data:(a.b.Message({showClose:!0,message:"登录信息丢失,请重新登陆!",type:"error",duration:2e3,offset:100}),void s.app.$router.push({path:"/login"}))},function(t){var e="err:"+t,n={};return t.response?n=t.response.data:(-1!=e.indexOf("timeout")?(n.code=500,n.message="请求超时,请稍后再试"):-1!=e.indexOf("Network Error")?(n.code=500,n.message="网络错误,请稍后再试"):(n.code=500,n.message=""+t),n)}),e.b=r}}]);
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-58db4e7f"],{"159b":function(c,n,o){var r,t=o("da84"),a=o("fdbc"),f=o("17c2"),i=o("9112");for(r in a){var u=t[r],u=u&&u.prototype;if(u&&u.forEach!==f)try{i(u,"forEach",f)}catch(c){u.forEach=f}}},"17c2":function(c,n,o){"use strict";var r=o("b727").forEach,o=o("a640")("forEach");c.exports=o?[].forEach:function(c){return r(this,c,1<arguments.length?arguments[1]:void 0)}},a640:function(c,n,o){"use strict";var r=o("d039");c.exports=function(c,n){var o=[][c];return!!o&&r(function(){o.call(null,n||function(){throw 1},1)})}}}]);
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-a74869b6"],{1:function(t,e){},2934:function(t,e,n){"use strict";n.d(e,"e",function(){return a}),n.d(e,"d",function(){return s}),n.d(e,"b",function(){return i}),n.d(e,"c",function(){return c}),n.d(e,"a",function(){return u}),n.d(e,"f",function(){return d});var e=n("b0c0"),o=n("b775"),e=n("4328"),r=n.n(e);function a(t,e){return Object(o.b)({url:t,method:"GET",params:e})}function s(t,e){return Object(o.b)({url:t,method:"GET",params:e})}function i(t,e){return Object(o.b)({url:t,method:"DELETE",data:r.a.stringify(e)})}function c(t,e){return Object(o.b)({url:t,method:"PUT",data:r.a.stringify(e)})}function u(t,e){return Object(o.b)({url:t,method:"POST",data:r.a.stringify(e)})}function d(t){var e=new FormData;return e.append("file",t,t.name),Object(o.b)({url:"file",headers:{"Content-Type":"multipart/form-data"},method:"POST",data:e})}},"40a7":function(t,e,n){},"578a":function(t,e,n){"use strict";n.r(e);n("b0c0");var s=n("9f9f");Object(s.O)("data-v-581864d3");var i={class:"login",style:{width:"100%",height:"100vh"}},c={class:"login-item"},u={class:"left-title"},d={class:"right-content"},l=Object(s.o)("p",{class:"login-title"},"登录",-1),f={style:{height:"40px"}},b={class:"inputWrap"},p=Object(s.r)(" 账号:"),m={class:"inputWrap"},h=Object(s.r)(" 密码:");Object(s.M)();var o=n("2934"),r={name:"Login",data:function(){return{showLog:!1,showLogInfo:"",label:"HoTime DashBoard",form:{name:"",password:""}}},methods:{login:function(){var e=this;if(""==this.name||""==this.password)return this.showLogInfo="参数不足!",void(this.showLog=!0);Object(o.a)(window.Hotime.data.name+"/hotime/login",e.form).then(function(t){return 0!=t.status?(e.showLogInfo=t.error.msg,void(e.showLog=!0)):void e.$router.push({path:"/"})})}},mounted:function(){this.label=window.Hotime.data.label}};n("8d39");r.render=function(t,e,n,o,r,a){return Object(s.L)(),Object(s.n)("div",i,[Object(s.o)("div",c,[Object(s.o)("div",u,[Object(s.o)("p",null,Object(s.Y)(r.label),1)]),Object(s.o)("div",d,[l,Object(s.o)("div",f,[Object(s.kb)(Object(s.o)("p",{class:"errorMsg"},Object(s.Y)(r.showLogInfo),513),[[s.gb,r.showLog]])]),Object(s.o)("p",b,[p,Object(s.kb)(Object(s.o)("input",{type:"text","onUpdate:modelValue":e[0]||(e[0]=function(t){return r.form.name=t}),class:"accountVal"},null,512),[[s.fb,r.form.name]])]),Object(s.o)("p",m,[h,Object(s.kb)(Object(s.o)("input",{type:"password","onUpdate:modelValue":e[1]||(e[1]=function(t){return r.form.password=t}),class:"passwordVal"},null,512),[[s.fb,r.form.password]])]),Object(s.o)("p",{class:"login-btn",onClick:e[2]||(e[2]=function(){return a.login&&a.login.apply(a,arguments)})},"登录")])])])},r.__scopeId="data-v-581864d3";e.default=r},"8d39":function(t,e,n){"use strict";n("40a7")},b775:function(t,e,n){"use strict";n.d(e,"a",function(){return c});var o=n("d3b7"),r=n("bc3a"),o=n.n(r),r=n("4328"),a=n.n(r),s=n("2bea"),i=n("56d7"),c="";o.a.defaults.withCredentials=!0,o.a.defaults.headers.post["Content-Type"]="application/x-www-form-urlencoded;charset=UTF-8";o=o.a.create({baseURL:c,timeout:2e4});o.interceptors.request.use(function(t){return"get"===t.method&&(t.paramsSerializer=function(t){return a.a.stringify(t,{arrayFormat:"repeat"})}),t.withCredentials=!0,t},function(t){Promise.reject(t)}),o.interceptors.response.use(function(t){return 2!==t.data.statu?t.data:(s.b.Message({showClose:!0,message:"登录信息丢失,请重新登陆!",type:"error",duration:2e3,offset:100}),void i.app.$router.push({path:"/login"}))},function(t){var e="err:"+t,n={};return t.response?n=t.response.data:(-1!=e.indexOf("timeout")?(n.code=500,n.message="请求超时,请稍后再试"):-1!=e.indexOf("Network Error")?(n.code=500,n.message="网络错误,请稍后再试"):(n.code=500,n.message=""+t),n)}),e.b=o}}]);
File diff suppressed because one or more lines are too long
@@ -1 +0,0 @@
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-d1a9ebe6"],{"587e":function(a,e,t){"use strict";t.r(e);var n=t("9f9f");Object(n.O)("data-v-28af1b93");var v={class:"hello"},b=Object(n.q)('<p data-v-28af1b93> For a guide and recipes on how to configure / customize this project,<br data-v-28af1b93> check out the <a href="https://cli.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>vue-cli documentation</a>. </p><h3 data-v-28af1b93>Installed CLI Plugins</h3><ul data-v-28af1b93><li data-v-28af1b93><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener" data-v-28af1b93>babel</a></li><li data-v-28af1b93><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener" data-v-28af1b93>eslint</a></li></ul><h3 data-v-28af1b93>Essential Links</h3><ul data-v-28af1b93><li data-v-28af1b93><a href="https://vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>Core Docs</a></li><li data-v-28af1b93><a href="https://forum.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>Forum</a></li><li data-v-28af1b93><a href="https://chat.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>Community Chat</a></li><li data-v-28af1b93><a href="https://twitter.com/vuejs" target="_blank" rel="noopener" data-v-28af1b93>Twitter</a></li><li data-v-28af1b93><a href="https://news.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>News</a></li></ul><h3 data-v-28af1b93>Ecosystem</h3><ul data-v-28af1b93><li data-v-28af1b93><a href="https://router.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>vue-router</a></li><li data-v-28af1b93><a href="https://vuex.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>vuex</a></li><li data-v-28af1b93><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener" data-v-28af1b93>vue-devtools</a></li><li data-v-28af1b93><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener" data-v-28af1b93>vue-loader</a></li><li data-v-28af1b93><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener" data-v-28af1b93>awesome-vue</a></li></ul>',7);Object(n.M)();var r={name:"HelloWorld",props:{msg:String}};t("6fe9");r.render=function(a,e,t,r,l,o){return Object(n.L)(),Object(n.n)("div",v,[Object(n.o)("h1",null,Object(n.Y)(t.msg),1),b])},r.__scopeId="data-v-28af1b93";e.default=r},"6fe9":function(a,e,t){"use strict";t("e8a7")},e8a7:function(a,e,t){}}]);
+13
View File
@@ -0,0 +1,13 @@
module code.hoteas.com/golang/hotime
go 1.16
require (
github.com/garyburd/redigo v1.6.3
github.com/go-sql-driver/mysql v1.6.0
github.com/mattn/go-sqlite3 v1.14.12
github.com/sirupsen/logrus v1.8.1
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.364
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.364
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
)
+27
View File
@@ -0,0 +1,27 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/garyburd/redigo v1.6.3 h1:HCeeRluvAgMusMomi1+6Y5dmFOdYV/JzoRrrbFlkGIc=
github.com/garyburd/redigo v1.6.3/go.mod h1:rTb6epsqigu3kYKBnaF028A7Tf/Aw5s0cqA47doKKqw=
github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0=
github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
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/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.364 h1:X1Jws4XqrTH+p7FBQ7BpjW4qFXObKHWm0/XhW/GvqRs=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.364/go.mod h1:7sCQWVkxcsR38nffDW057DRGk8mUjK1Ing/EFOK8s8Y=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.364 h1:kbor60vo37v7Hu+i17gooox9Rw281fVHNna8zwtDG1w=
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/ocr v1.0.364/go.mod h1:LeIUBOLhc+Y5YCEpZrULPD9lgoXXV4/EmIcoEvmHz9c=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+2 -2
View File
@@ -1,8 +1,8 @@
package hotime package hotime
import ( import (
. "./cache" . "code.hoteas.com/golang/hotime/cache"
. "./common" . "code.hoteas.com/golang/hotime/common"
) )
//session对象 //session对象
+1 -1
View File
@@ -1,7 +1,7 @@
package hotime package hotime
import ( import (
. "./common" . "code.hoteas.com/golang/hotime/common"
) )
var IsRun = false //当前状态 var IsRun = false //当前状态