Commit 4b6ebd4a by 朱继来

调整快速找料脚本

parent 423d7f19
...@@ -12,7 +12,9 @@ import ( ...@@ -12,7 +12,9 @@ import (
"crm-server/cmd/task/common" "crm-server/cmd/task/common"
"crm-server/configs" "crm-server/configs"
"crm-server/internal/dao" "crm-server/internal/dao"
"crm-server/internal/logic"
"crm-server/internal/model" "crm-server/internal/model"
"crm-server/internal/model/cms"
"crm-server/internal/service" "crm-server/internal/service"
"flag" "flag"
"fmt" "fmt"
...@@ -138,8 +140,13 @@ func setFindGoods(status, task_id, task_type, task_display_degree int) { ...@@ -138,8 +140,13 @@ func setFindGoods(status, task_id, task_type, task_display_degree int) {
db.Get(&invUserId, "select id from lie_invoice_com_user where user_id = ?", feedback.User_Id) db.Get(&invUserId, "select id from lie_invoice_com_user where user_id = ?", feedback.User_Id)
if invUserId == 0 { if invUserId == 0 {
db.Exec("INSERT INTO `lie_invoice_com_user` ( `user_id`, `sale_id`, `create_time`, `update_time`) VALUES (?,?,?,?)", var cms_user_info cms.CmsUserInfo
feedback.User_Id, salesman.Sale_Id, current_time, current_time) dao.GetCmsDb().Get(&cms_user_info, "select userId,name,department_id from user_info where userId =", salesman.Sale_Id)
channel_type := logic.GetChannelType(salesman.Sale_Id)
db.Exec("INSERT INTO `lie_invoice_com_user` ( `user_id`, `sale_id`, `department_id`, `sale_type`, `create_time`, `update_time`) VALUES (?,?,?,?)",
feedback.User_Id, salesman.Sale_Id, cms_user_info.DepartmentId, channel_type, current_time, current_time)
} else { } else {
db.Exec("update `lie_invoice_com_user` set sale_id= ?, status = ?, update_time = ? where user_id = ?", db.Exec("update `lie_invoice_com_user` set sale_id= ?, status = ?, update_time = ? where user_id = ?",
salesman.Sale_Id, 0, current_time, feedback.User_Id) salesman.Sale_Id, 0, current_time, feedback.User_Id)
......
...@@ -79,7 +79,8 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool { ...@@ -79,7 +79,8 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool {
} }
//插入跟进记录 //插入跟进记录
insertResult, err = dbTran.Exec("INSERT INTO `lie_assign_active` (`user_id`, `turn_in_id`,`is_success`,`change_time`,`create_time`)VALUES(?,?,1,?,?);",lastInsertId,memberInfo.Sale_Id,memberInfo.Create_Time,memberInfo.Create_Time) insertResult, err = dbTran.Exec("INSERT INTO `lie_assign_active` (`user_id`, `turn_in_id`,`is_success`,`change_time`,`create_time`) VALUES (?,?,1,?,?);",
lastInsertId,memberInfo.Sale_Id,memberInfo.Create_Time,memberInfo.Create_Time)
if err != nil { if err != nil {
service.WriteErrDetail("插入用户数据错误:插入跟进销售记录"+err.Error()) service.WriteErrDetail("插入用户数据错误:插入跟进销售记录"+err.Error())
err = dbTran.Rollback() err = dbTran.Rollback()
...@@ -88,7 +89,8 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool { ...@@ -88,7 +89,8 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool {
} }
//插入用户关联关系 20200406新增 //插入用户关联关系 20200406新增
insertResult, err = dbTran.Exec(INSERTINVOICECOMUSER,0,memberInfo.User_Id,memberInfo.Sale_Id,department_id,memberInfo.Channel_type,memberInfo.Create_Time, memberInfo.Invite_Code) insertResult, err = dbTran.Exec(INSERTINVOICECOMUSER,0,memberInfo.User_Id,memberInfo.Sale_Id,department_id,memberInfo.Channel_type,memberInfo.Create_Time,
memberInfo.Invite_Code)
if err != nil { if err != nil {
service.WriteErrDetail("插入用户数据错误:插入用户关联关系"+err.Error()) service.WriteErrDetail("插入用户数据错误:插入用户关联关系"+err.Error())
err = dbTran.Rollback() err = dbTran.Rollback()
...@@ -96,7 +98,8 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool { ...@@ -96,7 +98,8 @@ func InsertMemberUser(memberInfo model.MemberAddUserData)bool {
} }
//插入公司 //插入公司
insertResult, err = dbTran.Exec(INSERTCOMPANY,lastInsertId,memberInfo.Com_Name,memberInfo.Com_Full_addr,memberInfo.Com_Telphone,memberInfo.Com_Fax,"",memberInfo.Com_Desc, memberInfo.Create_Time) insertResult, err = dbTran.Exec(INSERTCOMPANY,lastInsertId,memberInfo.Com_Name,memberInfo.Com_Full_addr,memberInfo.Com_Telphone,memberInfo.Com_Fax,"",
memberInfo.Com_Desc, memberInfo.Create_Time)
if err != nil { if err != nil {
service.WriteErrDetail("插入用户数据错误:插入公司"+err.Error()) service.WriteErrDetail("插入用户数据错误:插入公司"+err.Error())
err = dbTran.Rollback() err = dbTran.Rollback()
......
package cms
type CmsUserInfo struct {
UserId int `json:"userId" db:"userId"`
Name string `json:"name" db:"name"`
EngName string `json:"engName" db:"engName"`
Email string `json:"email" db:"email"`
CodeSn string `json:"code_sn" db:"code_sn"`
Mobile string `json:"mobile" db:"mobile"`
DepartmentId int `json:"department_id" db:"department_id"`
DepartmentName string `json:"department_name" db:"department_name"`
PositionId int `json:"position_id" db:"position_id"`
PositionName string `json:"position_name" db:"position_name"`
Status int `json:"status" db:"status"`
Ctime int `json:"ctime" db:"ctime"`
Mtime int `json:"mtime" db:"mtime"`
}
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