def get(self): sql = """select wb.id, wb.name, wb.phone, wb.remark, wb.time, wb.date, wb.status, wb.created_at, ss.name sname, wb.wbs_id from wx_booking wb join supplier_shop ss on wb.shop_id = ss.id where wb.wx_id = %s order by wb.created_at desc""" page = Paginator(self, sql, [self.current_user.wx_id], page_size=10) self.render('book/orders.html', orders=page.rows, links=page.boot_links())
def get(self): sql = """select wb.id, wb.name, wb.phone, wb.remark, wb.time, wb.date, wb.status, wb.created_at, ss.name sname, wb.wbs_id from wx_booking wb join supplier_shop ss on wb.shop_id = ss.id where wb.wx_id = %s order by wb.created_at desc""" page = Paginator(self, sql, [self.current_user.wx_id], page_size=10) self.render('book/orders.html', orders=page.rows, links=page.boot_links())
def get(self): sql = 'select * from wx_points where mem_id = %s ' page = Paginator(self, sql, [self.current_user.id], page_size=10) now = datetime.now().replace(hour=0, minute=0, second=0) sum = 0 sign = False points = self.db.query('select * from wx_points where mem_id = %s', self.current_user.id) for point in points: if point.expire_type == '1' or (point.expire_type == '0' and point.expire_at >= now): sum += point.num if not sign and point.created_at >= now: sign = True params = { 'points': page.rows, 'sum': sum, 'current_user': self.current_user, 'sign': sign, 'links': page.boot_links() } self.render('member/sign.html', **params)
def get(self): sql = 'select * from wx_points where mem_id = %s ' page = Paginator(self, sql, [self.current_user.id], page_size=10) now = datetime.now().replace(hour=0, minute=0, second=0) sum = 0 sign = False points = self.db.query('select * from wx_points where mem_id = %s', self.current_user.id) for point in points: if point.expire_type == '1' or (point.expire_type == '0' and point.expire_at >= now): sum += point.num if not sign and point.created_at >= now: sign = True params = { 'points': page.rows, 'sum': sum, 'current_user': self.current_user, 'sign': sign, 'links': page.boot_links() } self.render('member/sign.html', **params)
def get(self): user = self.current_user if user.level == 0: # 不是会员,先跳转到加入会员页面 self.redirect( url_concat(self.reverse_url('member_join'), {'wx_id': user.wx_id})) else: # 查询有效的预约信息 sql = 'select id, info from wx_booking_setting where sp_id = %s and deleted=0' page = Paginator(self, sql, [user.sp_id], page_size=10) lists = [{ 'id': b.id, 'info': json.loads(b.info, object_hook=json_hook) } for b in page.rows] # 查询用户已提交的预约 orders = self.db.get( 'select count(*) num from wx_booking where wx_id = %s', self.current_user.wx_id)['num'] self.render('book/list.html', lists=lists, orders=orders, img_url=img_url, links=page.boot_links())
def get(self): user = self.current_user if user.level == 0: # 不是会员,先跳转到加入会员页面 self.redirect(url_concat(self.reverse_url('member_join'), {'wx_id': user.wx_id})) else: # 查询有效的预约信息 sql = 'select id, info from wx_booking_setting where sp_id = %s and deleted=0' page = Paginator(self, sql, [user.sp_id], page_size=10) lists = [{'id': b.id, 'info': json.loads(b.info, object_hook=json_hook)} for b in page.rows] # 查询用户已提交的预约 orders = self.db.get('select count(*) num from wx_booking where wx_id = %s', self.current_user.wx_id)['num'] self.render('book/list.html', lists=lists, orders=orders, img_url=img_url, links=page.boot_links())