瀏覽代碼

add:增加脚本文件;

gongyuan 9 月之前
父節點
當前提交
fa99ab18f1

+ 0 - 0
module/.keep


+ 123 - 0
module/Demo_QY_WX.py

@@ -0,0 +1,123 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+"""
+Author: ZhenYuSha
+Create type_time: 2020-2-24
+Info: 定期向企业微信推送消息
+"""
+import requests
+import json
+import datetime
+import time
+
+wx_url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4ebd03c3-3418-40a4-998d-8c84268814da"    # 测试机器人1号
+send_message = "测试:测试机器人1号………………………………!"
+
+
+def get_current_time():
+    """获取当前时间,当前时分秒"""
+    now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+    hour = datetime.datetime.now().strftime("%H")
+    mm = datetime.datetime.now().strftime("%M")
+    ss = datetime.datetime.now().strftime("%S")
+    return now_time, hour, mm, ss
+
+
+def sleep_time(hour, m, sec):
+    """返回总共秒数"""
+    return hour * 3600 + m * 60 + sec
+
+
+def send_msg(content):
+    """艾特全部,并发送指定信息"""
+    data = json.dumps({"msgtype": "text", "text": {
+                      "content": content, "mentioned_list": ["@all"]}})
+    r = requests.post(wx_url, data, auth=('Content-Type', 'application/json'))
+    print(r.json)
+
+
+def every_time_send_msg(interval_h=0, interval_m=1, interval_s=0, special_h="00", special_m="00", mode="special"):
+    """每天指定时间发送指定消息"""
+
+    # 设置自动执行间隔时间
+    second = sleep_time(interval_h, interval_m, interval_s)
+    # 死循环
+    while 1 == 1:
+        # 获取当前时间和当前时分秒
+        c_now, c_h, c_m, c_s = get_current_time()
+        print("当前时间:", c_now, c_h, c_m, c_s)
+        if mode == "special":
+            if c_h == special_h and c_m == special_m:
+                # 执行
+                print("正在发送...")
+                send_msg(send_message)
+        else:
+            send_msg(send_message)
+        print("每隔" + str(interval_h) + "小时" +
+              str(interval_m) + "分" + str(interval_s) + "秒执行一次")
+        # 延时
+        time.sleep(second)
+
+
+if __name__ == '__main__':
+    every_time_send_msg(mode="no")
+
+# import requests
+
+# url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4ebd03c3-3418-40a4-998d-8c84268814da"
+
+# headers = {
+#     "Content-Type": "application/json"
+# }
+
+# data = {
+#     "msgtype": "text",
+#     "text": {
+#         "content": "广州今日天气:29度,大部分多云,降雨概率:60%",
+#         "mentioned_list": ["wangqing", "@all"],
+#         "mentioned_mobile_list": ["13800001111", "@all"]
+#     }
+# }
+
+# response = requests.post(url, json=data, headers=headers)
+
+# print(response.status_code)
+# print(response.text)
+
+
+# import requests
+# import schedule
+# import time
+
+# def send_message(content):
+#     url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4ebd03c3-3418-40a4-998d-8c84268814da"
+    
+#     headers = {
+#         "Content-Type": "application/json"
+#     }
+
+#     data = {
+#         "msgtype": "text",
+#         "text": {
+#             "content": content
+#         }
+#     }
+
+#     response = requests.post(url, json=data, headers=headers)
+#     print(response.status_code, response.text)
+
+# def send_weather_message():
+#     send_message("重庆今日天气:29度,大部分多云,降雨概率:60%")
+
+# def send_ad_message():
+#     send_message("宝宝喝AD哦")
+
+# # 定义定时任务
+# schedule.every().day.at("08:10").do(send_weather_message)
+# schedule.every().day.at("10:00").do(send_ad_message)
+
+# # 保持脚本运行
+# while True:
+#     schedule.run_pending()
+#     time.sleep(1)

+ 76 - 0
module/Demo_QY_WX_timed reminder.py

