Commit 114fb871 by 孙龙

团购定时任务

parent de4c9c78
package Order
import (
_"database/sql"
_"fmt"
_ "database/sql"
_ "fmt"
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/util"
_"time"
_ "time"
)
func initDb(dns string) (err error) {
err = db.Init(dns)
if err != nil {
return
}
return
}
func UpdateStatus(order_id int, status_extend int) (err error) {
initDb(util.Configs.Liexin_databases.Dns) //初始化db
_, err1 := db.DB.Exec("update lie_order set status_extend = ?, wms_syn = ? where order_id = ?", status_extend, 1, order_id)
......
......@@ -5,7 +5,6 @@ import (
"fmt"
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/util"
"log"
"time"
)
......@@ -20,17 +19,8 @@ type ActionLog struct {
CreateTime int `db:"create_time"`
}
func initDb(dns string) (err error) {
err = db.Init(dns)
if err != nil {
return
}
return
}
func AddLog() (err error) {
initDb(util.Configs.Liexin_databases.Dns) //初始化db
// QueryRow()
// Query()
......
......@@ -2,11 +2,10 @@ package UserGroup
import (
"database/sql"
_"fmt"
"encoding/json"
_ "fmt"
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/util"
"encoding/json"
)
type UserGroup struct {
......@@ -21,18 +20,11 @@ type UserGroup struct {
CreateTime int `db:"create_time"`
}
func initDb(dns string) (err error) {
err = db.Init(dns)
if err != nil {
return
}
return
}
// 单行查询
func QueryRow(order_id int) []byte {
initDb(util.Configs.Liexin_databases.Dns) //初始化db
//initDb(util.Configs.Liexin_databases.Dns) //初始化db
var userGroup UserGroup
......@@ -50,7 +42,7 @@ func QueryRow(order_id int) []byte {
// 更新参团状态
func UpdateStatus(order_id int) (err error) {
initDb(util.Configs.Liexin_databases.Dns) //初始化db
//initDb(util.Configs.Liexin_databases.Dns) //初始化db
_, err1 := db.DB.Exec("update lie_user_group set status = ?, is_assign = ? where order_id = ?", 1, 1, order_id)
......
......@@ -3,7 +3,6 @@ package UserGroupJoin
import (
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/util"
"time"
)
......@@ -18,7 +17,6 @@ func initDb(dns string) (err error) {
// 新增虚拟参团人员
func InsertGroupJoin(group_id int, order_id int, account string) (err error) {
initDb(util.Configs.Liexin_databases.Dns) //初始化db
current := time.Now().Unix()
_, err1 := db.DB.Exec("insert into lie_user_group_join (group_id, account, order_id, join_time) values (?, ?, ?, ?)", group_id, account, order_id, current)
......
......@@ -3,7 +3,7 @@ package main
import (
"encoding/json"
"flag"
_"fmt"
"fmt"
"github.com/ichunt2019/logger"
"go-queue-server/dal/db"
"go-queue-server/util"
......@@ -73,7 +73,9 @@ func main() {
RedisConn = redis_connect(util.Configs)
t1 := time.NewTimer(time.Minute * 5)
t1 := time.NewTimer(time.Second * 5)
for {
select {
......@@ -110,7 +112,7 @@ func main() {
}
//t1.Reset(time.Second * 1)
t1.Reset(time.Minute * 5)
t1.Reset(time.Second * 5)
}
}
}
......@@ -141,7 +143,7 @@ func assign() {
for _, v := range tuangou_order {
value, _ := v.([]byte)
order_id, _ := strconv.Atoi(string(value))
//fmt.Println(order_id)
fmt.Println(order_id)
// 写入到chan
select {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment