1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
| import sys,json
| from pathlib import Path
| sys.stdout.reconfigure(encoding='utf-8')
| sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'iqc-import-20261012/deps'))
| import pymysql
| with pymysql.connect(host='36.213.150.237',port=10000,user='root',password=sys.stdin.readline().strip(),database='mom-hm',charset='utf8mb4',connect_timeout=15,cursorclass=pymysql.cursors.DictCursor) as connection:
| with connection.cursor() as cursor:
| queries=[
| 'SHOW COLUMNS FROM system_dict_data',
| 'SHOW COLUMNS FROM crm_clue',
| 'SELECT user_id,user_type,type,sub_type,tenant_id,COUNT(*) count FROM system_operate_log WHERE deleted=0 GROUP BY user_id,user_type,type,sub_type,tenant_id LIMIT 8',
| 'SELECT DATABASE() db,NOW() db_time',
| 'SHOW COLUMNS FROM crm_follow_up_record',
| 'SHOW COLUMNS FROM system_operate_log',
| "SELECT COUNT(*) total, SUM(follow_up_status=0 AND owner_user_id IS NOT NULL) pending_follow, SUM(contact_next_time>=CURDATE() AND contact_next_time<DATE_ADD(CURDATE(),INTERVAL 1 DAY)) today_contact, SUM(contact_next_time<CURDATE()) overdue_contact FROM crm_customer WHERE deleted=0",
| 'SELECT COUNT(*) total,SUM(follow_up_status=0 AND owner_user_id IS NOT NULL) pending_follow FROM crm_clue WHERE deleted=0',
| 'SELECT * FROM crm_customer_pool_config WHERE deleted=0',
| "SELECT dict_type,value,label FROM system_dict_data WHERE deleted=0 AND dict_type LIKE '%follow%'",
| 'SELECT owner_user_id,COUNT(*) pending FROM crm_customer WHERE deleted=0 AND follow_up_status=0 GROUP BY owner_user_id',
| 'SELECT id,username,nickname FROM system_users WHERE deleted=0 AND id IN (1)',
| ]
| for sql in queries:
| cursor.execute(sql)
| print(json.dumps({'sql':sql,'rows':cursor.fetchall()},ensure_ascii=False,default=str))
|
|