@@ -0,0 +1,76 @@
+#! -*- coding: utf-8 -*-
+"""
+Author: ZhenYuSha
+Create type_time: 2020-2-24
+Info: 定期向企业微信推送消息
+
+Amended by: Ge Zhi
+Amend time: 2020-3-22
+修订内容: 从原代码每分钟发布一次提醒改成在设定时间点发送提醒,可以实现多时间点发布不同内容提醒信息并@所有人
+"""
+import requests
+import json
+import datetime
+import time
+
+# 测试机器人1号    将此网址替换成你的群聊机器人Webhook地址
+wx_url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=4ebd03c3-3418-40a4-998d-8c84268814da"
+send_message1 = "内容1,内容1,内容1!"
+send_message2 = "内容2,内容2,内容2!"
+
+
+def get_current_time():
+    """获取当前时间,当前时分秒"""
+    now_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+    hour = datetime.datetime.now().strftime("%H")
+    mm = datetime.datetime.now().strftime("%M")
+    ss = datetime.datetime.now().strftime("%S")
+    return now_time, hour, mm, ss
+
+
+def sleep_time(hour, m, sec):
+    """返回总共秒数"""
+    return hour * 3600 + m * 60 + sec
+
+
+def send_msg(content):
+    """@全部,并发送指定信息"""
+    data = json.dumps({"msgtype": "text", "text": {
+                      "content": content, "mentioned_list": ["@all"]}})
+    r = requests.post(wx_url, data, auth=('Content-Type', 'application/json'))
+    print(r.json)
+
+
+# 此处定义了每多长时间重复一次此指令,在这里我设置的是每31秒重复一次。且此处设置定时发送消息的时间点(24小时制),在这里我设置的是8点和12点整。
+def every_time_send_msg(interval_h=0, interval_m=0, interval_s=31, special_h1="08", special_h2="12", special_m="00", mode="special"):
+    """每天指定时间发送指定消息"""
+
+    # 设置自动执行间隔时间
+    second = sleep_time(interval_h, interval_m, interval_s)
+    # 循环
+    while True:
+        # 获取当前时间和当前时分秒
+        c_now, c_h, c_m, c_s = get_current_time()
+        print("当前时间:", c_now, c_h, c_m, c_s)
+        if c_h == special_h1 and c_m == special_m:
+            print('正在发送提醒')
+            send_msg(send_message1)
+        else:
+            print('未到早8点提醒时间')
+        # 下午3点报送一次体温
+
+        if c_h == special_h2 and c_m == special_m:
+            print('正在发送提醒')
+            send_msg(send_message2)
+        else:
+            print('未到中午12点提醒时间')
+        # 下午5点报送一次轨迹
+
+        print("每隔" + str(interval_h) + "小时" +
+              str(interval_m) + "分" + str(interval_s) + "秒执行一次")
+        # 延时
+        time.sleep(second)
+
+
+if __name__ == '__main__':
+    every_time_send_msg(mode="no")

+ 142 - 0
module/content_audit_bd.py

