修改负责人配置
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||||
"git.rosy.net.cn/jx-callback/globals"
|
"git.rosy.net.cn/jx-callback/globals"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
// 更新门店负责人信息
|
// 更新门店负责人信息
|
||||||
@@ -15,13 +16,11 @@ func UpdateStoreOperatorConfig() {
|
|||||||
globals.SugarLogger.Debug("定时任务,获取所有门店信息错误")
|
globals.SugarLogger.Debug("定时任务,获取所有门店信息错误")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
userData := make(map[string][][]interface{}, 0)
|
||||||
userData := make(map[string][]map[string]string, 0)
|
jx := make(map[string]string, 0)
|
||||||
userData["jx"] = nil
|
jd := make(map[string]string, 0)
|
||||||
userData["jd"] = nil
|
mt := make(map[string]string, 0)
|
||||||
userData["mt"] = nil
|
eb := make(map[string]string, 0)
|
||||||
userData["eb"] = nil
|
|
||||||
userData["test_write"] = nil
|
|
||||||
for _, v := range store {
|
for _, v := range store {
|
||||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), v.ID, 0, "")
|
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), v.ID, 0, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -29,29 +28,22 @@ func UpdateStoreOperatorConfig() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if storeDetail.MarketManPhone != "" { // 平台负责人jx
|
if storeDetail.MarketManPhone != "" { // 平台负责人jx
|
||||||
if _, ok := userData["jx"]; ok {
|
jx[storeDetail.MarketManName] = storeDetail.MarketManPhone
|
||||||
userData["jx"] = append(userData["jx"], map[string]string{storeDetail.MarketManName: storeDetail.MarketManPhone})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if storeDetail.OperatorPhone != "" { // 京东负责人电话
|
if storeDetail.OperatorPhone != "" { // 京东负责人电话
|
||||||
if _, ok := userData["jd"]; ok {
|
jd[storeDetail.OperatorName] = storeDetail.OperatorPhone
|
||||||
userData["jd"] = append(userData["jd"], map[string]string{storeDetail.OperatorName: storeDetail.OperatorPhone})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if storeDetail.OperatorPhone2 != "" { // 美团负责人电话
|
if storeDetail.OperatorPhone2 != "" { // 美团负责人电话
|
||||||
if _, ok := userData["jd"]; ok {
|
mt[storeDetail.OperatorName2] = storeDetail.OperatorPhone2
|
||||||
userData["mt"] = append(userData["mt"], map[string]string{storeDetail.OperatorName2: storeDetail.OperatorPhone2})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if storeDetail.OperatorPhone3 != "" { // 饿了么负责人电话
|
if storeDetail.OperatorPhone3 != "" { // 饿了么负责人电话
|
||||||
if _, ok := userData["eb"]; ok {
|
eb[storeDetail.OperatorName3] = storeDetail.OperatorPhone3
|
||||||
userData["eb"] = append(userData["eb"], map[string]string{storeDetail.OperatorName3: storeDetail.OperatorPhone3})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
userData["jx"] = Map2Slice(jx)
|
||||||
|
userData["jd"] = Map2Slice(jd)
|
||||||
userData["test_write"] = append(userData["test_write"], map[string]string{"ll": "18981810340"})
|
userData["mt"] = Map2Slice(mt)
|
||||||
globals.SugarLogger.Debug("update user data:", userData)
|
userData["eb"] = Map2Slice(eb)
|
||||||
// 写入配置
|
// 写入配置
|
||||||
byteData, err := json.Marshal(userData)
|
byteData, err := json.Marshal(userData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -64,3 +56,16 @@ func UpdateStoreOperatorConfig() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Map2Slice(param map[string]string) [][]interface{}{
|
||||||
|
if len(param) <= 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
result := make([][]interface{}, len(param), 0)
|
||||||
|
for k, v := range param {
|
||||||
|
phone, _ := strconv.Atoi(v)
|
||||||
|
result = append(result, []interface{}{k, phone})
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user