Commit db40f333 by 朱继来

调整竞调用户、推送客服

parent 9b78daed
package JingdiaoAddress package JingdiaoAddress
type JingdiaoAddress struct { type JingdiaoAddress struct {
Id int `db:"id"` Id int `db:"id"`
Company string `db:"company"` Company string `db:"company"`
Lianxiren string `db:"lianxiren"` Lianxiren string `db:"lianxiren"`
Address string `db:"address"` Address string `db:"address"`
Telphone string `db:"telphone"` UserId int `db:"user_id"`
} Telphone string `db:"telphone"`
\ No newline at end of file }
...@@ -81,7 +81,7 @@ func GetOrderAddress() JingdiaoAddress.JingdiaoAddress { ...@@ -81,7 +81,7 @@ func GetOrderAddress() JingdiaoAddress.JingdiaoAddress {
rand_num := RandInt(1, count + 1) // 从总数中取个随机数 rand_num := RandInt(1, count + 1) // 从总数中取个随机数
var address JingdiaoAddress.JingdiaoAddress var address JingdiaoAddress.JingdiaoAddress
db.DB.Get(&address, "select id, company, lianxiren, address, telphone from lie_jingdiao_address where id = ?", rand_num) db.DB.Get(&address, "select id, company, lianxiren, address, user_id, telphone from lie_jingdiao_address where id = ? and user_id != 0", rand_num)
if address.Id == 0 { if address.Id == 0 {
return GetOrderAddress() return GetOrderAddress()
......
...@@ -69,8 +69,8 @@ func main() { ...@@ -69,8 +69,8 @@ func main() {
// 创建订单 // 创建订单
for i := 0; i < order_count; i++ { for i := 0; i < order_count; i++ {
var user_id int = handle.GetJingDiaoUserId() //var user_id int = handle.GetJingDiaoUserId()
go CreateOrder(user_id, start_time) go CreateOrder(start_time)
} }
start_time += 86400 start_time += 86400
...@@ -89,8 +89,8 @@ func main() { ...@@ -89,8 +89,8 @@ func main() {
// 创建订单 // 创建订单
for i := 0; i < order_count; i++ { for i := 0; i < order_count; i++ {
var user_id int = handle.GetJingDiaoUserId() //var user_id int = handle.GetJingDiaoUserId()
go CreateOrder(user_id, start_time) go CreateOrder(start_time)
} }
<-forever <-forever
...@@ -105,26 +105,28 @@ func main() { ...@@ -105,26 +105,28 @@ func main() {
Order.UpdateJingDiaoOrder() Order.UpdateJingDiaoOrder()
// 创建订单 // 创建订单
for i := 0; i < order_count; i++ { for i := 0; i < 1; i++ {
var user_id int = handle.GetJingDiaoUserId() //var user_id int = handle.GetJingDiaoUserId()
CreateOrder(user_id, time.Now().Unix()) CreateOrder(time.Now().Unix())
} }
} }
} }
// 创建订单 // 创建订单
func CreateOrder(user_id int, create_time int64) { func CreateOrder(create_time int64) {
var min_amount int // 订单总额不低于随机生成数 var min_amount int // 订单总额不低于随机生成数
var order_item OrderItems.OrderItems // 随机获取一条明细 var order_item OrderItems.OrderItems // 随机获取一条明细
var order_address JingdiaoAddress.JingdiaoAddress // 随机获取一条地址 var order_address JingdiaoAddress.JingdiaoAddress // 随机获取一条地址
var goods_number int // 商品数量 var goods_number int // 商品数量
var order_sn string // 订单号 var order_sn string // 订单号
var order_amount float64 // 订单总额 var order_amount float64 // 订单总额
var user_id int
min_amount = handle.RandInt(8000, 15000) / 100 * 100 min_amount = handle.RandInt(8000, 15000) / 100 * 100
order_item = handle.GetOneOrderItem() order_item = handle.GetOneOrderItem()
order_address = handle.GetOrderAddress() order_address = handle.GetOrderAddress()
user_id = order_address.UserId
goods_number = int(float64(min_amount) / order_item.GoodsPrice) goods_number = int(float64(min_amount) / order_item.GoodsPrice)
order_amount = handle.Decimal(order_item.GoodsPrice * float64(goods_number)) order_amount = handle.Decimal(order_item.GoodsPrice * float64(goods_number))
...@@ -138,8 +140,8 @@ func CreateOrder(user_id int, create_time int64) { ...@@ -138,8 +140,8 @@ func CreateOrder(user_id int, create_time int64) {
order["user_id"] = user_id order["user_id"] = user_id
order["order_amount"] = order_amount order["order_amount"] = order_amount
order["status"] = 4 order["status"] = 4
//order["sale_id"] = handle.GetSaleId() order["sale_id"] = handle.GetSaleId()
order["sale_id"] = 1434 // 默认推送给张婷玉 //order["sale_id"] = 1434 // 默认推送给张婷玉
order["is_type"] = 1 order["is_type"] = 1
goods_data["user_id"] = user_id goods_data["user_id"] = user_id
......
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