def modify_login_pwd(token, password, account, dialing_code=""): # 修改登录密码 url = "%s/api/v1/user/modify_login_pwd" % B1_url db = DB('mysql.b1dev.xyz', 3306, 'gpex', 'H8WidnS054aM', 'gpex') # B1devDB verification_id = send_email_sms(sms_type="4", account=account, token=token, language="zh") # verification_id = send_sms(sms_type="4",account=account,dialing_code=dialing_code,token=token,language="zh") verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] print(verification_code) password = str( hashlib.sha256((password + "YDEXSS").encode('utf-8')).hexdigest()) body = { "token": token, "password": password, "verification_code": verification_code, "verification_id": verification_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) # print(password) print(json.loads(run.response))
def apikey_create(account, token, permission, bind_ip, remark, dialing_code="86"): #申请ApiKey url = "%s/api/v1/merchant/apikey/create" % B4_url db = DB(host, port, user, password, database) # B4devDB # verification_id = send_email_sms(sms_type="8", account=account,token=token, language="zh") verification_id = send_sms(sms_type="8", account=account, token=token, language="zh", dialing_code=dialing_code) verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] body = { "token": token, "permission": permission, #权限类型,取值范围:1=读取 2=交易 4=划转,可组合使用 "verification_code": verification_code, "verification_id": verification_id, "bind_ip": bind_ip, "remark": remark } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) print(json.loads(run.response))
def reset_login_pwd(password, account, token="", dialing_code=""): # 重置登录密码 url = "%s/api/v1/user/reset_login_pwd" % B4_url db = DB('mysql.b4dev.xyz', 3306, 'b4_api', 'eYKRj3Vp@zM0SGWj', 'b4') # B4devDB # verification_id = send_email_sms(sms_type="4", account=account, token=token, language="zh") verification_id = send_sms(sms_type="3", account=account, dialing_code=dialing_code, token=token, language="zh") verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] print(verification_code) password = str(hashlib.sha256(password.encode('utf-8')).hexdigest()) print(password) body = { "token": token, "account": account + dialing_code, "password": password, "verification_code": verification_code, "verification_id": verification_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, send_msg=body, response_msg=json.loads(run.response)) # print(password) print(json.loads(run.response))
def payway_add(token, pay_way, pay_detail, account, dialing_code=""): #添加收付款方式 url = "%s/api/v1/payway/add" % B4_url # verification_id = send_sms(sms_type="6", account=account, dialing_code=dialing_code, token=token, language="zh") verification_id = send_email_sms(sms_type="6", account=account, token=token) db = DB('mysql.b4dev.xyz', 3306, 'b4_api', 'eYKRj3Vp@zM0SGWj', 'b4') # B4devDB verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] pay_detail = json.dumps(pay_detail, ensure_ascii=False) body = { "token": token, "pay_way": pay_way, "pay_detail": pay_detail, "verification_id": verification_id, "verification_code": verification_code } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url, response_msg=json.loads(run.response)) print(json.loads(run.response))
def user_email_register(sms_type, account, password, invitation_code=""): #dev邮箱注册 verification_id = send_email_sms(sms_type, account) db = DB('mysql.b1dev.xyz', 3306, 'gpex', 'H8WidnS054aM', 'gpex') # B1devDB verification_code = db.query( "SELECT verification_code FROM user_verification_code WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % account)[0][0] token = register(account=account, password=password, verification_id=verification_id, verification_code=verification_code, type="2", invitation_code=invitation_code, platform="2") print(token) return token
def user_email_login(sms_type, account, password, type="2"): #dev邮箱登录 verification_token = login_step1(account=account, password=password, type=type) verification_id = send_email_sms(sms_type=sms_type, account=account) db = DB('mysql.b1dev.xyz', 3306, 'gpex', 'H8WidnS054aM', 'gpex') # B1devDB verification_code = db.query( "SELECT verification_code FROM user_verification_code WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % account)[0][0] token = login_step2(verification_code=verification_code, verification_token=verification_token, verification_id=verification_id, account=account) print(token) return token
def user_phone_login(sms_type, account, password, type="1", dialing_code="86"): #dev手机登录 verification_token = login_step1(account=account, password=password, type=type, dialing_code=dialing_code) verification_id = send_sms(sms_type=sms_type, account=account, dialing_code=dialing_code) db = DB('mysql.b4dev.xyz', 3306, 'b4_api', 'eYKRj3Vp@zM0SGWj', 'b4') # B4devDB verification_code = db.query( "SELECT verification_code FROM user_verification_code WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] token = login_step2(verification_code=verification_code, verification_token=verification_token, verification_id=verification_id, account=account, dialing_code=dialing_code) print(token) return token
def register_kyc(account, password, dialing_code="86", invitation_code=""): # 实名认证注册 url = "%s/api/v1/user/register_kyc" % B4_url kyc = authentication_get_kyc_info(token=B1token_wen) if kyc["code"] == 1000: if kyc["data"]["state"] == 3: certificates_name = kyc["data"]["certificates_name"] # print(certificates_name) certificates_no = kyc["data"]["certificates_no"] # print(certificates_no) else: print(kyc) certificates_name = input() # print(kyc) verification_id = send_sms(sms_type="1", account=account, dialing_code=dialing_code) db = DB('mysql.b4dev.xyz', 3306, 'b4_api', 'eYKRj3Vp@zM0SGWj', 'b4') # B4devDB verification_code = db.query( "SELECT verification_code FROM user_verification_code WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] password = str(hashlib.sha256(password.encode('utf-8')).hexdigest()) body = { "account": account, "password": password, "verification_id": verification_id, "verification_code": verification_code, "invitation_code": invitation_code, "name": str(certificates_name), "certificate_no": str(certificates_no) } run = RunMain(url=url, params=None, data=body, headers=get_signture(Android_apikey, Android_apisecret, body), method='POST') out_log(url, body, json.loads(run.response)) print(json.loads(run.response))
def user_phone_register(sms_type, account, password, dialing_code, invitation_code=""): #dev手机注册 verification_id = send_sms(sms_type, account, dialing_code=dialing_code) db = DB('mysql.b4dev.xyz', 3306, 'b4_api', 'eYKRj3Vp@zM0SGWj', 'b4') # B4devDB verification_code = db.query( "SELECT verification_code FROM user_verification_code WHERE user_account = '%s' ORDER BY code_over_time DESC LIMIT 1" % (dialing_code + account))[0][0] token = register(account=account, password=password, verification_id=verification_id, verification_code=verification_code, dialing_code=dialing_code, type="1", invitation_code=invitation_code, platform="2") print(token) return token
def withdraw(token,symbol,amount,address,password,account,chain_id): #提交提币申请 url = "%s/api/v1/wallet/withdraw" % B4_url password = str(hashlib.sha256(password.encode('utf-8')).hexdigest()).upper() db = DB('mysql.b4dev.xyz', 3306, 'b4_api', 'eYKRj3Vp@zM0SGWj', 'b4') # B4devDB verification_id = send_sms(sms_type="7", account=account,token=token) verification_code = db.query( "SELECT verification_code FROM `user_verification_code` WHERE user_account = 86%s ORDER BY code_over_time DESC LIMIT 1" % account)[0][0] body={ "token":token, "symbol":symbol, "amount":amount, "address":address, "verification_id":verification_id, "verification_code":verification_code, "password":password, "account":"86%s"%account, "chain_id":chain_id } run = RunMain(url=url, params=None, data=body, headers=get_signture(H5_apikey, H5_apisecret, body), method='POST') out_log(url,send_msg=body,response_msg=json.loads(run.response)) print(json.loads(run.response))