@@ -0,0 +1,142 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import ssl
+import sys
+import json
+import base64
+
+
+# 保证兼容python2以及python3
+IS_PY3 = sys.version_info.major == 3
+if IS_PY3:
+    from urllib.request import urlopen
+    from urllib.request import Request
+    from urllib.error import URLError
+    from urllib.parse import urlencode
+    from urllib.parse import quote_plus
+else:
+    import urllib2
+    from urllib import quote_plus
+    from urllib2 import urlopen
+    from urllib2 import Request
+    from urllib2 import URLError
+    from urllib import urlencode
+
+# 防止https证书校验不正确
+ssl._create_default_https_context = ssl._create_unverified_context
+
+API_KEY = 'XuDpl9wYzpKAi1DqH5wv4zx4'
+
+SECRET_KEY = 'dqL2gDMgf6HsbMcxBgpTt0lUzOEldRZm'
+
+
+IMAGE_CENSOR = "https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined"
+
+TEXT_CENSOR = "https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined"
+
+"""  TOKEN start """
+TOKEN_URL = 'https://aip.baidubce.com/oauth/2.0/token'
+
+
+"""
+    获取token
+"""
+
+
+def fetch_token():
+    params = {'grant_type': 'client_credentials',
+              'client_id': API_KEY,
+              'client_secret': SECRET_KEY}
+    post_data = urlencode(params)
+    if (IS_PY3):
+        post_data = post_data.encode('utf-8')
+    req = Request(TOKEN_URL, post_data)
+    try:
+        f = urlopen(req, timeout=5)
+        result_str = f.read()
+    except URLError as err:
+        print(err)
+    if (IS_PY3):
+        result_str = result_str.decode()
+
+    result = json.loads(result_str)
+
+    if ('access_token' in result.keys() and 'scope' in result.keys()):
+        if not 'brain_all_scope' in result['scope'].split(' '):
+            print('please ensure has check the  ability')
+            exit()
+        return result['access_token']
+    else:
+        print('please overwrite the correct API_KEY and SECRET_KEY')
+        exit()
+
+
+"""
+    读取文件
+"""
+
+
+def read_file(image_path):
+    f = None
+    try:
+        f = open(image_path, 'rb')
+        return f.read()
+    except:
+        print('read image file fail')
+        return None
+    finally:
+        if f:
+            f.close()
+
+
+"""
+    调用远程服务
+"""
+
+
+def request(url, data):
+    req = Request(url, data.encode('utf-8'))
+    has_error = False
+    try:
+        f = urlopen(req)
+        result_str = f.read()
+        if (IS_PY3):
+            result_str = result_str.decode()
+        return result_str
+    except URLError as err:
+        print(err)
+
+
+if __name__ == '__main__':
+
+    # 获取access token
+    token = fetch_token()
+
+    # 拼接图像审核url
+    image_url = IMAGE_CENSOR + "?access_token=" + token
+
+    # 拼接文本审核url
+    text_url = TEXT_CENSOR + "?access_token=" + token
+
+    file_content = read_file('image_normal.jpeg')
+    result = request(image_url, urlencode(
+        {'image': file_content}))
+    print("----- 正常图调用结果 -----")
+    print(result)
+
+    file_content = read_file('image_advertise.jpeg')
+    result = request(image_url, urlencode(
+        {'image': base64.b64encode(file_content)}))
+    print("----- 广告图调用结果 -----")
+    print(result)
+
+    text = "我们要热爱祖国热爱党"
+    result = request(text_url, urlencode({'text': text}))
+    print("----- 正常文本调用结果 -----")
+    print(result)
+
+    text = "我要爆粗口啦:百度AI真他妈好用"
+    result = request(text_url, urlencode({'text': text}))
+    print("----- 粗俗文本调用结果 -----")
+    print(result)

+ 52 - 0
module/mysql_char_find.py

@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import pymysql
+
+# MySQL连接配置
+host = '47.98.212.223'
+user = '6636'
+password = 'Mt7DiMvk7W_2'
+database = 'db-tm'
+
+# 要查找的字符串
+search_string = 'timichat.net'
+
+# 要写入的txt文件路径
+output_file = 'output10.txt'
+
+# 跟踪已写入的字符串
+written_strings = set()
+
+# 连接到MySQL数据库
+connection = pymysql.connect(
+    host=host, user=user, password=password, database=database)
+
+try:
+    with connection.cursor() as cursor:
+        # 获取所有表名
+        cursor.execute("SHOW TABLES")
+        tables = cursor.fetchall()
+
+        # 遍历每个表
+        for table in tables:
+            table_name = table[0]
+            # if table_name == "tb_release_config":
+            print("123")
+            # 查询表中所有字段
+            cursor.execute(f"SELECT * FROM `{table_name}`")
+            rows = cursor.fetchall()
+            # 遍历每一行数据
+            for row in rows:
+                for value in row:
+                    if isinstance(value, str) and search_string in value and len(value) < 150000 and value not in written_strings:
+                        # 写入符合条件的字符串到txt文件
+                        with open(output_file, 'a') as file:
+                            file.write(value + '\n')
+                        # 将写入的字符串添加到集合中
+                        written_strings.add(value)
+
+    print("查询完成并写入到txt文件。")
+
+finally:
+    connection.close()

