def refresh_ktvinfo(self): try: DogName = AppSet()._dogname url = AppSet().GetCloudKtvIniValue( "KtvInfoURL" ) + "/ktvservice.aspx?op=getktvbydog&dogname=" + yhttp().UrlEncode( DogName) print(url) result = yhttp().get_y(url, 10) dic_res = json.loads(result) logger.debug("get ktvinfo: %s, result: %s" % (url, result)) if dic_res and str(dic_res['code']) == '1': if isinstance(dic_res['result'], dict): dic_ktv = dic_res['result'] ktv = dic_ktv['matches'][0] self._info = ktv_info() self._info.ktvid = int(ktv['StoreId']) self._info.ktvname = ktv['StoreName'] self._info.jd = float(ktv['Jd']) self._info.wd = float(ktv['Wd']) self._info.city = ktv['City'] self._info.provincename = ktv['Province'] self._info.country = ktv['Country'] self._info.hostaddress = ktv['Hostaddress'] self._info.stbsystemboot = ktv['stbsystemboot'] #获取ktv省市id try: url = AppSet().GetCloudKtvIniValue( "KtvInfoURL" ) + "/ktvservice.aspx?op=getktvcity&storeid=" + str( self._info.ktvid) result = yhttp().get_y(url, 10) dic_res = json.loads(result) if dic_res and str(dic_res['code']) == '1': if isinstance(dic_res['data'], dict): dic_city = dic_res['data'] self._info.province = str( dic_city['provincenum']) except Exception as ex: self._info = None logging.error('KtvInfo init excepted') logging.error(str(ex)) logging.error(traceback.format_exc()) # self.init_ktvmeta(self._info.ktvid) self.ktvconfig() except Exception as ex: self._info = None logging.error('KtvInfo init excepted') logging.error(str(ex)) logging.error(traceback.format_exc())
def checkthemestatus(self, id): result = 0 try: param = {} param['id'] = id param['time'] = str(int(time.time())) param['op'] = "checkinvalidtheme" paramurl = yhttp().ParamSign(param) baseurl = "{0}/ModuleService.aspx?".format(AppSet().KtvApi) url = baseurl + paramurl print(url) result = yhttp().get_y(url, 10) dic_res = json.loads(result) if dic_res and str(dic_res['code']) == '1': result = dic_res['result'] return result except Exception as e: print(e) return result
def ktvconfig(self): try: url = AppSet().GetCloudKtvIniValue( "Alter90URL" ) + "/KtvAppService.aspx?op=getstorejson&dogname=" + yhttp( ).UrlEncode(AppSet()._dogname) + "&storeid=" + str( self._info.ktvid) result = yhttp().get_y(url, 10) dic_res = json.loads(result) if dic_res and str(dic_res['code']) == '1': if isinstance(dic_res['result'], dict): result = dic_res['result']['matches'] logger.debug("getstoreJson: result:%s" % result) for item in result: self._info.mtype = item['ModuleType'] self._info.projectver = item['ProjectVer'] self._info.updatetime = item['StoreUpdateTime'] work_update = item["StoreIsWorkingUpdate"] except Exception as e: logger.error(traceback.format_exc()) pass