Commit e406b690 by 朱继来

新增用户添加客服池分配

parent 82a1f9e4
......@@ -86,8 +86,12 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool {
return false
}
var event string
if memberInfo.Sale_Id != 0 {
event = "已指派客服,客服ID:"+ strconv.Itoa(memberInfo.Sale_Id)
}
curr_time := time.Now().Unix()
dbTran.Exec("insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)", lastInsertId, 2, "新增用户", "自动分配客服,客服ID:"+ strconv.Itoa(memberInfo.Sale_Id), curr_time)
dbTran.Exec("insert into lie_action_log (user_id, type, event, remark, create_time) values (?, ?, ?, ?, ?)", lastInsertId, 2, "新增用户", event, curr_time)
dbTran.Commit()
return true
......
......@@ -9,6 +9,7 @@ import (
"regexp"
"strconv"
"strings"
"time"
)
//会员系统的用户逻辑
......@@ -61,6 +62,13 @@ func SetTagSale(tag string,memberInfo *model.MemberAddUserData){
}
//处理基本的原始数据
/*
sale_id 获取方式:
1. 从平台订单表lie_order获取最近一笔订单的客服;
2. 若用户从会员系统后台注册,默认分配给当前操作人员,通过lie_user_info获取客服;
3. 通过注册用户url携带参数(adtag、ptag),结合CRM自动分配表,获取指定客服;
4. CRM客服池自动分配;
*/
func HandleData(MemberUserInfo model.MemberAddUserData) model.MemberAddUserData{
var saleId = 0
......@@ -152,6 +160,24 @@ func HandleData(MemberUserInfo model.MemberAddUserData) model.MemberAddUserData{
SetTagSale(adtag,&MemberUserInfo)
}
// 若前三种方式都没获取到sale_id,则从客服池中获取
if MemberUserInfo.Sale_Id == 0 {
var kefu model.Kefu
dao.GetDb().Get(&kefu,"select * from lie_kefu where status = ?",1)
MemberUserInfo.Sale_Id = kefu.SaleId
// 删除后新增到末尾,并重新设置第一条为‘待分配’
dao.GetDb().Exec("delete from lie_kefu where sale_id = ?", kefu.SaleId)
current_time := time.Now().Unix()
dao.GetDb().Exec("insert into lie_kefu (sale_id, sale_name, email, operator_id, operator_name, create_time, update_time) values (?, ?, ?, ?, ?, ?, ?)", kefu.SaleId,
kefu.SaleName, kefu.Email, kefu.OperatorId, kefu.OperatorName, current_time, current_time)
var first_kefu model.Kefu
dao.GetDb().Get(&first_kefu, "select * from lie_kefu order by id asc limit 1")
dao.GetDb().Exec("update lie_kefu set status = ?, update_time = ? where id = ?", 1, current_time, first_kefu.Id)
}
//地址
if MemberUserInfo.Com_Province_Id != 0 && MemberUserInfo.Com_City_Id != 0 && MemberUserInfo.Com_Area_Id != 0 {
MemberUserInfo.Com_Full_addr = common.AllCity[strconv.Itoa(MemberUserInfo.Com_Province_Id)] + common.AllCity[strconv.Itoa(MemberUserInfo.Com_City_Id)] + common.AllCity[strconv.Itoa(MemberUserInfo.Com_Area_Id)] + MemberUserInfo.Com_Address
......@@ -179,7 +205,5 @@ func HandleData(MemberUserInfo model.MemberAddUserData) model.MemberAddUserData{
MemberUserInfo.No_Create_Order = 1
}
return MemberUserInfo
}
\ No newline at end of file
package model
type Kefu struct {
Id int `json:"id" db:"id"`
SaleId int `json:"sale_id" db:"sale_id"`
SaleName string `json:"sale_name" db:"sale_name"`
Email string `json:"email" db:"email"`
Status int `json:"status" db:"status"`
OperatorId int `json:"operator_id" db:"operator_id"`
OperatorName string `json:"operator_name" db:"operator_name"`
Create_Time int64 `json:"create_time" db:"create_time"`
Update_Time int64 `json:"update_time" db:"update_time"`
}
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