+ 56 - 0
module/mysql_content_replace.py

@@ -0,0 +1,56 @@
+import pymysql
+
+# 数据库连接配置
+host = '47.98.212.223'
+user = '6636'
+password = 'Mt7DiMvk7W_2'
+database = 'db-tm'
+
+# 要替换的字符串timichat.com .cn .net都替换为panygo.com
+string_to_replace = 'timichat.net'
+replacement_string = 'panygo.com'
+
+# 创建数据库连接
+conn = pymysql.connect(host=host, user=user,
+                       password=password, database=database)
+
+try:
+    # 创建游标对象
+    cursor = conn.cursor()
+
+    # 获取数据库中的所有表名
+    cursor.execute("SHOW TABLES;")
+    tables = cursor.fetchall()
+
+    # 遍历每个表并进行数据替换操作
+    for table in tables:
+        table_name = table[0]
+
+        # 获取表的列名列表
+        cursor.execute(f"SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s;",
+                       (database, table_name))
+        columns = [column[0] for column in cursor.fetchall()]
+
+        # 构造更新语句
+        update_queries = []
+        for column in columns:
+            update_queries.append(
+                f"UPDATE {table_name} SET `{column}` = REPLACE(`{column}`, %s, %s);")
+
+        # 执行更新操作
+        for query in update_queries:
+            cursor.execute(query, (string_to_replace, replacement_string))
+
+    # 提交事务
+    conn.commit()
+    print("数据替换完成。")
+
+except pymysql.Error as e:
+    # 发生错误时回滚事务
+    conn.rollback()
+    print(f"数据替换出错:{e}")
+
+finally:
+    # 关闭游标和数据库连接
+    cursor.close()
+    conn.close()

+ 79 - 0
module/mysql_image_down.py

@@ -0,0 +1,79 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import os
+import requests
+import time
+from urllib.parse import urlparse
+
+# 要读取的txt文件路径
+txt_file = 'unique_urls1.txt'
+
+# 图片保存目录
+base_image_dir = 'completeimage2'
+
+# 创建保存图片的基础目录
+os.makedirs(base_image_dir, exist_ok=True)
+
+# 创建下载成功和下载失败的文件
+complete_file = 'downcomplete2.txt'
+error_file = 'downerror2.txt'
+
+# 读取txt文件中的所有行
+with open(txt_file, 'r') as file:
+    lines = file.readlines()
+
+# 遍历每一行图片地址并下载
+for i, line in enumerate(lines, 1):
+    url = line.strip()
+    # 解析URL
+    parsed_url = urlparse(url)
+
+    try:
+        # 下载图片
+        response = requests.get(url, timeout=5)
+
+        if response.status_code == 200:
+            # 判断是否需要创建文件夹
+            if parsed_url.path.split('/')[-1] != "":
+                # 生成文件夹路径
+                folder_path = os.path.join(
+                    base_image_dir, parsed_url.netloc, *parsed_url.path.strip("/").split("/")[:-1])
+                # 创建文件夹
+                os.makedirs(folder_path, exist_ok=True)
+                # 提取文件名
+                filename = url.split('/')[-1]
+                # 保存图片
+                with open(os.path.join(folder_path, filename), 'wb') as file:
+                    file.write(response.content)
+            else:
+                # 保存图片在基础目录下
+                filename = url.split('/')[-1]
+                with open(os.path.join(base_image_dir, filename), 'wb') as file:
+                    file.write(response.content)
+
+            print(f"图片 {i}: {url} 下载完成。")
+            # 写入下载成功的地址
+            with open(complete_file, 'a') as file:
+                file.write(url + '\n')
+
+        else:
+            print(f"图片 {i}: {url} 下载失败。")
+            # 写入下载失败的地址
+            with open(error_file, 'a') as file:
+                file.write(url + '\n')
+
+    except requests.exceptions.Timeout:
+        print(f"图片 {i}: {url} 下载超时。")
+        # 写入下载失败的地址
+        with open(error_file, 'a') as file:
+            file.write(url + '\n')
+
+    except requests.exceptions.RequestException as e:
+        print(f"图片 {i}: {url} 下载发生错误:{e}")
+        # 写入下载失败的地址
+        with open(error_file, 'a') as file:
+            file.write(url + '\n')
+
+    # 添加间隔
+    time.sleep(1)

