Exemple #1
0
 def decode(self, s, _w=WHITESPACE.match):
     dic = super(categoryDecode, self).decode(s)
     print dic
     categoryList = []
     currentTime = int(time.time())
     for categoryTmp in dic['result']:
         category = Category()
         category.cate_id = categoryTmp['cate_id']
         category.cate_name = categoryTmp['cate_name']
         category.parent_id = categoryTmp['parent_id']
         category.parent_cate_name = categoryTmp['parent_cate_name']
         category.sort_num = categoryTmp['sort_num']
         category.cate_item_num = categoryTmp['cate_item_num']
         category.description = categoryTmp['description']
         category.listUrl = categoryTmp['listUrl']
         category.shopName = categoryTmp['shopName']
         category.shopLogo = categoryTmp['shopLogo']
         category.update_time = currentTime
         categoryList.append(category)
     return categoryList
Exemple #2
0
def getCategoryFromDb():
    print '--- getCategoryFromDb start ---'
    query = "select * from sh_category"
    results = DbUtil.query(query)
    print results
    if results is None:
        return None
    categoryList = []
    for row in results:
        category = Category()
        row_id = row[0]
        cate_id = row[1]
        cate_name = row[2]
        parent_id = row[3]
        parent_cate_name = row[4]
        sort_num = row[5]
        cate_item_num = row[6]
        description = row[7]
        listUrl = row[8]
        shopName = row[9]
        shopLogo = row[10]
        updateTime = row[11]
        category.cate_id = cate_id
        category.cate_name = cate_name
        category.parent_id = parent_id
        category.parent_cate_name = parent_cate_name
        category.sort_num = sort_num
        category.cate_item_num = cate_item_num
        category.description = description
        category.listUrl = listUrl
        category.shopName = shopName
        category.shopLogo = shopLogo
        category.update_time = updateTime
        categoryList.append(category)
        # print "row_id = %s, access_token = %s, expire_in = %s, update_time = %s " %(row_id, access_token, expire_in, update_time)
    return categoryList