修复短信发送bug

This commit is contained in:
hoteas 2021-10-27 00:27:24 +08:00
parent 25f355c8d0
commit c57afd6a5d
5 changed files with 26 additions and 22 deletions

View File

@ -652,8 +652,10 @@ func (that *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
where := ""
res := make([]interface{}, 0)
length := len(k)
if length > 0 && strings.Contains(k, "[") && k[length-1] == ']' {
if k == "[#]" {
k = strings.Replace(k, "[#]", "", -1)
where += " " + ObjToStr(v) + " "
} else if length > 0 && strings.Contains(k, "[") && k[length-1] == ']' {
def := false
switch Substr(k, length-3, 3) {
@ -791,9 +793,6 @@ func (that *HoTimeDB) varCond(k string, v interface{}) (string, []interface{}) {
}
}
} else if k == "[#]" {
k = strings.Replace(k, "[#]", "", -1)
where += " " + ObjToStr(v) + " "
} else {
//fmt.Println(reflect.ValueOf(v).Type().String())
if !strings.Contains(k, ".") {

View File

@ -54,17 +54,20 @@ var orderCtr = Ctr{
this.Db.Update("ctg_order_date", Map{"now_sn": ctgOrderDate.GetCeilInt64("now_sn") + 1, "modify_time": time.Now().Unix()}, Map{"id": ctgOrderDate.GetCeilInt("id")})
//查询并发送短信
category := this.Db.Get("category", "name", Map{"id": ctgOrderDate.GetCeilInt("category_id")})
categorys := this.Db.Select("category", "org_id", Map{"index[~]": "," + ctgOrderDate.GetString("category_id") + ","})
orgIDs := Slice{}
category := this.Db.Get("category", "`name`,`index`", Map{"id": ctgOrderDate.GetCeilInt("category_id")})
//categorys := this.Db.Select("category", "org_id", Map{"index[~]": "," + ctgOrderDate.GetString("category_id") + ","})
categorys := this.Db.Select("category", "org_id", Map{"[#]": "id IN (" + category.GetString("index")[1:len(category.GetString("index"))-1] + ")"})
orgIDs := ""
for _, v := range categorys {
orgs := this.Db.Select("org", "id", Map{"index[~]": v.GetCeilInt("org_id")})
orgs := this.Db.Select("org", "id,`index`", Map{"id": v.GetCeilInt("org_id")})
for _, orgv := range orgs {
orgIDs = append(orgIDs, orgv.GetCeilInt("id"))
//orgIDs = append(orgIDs, orgv.GetCeilInt("id"))
orgIDs = orgIDs + orgv.GetString("index")[1:]
}
}
admin := this.Db.Select("admin", "phone,id", Map{"org_id": orgIDs})
if len(orgIDs) != 0 {
orgIDs = orgIDs[0 : len(orgIDs)-1]
admin := this.Db.Select("admin", "phone,id", Map{"[#]": "org_id IN (" + orgIDs + ")"})
user := this.Db.Get("user", "name", Map{"id": this.Session("id").ToCeilInt()})
for _, v := range admin {
phone := v.GetString("phone")
@ -76,6 +79,7 @@ var orderCtr = Ctr{
})
}
}
}
this.Display(0, data)
},

Binary file not shown.

View File

@ -24,7 +24,7 @@
"db": {
"mysql": {
"host": "192.168.6.253",
"name": "bzyy",
"name": "bzyyweb",
"password": "dasda8454456",
"port": "3306",
"prefix": "",

View File

@ -16,6 +16,7 @@ import (
func main() {
date, _ := time.Parse("2006-01-02 15:04", time.Now().Format("2006-01-02")+" 14:00")
fmt.Println(date, date.Unix())
//fmt.Println("0123456"[1:7])
appIns := hotime.Init("config/config.json")
//RESTfull接口适配
appIns.SetConnectListener(func(context *hotime.Context) bool {