def Login(tel=CONFIG.Mobile()): login_exit.Login_exit() # 初始化操作,解除绑定 url = CONFIG.Url() + '/api/small/login/checkSms.jhtml' # 判断是1还是2开头的手机号码并生成相应的验证码 # tel = CONFIG.Mobile() if str(tel[:2]) == '23' and len(str(tel)) == 11: code = str((int(tel[:1]) + int(tel[-5:])) * 201812306 )[:6] elif str(tel[0]) == '1' and len(tel) == 11: code = tel[-4:]+time.strftime('%m%d') else: return '[×] 异常记录-->登陆账号错误' params = {'tel': tel, 'code': code, 'unionId': CONFIG.Unionid()} # print(params['tel']) request_login = requests.get(url, params) if request_login.status_code == 200: if request_login.json()['msg'] == '成功': return '登陆成功', request_login.json() else: return '[×] 异常记录-->%s'%request_login.json() else: return '[×] %s登录失败' % request_login.status_code
def Member_id(): connect = pymysql.connect(CONFIG.Data_base_config()['address'], CONFIG.Data_base_config()['user'],CONFIG.Data_base_config()['pwd'],CONFIG.Data_base_config()['base_name']) try: cursor = connect.cursor() # 游标 cursor.execute('select id, mobile \ from xx_member \ where mobile = \'%s\'' % CONFIG.Mobile()) #执行sql member_id = cursor.fetchall()[0] # 返回执行结果 connect.close() # 断开数据库连接 return member_id except Exception as error: connect.close() return '数据库操作失败-->%s' % error