+ 106 - 0
module/robot_qw_family.py

@@ -0,0 +1,106 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import requests
+import schedule
+import time
+
+# 获取天气
+def get_weather(lat, lon, api_key):
+    #每日天气预报
+    weather_api_url = f"https://devapi.qweather.com/v7/weather/3d?location={lat},{lon}&key={api_key}"
+    response = requests.get(weather_api_url)
+
+    #实时天气https://dev.qweather.com/docs/api/weather/weather-now/
+    weather_api_url1 = f"https://devapi.qweather.com/v7/weather/now?location={lat},{lon}&key={api_key}"
+    response1 = requests.get(weather_api_url1)
+
+    if response.status_code == 200:
+        weather_data = response.json().get("daily", [])[0]
+        weather_data1 = response1.json().get("now")
+        
+        merged_data = {}
+        merged_data.update(weather_data)
+        merged_data.update(weather_data1)
+
+        print(merged_data)
+
+        return merged_data
+    else:
+        print(f"Failed to fetch weather data. Status Code: {response.status_code}")
+        return None
+
+# 发送消息curl -L -X GET --compressed https://api.qweather.com/v7/weather/3d?location=101010100&key=qwertytqtx
+def send_message(content):
+    url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=3acd5b11-98f3-4911-b4eb-bd9090e83635"
+    
+    headers = {
+        "Content-Type": "application/json"
+    }
+
+    data = {
+        "msgtype": "text",
+        "text": {
+            "content": content
+        }
+    }
+
+    response = requests.post(url, json=data, headers=headers)
+    print(response.status_code, response.text)
+
+# 获取并发送天气消息
+def send_weather_message():
+    print("获取并发送天气消息")
+    # 替换为你的经度、纬度和和风天气 API Key
+    your_api_key = "f241d139d5cf40aba5ee02035974d93e"
+    lat = "106.51"
+    lon = "29.55"
+
+    # 获取当前真实天气
+    weather_data = get_weather(lat, lon, your_api_key)
+
+    if weather_data:
+        # 提取天气信息
+        tempMin = weather_data["tempMin"]
+        tempMax = weather_data["tempMax"]
+        textDay = weather_data["textDay"]
+        temp = weather_data["temp"]
+        rain = weather_data["precip"];
+        weather_message = f"重庆今日天气:{temp},{tempMin}~{tempMax}度,大部分{textDay},降雨概率:{rain}%"
+
+        # 发送天气消息
+        send_message(weather_message)
+
+def send_ad_message():
+    send_message("👶🏻宝宝喝AD哦,健健康康开开心心也!")
+
+def send_ahj_message():
+    send_message("🤗宝贝喝安合剂哦,爱你哦么么哒!")
+
+def send_ahj1_message():
+    send_message("🤗宝贝喝安合剂哦,爱你哦么么哒!")
+
+def send_gp_message():
+    send_message("🤗宝贝喝钙片哦,身体棒棒的嘻嘻!")
+
+def send_drink_water_message():
+    drink_water_message = "🤗宝贝记得喝水哦,保持身体健康!"
+    send_message(drink_water_message)
+
+#测试获取天气
+send_weather_message()
+
+# 定义定时任务
+schedule.every().day.at("08:10").do(send_weather_message)
+schedule.every().day.at("10:00").do(send_ad_message)
+schedule.every().day.at("13:10").do(send_ahj_message)
+schedule.every().day.at("20:00").do(send_ahj1_message)
+schedule.every().day.at("21:00").do(send_gp_message)
+
+# 每隔多久发消息
+schedule.every().hour.do(send_drink_water_message)
+
+# 保持脚本运行
+while True:
+    schedule.run_pending()
+    time.sleep(1)

