def handle_event_new_prods(self, fromUser, toUser): try: items = modelProduct().getList('id,picture,name', condition='category>1', orders="id desc", limits='5') for x in items: x['desc'] = "" x['url'] = "http://%s.wiaapp.cn/ajax/views/prodcontent?id=%d" % (config.AJAX_TEMPLATE, x['id']) x['picurl']=self.imageUrl(x['picture']) return self.render.wx_reply_list(fromUser, toUser, int(time.time()), len(items), items) except Exception, e: #log.warn(e) return self.notFound()
def handle_event_hot_prods(self, fromUser, toUser): try: commentitems = modelProdcomment().getList('product,count(product)', '1=1 group by product', orders='count(product) desc',limits='5') products = [] for item in commentitems: condition = 'id = ' + str(item['product']) prod = modelProduct().getOne('id,picture,name',condition) if (prod): prod['desc'] = "" prod['picurl'] = self.imageUrl(prod['picture']) prod['url'] = "http://%s.wiaapp.cn/ajax/views/prodcontent?id=%d" % (config.AJAX_TEMPLATE, prod['id']) products.append(prod) return self.render.wx_reply_list(fromUser, toUser, int(time.time()), len(products), products) except Exception, e: log.warn(e) return self.notFound()