Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b940afa6b0 | |||
| 8afd00ff86 | |||
| 8992fd6d3a |
@@ -675,11 +675,15 @@ var TptProject = Proj{
|
|||||||
where := Map{"name": name}
|
where := Map{"name": name}
|
||||||
if that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")]["phone"] != nil {
|
if that.MakeCodeRouter[hotimeName].TableColumns[fileConfig.GetString("table")]["phone"] != nil {
|
||||||
where["phone"] = name
|
where["phone"] = name
|
||||||
where = Map{"AND": Map{"OR": where, "password": Md5(password)}}
|
where = Map{"OR": where, "password": Md5(password)}
|
||||||
} else {
|
} else {
|
||||||
where["password"] = Md5(password)
|
where["password"] = Md5(password)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(where) > 1 {
|
||||||
|
where = Map{"AND": where}
|
||||||
|
}
|
||||||
|
|
||||||
user := that.Db.Get(fileConfig.GetString("table"), "*", where)
|
user := that.Db.Get(fileConfig.GetString("table"), "*", where)
|
||||||
|
|
||||||
if user == nil {
|
if user == nil {
|
||||||
@@ -776,16 +780,24 @@ var TptProject = Proj{
|
|||||||
name = v2.GetString("table")
|
name = v2.GetString("table")
|
||||||
}
|
}
|
||||||
if v2["auth"] != nil {
|
if v2["auth"] != nil {
|
||||||
newAuth := Slice{}
|
|
||||||
for k3, _ := range linkAuth.GetSlice(name) {
|
|
||||||
v3 := linkAuth.GetSlice(name).GetString(k3)
|
|
||||||
if strings.Contains(v2.GetString("auth"), v3) {
|
|
||||||
newAuth = append(newAuth, v3)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
linkAuth[name] = newAuth
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if linkAuth[name] == nil {
|
||||||
|
linkAuth[name] = v2["auth"]
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
newAuth := Slice{}
|
||||||
|
for k3, _ := range linkAuth.GetSlice(name) {
|
||||||
|
v3 := linkAuth.GetSlice(name).GetString(k3)
|
||||||
|
if strings.Contains(v2.GetString("auth"), v3) {
|
||||||
|
newAuth = append(newAuth, v3)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
linkAuth[name] = newAuth
|
||||||
|
continue
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+85
-7
@@ -70,7 +70,21 @@ func (that *HotimeDBBuilder) Select(qu ...interface{}) []Map {
|
|||||||
return that.HoTimeDB.Select(that.table, that.join, qu, that.where)
|
return that.HoTimeDB.Select(that.table, that.join, qu, that.where)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *HotimeDBBuilder) Update(data Map) int64 {
|
func (that *HotimeDBBuilder) Update(qu ...interface{}) int64 {
|
||||||
|
lth := len(qu)
|
||||||
|
if lth == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
data := Map{}
|
||||||
|
if lth == 1 {
|
||||||
|
data = ObjToMap(qu[0])
|
||||||
|
}
|
||||||
|
if lth > 1 {
|
||||||
|
for k := 1; k < lth; k++ {
|
||||||
|
data[ObjToStr(k-1)] = qu[k]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return that.HoTimeDB.Update(that.table, data, that.where)
|
return that.HoTimeDB.Update(that.table, data, that.where)
|
||||||
}
|
}
|
||||||
@@ -101,19 +115,51 @@ func (that *HotimeDBBuilder) FullJoin(table, joinStr string) *HotimeDBBuilder {
|
|||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *HotimeDBBuilder) Join(join Map) *HotimeDBBuilder {
|
func (that *HotimeDBBuilder) Join(qu ...interface{}) *HotimeDBBuilder {
|
||||||
|
lth := len(qu)
|
||||||
|
if lth == 0 {
|
||||||
|
return that
|
||||||
|
}
|
||||||
|
data := Map{}
|
||||||
|
if lth == 1 {
|
||||||
|
data = ObjToMap(qu[0])
|
||||||
|
}
|
||||||
|
if lth > 1 {
|
||||||
|
for k := 1; k < lth; k++ {
|
||||||
|
data[ObjToStr(k-1)] = qu[k]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if that.join == nil {
|
if that.join == nil {
|
||||||
that.join = Slice{}
|
that.join = Slice{}
|
||||||
}
|
}
|
||||||
if join == nil {
|
if data == nil {
|
||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
|
|
||||||
that.join = append(that.join, join)
|
that.join = append(that.join, data)
|
||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *HotimeDBBuilder) And(where Map) *HotimeDBBuilder {
|
func (that *HotimeDBBuilder) And(qu ...interface{}) *HotimeDBBuilder {
|
||||||
|
|
||||||
|
lth := len(qu)
|
||||||
|
if lth == 0 {
|
||||||
|
return that
|
||||||
|
}
|
||||||
|
var where Map
|
||||||
|
if lth == 1 {
|
||||||
|
where = ObjToMap(qu[0])
|
||||||
|
}
|
||||||
|
if lth > 1 {
|
||||||
|
where = Map{}
|
||||||
|
for k := 1; k < lth; k++ {
|
||||||
|
where[ObjToStr(k-1)] = qu[k]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if where == nil {
|
if where == nil {
|
||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
@@ -129,7 +175,22 @@ func (that *HotimeDBBuilder) And(where Map) *HotimeDBBuilder {
|
|||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
|
|
||||||
func (that *HotimeDBBuilder) Or(where Map) *HotimeDBBuilder {
|
func (that *HotimeDBBuilder) Or(qu ...interface{}) *HotimeDBBuilder {
|
||||||
|
lth := len(qu)
|
||||||
|
if lth == 0 {
|
||||||
|
return that
|
||||||
|
}
|
||||||
|
var where Map
|
||||||
|
if lth == 1 {
|
||||||
|
where = ObjToMap(qu[0])
|
||||||
|
}
|
||||||
|
if lth > 1 {
|
||||||
|
where = Map{}
|
||||||
|
for k := 1; k < lth; k++ {
|
||||||
|
where[ObjToStr(k-1)] = qu[k]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
}
|
||||||
if where == nil {
|
if where == nil {
|
||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
@@ -144,7 +205,24 @@ func (that *HotimeDBBuilder) Or(where Map) *HotimeDBBuilder {
|
|||||||
|
|
||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
func (that *HotimeDBBuilder) Where(where Map) *HotimeDBBuilder {
|
func (that *HotimeDBBuilder) Where(qu ...interface{}) *HotimeDBBuilder {
|
||||||
|
|
||||||
|
lth := len(qu)
|
||||||
|
if lth == 0 {
|
||||||
|
return that
|
||||||
|
}
|
||||||
|
var where Map
|
||||||
|
if lth == 1 {
|
||||||
|
where = ObjToMap(qu[0])
|
||||||
|
}
|
||||||
|
if lth > 1 {
|
||||||
|
where = Map{}
|
||||||
|
for k := 1; k < lth; k++ {
|
||||||
|
where[ObjToStr(k-1)] = qu[k]
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if where == nil {
|
if where == nil {
|
||||||
return that
|
return that
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,9 +23,9 @@
|
|||||||
],
|
],
|
||||||
"db": {
|
"db": {
|
||||||
"mysql": {
|
"mysql": {
|
||||||
"host": "192.168.6.253",
|
"host": "192.168.2.20",
|
||||||
"name": "dgs-cms",
|
"name": "gov_crawler",
|
||||||
"password": "dasda8454456",
|
"password": "fh22y8b882d",
|
||||||
"port": "3306",
|
"port": "3306",
|
||||||
"prefix": "",
|
"prefix": "",
|
||||||
"user": "root"
|
"user": "root"
|
||||||
|
|||||||
Reference in New Issue
Block a user