|
@@ -12,7 +12,8 @@ import (
|
|
|
)
|
|
|
|
|
|
var LuaUserMap map[string]map[string]string
|
|
|
-var LuaUserInfoMap map[string]*LuaUserInfo
|
|
|
+var LuaModifyUserInfoMap map[string]*LuaUserInfo //开发人员信息集合
|
|
|
+var LuaAuditorInfoMap map[string]*LuaUserInfo //审核人员信息集合
|
|
|
|
|
|
type UserTextInfo struct {
|
|
|
Username string
|
|
@@ -25,6 +26,7 @@ type UserTextInfo struct {
|
|
|
type LuaUserInfo struct {
|
|
|
Username string
|
|
|
Mobile string
|
|
|
+ Auth string
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -45,28 +47,42 @@ var MarkdownModel = `{
|
|
|
var TextModel = `{
|
|
|
"msgtype": "text",
|
|
|
"text": {
|
|
|
- "content": "",
|
|
|
+ "content": "%s",
|
|
|
"mentioned_mobile_list":[%s]
|
|
|
}
|
|
|
}`
|
|
|
|
|
|
func GetLuaUserInfo() {
|
|
|
- LuaUserInfoMap = map[string]*LuaUserInfo{}
|
|
|
+ LuaModifyUserInfoMap = map[string]*LuaUserInfo{}
|
|
|
+ LuaAuditorInfoMap = map[string]*LuaUserInfo{}
|
|
|
for eu, info := range LuaUserMap {
|
|
|
- LuaUserInfoMap[eu] = &LuaUserInfo{
|
|
|
- Username: info["username"],
|
|
|
- Mobile: info["mobile"],
|
|
|
+ auth := info["auth"]
|
|
|
+ if auth == "1" { //开发人员
|
|
|
+ LuaModifyUserInfoMap[eu] = &LuaUserInfo{
|
|
|
+ Username: info["username"],
|
|
|
+ Mobile: info["mobile"],
|
|
|
+ Auth: auth,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if auth == "3" || eu == "ssc" { //审核人员
|
|
|
+ LuaAuditorInfoMap[eu] = &LuaUserInfo{
|
|
|
+ Username: info["username"],
|
|
|
+ Mobile: info["mobile"],
|
|
|
+ Auth: auth,
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ qu.Debug(LuaModifyUserInfoMap)
|
|
|
+ qu.Debug(LuaAuditorInfoMap)
|
|
|
}
|
|
|
|
|
|
-// SendInfoToWxWork
|
|
|
-func SendInfoToWxWork() {
|
|
|
+// 统计爬虫开发人员未完成爬虫和任务
|
|
|
+func Sendinfotowxwork_Tomodifyuser() {
|
|
|
defer qu.Catch()
|
|
|
qu.Debug("企业微信发送提示信息")
|
|
|
failedTaskCount, heartCodeCount := 0, 0 //总未通过任务个数,总待处理心跳异常爬虫个数
|
|
|
userTextMap := map[string]*UserTextInfo{} //key:mobile
|
|
|
- for eu, userInfo := range LuaUserInfoMap {
|
|
|
+ for eu, userInfo := range LuaModifyUserInfoMap {
|
|
|
textInfo := &UserTextInfo{}
|
|
|
textInfo.Username = userInfo.Username
|
|
|
//1、未通过任务信息
|
|
@@ -136,22 +152,66 @@ func SendInfoToWxWork() {
|
|
|
}
|
|
|
msg := fmt.Sprintf(MarkdownModel, resultContent)
|
|
|
qu.Debug("msg", msg)
|
|
|
- toUserMsg := fmt.Sprintf(TextModel, strings.Join(mobileArr, ","))
|
|
|
+ toUserMsg := fmt.Sprintf(TextModel, "", strings.Join(mobileArr, ","))
|
|
|
qu.Debug("toUserMsg", toUserMsg)
|
|
|
resp1, err := http.Post(
|
|
|
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=97850772-88d0-4544-a2c3-6201aeddff9e",
|
|
|
"application/json",
|
|
|
bytes.NewBuffer([]byte(toUserMsg)),
|
|
|
)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("request error:", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
defer resp1.Body.Close()
|
|
|
resp2, err := http.Post(
|
|
|
"https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=97850772-88d0-4544-a2c3-6201aeddff9e",
|
|
|
"application/json",
|
|
|
bytes.NewBuffer([]byte(msg)),
|
|
|
)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("request error:", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
defer resp2.Body.Close()
|
|
|
+}
|
|
|
+
|
|
|
+// 统计爬虫审核人员待审核爬虫
|
|
|
+func SendInfoToWxWork_ToAuditor() {
|
|
|
+ defer qu.Catch()
|
|
|
+ qu.Debug("企业微信发送提示信息")
|
|
|
+ tmpContent := "当前"
|
|
|
+ tmpModifyList := []string{}
|
|
|
+ qu.Debug(LuaAuditorInfoMap)
|
|
|
+ for eu, userInfo := range LuaAuditorInfoMap {
|
|
|
+ query := map[string]interface{}{
|
|
|
+ "state": 1,
|
|
|
+ "platform": "golua平台",
|
|
|
+ }
|
|
|
+ if eu == "cjk" { //陈佳康审核的施顺才的爬虫
|
|
|
+ query["modifyuser"] = map[string]interface{}{
|
|
|
+ "$eq": "ssc",
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ query["modifyuser"] = map[string]interface{}{
|
|
|
+ "$ne": "ssc",
|
|
|
+ }
|
|
|
+ }
|
|
|
+ count := util.MgoE.Count("luaconfig", query)
|
|
|
+ tmpContent += userInfo.Username + "待审核爬虫的个数为:" + fmt.Sprint(count) + ";"
|
|
|
+ tmpModifyList = append(tmpModifyList, userInfo.Mobile)
|
|
|
+ }
|
|
|
+ msg := fmt.Sprintf(TextModel, tmpContent, strings.Join(tmpModifyList, ","))
|
|
|
+ qu.Debug("msg", msg)
|
|
|
+ resp1, err := http.Post(
|
|
|
+ "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=97850772-88d0-4544-a2c3-6201aeddff9e",
|
|
|
+ "application/json",
|
|
|
+ bytes.NewBuffer([]byte(msg)),
|
|
|
+ )
|
|
|
if err != nil {
|
|
|
fmt.Println("request error:", err)
|
|
|
+ return
|
|
|
}
|
|
|
+ defer resp1.Body.Close()
|
|
|
|
|
|
}
|