Commit f625d841 by 朱继来

修改关联表

parent e5cd0dcc
Showing with 12 additions and 2 deletions
...@@ -104,12 +104,22 @@ func handle(userId,saleId int)(result bool) { ...@@ -104,12 +104,22 @@ func handle(userId,saleId int)(result bool) {
_,err := dao.GetDb().Exec("INSERT INTO `lie_salesman` ( `user_id`, `sale_id`, `assign_time`, `update_time`)VALUES(?,?,?,?)",crmUserId,saleId,timeNow,timeNow) _,err := dao.GetDb().Exec("INSERT INTO `lie_salesman` ( `user_id`, `sale_id`, `assign_time`, `update_time`)VALUES(?,?,?,?)",crmUserId,saleId,timeNow,timeNow)
fmt.Println(err) fmt.Println(err)
}else{ }else{
_,err := dao.GetDb().Exec("update lie_salesman set assign_time = ?,update_time = ?,sale_id= ? where user_id = ?",timeNow,timeNow,saleId,crmUserId) _,err := dao.GetDb().Exec("update lie_salesman set update_time = ?,sale_id= ? where user_id = ?",timeNow,saleId,crmUserId)
fmt.Println(err) fmt.Println(err)
} }
// 修改新的关联表 lie_invoice_com_user
var invUserId int
_ = dao.GetDb().QueryRowx("select user_id from lie_invoice_com_user where user_id = ?",userId).Scan(&invUserId)
if invUserId == 0 {
dao.GetDb().Exec("INSERT INTO `lie_invoice_com_user` ( `user_id`, `sale_id`, `create_time`, `update_time`)VALUES(?,?,?,?)",userId,saleId,timeNow,timeNow)
} else {
dao.GetDb().Exec("update `lie_invoice_com_user` set sale_id= ?, status = ?, update_time = ? where user_id = ?", saleId, 0, timeNow, userId)
}
dao.GetDb().Exec("update lie_user set is_free = ?, free_time = ? where user_id = ?", 0, 0, crmUserId) dao.GetDb().Exec("update lie_user set is_free = ?, free_time = ? where user_id = ?", 0, 0, crmUserId)
_,err := dao.GetDb().Exec("insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)", crmUserId, 2, "用户下单", "自动分配客服,客服ID:"+ strconv.Itoa(saleId), timeNow) _,err := dao.GetDb().Exec("insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)", crmUserId, 2, "用户下单", "分配客服,客服ID:"+ strconv.Itoa(saleId), timeNow)
fmt.Println(err) fmt.Println(err)
return true return true
} }
......
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