瀏覽代碼

Merge branch 'dev2.3.12' of http://192.168.3.207:8080/group3/qmx_admin into dev2.3.12

fuwencai 3 年之前
父節點
當前提交
70ad2f600e

+ 7 - 3
src/config.json

@@ -35,7 +35,8 @@
   "noCheck": [
     112,
     168,
-    169
+    169,
+    191
   ],
   "banTime": 86400,
   "errSaveTime": 86400,
@@ -49,7 +50,7 @@
   "jobNum": 20,
   "webdomain": "http://web-jydev-wh.jianyu360.cn",
   "bigmemberKey": "bigmember_power_",
-  "jyOrderApi": "http://192.168.3.204:8889",
+  "jyOrderApi": "http://192.168.3.240:1234",
   "jyRedis": "bigmember_power_",
   "jyResources": "http://127.0.0.1:8889",
   "unitPrice_normal": 1,
@@ -98,5 +99,8 @@
     "192.168.3.240:2379"
   ],
   "pushGrpcServer": "192.168.3.11:5565",
-  "tidb": "jianyu:top@123@tcp(192.168.3.109:4000)/convertlabsync?charset=utf8mb4&parseTime=true&loc=Local"
+  "tidb": "jianyu:top@123@tcp(192.168.3.109:4000)/convertlabsync?charset=utf8mb4&parseTime=true&loc=Local",
+  "lookAllMsg": {
+    "87": true
+  }
 }

+ 1 - 0
src/config/config.go

@@ -50,6 +50,7 @@ type SysConfig struct {
 	Etcd           []string          `json:"etcd"`
 	PushGrpcServer string            `json:"pushGrpcServer"`
 	Tidb           string            `json:"tidb"`
+	LookAllMsg     map[string]bool   `json:"lookAllMsg"`
 }
 
 var SysConfigs SysConfig

+ 49 - 1
src/customerService/customController.go

@@ -1,6 +1,11 @@
 package customerService
 
-import "github.com/baiy/Cadmin-server-go/admin"
+import (
+	"errors"
+	"github.com/baiy/Cadmin-server-go/admin"
+	qutil "qfw/util"
+	"util"
+)
 
 type customMsg struct {
 	Id         int    `form:"id"`         //消息id
@@ -34,3 +39,46 @@ func CustomSendMsg(context *admin.Context) (interface{}, error) {
 		"status": status,
 	}, err
 }
+
+func MycustomerList(context *admin.Context) (interface{}, error) {
+	param := new(struct {
+		State           string `form:"state"`           //客户状态
+		UpdateTimeStart string `form:"updateTimeStart"` //最近更新时间筛选开始时间
+		UpdateTimeEnd   string `form:"updateTimeEnd"`   //最近更新时间筛选结束时间
+		CompanyName     string `form:"companyName"`     //公司名称
+		Phone           string `form:"phone"`
+	})
+	err := context.Form(param)
+	if err != nil {
+		return nil, err
+	}
+	MyCustomerService(param.State, param.UpdateTimeStart, param.UpdateTimeEnd, param.CompanyName, param.Phone)
+
+	return nil, nil
+}
+
+func SingleAdd(context *admin.Context) (interface{}, error) {
+	param := new(struct {
+		UserId string `form:"userId"`
+	})
+	err := context.Form(param)
+	if err != nil {
+		return nil, err
+	}
+	//判断是否是剑鱼用户
+	//userData := &map[string]interface{}{}
+	userData, ok := util.MQFW.FindById("user", param.UserId, `"s_phone":1,"s_m_phone":1`)
+	if userData != nil && len(*userData) > 0 && ok {
+		phone := ""
+		if qutil.ObjToString((*userData)["s_phone"]) != "" {
+			phone = qutil.ObjToString((*userData)["s_phone"])
+		} else {
+			phone = qutil.ObjToString((*userData)["s_m_phone"])
+		}
+		return map[string]interface{}{
+			"userId":        param.UserId,
+			"registerPhone": phone,
+		}, nil
+	}
+	return nil, errors.New("添加失败,无此用户")
+}

