diff --git a/b/account/email_info.dspy b/b/account/email_info.dspy index c4a6e4b..741c857 100644 --- a/b/account/email_info.dspy +++ b/b/account/email_info.dspy @@ -90,8 +90,10 @@ async def email_info(msg, indent=0): index = find_data.index("<") name = find_data[:index] if price and name: - mail_code_sql = """SELECT * FROM mail_code WHERE LOCATE(mailcode, '%s') > 0 and del_flg = '0';""" % name - mail_code = await sor.sqlExe(mail_code_sql, {}) + mail_code_sql = """SELECT * FROM mail_code WHERE mailcode= ${mailcode}$ and del_flg = '0';""" + mail_code = await sor.sqlExe(mail_code_sql, {'mailcode': name}) + if len(mail_code) < 1: + raise Exception(f'{name}不是合法的编码,数据库中没有找到') # mail_code = await sor.R('mail_code',{'mailcode':name,'del_flg':'0'}) date = await get_business_date(sor=None) recharge_log = {'customerid': mail_code[0]['customer_id'], 'recharge_amt': price, @@ -119,4 +121,4 @@ async def email_info(msg, indent=0): msg = Parser().parsestr(msg_content) ret = await email_info(msg) -return ret \ No newline at end of file +return ret