示例#1
0
 def get_location_and_save(self, openid, longitude, latitude, description):
     '''获取用户地址位置,并且保存'''
     user = self.get_user_by_openid(openid)
     user.update(longitude=longitude,
                 latitude=latitude,
                 description=description)
     db.commit()
 def update_user_coupons(self,user_id,coupons_id):
     user=self.get_user_by_id(user_id)
     if user.coupons_id:
         user.coupons_id = user.coupons_id + ',' + str(coupons_id)
     else:
         user.coupons_id = str(coupons_id)
     db.commit()
示例#3
0
 def update_user_coupons(self, user_id, coupons_id):
     user = self.get_user_by_id(user_id)
     if user.coupons_id:
         user.coupons_id = user.coupons_id + ',' + str(coupons_id)
     else:
         user.coupons_id = str(coupons_id)
     db.commit()
示例#4
0
def cancel(queue_id):
    '''取消排队'''
    queue = Queue.query.filter(Queue.id == queue_id).first()
    if queue:
        queue.status = 0
        try:
            db.commit()
        except:
            db.rollback()
def cancel(queue_id):
    '''取消排队'''
    queue = Queue.query.filter(Queue.id == queue_id).first()
    if queue:
        queue.status = 0
        try:
            db.commit()
        except:
            db.rollback()
示例#6
0
def call_number(queue_id):
    '''店员叫号'''
    queue = Queue.query.filter(Queue.id == queue_id).first()
    if queue:
        queue.status = 0  # 叫号修改状态值。说明已经叫过号
        try:
            db.commit()
        except:
            db.rollback()
            return False
    return True
def call_number(queue_id):
    '''店员叫号'''
    queue = Queue.query.filter(Queue.id == queue_id).first()
    if queue:
        queue.status = 0 # 叫号修改状态值。说明已经叫过号
        try:
            db.commit()
        except:
            db.rollback()
            return False
    return True
def register_view():
    register_form = RegisterForm(request.form)
    if helpers.validate_form_on_submit(register_form):
        user = AdminUser(name=register_form.user_name.data, password=register_form.password.data,
                         admin='1111')
        db.add(user)
        db.commit()

        login_user_with_remember(user)
        if user.admin:
            return redirect('/admin')

        return redirect('/admin')

    return render_template('admin_page/auth.html', form=register_form)
示例#9
0
def register_view():
    register_form = RegisterForm(request.form)
    if helpers.validate_form_on_submit(register_form):
        user = AdminUser(name=register_form.user_name.data,
                         password=register_form.password.data,
                         admin='1111')
        db.add(user)
        db.commit()

        login_user_with_remember(user)
        if user.admin:
            return redirect('/admin')

        return redirect('/admin')

    return render_template('admin_page/auth.html', form=register_form)
示例#10
0
def insert_user(nickname, openid, img_url):
    user = User(nick_name=nickname, openid=openid, picture_url=img_url)
    db.add(user)
    db.commit()
示例#11
0
 def update_coupons_total(coupons_id):
     coupons = Coupons.get_coupons_by_id(coupons_id)
     if coupons.total > 0:
         coupons.total = coupons.total - 1
         db.commit()
    def create_user(self, nickname, openid, picture_url):

        user = User(nick_name=nickname, openid=openid, picture_url=picture_url)
        db.add(user)
        db.commit()
        return user
示例#13
0
 def update_coupons_total(coupons_id):
     coupons = Coupons.get_coupons_by_id(coupons_id)
     if coupons.total > 0:
         coupons.total = coupons.total - 1
         db.commit()
def insert_user(nickname, openid, img_url):
    user = User(nick_name=nickname, openid=openid, picture_url=img_url)
    db.add(user)
    db.commit()
 def get_location_and_save(self, openid, longitude, latitude, description):
     '''获取用户地址位置,并且保存'''
     user = self.get_user_by_openid(openid)
     user.update(longitude=longitude,latitude=latitude, description=description)
     db.commit()
def create_new_queue(model):
    '''创建新model'''
    db.add(model)
    db.commit()
示例#17
0
 def update_user(self, longitude, latitude, openid):
     '''修改'''
     user = self.get_user_by_openid(openid)
     user.update(longitude=longitude, latitude=latitude)
     db.commit()
示例#18
0
def create_new_queue(model):
    '''创建新model'''
    db.add(model)
    db.commit()
 def update_user(self, longitude, latitude, openid):
     '''修改'''
     user = self.get_user_by_openid(openid)
     user.update(longitude=longitude,latitude=latitude)
     db.commit()
示例#20
0
    def create_user(self, nickname, openid, picture_url):

        user = User(nick_name=nickname, openid=openid, picture_url=picture_url)
        db.add(user)
        db.commit()
        return user