Exemple #1
0
 def get_goods_ids(cls, quick_id):
     sql = "SELECT id FROM cms_quick_order_goods where quick_order_id={0}".format(
         quick_id)
     ids = BaseCursor.get_all(sql)
     result = set()
     for i in ids:
         result.add(i[0])
     return result
Exemple #2
0
 def get_ads_id(cls, category_index_id):
     sql = "SELECT id FROM cms_category_index_ads where category_index_id={0}".format(
         category_index_id)
     ids = BaseCursor.get_all(sql)
     result = set()
     for i in ids:
         result.add(i[0])
     return result
Exemple #3
0
 def get_category(cls, quick_order_id):
     sql = "select c.name,c.id from cms_quick_order_category qoc inner join cms_navi_category c on c.id = qoc.category_id where qoc.quick_order_id={0}".format(
         quick_order_id)
     result = BaseCursor.get_all(sql)
     if len(result) == 1:
         return result[0]
     else:
         return None
    def get_recommended(cls, category_index_id):
        sql = "select cg.goods_id,g.name,cg.start_date,cg.end_date from cms_category_index_recommended_goods cg inner join view_cms_goods_formal g on g.goods_id = cg.goods_id and g.parent_id=-1 where cg.category_index_id={0} ORDER BY cg.sort DESC".format(
            category_index_id)
        result = BaseCursor.get_all(sql=sql)

        def _format(item):
            item[-1] = timestamp2str(item[-1])
            item[-2] = timestamp2str(item[-2])
            return item

        result = list(map(_format, result))
        return result
Exemple #5
0
    def get_ads(cls, category_index_id):
        sql = "SELECT ad.id AS adbean_id, ad.name AS adbean_name, ad.img_url AS image, ad.start, ad.end, ad.action_id, ifnull(ac.memo,'') AS action_name, ad.city FROM cms_adbeans ad LEFT JOIN cms_actions ac ON ac.id = ad.action_id INNER JOIN cms_category_index_ads cad ON cad.adbean_id = ad.id WHERE cad.category_index_id = {0} ORDER BY cad.sort DESC ".format(
            category_index_id)
        result = BaseCursor.get_all(sql=sql)

        def _format(item):
            item[3] = timestamp2str(item[3])
            item[4] = timestamp2str(item[4])
            if item[6]:
                item[6] = "%d(%s)" % (item[5], item[6])
            else:
                item[6] = "%d" % (item[5])
            return item

        result = list(map(_format, result))
        return result
Exemple #6
0
 def get_goods(cls, quick_order_id):
     sql = "select qg.goods_id,qg.operation_desc,g.cp_name,g.city,g.name from cms_quick_order_goods qg inner join view_cms_goods_formal g on g.goods_id = qg.goods_id and g.parent_id=-1 where qg.quick_order_id={0} order by qg.sort desc".format(
         quick_order_id)
     result = BaseCursor.get_all(sql)
     return result
Exemple #7
0
 def get_goods_simple(cls, quick_id):
     sql = "select g.cp_name,g.name from cms_quick_order_goods qog inner join view_cms_goods_formal g on g.goods_id = qog.goods_id and g.parent_id=-1 where qog.quick_order_id={0}".format(
         quick_id)
     result = BaseCursor.get_all(sql=sql)
     return list(map(cls.quick_order_simple_format, result))
 def get_quick_orders(cls, category_index_id):
     sql = "select ciqo.quick_order_id,qo.cms_quick_desc,qo.cms_quick_name from cms_category_index_quick_order ciqo inner join cms_quick_order qo on qo.id = ciqo.quick_order_id where ciqo.category_index_id={0} ORDER BY ciqo.sort DESC".format(
         category_index_id)
     result = BaseCursor.get_all(sql=sql)
     return result