if_account.py 488 B

123456789101112131415161718192021
  1. from django import http
  2. from django.db import connection
  3. # 用于判断银行账号是否存在
  4. def if_account(CACC_NO):
  5. """
  6. :return:
  7. """
  8. if len(CACC_NO)<=0:
  9. return 'NO'
  10. sql = "SELECT Bacc_Type FROM BACC WHERE BACC_NO=%s" % (CACC_NO)
  11. with connection.cursor() as cursor:
  12. IF_CACC_NO = cursor.execute(sql).fetchall()[0][0]
  13. if int(IF_CACC_NO) ==1:
  14. return '1'
  15. elif int(IF_CACC_NO) ==2:
  16. return '2'
  17. else:
  18. return 'NO'