- 新增师傅资质审核模块及权限 - 未审核通过的师傅默认禁用接单状态 - 新增售后退款申诉功能与相关界面 - 新增用户钱包管理及充值功能 - 更新服务定价矩阵相关数据库结构 - 修复微信支付证书验证问题
38 行
1.8 KiB
Python
38 行
1.8 KiB
Python
import pymysql
|
|
import paramiko
|
|
import time
|
|
|
|
now = int(time.time())
|
|
|
|
def insert_rule(conn, is_remote=False):
|
|
cur = conn.cursor()
|
|
cur.execute("SELECT id FROM fa_auth_rule WHERE name = 'master/audit'")
|
|
row = cur.fetchone()
|
|
if not row:
|
|
sql = f"INSERT INTO fa_auth_rule (pid, name, title, icon, `condition`, remark, ismenu, createtime, updatetime, weigh, status) VALUES (125, 'master/audit', '审核', 'fa fa-check-square-o', '', '师傅入驻资质审核', 0, {now}, {now}, 0, 'normal')"
|
|
cur.execute(sql)
|
|
rule_id = cur.lastrowid
|
|
print(f"[{'Remote' if is_remote else 'Local'}] Inserted master/audit rule id: {rule_id}")
|
|
else:
|
|
print(f"[{'Remote' if is_remote else 'Local'}] master/audit rule already exists, id: {row[0]}")
|
|
conn.commit()
|
|
|
|
# Local
|
|
conn_local = pymysql.connect(host='127.0.0.1', user='yjyf', password='4bRz2NYz6pDhsCk4', database='yjyf', port=3306)
|
|
insert_rule(conn_local, False)
|
|
conn_local.close()
|
|
|
|
# Remote
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('8.137.181.63', port=22, username='root', password='liyanxia@6688', timeout=10)
|
|
stdin, stdout, stderr = ssh.exec_command(f'mysql -uyjyf -pyjyf yjyf -e "SELECT id FROM fa_auth_rule WHERE name = \'master/audit\';"')
|
|
out = stdout.read().decode('utf-8', errors='ignore')
|
|
if 'master/audit' not in out and not any(line.strip().isdigit() for line in out.splitlines()):
|
|
cmd = f'mysql -uyjyf -pyjyf yjyf -e "INSERT INTO fa_auth_rule (pid, name, title, icon, \\`condition\\`, remark, ismenu, createtime, updatetime, weigh, status) VALUES (125, \'master/audit\', \'审核\', \'fa fa-check-square-o\', \'\', \'师傅入驻资质审核\', 0, {now}, {now}, 0, \'normal\');"'
|
|
ssh.exec_command(cmd)
|
|
print("[Remote] Inserted master/audit rule")
|
|
else:
|
|
print("[Remote] master/audit rule already exists")
|
|
ssh.close()
|