From: p15692025051 <846603105@qq.com> Date: Fri, 21 Apr 2023 07:22:33 +0000 (+0800) Subject: 支付宝打开时判断是否初始化增加等待时间 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=a4c0328158bb281218e1e19d9e91e6143a41f675;p=mirrors%2FASR1603_G5.git 支付宝打开时判断是否初始化增加等待时间 --- diff --git a/3.code/1.watch/2.code/appAlipay.py b/3.code/1.watch/2.code/appAlipay.py index b5e25fed..57db3f59 100644 --- a/3.code/1.watch/2.code/appAlipay.py +++ b/3.code/1.watch/2.code/appAlipay.py @@ -79,13 +79,13 @@ class Alipay(Abstract): #print("timeout_Alipay1:{}".format(EventMesh.publish(constants.EVENT.GET_CONNECT))) time = utime.localtime() - #if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and self.alipay != None and (self.is_simcard_identify != 0 or time[3] == 0 or time[3] == 12): - if self.alipay != None and (self.is_simcard_identify != 0 or time[3] == 0 or time[3] == 12): + if EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and self.alipay != None and (self.is_simcard_identify != 0 or time[3] == 0 or time[3] == 12): + #if self.alipay != None and (self.is_simcard_identify != 0 or time[3] == 0 or time[3] == 12): self.is_simcard_identify = self.alipay.start_simcard_identify() print("is_simcard_identify:%d"%self.is_simcard_identify) #if self.is_simcard_identify == 0 and EventMesh.publish(constants.EVENT.GET_CONNECT) == 1 and self.is_init != 0: - if self.is_simcard_identify == 0 and self.is_init != 0: + if self.is_init != 0: id2_st = bytearray([0]) id2_ret = self.alipay.id2_init() #print("id2_ret:%d"%id2_ret) @@ -267,10 +267,17 @@ class Alipay(Abstract): def alipay_1(self, event, msg): + for i in range(5) : + if self.is_init == 0 : + utime.sleep(2) + else : + break + #本地判断是否绑定 check_bind = self.alipay.check_bind_status() check_bind_online = self.alipay.check_bind_status() print("check_bind:{} check_bind_online:{}".format(check_bind,check_bind_online)) + if check_bind == 4: #已绑定 EventMesh.publish("load_screen", {"screen": "alipay_1_1"}) # if self.is_init == 0 : @@ -279,26 +286,14 @@ class Alipay(Abstract): # ret = self.alipay.msg_send(3,args,userdata) #发送获取付款码消息 # ret = self.alipay.msg_send(5,args,userdata) #发送获取收款码消息 elif check_bind == 5: #未绑定 - #EventMesh.publish("load_screen", {"screen": "alipay_invite"}) - if self.is_init == 0 : - # bindcode = bytearray(500) - # bindcode_len = bytearray([500]) - # self.alipay.get_bindcode(bindcode,bindcode_len) - # print("len:{} qrcode:{}".format(bindcode_len,bindcode)) - # self.timer_Alipay_check.start(2000, 1, self.timeout_Alipay_check_cb) - args = "" - userdata = "" - print("--000--") - ret = self.alipay.msg_send(1,args,userdata) #发送获取绑定码消息 - print("alipay_1 send msg:HELIOS_PAY_MSG_GET_BIND_CODE:{}".format(ret)) + args = "" + userdata = "" + # print("--000--") + ret = self.alipay.msg_send(1,args,userdata) #发送获取绑定码消息,在回调函数里打开界面 + print("alipay_1 send msg:HELIOS_PAY_MSG_GET_BIND_CODE:{}".format(ret)) else : print("check bind error!!!") - def timeout_Alipay_check_cb(self, *args, **kwargs): - - ret = self.alipay.query_bind_result() - print("query_bind_result:{}".format(ret)) - style_alipay_screen_default = lv.style_t() style_alipay_screen_default.init() style_alipay_screen_default.set_radius(0)