|
@@ -1,32 +1,18 @@
|
|
|
package client
|
|
|
|
|
|
import (
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- "app.yhyue.com/moapp/jybase/common"
|
|
|
- "app.yhyue.com/moapp/jybase/encrypt"
|
|
|
- "app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
- "app.yhyue.com/moapp/jybase/mongodb"
|
|
|
- "cmplatform/util"
|
|
|
-========
|
|
|
qu "app.yhyue.com/moapp/jybase/common"
|
|
|
"app.yhyue.com/moapp/jybase/encrypt"
|
|
|
"app.yhyue.com/moapp/jybase/go-xweb/xweb"
|
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
|
"github.com/lauyoume/gopinyin"
|
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- "io"
|
|
|
-
|
|
|
- "log"
|
|
|
-========
|
|
|
"io/ioutil"
|
|
|
"log"
|
|
|
. "seplatform/util"
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
"time"
|
|
@@ -55,7 +41,7 @@ type OwnTag struct {
|
|
|
|
|
|
// 保存客户信息
|
|
|
func (c *OwnTag) CustomerSave() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
//data := GetPostForm(c.Request)
|
|
|
data := map[string]interface{}{}
|
|
@@ -64,7 +50,7 @@ func (c *OwnTag) CustomerSave() {
|
|
|
log.Println("err", err)
|
|
|
}
|
|
|
log.Println("接收数据:", data)
|
|
|
- id := common.ObjToString(data["id"])
|
|
|
+ id := qu.ObjToString(data["id"])
|
|
|
delete(data, "id")
|
|
|
i_createtime := time.Now().Unix()
|
|
|
data["i_updatetime"] = i_createtime
|
|
@@ -77,19 +63,19 @@ func (c *OwnTag) CustomerSave() {
|
|
|
data["b_delete"] = false
|
|
|
data["i_createtime"] = i_createtime
|
|
|
data["i_state"] = 0
|
|
|
- id = util.Mgo.Save("cuser", data)
|
|
|
+ id = Mgo.Save("cuser", data)
|
|
|
if id != "" {
|
|
|
for _, v := range departArr {
|
|
|
v["s_userid"] = id
|
|
|
v["i_createtime"] = time.Now().Unix()
|
|
|
v["i_updatetime"] = time.Now().Unix()
|
|
|
- v["i_isuse"] = common.IntAll(v["i_isuse"])
|
|
|
+ v["i_isuse"] = qu.IntAll(v["i_isuse"])
|
|
|
v["b_delete"] = false
|
|
|
}
|
|
|
if len(departArr) == 0 {
|
|
|
rep = true
|
|
|
} else {
|
|
|
- rep = util.Mgo.SaveBulk("cuserdepart", departArr...)
|
|
|
+ rep = Mgo.SaveBulk("cuserdepart", departArr...)
|
|
|
}
|
|
|
} else {
|
|
|
rep = false
|
|
@@ -97,20 +83,20 @@ func (c *OwnTag) CustomerSave() {
|
|
|
} else {
|
|
|
if data["mails"] != nil {
|
|
|
mailsMap := map[string]interface{}{}
|
|
|
- mails := common.ObjArrToStringArr(data["mails"].([]interface{}))
|
|
|
+ mails := qu.ObjArrToStringArr(data["mails"].([]interface{}))
|
|
|
for _, val := range mails {
|
|
|
mailArr := strings.Split(val, "+")
|
|
|
mailsMap[mailArr[0]] = mailArr[1]
|
|
|
}
|
|
|
log.Println(mailsMap)
|
|
|
- appid := common.ObjToString(data["s_appid"])
|
|
|
+ appid := qu.ObjToString(data["s_appid"])
|
|
|
q := bson.M{
|
|
|
"appid": appid,
|
|
|
}
|
|
|
setMap := map[string]interface{}{
|
|
|
"mails": mailsMap,
|
|
|
}
|
|
|
- rep = util.MgoCus.Update("user", q, bson.M{"$set": setMap}, false, false)
|
|
|
+ rep = MgoCus.Update("user", q, bson.M{"$set": setMap}, false, false)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rep": rep,
|
|
|
})
|
|
@@ -121,7 +107,7 @@ func (c *OwnTag) CustomerSave() {
|
|
|
query := bson.M{
|
|
|
"_id": mongodb.StringTOBsonId(id),
|
|
|
}
|
|
|
- rep = util.Mgo.Update("cuser", query, bson.M{"$set": data}, false, false)
|
|
|
+ rep = Mgo.Update("cuser", query, bson.M{"$set": data}, false, false)
|
|
|
|
|
|
}
|
|
|
c.ServeJson(map[string]interface{}{
|
|
@@ -132,29 +118,29 @@ func (c *OwnTag) CustomerSave() {
|
|
|
|
|
|
// 新建/编辑标签
|
|
|
func (c *OwnTag) EuserTagEdit() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
_id := c.GetString("_id")
|
|
|
- data := util.GetPostForm(c.Request)
|
|
|
- cid := common.ObjToString(data["s_userid"])
|
|
|
+ data := GetPostForm(c.Request)
|
|
|
+ cid := qu.ObjToString(data["s_userid"])
|
|
|
createTime := time.Now().Unix()
|
|
|
o_rules := []map[string]interface{}{}
|
|
|
o_rulesStr := data["o_list"].(string)
|
|
|
json.Unmarshal([]byte(o_rulesStr), &o_rules)
|
|
|
data["o_list"] = o_rules
|
|
|
- hid := common.ObjToString(data["hid"])
|
|
|
+ hid := qu.ObjToString(data["hid"])
|
|
|
var rep = true
|
|
|
if hid == "" {
|
|
|
if _id == "" {
|
|
|
data["i_createtime"] = createTime
|
|
|
data["i_updatetime"] = createTime
|
|
|
data["b_delete"] = false
|
|
|
- _id = util.Mgo.Save("eusertagrule", data)
|
|
|
+ _id = Mgo.Save("eusertagrule", data)
|
|
|
} else {
|
|
|
query := bson.M{
|
|
|
"_id": mongodb.StringTOBsonId(_id),
|
|
|
}
|
|
|
- rep = util.Mgo.Update("eusertagrule", query, bson.M{"$set": data}, false, false)
|
|
|
+ rep = Mgo.Update("eusertagrule", query, bson.M{"$set": data}, false, false)
|
|
|
}
|
|
|
} else {
|
|
|
if _id == "" {
|
|
@@ -162,13 +148,13 @@ func (c *OwnTag) EuserTagEdit() {
|
|
|
data["i_updatetime"] = createTime
|
|
|
data["i_type"] = "historyData"
|
|
|
data["b_delete"] = true
|
|
|
- _id = util.Mgo.Save("eusertagrule", data)
|
|
|
+ _id = Mgo.Save("eusertagrule", data)
|
|
|
rep = AddHistoryLogTag(data, false, _id)
|
|
|
} else {
|
|
|
query := bson.M{
|
|
|
"_id": mongodb.StringTOBsonId(_id),
|
|
|
}
|
|
|
- reps := util.Mgo.Update("eusertagrule", query, bson.M{"$set": data}, false, false)
|
|
|
+ reps := Mgo.Update("eusertagrule", query, bson.M{"$set": data}, false, false)
|
|
|
if reps {
|
|
|
rep = AddHistoryLogTag(data, true, _id)
|
|
|
}
|
|
@@ -180,19 +166,19 @@ func (c *OwnTag) EuserTagEdit() {
|
|
|
})
|
|
|
} else {
|
|
|
if c.GetString("id") != "" {
|
|
|
- data, _ := util.Mgo.FindById("eusertagrule", c.GetString("id"), nil)
|
|
|
+ data, _ := Mgo.FindById("eusertagrule", c.GetString("id"), nil)
|
|
|
c.T["tagrule"] = *data
|
|
|
}
|
|
|
cid := c.GetString("cid")
|
|
|
c.T["cid"] = cid
|
|
|
- c.T["matchTypeMap"] = util.MatchTypeMap3
|
|
|
+ c.T["matchTypeMap"] = MatchTypeMap3
|
|
|
c.T["hid"] = c.GetString("hid")
|
|
|
c.Render("client/customer_tag_rule.html", &c.T)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
func (c *OwnTag) CustomerHistory() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
id := c.GetString("id")
|
|
|
user := c.GetSession("user").(map[string]interface{})
|
|
|
query := bson.M{}
|
|
@@ -202,11 +188,7 @@ func (c *OwnTag) CustomerHistory() {
|
|
|
history_id := ""
|
|
|
if hid != "" {
|
|
|
history_id = hid
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- hData, ok := util.Mgo.FindOne("historylog", bson.M{"_id": mongodb.StringTOBsonId(history_id)})
|
|
|
-========
|
|
|
hData, ok := Mgo.FindOne("historylog", bson.M{"_id": mongodb.StringTOBsonId(history_id)})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if ok && hData != nil && len(*hData) > 0 {
|
|
|
c.T["history_rule"] = (*hData)["dep_rules"]
|
|
|
c.T["tagrule"] = (*hData)["tag_rules"]
|
|
@@ -216,17 +198,17 @@ func (c *OwnTag) CustomerHistory() {
|
|
|
} else {
|
|
|
var user_name, user_customername, user_salesperson, appid = "", "", "", ""
|
|
|
var push_model, push_type, i_push = 0, 0, 0
|
|
|
- userInfo, ok := util.Mgo.FindOne("euser", query)
|
|
|
+ userInfo, ok := Mgo.FindOne("euser", query)
|
|
|
if ok && userInfo != nil && *userInfo != nil {
|
|
|
- user_name = common.ObjToString((*userInfo)["s_name"])
|
|
|
- user_customername = common.ObjToString((*userInfo)["s_customername"])
|
|
|
- user_salesperson = common.ObjToString((*userInfo)["s_salesperson"])
|
|
|
- push_model = common.IntAll((*userInfo)["i_pushmodel"])
|
|
|
- push_type = common.IntAll((*userInfo)["i_pushtype"])
|
|
|
- i_push = common.IntAll((*userInfo)["i_push"])
|
|
|
- appid = common.ObjToString((*userInfo)["s_appid"])
|
|
|
+ user_name = qu.ObjToString((*userInfo)["s_name"])
|
|
|
+ user_customername = qu.ObjToString((*userInfo)["s_customername"])
|
|
|
+ user_salesperson = qu.ObjToString((*userInfo)["s_salesperson"])
|
|
|
+ push_model = qu.IntAll((*userInfo)["i_pushmodel"])
|
|
|
+ push_type = qu.IntAll((*userInfo)["i_pushtype"])
|
|
|
+ i_push = qu.IntAll((*userInfo)["i_push"])
|
|
|
+ appid = qu.ObjToString((*userInfo)["s_appid"])
|
|
|
}
|
|
|
- history_id = util.Mgo.Save("historylog", map[string]interface{}{
|
|
|
+ history_id = Mgo.Save("historylog", map[string]interface{}{
|
|
|
"createtime": time.Now().Unix(),
|
|
|
"updatetime": time.Now().Unix(),
|
|
|
"user_id": id,
|
|
@@ -249,13 +231,13 @@ func (c *OwnTag) CustomerHistory() {
|
|
|
|
|
|
// 导入关键词
|
|
|
func (c *OwnTag) EuserImport() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
mf, _, err := c.GetFile("xlsx")
|
|
|
if err == nil {
|
|
|
- binary, err := io.ReadAll(mf)
|
|
|
+ binary, err := ioutil.ReadAll(mf)
|
|
|
if err == nil {
|
|
|
- rdata, err := util.Parsxlsx1(binary)
|
|
|
+ rdata, err := Parsxlsx1(binary)
|
|
|
if err == nil {
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rdata": rdata,
|
|
@@ -273,20 +255,15 @@ func (c *OwnTag) EuserImport() {
|
|
|
|
|
|
// 编辑客户信息
|
|
|
func (c *OwnTag) CustomerEdit() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
id := c.GetString("id")
|
|
|
query := bson.M{}
|
|
|
query["_id"] = mongodb.StringTOBsonId(id)
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- data, _ := util.Mgo.FindOneByField("cuser", query, `{}`)
|
|
|
- depart, _ := util.Mgo.Find("cuserdepart", bson.M{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
|
|
|
-========
|
|
|
data, _ := Mgo.FindOneByField("cuser", query, `{}`)
|
|
|
depart, _ := Mgo.Find("cuserdepart", bson.M{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
(*data)["_id"] = mongodb.BsonIdToSId((*data)["_id"])
|
|
|
if (*data)["i_state"] == 1 {
|
|
|
- tagRule, _ := util.Mgo.Find("eusertagrule", bson.M{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
|
|
|
+ tagRule, _ := Mgo.Find("eusertagrule", bson.M{"s_userid": id, "b_delete": false}, nil, nil, false, -1, -1)
|
|
|
c.T["tagrule"] = *tagRule
|
|
|
}
|
|
|
c.T["data"] = *data
|
|
@@ -296,7 +273,7 @@ func (c *OwnTag) CustomerEdit() {
|
|
|
|
|
|
// 标签的启用禁用
|
|
|
func (c *OwnTag) TagSetup() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
_id := c.GetString("_id")
|
|
|
i_isuse, _ := c.GetInt("i_isuse")
|
|
@@ -305,7 +282,7 @@ func (c *OwnTag) TagSetup() {
|
|
|
"i_isuse": i_isuse,
|
|
|
},
|
|
|
}
|
|
|
- b := util.Mgo.UpdateById("eusertagrule", _id, set)
|
|
|
+ b := Mgo.UpdateById("eusertagrule", _id, set)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rep": b,
|
|
|
})
|
|
@@ -314,14 +291,14 @@ func (c *OwnTag) TagSetup() {
|
|
|
|
|
|
// 删除标签
|
|
|
func (c *OwnTag) TagDel() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
_id := c.GetString("_id")
|
|
|
set := bson.M{
|
|
|
"$set": bson.M{
|
|
|
"b_delete": true,
|
|
|
},
|
|
|
}
|
|
|
- b := util.Mgo.UpdateById("eusertagrule", _id, set)
|
|
|
+ b := Mgo.UpdateById("eusertagrule", _id, set)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rep": b,
|
|
|
})
|
|
@@ -329,7 +306,7 @@ func (c *OwnTag) TagDel() {
|
|
|
|
|
|
// 关联规则列表
|
|
|
func (c *OwnTag) CuserRuleList() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
eid := c.GetString("eid")
|
|
|
start, _ := c.GetInt("start")
|
|
@@ -347,16 +324,12 @@ func (c *OwnTag) CuserRuleList() {
|
|
|
bson.M{"s_name": bson.M{"$regex": search}},
|
|
|
}
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- data, _ := util.Mgo.Find("euserdepartrule", query, `{"i_createtime":-1}`, nil, false, int(start), int(limit))
|
|
|
-========
|
|
|
data, _ := Mgo.Find("euserdepartrule", query, `{"i_createtime":-1}`, nil, false, int(start), int(limit))
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
for _, v := range *data {
|
|
|
- d, _ := util.Mgo.FindById("euserdepart", common.ObjToString(v["s_departid"]), nil)
|
|
|
- v["s_depart"] = common.ObjToString((*d)["s_name"])
|
|
|
+ d, _ := Mgo.FindById("euserdepart", qu.ObjToString(v["s_departid"]), nil)
|
|
|
+ v["s_depart"] = qu.ObjToString((*d)["s_name"])
|
|
|
}
|
|
|
- count := util.Mgo.Count("euserdepartrule", query)
|
|
|
+ count := Mgo.Count("euserdepartrule", query)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"draw": draw,
|
|
|
"data": data,
|
|
@@ -367,7 +340,7 @@ func (c *OwnTag) CuserRuleList() {
|
|
|
}
|
|
|
|
|
|
func (c *OwnTag) TagAssociated() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
_id := c.GetString("_id")
|
|
|
ids := c.GetString("ids")
|
|
|
set := bson.M{
|
|
@@ -375,14 +348,14 @@ func (c *OwnTag) TagAssociated() {
|
|
|
"o_departruleids": ids,
|
|
|
},
|
|
|
}
|
|
|
- b := util.Mgo.UpdateById("eusertagrule", _id, set)
|
|
|
+ b := Mgo.UpdateById("eusertagrule", _id, set)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rep": b,
|
|
|
})
|
|
|
}
|
|
|
|
|
|
func (c *OwnTag) Addhistoryrule() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
his_id := c.GetString("history_id")
|
|
|
//log.Println("hisid", his_id)
|
|
@@ -407,11 +380,7 @@ func (c *OwnTag) Addhistoryrule() {
|
|
|
"i_extfieldstype": i_extfieldstype,
|
|
|
},
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- isupdata := util.Mgo.UpdateById("historylog", mongodb.StringTOBsonId(his_id), set)
|
|
|
-========
|
|
|
isupdata := Mgo.UpdateById("historylog", mongodb.StringTOBsonId(his_id), set)
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if isupdata {
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"history_id": his_id,
|
|
@@ -430,20 +399,20 @@ func (c *OwnTag) Addhistoryrule() {
|
|
|
}
|
|
|
|
|
|
func (c *OwnTag) HistoryRuleCreate() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
if c.Method() == "POST" {
|
|
|
user := c.GetSession("user").(map[string]interface{})
|
|
|
- data := util.GetPostForm(c.Request)
|
|
|
+ data := GetPostForm(c.Request)
|
|
|
o_rules := []map[string]interface{}{}
|
|
|
o_rulesStr := data["o_rules"].(string)
|
|
|
json.Unmarshal([]byte(o_rulesStr), &o_rules)
|
|
|
data["o_rules"] = o_rules
|
|
|
- id := common.ObjToString(data["id"])
|
|
|
+ id := qu.ObjToString(data["id"])
|
|
|
user_id := data["ids"]
|
|
|
delete(data, "id")
|
|
|
delete(data, "ids")
|
|
|
- if common.IntAll(data["i_esquerytype"]) == 1 { //自动生成es
|
|
|
- data["s_esquery"] = util.Utiltags(data)
|
|
|
+ if qu.IntAll(data["i_esquerytype"]) == 1 { //自动生成es
|
|
|
+ data["s_esquery"] = Utiltags(data)
|
|
|
}
|
|
|
i_createtime := time.Now().Unix()
|
|
|
data["i_updatetime"] = i_createtime
|
|
@@ -452,7 +421,7 @@ func (c *OwnTag) HistoryRuleCreate() {
|
|
|
var rep = false
|
|
|
s_id := ""
|
|
|
if id == "" { //新建
|
|
|
- dData, ok := util.Mgo.FindOne("euserdepart", bson.M{"s_userid": user_id, "s_name": data["departmentName"]})
|
|
|
+ dData, ok := Mgo.FindOne("euserdepart", bson.M{"s_userid": user_id, "s_name": data["departmentName"]})
|
|
|
if dData == nil || *dData == nil || !ok {
|
|
|
d_data := map[string]interface{}{
|
|
|
"i_isuse": 1,
|
|
@@ -463,7 +432,7 @@ func (c *OwnTag) HistoryRuleCreate() {
|
|
|
"b_delete": true,
|
|
|
"i_type": "historyData",
|
|
|
}
|
|
|
- s_id = util.Mgo.Save("euserdepart", d_data)
|
|
|
+ s_id = Mgo.Save("euserdepart", d_data)
|
|
|
} else {
|
|
|
s_id = mongodb.BsonIdToSId((*dData)["_id"])
|
|
|
}
|
|
@@ -471,12 +440,12 @@ func (c *OwnTag) HistoryRuleCreate() {
|
|
|
data["s_departid"] = s_id
|
|
|
data["i_createtime"] = i_createtime
|
|
|
data["s_createuser"] = user["name"]
|
|
|
- s_namekey := gopinyin.Convert(common.ObjToString(data["s_name"]), false)
|
|
|
+ s_namekey := gopinyin.Convert(qu.ObjToString(data["s_name"]), false)
|
|
|
data["s_namekey"] = s_namekey
|
|
|
data["b_delete"] = true
|
|
|
data["s_dataid"] = encrypt.SE.EncodeString(fmt.Sprintf("%v", i_createtime) + s_namekey + s_id)
|
|
|
data["i_type"] = "historyData"
|
|
|
- id = util.Mgo.Save("euserdepartrule", data)
|
|
|
+ id = Mgo.Save("euserdepartrule", data)
|
|
|
if id != "" {
|
|
|
rep = AddHistoryLogDep(data, false, id)
|
|
|
} else {
|
|
@@ -486,7 +455,7 @@ func (c *OwnTag) HistoryRuleCreate() {
|
|
|
query := bson.M{
|
|
|
"_id": mongodb.StringTOBsonId(id),
|
|
|
}
|
|
|
- reps := util.Mgo.Update("euserdepartrule", query, bson.M{"$set": data}, false, false)
|
|
|
+ reps := Mgo.Update("euserdepartrule", query, bson.M{"$set": data}, false, false)
|
|
|
if reps {
|
|
|
rep = AddHistoryLogDep(data, true, id)
|
|
|
}
|
|
@@ -504,34 +473,30 @@ func (c *OwnTag) HistoryRuleCreate() {
|
|
|
c.T["cid"] = id //客户id
|
|
|
c.T["ids"] = id
|
|
|
c.T["history_id"] = c.GetString("hid")
|
|
|
- c.T["province"] = util.Province
|
|
|
- c.T["city"] = util.ProvinceCitys
|
|
|
- c.T["district"] = util.CityDistricts
|
|
|
- c.T["topTypeArr"] = util.TopTypeArr
|
|
|
- c.T["subTypeArr"] = util.SubTypeArr
|
|
|
- c.T["matchTypeMap"] = util.MatchTypeMap
|
|
|
- c.T["matchTypeMap2"] = util.MatchTypeMap2
|
|
|
- c.T["existField"] = util.ExistFiled
|
|
|
- c.T["buyerClass"] = util.BuyerClass
|
|
|
- c.T["scopeClass"] = util.ScopeClassMap
|
|
|
+ c.T["province"] = Province
|
|
|
+ c.T["city"] = ProvinceCitys
|
|
|
+ c.T["district"] = CityDistricts
|
|
|
+ c.T["topTypeArr"] = TopTypeArr
|
|
|
+ c.T["subTypeArr"] = SubTypeArr
|
|
|
+ c.T["matchTypeMap"] = MatchTypeMap
|
|
|
+ c.T["matchTypeMap2"] = MatchTypeMap2
|
|
|
+ c.T["existField"] = ExistFiled
|
|
|
+ c.T["buyerClass"] = BuyerClass
|
|
|
+ c.T["scopeClass"] = ScopeClassMap
|
|
|
c.Render("client/cuser_rule_history_edit.html", &c.T)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 历史任务删除私有标签
|
|
|
func (c *OwnTag) HistoryTagDel() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
// userid := c.GetString("userid")
|
|
|
tagid := c.GetString("tagid")
|
|
|
hid := c.GetString("hid")
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- user_info, _ := util.Mgo.FindOne("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
-========
|
|
|
user_info, _ := Mgo.FindOne("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if user_info != nil && *user_info != nil {
|
|
|
if (*user_info)["tag_rules"] != nil {
|
|
|
- user_tag_rules := common.ObjArrToMapArr((*user_info)["tag_rules"].([]interface{}))
|
|
|
+ user_tag_rules := qu.ObjArrToMapArr((*user_info)["tag_rules"].([]interface{}))
|
|
|
ruleMap := map[string]bool{tagid: true}
|
|
|
ruleArr := []map[string]interface{}{}
|
|
|
for _, m := range user_tag_rules {
|
|
@@ -539,11 +504,7 @@ func (c *OwnTag) HistoryTagDel() {
|
|
|
ruleArr = append(ruleArr, m)
|
|
|
}
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- is_updata := util.Mgo.Update("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)}, bson.M{"$set": bson.M{"tag_rules": ruleArr}}, false, false)
|
|
|
-========
|
|
|
is_updata := Mgo.Update("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)}, bson.M{"$set": bson.M{"tag_rules": ruleArr}}, false, false)
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rep": is_updata,
|
|
|
})
|
|
@@ -557,24 +518,20 @@ func (c *OwnTag) HistoryTagDel() {
|
|
|
|
|
|
// 私有标签关联数据
|
|
|
func (c *OwnTag) HistoryTagAssociated() {
|
|
|
- defer common.Catch()
|
|
|
+ defer qu.Catch()
|
|
|
userid := c.GetString("userid")
|
|
|
rule_id := c.GetString("_id")
|
|
|
tags := c.GetString("ids")
|
|
|
hid := c.GetString("hid")
|
|
|
|
|
|
if userid != "" {
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- user_info, _ := util.Mgo.FindOne("historylog", map[string]interface{}{
|
|
|
-========
|
|
|
user_info, _ := Mgo.FindOne("historylog", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId(hid),
|
|
|
})
|
|
|
if user_info != nil && *user_info != nil {
|
|
|
tagrules := (*user_info)["tag_rules"]
|
|
|
if tagrules != nil {
|
|
|
- tagrulesArr := common.ObjArrToMapArr(tagrules.([]interface{}))
|
|
|
+ tagrulesArr := qu.ObjArrToMapArr(tagrules.([]interface{}))
|
|
|
for _, m := range tagrulesArr {
|
|
|
if rule_id == mongodb.BsonIdToSId(m["_id"]) {
|
|
|
m["o_departruleids"] = tags
|
|
@@ -585,11 +542,7 @@ func (c *OwnTag) HistoryTagAssociated() {
|
|
|
"tag_rules": tagrulesArr,
|
|
|
},
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- is_updata := util.Mgo.Update("historylog", map[string]interface{}{
|
|
|
-========
|
|
|
is_updata := Mgo.Update("historylog", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId(hid),
|
|
|
}, set, false, false)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
@@ -606,18 +559,14 @@ func (c *OwnTag) SaveHistoryRule() {
|
|
|
history_id := c.GetString("hid")
|
|
|
// userid := c.GetString("userid")
|
|
|
if history_id != "" {
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- user_history, _ := util.Mgo.FindOne("historylog", map[string]interface{}{
|
|
|
-========
|
|
|
user_history, _ := Mgo.FindOne("historylog", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId(history_id),
|
|
|
})
|
|
|
if *user_history != nil && user_history != nil {
|
|
|
//获取私有标签
|
|
|
// usertags := getTserTag(userid)
|
|
|
if (*user_history)["dep_rules"] != nil {
|
|
|
- dep_rules := common.ObjArrToMapArr((*user_history)["dep_rules"].([]interface{}))
|
|
|
+ dep_rules := qu.ObjArrToMapArr((*user_history)["dep_rules"].([]interface{}))
|
|
|
dep_new_rules := []map[string]interface{}{}
|
|
|
ruleMap := map[string]bool{}
|
|
|
if len(dep_rules) > 0 {
|
|
@@ -633,14 +582,10 @@ func (c *OwnTag) SaveHistoryRule() {
|
|
|
"_id": mongodb.StringTOBsonId(rule),
|
|
|
"b_delete": false,
|
|
|
}
|
|
|
- res, _ := util.Mgo.FindOne("euserdepartrule", query)
|
|
|
+ res, _ := Mgo.FindOne("euserdepartrule", query)
|
|
|
if res != nil && len(*res) != 0 {
|
|
|
//获取规则所属部门信息
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- department_info, _ := util.Mgo.FindOne("euserdepart", map[string]interface{}{
|
|
|
-========
|
|
|
department_info, _ := Mgo.FindOne("euserdepart", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId((*res)["s_departid"].(string)),
|
|
|
"b_delete": false,
|
|
|
})
|
|
@@ -657,11 +602,7 @@ func (c *OwnTag) SaveHistoryRule() {
|
|
|
"updatetime": time.Now().Unix(),
|
|
|
},
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- ok := util.Mgo.Update("historylog", map[string]interface{}{
|
|
|
-========
|
|
|
ok := Mgo.Update("historylog", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId(history_id),
|
|
|
}, set, false, false)
|
|
|
//log.Println("ok", ok)
|
|
@@ -677,14 +618,10 @@ func (c *OwnTag) SaveHistoryRule() {
|
|
|
"_id": mongodb.StringTOBsonId(rule),
|
|
|
"b_delete": false,
|
|
|
}
|
|
|
- res, _ := util.Mgo.FindOne("euserdepartrule", query)
|
|
|
+ res, _ := Mgo.FindOne("euserdepartrule", query)
|
|
|
if res != nil && *res != nil {
|
|
|
//获取规则所属部门信息
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- department_info, _ := util.Mgo.FindOne("euserdepart", map[string]interface{}{
|
|
|
-========
|
|
|
department_info, _ := Mgo.FindOne("euserdepart", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId((*res)["s_departid"].(string)),
|
|
|
"b_delete": false,
|
|
|
})
|
|
@@ -700,11 +637,7 @@ func (c *OwnTag) SaveHistoryRule() {
|
|
|
"updatetime": time.Now().Unix(),
|
|
|
},
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- isupdata := util.Mgo.Update("historylog", map[string]interface{}{
|
|
|
-========
|
|
|
isupdata := Mgo.Update("historylog", map[string]interface{}{
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
"_id": mongodb.StringTOBsonId(history_id),
|
|
|
}, set, false, false)
|
|
|
c.ServeJson(map[string]interface{}{
|
|
@@ -726,14 +659,10 @@ func (c *OwnTag) DelHistoryRule() {
|
|
|
id := c.GetString("id")
|
|
|
hid := c.GetString("hid")
|
|
|
if hid != "" {
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- data, ok := util.Mgo.FindOne("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
-========
|
|
|
data, ok := Mgo.FindOne("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if ok && data != nil && *data != nil {
|
|
|
if (*data)["dep_rules"] != nil {
|
|
|
- dep_rules := common.ObjArrToMapArr((*data)["dep_rules"].([]interface{}))
|
|
|
+ dep_rules := qu.ObjArrToMapArr((*data)["dep_rules"].([]interface{}))
|
|
|
ruleMap := map[string]bool{id: true}
|
|
|
ruleArr := []map[string]interface{}{}
|
|
|
for _, m := range dep_rules {
|
|
@@ -741,11 +670,7 @@ func (c *OwnTag) DelHistoryRule() {
|
|
|
ruleArr = append(ruleArr, m)
|
|
|
}
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- ok := util.Mgo.Update("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)}, bson.M{"$set": bson.M{"dep_rules": ruleArr}}, false, false)
|
|
|
-========
|
|
|
ok := Mgo.Update("historylog", bson.M{"_id": mongodb.StringTOBsonId(hid)}, bson.M{"$set": bson.M{"dep_rules": ruleArr}}, false, false)
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"success": ok,
|
|
|
})
|
|
@@ -758,35 +683,24 @@ func (c *OwnTag) HistoryRuleEdit() {
|
|
|
hid := c.GetString("hid")
|
|
|
rid := c.GetString("rid")
|
|
|
if c.Method() == "POST" {
|
|
|
- data := util.GetPostForm(c.Request)
|
|
|
+ data := GetPostForm(c.Request)
|
|
|
o_rules := []map[string]interface{}{}
|
|
|
o_rulesStr := data["o_rules"].(string)
|
|
|
json.Unmarshal([]byte(o_rulesStr), &o_rules)
|
|
|
data["o_rules"] = o_rules
|
|
|
data["_id"] = mongodb.StringTOBsonId(rid)
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- if common.IntAll(data["i_esquerytype"]) == 1 { //自动生成es
|
|
|
- data["s_esquery"] = util.Utiltags(data)
|
|
|
- }
|
|
|
- datas, ok := util.Mgo.FindOne("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
-========
|
|
|
if qu.IntAll(data["i_esquerytype"]) == 1 { //自动生成es
|
|
|
data["s_esquery"] = Utiltags(data)
|
|
|
}
|
|
|
datas, ok := Mgo.FindOne("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if ok && datas != nil && *datas != nil {
|
|
|
- dep_rules := common.ObjArrToMapArr((*datas)["dep_rules"].([]interface{}))
|
|
|
+ dep_rules := qu.ObjArrToMapArr((*datas)["dep_rules"].([]interface{}))
|
|
|
for k, v := range dep_rules {
|
|
|
if rid == mongodb.BsonIdToSId(v["_id"]) {
|
|
|
dep_rules[k] = data
|
|
|
}
|
|
|
}
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- rep := util.Mgo.Update("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(hid)}, map[string]interface{}{"$set": map[string]interface{}{"dep_rules": dep_rules}}, false, false)
|
|
|
-========
|
|
|
rep := Mgo.Update("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(hid)}, map[string]interface{}{"$set": map[string]interface{}{"dep_rules": dep_rules}}, false, false)
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
c.ServeJson(map[string]interface{}{
|
|
|
"rep": rep,
|
|
|
"s_esquery": data["s_esquery"],
|
|
@@ -794,13 +708,9 @@ func (c *OwnTag) HistoryRuleEdit() {
|
|
|
}
|
|
|
} else {
|
|
|
id := c.GetString("id")
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- data, ok := util.Mgo.FindOne("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
-========
|
|
|
data, ok := Mgo.FindOne("historylog", map[string]interface{}{"_id": mongodb.StringTOBsonId(hid)})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if ok && data != nil && *data != nil {
|
|
|
- dep_rules := common.ObjArrToMapArr((*data)["dep_rules"].([]interface{}))
|
|
|
+ dep_rules := qu.ObjArrToMapArr((*data)["dep_rules"].([]interface{}))
|
|
|
for _, v := range dep_rules {
|
|
|
if rid == mongodb.BsonIdToSId(v["_id"]) {
|
|
|
c.T["data"] = v
|
|
@@ -812,16 +722,16 @@ func (c *OwnTag) HistoryRuleEdit() {
|
|
|
c.T["ids"] = id
|
|
|
c.T["history_id"] = hid
|
|
|
c.T["rid"] = rid
|
|
|
- c.T["province"] = util.Province
|
|
|
- c.T["city"] = util.ProvinceCitys
|
|
|
- c.T["district"] = util.CityDistricts
|
|
|
- c.T["topTypeArr"] = util.TopTypeArr
|
|
|
- c.T["subTypeArr"] = util.SubTypeArr
|
|
|
- c.T["matchTypeMap"] = util.MatchTypeMap
|
|
|
- c.T["matchTypeMap2"] = util.MatchTypeMap2
|
|
|
- c.T["existField"] = util.ExistFiled
|
|
|
- c.T["buyerClass"] = util.BuyerClass
|
|
|
- c.T["scopeClass"] = util.ScopeClassMap
|
|
|
+ c.T["province"] = Province
|
|
|
+ c.T["city"] = ProvinceCitys
|
|
|
+ c.T["district"] = CityDistricts
|
|
|
+ c.T["topTypeArr"] = TopTypeArr
|
|
|
+ c.T["subTypeArr"] = SubTypeArr
|
|
|
+ c.T["matchTypeMap"] = MatchTypeMap
|
|
|
+ c.T["matchTypeMap2"] = MatchTypeMap2
|
|
|
+ c.T["existField"] = ExistFiled
|
|
|
+ c.T["buyerClass"] = BuyerClass
|
|
|
+ c.T["scopeClass"] = ScopeClassMap
|
|
|
c.Render("private/history_rule_edit.html", &c.T)
|
|
|
}
|
|
|
}
|
|
@@ -841,7 +751,7 @@ func (c *OwnTag) CustomerAllRule() {
|
|
|
//获取新增历史规则
|
|
|
inc_rules := []map[string]interface{}{}
|
|
|
inc_rule := make(map[string]interface{})
|
|
|
- inc_data, _ := util.Mgo.FindOne("historylog", inc_query)
|
|
|
+ inc_data, _ := Mgo.FindOne("historylog", inc_query)
|
|
|
if inc_data != nil && *inc_data != nil {
|
|
|
for _, t := range (*inc_data)["dep_rules"].([]interface{}) {
|
|
|
if !t.(map[string]interface{})["is_new"].(bool) {
|
|
@@ -856,7 +766,7 @@ func (c *OwnTag) CustomerAllRule() {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- data, _ := util.Mgo.Find("euserdepart", query, `{"i_createtime":-1}`, nil, false, 0, 0)
|
|
|
+ data, _ := Mgo.Find("euserdepart", query, `{"i_createtime":-1}`, nil, false, 0, 0)
|
|
|
if data != nil && len(*data) != 0 {
|
|
|
res := []map[string]interface{}{}
|
|
|
for _, m := range *data {
|
|
@@ -867,7 +777,7 @@ func (c *OwnTag) CustomerAllRule() {
|
|
|
}
|
|
|
history_rule_data["department_isuse"] = m["i_isuse"]
|
|
|
history_rule_data["depart_name"] = m["s_name"]
|
|
|
- depart_rule_data, _ := util.Mgo.Find("euserdepartrule", q, `{"i_createtime":-1}`, `{"s_name":1,"i_updatetime":1,"i_isuse":1,"_id":1}`, false, 0, 0)
|
|
|
+ depart_rule_data, _ := Mgo.Find("euserdepartrule", q, `{"i_createtime":-1}`, `{"s_name":1,"i_updatetime":1,"i_isuse":1,"_id":1}`, false, 0, 0)
|
|
|
if depart_rule_data != nil && len(*depart_rule_data) != 0 {
|
|
|
for _, j := range *depart_rule_data {
|
|
|
j["_id"] = j["_id"].(primitive.ObjectID).Hex()
|
|
@@ -891,17 +801,12 @@ func (c *OwnTag) CustomerAllRule() {
|
|
|
}
|
|
|
|
|
|
func AddHistoryLogTag(ruleData map[string]interface{}, isUpdate bool, id string) bool {
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- history_id := mongodb.StringTOBsonId(common.ObjToString(ruleData["hid"]))
|
|
|
- hData, ok := util.Mgo.FindOne("historylog", bson.M{"_id": history_id})
|
|
|
-========
|
|
|
history_id := mongodb.StringTOBsonId(qu.ObjToString(ruleData["hid"]))
|
|
|
hData, ok := Mgo.FindOne("historylog", bson.M{"_id": history_id})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if ok && hData != nil && *hData != nil && len(*hData) > 0 {
|
|
|
tag_rules := []map[string]interface{}{}
|
|
|
if (*hData)["tag_rules"] != nil {
|
|
|
- tag_rules = common.ObjArrToMapArr((*hData)["tag_rules"].([]interface{}))
|
|
|
+ tag_rules = qu.ObjArrToMapArr((*hData)["tag_rules"].([]interface{}))
|
|
|
}
|
|
|
ruleData["is_new"] = true
|
|
|
if isUpdate {
|
|
@@ -913,7 +818,7 @@ func AddHistoryLogTag(ruleData map[string]interface{}, isUpdate bool, id string)
|
|
|
} else {
|
|
|
tag_rules = append(tag_rules, ruleData)
|
|
|
}
|
|
|
- return util.Mgo.Update("historylog", bson.M{"_id": history_id}, bson.M{"$set": bson.M{"tag_rules": tag_rules}}, false, false)
|
|
|
+ return Mgo.Update("historylog", bson.M{"_id": history_id}, bson.M{"$set": bson.M{"tag_rules": tag_rules}}, false, false)
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
@@ -922,15 +827,11 @@ func AddHistoryLogTag(ruleData map[string]interface{}, isUpdate bool, id string)
|
|
|
|
|
|
func AddHistoryLogDep(ruleData map[string]interface{}, isUpdate bool, id string) bool {
|
|
|
history_id := mongodb.StringTOBsonId(ruleData["history_id"].(string))
|
|
|
-<<<<<<<< HEAD:CMPlatform/client/ownTag.go
|
|
|
- hData, ok := util.Mgo.FindOne("historylog", bson.M{"_id": history_id})
|
|
|
-========
|
|
|
hData, ok := Mgo.FindOne("historylog", bson.M{"_id": history_id})
|
|
|
->>>>>>>> dev1.4.2:SEPlatform/client/ownTag.go
|
|
|
if ok && hData != nil && *hData != nil && len(*hData) > 0 {
|
|
|
dep_rules := []map[string]interface{}{}
|
|
|
if (*hData)["dep_rules"] != nil {
|
|
|
- dep_rules = common.ObjArrToMapArr((*hData)["dep_rules"].([]interface{}))
|
|
|
+ dep_rules = qu.ObjArrToMapArr((*hData)["dep_rules"].([]interface{}))
|
|
|
}
|
|
|
ruleData["is_new"] = true
|
|
|
if isUpdate {
|
|
@@ -942,7 +843,7 @@ func AddHistoryLogDep(ruleData map[string]interface{}, isUpdate bool, id string)
|
|
|
} else {
|
|
|
dep_rules = append(dep_rules, ruleData)
|
|
|
}
|
|
|
- return util.Mgo.Update("historylog", bson.M{"_id": history_id}, bson.M{"$set": bson.M{"dep_rules": dep_rules}}, false, false)
|
|
|
+ return Mgo.Update("historylog", bson.M{"_id": history_id}, bson.M{"$set": bson.M{"dep_rules": dep_rules}}, false, false)
|
|
|
} else {
|
|
|
return false
|
|
|
}
|