You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.4 KiB
32 lines
1.4 KiB
# -*- coding: utf-8 -*-
|
|
"""票14 取证第二轮:transfer_detail 列结构 / 查重设置现状 / 撞码 seed 客户。"""
|
|
import io, sys
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
import pymysql
|
|
|
|
def db():
|
|
return pymysql.connect(host='8.129.84.155', port=3306, user='root', password='Itc@123456',
|
|
database='crm', charset='utf8mb4', autocommit=True,
|
|
connect_timeout=10, cursorclass=pymysql.cursors.DictCursor)
|
|
|
|
def q(sql, args=None):
|
|
with db() as c, c.cursor() as cur:
|
|
cur.execute(sql, args); return cur.fetchall()
|
|
|
|
print("== 1) customer_transfer_detail 列结构 ==")
|
|
for r in q("SHOW COLUMNS FROM customer_transfer_detail"):
|
|
print(r["Field"], r["Type"], r["Null"], r["Default"])
|
|
|
|
print("== 2) customer_dedup_rule 现状(查重设置是否被污染)==")
|
|
for r in q("SELECT * FROM customer_dedup_rule"):
|
|
print(r)
|
|
|
|
print("== 3) 最近 3 张交割单明细(SELECT *)==")
|
|
for r in q("SELECT id, transfer_no, status FROM customer_transfer ORDER BY id DESC LIMIT 3"):
|
|
print(r)
|
|
for d in q("SELECT * FROM customer_transfer_detail WHERE transfer_id=%s", (r["id"],)):
|
|
print(" 明细:", d)
|
|
|
|
print("== 4) 信用代码 91440101E2CTEST001 占用者 ==")
|
|
for r in q("SELECT id, customer_name, archive_status, deleted FROM customer WHERE unified_credit_code=%s", ("91440101E2CTEST001",)):
|
|
print(r)
|
|
|