from django import http from django.db import connection # 用于判断银行账号是否存在 def if_account(CACC_NO): """ :return: """ if len(CACC_NO)<=0: return 'NO' sql = "SELECT Bacc_Type FROM BACC WHERE BACC_NO=%s" % (CACC_NO) with connection.cursor() as cursor: IF_CACC_NO = cursor.execute(sql).fetchall()[0][0] if int(IF_CACC_NO) ==1: return '1' elif int(IF_CACC_NO) ==2: return '2' else: return 'NO'