+ 10 - 0
src/customerService/customService.go

@@ -200,3 +200,13 @@ func CustomSendMsgService(param *customMsg, sendStatus int, loginUserName string
 	}
 	return 0, errors.New("发送消息出错")
 }
+
+func MyCustomerService(state, updateTimeStart, UpdateTimeEnd, CompanyName, Phone string) {
+	sql := "SELECT * FROM message_send_log "
+	str := ""
+	sqlc := "SELECT COUNt(id) FROM message_send_log "
+	if state != "" {
+		str += " "
+	}
+	log.Println(sql, sqlc)
+}

+ 20 - 1
src/customerService/newsController.go

@@ -1,8 +1,11 @@
 package customerService
 
 import (
+	"config"
 	"github.com/baiy/Cadmin-server-go/admin"
 	"github.com/baiy/Cadmin-server-go/system/utils"
+	"log"
+	"strconv"
 )
 
 type MsgListParam struct {
@@ -67,7 +70,23 @@ func MessageList(context *admin.Context) (interface{}, error) {
 	if err != nil {
 		return nil, err
 	}
-	data, count := MsgList(param)
+	//获取登陆用户的id,沈炳毅、杨露、超级管理员账号可查看全部已发送的消息
+	isLookAll := 0
+	lookAllMsgUser := config.SysConfigs.LookAllMsg
+	loginUserId := context.User.Id
+	if ok := lookAllMsgUser[strconv.Itoa(loginUserId)]; ok {
+		isLookAll = 1
+	} else {
+		userGroup := context.User.UserGroupIds()
+		for _, val := range userGroup {
+			if val == 1 {
+				isLookAll = 1
+				break
+			}
+		}
+	}
+	log.Println(isLookAll)
+	data, count := MsgList(param, isLookAll, loginUserId)
 	return map[string]interface{}{
 		"lists": data,
 		"total": count,

+ 4 - 1
src/customerService/newsService.go

@@ -76,7 +76,7 @@ func MsgDetail(id int) (*map[string]interface{}, error) {
 var Str = "id,send_usergroup_name,msg_type,title,content,send_mode,send_time,send_status,update_time,createtime,link,isdel,send_name,send_usergroup_id"
 
 //消息列表查询
-func MsgList(param *MsgListParam) (*[]map[string]interface{}, int) {
+func MsgList(param *MsgListParam, isLookAllMsg, loginUserId int) (*[]map[string]interface{}, int) {
 	sql := "SELECT " + Str + " FROM message_send_log "
 	str := ""
 	sqlc := "SELECT COUNt(*) FROM message_send_log "
@@ -104,6 +104,9 @@ func MsgList(param *MsgListParam) (*[]map[string]interface{}, int) {
 	if param.UpdateTimeEnd != "" {
 		str += " update_time <= '" + param.UpdateTimeEnd + " 23:59:59" + "' and"
 	}
+	if isLookAllMsg == 0 {
+		str += " send_userid = " + strconv.Itoa(loginUserId) + " and"
+	}
 	page := " order by id desc limit " + fmt.Sprint(param.Page.Offset) + " " + "," + " " + fmt.Sprint(param.Page.PageSize)
 	sql += " WHERE isdel = 1 and"
 	sqlc += " WHERE isdel = 1 and"

+ 1 - 0
src/customerService/router.go

@@ -74,6 +74,7 @@ func init() {
 		"Baiy.Cadmin.Message.getGroup":               GetGroup,
 		"Baiy.Cadmin.Message.messageSave":            MessageSave,
 		"Baiy.Cadmin.Message.customSendMsg":          CustomSendMsg,
+		"Baiy.Cadmin.Message.singleAdd":              SingleAdd,
 	})
 	RegisterDispatch(SalesDispatcher)
 }