+ 177 - 0
module/robot_qw_logpaper.py

@@ -0,0 +1,177 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+# 1、定时获取当天的git日志。
+# 2、定时发送到群里确认。
+# 3、定时调用日报接口发布日志。
+
+import git
+import requests
+import datetime
+import schedule
+import time
+from datetime import datetime, timezone
+import re
+import requests
+
+# 发送请求
+url = "https://doc.weixin.qq.com/formcol/answer_page"
+headers = {
+    'Host': 'doc.weixin.qq.com',
+    'Accept': 'application/json, text/plain, */*',
+    'Sec-Fetch-Site': 'same-origin',
+    # 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundaryVfP45gTdNBENAZ70',
+    'Accept-Language': 'zh-CN,zh-Hans;q=0.9',
+    'Sec-Fetch-Mode': 'cors',
+    'Accept-Encoding': 'gzip, deflate, br',
+    'Origin': 'https://doc.weixin.qq.com',
+    'Content-Length': '1890',
+    'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko)  Mobile/15E148 wxwork/4.1.3 MicroMessenger/7.0.1 Language/zh ColorScheme/Light',
+    'Connection': 'close',
+    'Sec-Fetch-Dest': 'empty',
+    'Cookie': 'fingerprint=ca6fb466a7454afa8ed96d103adabd5a35; hashkey=f1dd9a02; traceid=f1dd9a022a; TOK=4111dcd01a3c4f20; tdoc_uid=13102702184490373; uid=; uid_key=; wedoc_openid=wozbKqDgAAMAA3rCOMGE0RRvFxRz4SaQ; wedoc_sid=1oVWVozlRGQuTVJ2AJVVQwAA; wedoc_sids=13102702184490373&1oVWVozlRGQuTVJ2AJVVQwAA; wedoc_skey=13102702184490373&4016e8cf1ea3cf8039cbc8cd5f56f72f; wedoc_ticket=13102702184490373&CAESILpv6XseP1IZarCVrYqGK-psJXWRKE0v7f9qC-RFxH32; optimal_cdn_domain=rescdn.qqmail.com'
+}
+
+
+def post_form_data(url, headers, text_reply_var, plain_text_reply_var, cookie):
+    # Update headers with the provided Cookie
+    headers['Cookie'] = cookie
+    multipart_data = {
+        'form_id': ('', 'AIgA0QcMAAgAI0A6AaoAOUFH2ayj3FSzj_base'),
+        'form_reply': ('', f'{{"items":[{{"question_id":"1","rich_text_reply":{{"text_reply":"{text_reply_var}","plain_text_reply":"{plain_text_reply_var}"}}}}]}}'),
+        'type': ('', '8'),
+        'check_setting': ('', '{"can_anonymous":2}'),
+        'use_anonymous': ('', 'false'),
+        'submit_again': ('', 'true'),
+        'wwjournal_data': ('', '{"entry":{"mngreporter":[{"vid":"1688853713315981"},{"vid":"1688853713316022"},{"vid":"1688853713316001"},{"vid":"1688853713316000"},{"vid":"1688856046406642"}],"reporter":[],"templateid":"ZLqsG4jMZzTM7oJFatFcrDiTN25WS8BQaQrMuZ","doc_info":{"type":2,"form_id":"AIgA0QcMAAgAI0A6AaoAOUFH2ayj3FSzj_base","template_id":"ZLqsG4jMZzTM7oJFatFcrDiTN25WS8BQaQrMuZ"}}}'),
+        'isSendToRoom': ('', 'false'),
+        'f': ('', 'json'),
+    }
+    response = requests.post(url, headers=headers, files=multipart_data)
+    return response
+
+
+# 操作git
+def extract_message_content(message):
+    # 使用正则表达式匹配 ] 或 】 后的字符串
+    match = re.search(r'[\]】](.+)', message)
+    if match:
+        return match.group(1).strip()
+    return message
+
+
+def pull_latest_changes(repo):
+    # 拉取最新代码
+    repo.remotes.origin.pull()
+
+# 获取今天我的提交
+def get_last_commits_today(repo_path):
+    repo = git.Repo(repo_path)
+    # 拉取最新代码
+    pull_latest_changes(repo)
+    # 获取今天的日期
+    today = datetime.now(timezone.utc).replace(
+        hour=0, minute=0, second=0, microsecond=0)
+    commits_today = []
+    for commit in repo.iter_commits('gy_3.39', max_count=100):
+        # 仅处理作者是 'gongyuan',且提交消息包含中文
+        if commit.author.name == 'gongyuan' or commit.author.name == 'sszf7605' or commit.author.name == '龚圆1' and any(ord(c) > 127 for c in commit.message):
+            # 判断提交的日期是否是今天
+            if commit.authored_datetime >= today:
+                commits_today.append(commit)
+    return commits_today
+
+
+# 返回今天需要发布日报的文本
+def get_today_commit_text(commits_today):
+    for commit in commits_today:
+        print(f"Commit: {commit.hexsha}")
+        print(f"Author: {commit.author.name} <{commit.author.email}>")
+        print(f"Date: {commit.authored_datetime}")
+        print(f"Message: {commit.message}")
+        print()
+    # 提取每个 commit 对象的 message 内容中 ] 或 】 后的字符串
+    extracted_messages = [extract_message_content(
+        commit.message) for commit in commits_today]
+    # 使用空格连接数组中的字符串
+    logpaper_text = ''.join(extracted_messages)
+    # 打印拼接后的字符串
+    print('提交记录='+logpaper_text)
+    return logpaper_text
+
+# 处理为月报需要的文本并保存
+def save_month_text(commits_today):
+    # 根据标识分为优化功能、新增需求、修改bug,然后存起来
+    print('根据标识分为优化功能、新增需求、修改bug,然后存起来')
+
+# 通过接口发送消息到企微群
+def send_qwgroup_message(content):
+    webhook_url = "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=85c23f32-4df1-4e4d-af51-d952d927a3fb"
+    data = {
+        "msgtype": "text",
+        "text": {
+            "content": content
+        }
+    }
+    response = requests.post(webhook_url, json=data)
+    print(response.status_code, response.text)
+
+# 通过接口发送消息到企微日志平台
+def send_qwlogpaperplatform(text_reply_var, plain_text_reply_var):
+    cookie = 'fingerprint=ca6fb466a7454afa8ed96d103adabd5a35; hashkey=f1dd9a02; traceid=f1dd9a022a; TOK=4111dcd01a3c4f20; tdoc_uid=13102702184490373; uid=; uid_key=; wedoc_openid=wozbKqDgAAMAA3rCOMGE0RRvFxRz4SaQ; wedoc_sid=1oVWVozlRGQuTVJ2AJVVQwAA; wedoc_sids=13102702184490373&1oVWVozlRGQuTVJ2AJVVQwAA; wedoc_skey=13102702184490373&4016e8cf1ea3cf8039cbc8cd5f56f72f; wedoc_ticket=13102702184490373&CAESILpv6XseP1IZarCVrYqGK-psJXWRKE0v7f9qC-RFxH32; optimal_cdn_domain=rescdn.qqmail.com'
+    response = post_form_data(
+        url, headers, text_reply_var, plain_text_reply_var, cookie)
+    print(response.status_code)
+    print(response.text)
+
+
+# 发送日报到企微群里,以及发布日报到企微日志平台上
+def send_message_to_qwgroup_and_qwlogpaperplatform(logpaper_text):
+    if logpaper_text:
+        # 发送给企微群
+        qw_text = '10分钟后将自动发布以下内容!:\n'+logpaper_text
+        send_qwgroup_message(qw_text)
+
+        # 发布日报到企微日志平台上(延时执行)
+        text_reply_var = logpaper_text
+        plain_text_reply_var = logpaper_text
+        send_qwlogpaperplatform(text_reply_var, plain_text_reply_var)
+
+    else:  # git没提交,且为工作日 发个提醒到企微群(节假日上班😄)
+        today = datetime.now().date()
+        if is_weekday(today):
+            # qw_text = '没找到今天的git提交记录,记得手动填写发布哦!!!'
+            # send_message(qw_text)
+            timeStr = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+            qw_text = '没找到今天的git提交记录,随便发测试!!!' + timeStr
+            send_message_to_qwgroup_and_qwlogpaperplatform(qw_text)
+
+        else:
+            print("今天是周末")
+
+
+def is_weekday(date):
+    # Monday is 0 and Sunday is 6
+    return 0 <= date.weekday() < 10
+
+# 定时执行任务
+def job():
+    # 得到当天我的提交记录
+    commits_today = get_last_commits_today(
+        '/Users/gy/Downloads/file/softisland/IGXEAssistant2')
+    # 以月报形式保存
+    save_month_text(commits_today)
+
+    # 获取日报形式的文本
+    logpaper_text = get_today_commit_text(commits_today)
+    send_message_to_qwgroup_and_qwlogpaperplatform(logpaper_text)
+
+if __name__ == "__main__":
+    # 定义定时任务,每天下午6点执行 job 函数
+    # schedule.every().day.at("18:20").do(job)
+    # 测试
+    job()
+
+# 保持脚本运行
+while True:
+    schedule.run_pending()
+    time.sleep(1)

