def item_baseInfoString(self, b_baseInfo): if b_baseInfo != '': m = re.search(r'"activityId":(.+?),', b_baseInfo, flags=re.S) if m: # 品牌团Id self.brandact_id = m.group(1) m = re.search(r'"activityUrl":"(.+?)",', b_baseInfo, flags=re.S) if m: # 品牌团链接 self.brandact_url = Common.fix_url(m.group(1)) if self.brandact_url.find('ladygo.tmall.com') != -1: # 品牌团标识 self.brandact_sign = 3 m = re.search(r'"ostime":(.+?),', b_baseInfo, flags=re.S) if m: # 品牌团开团时间 self.brandact_starttime = m.group(1) self.brandact_startdate = Common.add_hours_D(int(float(self.brandact_starttime)/1000), 1) m = re.search(r'"oetime":(.+?),', b_baseInfo, flags=re.S) if m: # 品牌团结束时间 self.brandact_endtime = m.group(1) m = re.search(r'"activityStatus":"(.+?)",', b_baseInfo, flags=re.S) if m: # 品牌团状态 self.brandact_status = m.group(1) m = re.search(r'"sellerId":(.+?),', b_baseInfo, flags=re.S) if m: # 品牌团卖家Id self.brandact_sellerId = m.group(1) m = re.search(r'"otherActivityIdList":\[(.+?)\],', b_baseInfo, flags=re.S) if m: otherActivityIdList = m.group(1) # 如果是拼团, 其他团的ID self.brandact_other_ids = str(self.brandact_id) + ',' + otherActivityIdList.replace('"','') # 品牌团标识 self.brandact_sign = 2 else: self.brandact_other_ids = str(self.brandact_id) m = re.search(r'"brandId":(.+?),', b_baseInfo, flags=re.S) if m: # 品牌团Id self.brandact_brandId = m.group(1) m = re.search(r'"sgFrontCatId":(\d+)', b_baseInfo, flags=re.S) if m: # 品牌团所在类别Id self.brandact_front_categoryId = m.group(1)
def item_baseInfoDict(self, b_baseInfo): if b_baseInfo: if b_baseInfo.has_key('activityId') and b_baseInfo['activityId']: # 品牌团Id self.brandact_id = b_baseInfo['activityId'] if b_baseInfo.has_key('activityUrl') and b_baseInfo['activityUrl']: # 品牌团链接 self.brandact_url = Common.fix_url(b_baseInfo['activityUrl']) if self.brandact_url.find('ladygo.tmall.com') != -1: # 品牌团标识 self.brandact_sign = 3 if b_baseInfo.has_key('ostime') and b_baseInfo['ostime']: # 品牌团开团时间 self.brandact_starttime = b_baseInfo['ostime'] self.brandact_startdate = Common.add_hours_D(int(float(self.brandact_starttime)/1000), 1) if b_baseInfo.has_key('oetime') and b_baseInfo['oetime']: # 品牌团结束时间 self.brandact_endtime = b_baseInfo['oetime'] if b_baseInfo.has_key('activityStatus') and b_baseInfo['activityStatus']: # 品牌团状态 self.brandact_status = b_baseInfo['activityStatus'] if b_baseInfo.has_key('sellerId') and b_baseInfo['sellerId']: # 品牌团卖家Id self.brandact_sellerId = b_baseInfo['sellerId'] if b_baseInfo.has_key('otherActivityIdList') and b_baseInfo['otherActivityIdList']: # 如果是拼团, 其他团的ID self.brandact_other_ids = str(self.brandact_id) + ',' + ','.join(b_baseInfo['otherActivityIdList']) # 品牌团标识 self.brandact_sign = 2 else: self.brandact_other_ids = str(self.brandact_id) if b_baseInfo.has_key('brandId') and b_baseInfo['brandId']: # 品牌团Id self.brandact_brandId = b_baseInfo['brandId'] if b_baseInfo.has_key('sgFrontCatId') and b_baseInfo['sgFrontCatId']: # 品牌团所在类别Id self.brandact_front_categoryId = b_baseInfo['sgFrontCatId']