+ 27 - 0
module/txt_char_find.py

@@ -0,0 +1,27 @@
+# 输入文件,包含URL的内容
+input_file = 'output9.txt'
+
+# 输出文件,用于存放提取出的URL
+output_file = 'extracted_urls.txt'
+
+# 存放提取出的URL的列表
+extracted_urls = []
+
+# 读取输入文件并提取URL
+with open(input_file, 'r') as file:
+    # 读取整个文件内容
+    data = file.read()
+
+    # 使用正则表达式提取URL
+    import re
+    urls = re.findall(
+        r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\(\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+', data)
+    extracted_urls.extend(urls)
+
+# 将提取出的URL写入输出文件
+with open(output_file, 'w') as file:
+    for url in extracted_urls:
+        # 每个URL单独一行
+        file.write(url + '\n')
+
+print("提取出的URL已保存到输出文件中。")

+ 31 - 0
module/txt_different_find.py

@@ -0,0 +1,31 @@
+# 输入文件,包含URL的内容
+input_file1 = 'output10.txt'
+input_file2 = 'extracted_urls.txt'
+
+# 输出文件,用于存放提取出的不同的URL
+output_file = 'different_urls.txt'
+
+# 存放URL的集合
+urls_set1 = set()
+urls_set2 = set()
+
+# 读取输入文件1中的URL
+with open(input_file1, 'r') as file1:
+    for line in file1:
+        urls_set1.add(line.strip())
+
+# 读取输入文件2中的URL
+with open(input_file2, 'r') as file2:
+    for line in file2:
+        urls_set2.add(line.strip())
+
+# 提取在extracted_urls.txt中独有的URL
+different_urls = urls_set2.difference(urls_set1)
+
+# 将提取出的不同的URL写入输出文件
+with open(output_file, 'w') as output:
+    for url in different_urls:
+        # 每个URL单独一行
+        output.write(url + '\n')
+
+print("提取出的不同的URL已保存到输出文件中。")

+ 21 - 0
module/txt_unique.py

@@ -0,0 +1,21 @@
+# 输入文件,包含URL的内容
+input_file = 'extracted_urls1.txt'
+
+# 输出文件,用于存放去重后的URL
+output_file = 'unique_urls1.txt'
+
+# 存放URL的集合
+urls_set = set()
+
+# 读取输入文件中的URL并去除重复项
+with open(input_file, 'r') as file:
+    for line in file:
+        urls_set.add(line.strip())
+
+# 将去重后的URL写入输出文件
+with open(output_file, 'w') as file:
+    for url in urls_set:
+        # 每个URL单独一行
+        file.write(url + '\n')
+
+print("去除重复的URL并保存到输出文件中。")

+ 0 - 0
util/keep