Exemplo n.º 1
0
def remove_email():
    data = request.form.to_dict()
    if data != '':
        email = data['email']
        if email in monitor.email:
            monitor.email.remove(email)
            return Response.success(message='删除成功')
        else:
            return Response.failure(message='邮箱不存在')
Exemplo n.º 2
0
def add_email():
    data = request.form.to_dict()
    if data != '':
        email = data['email']
        if email not in monitor.email:
            monitor.email.append(email)
            return Response.success(message='添加成功')
        else:
            return Response.failure(message='邮箱已存在')
Exemplo n.º 3
0
def remove():
    data = request.form.to_dict()
    if data != '':
        id = data['id']
        res = monitor.remove(id)
        if res:
            return Response.success(message='删除成功')
        else:
            return Response.failure(message='商品不存在')
Exemplo n.º 4
0
def history():
    data = request.args.to_dict()
    if data != '':
        id = data['id']
        res = monitor.history(id)
        if history:
            return Response.success(data=res)
        else:
            return Response.failure(message='商品编号错误')
Exemplo n.º 5
0
def update_status():
    data = request.form.to_dict()
    if data != '':
        id = data['id']
        status = data['status'] == 'true'
        res = monitor.update_status(id, status)
        if res:
            return Response.success(message='修改成功')
        else:
            return Response.failure(message='商品不存在')
Exemplo n.º 6
0
def update_want():
    data = request.form.to_dict()
    if data != '':
        id = data['id']
        want = float(data['want'])
        res = monitor.update_want(id, want)
        if res:
            return Response.success(message='修改成功')
        else:
            return Response.failure(message='商品不存在')
Exemplo n.º 7
0
def update_setting():
    data = request.form.to_dict()
    if data != '':
        rate = int(data['rate'])
        note = int(data['note'])
        if rate and note:
            monitor.rate = rate
            monitor.note = note
            return Response.success(message='设置成功')
        else:
            return Response.failure(message='请输入刷新频率和通知频率')
Exemplo n.º 8
0
def add():
    data = request.form.to_dict()
    if data != '':
        id = data['id']
        want = float(data['want'])
        status = data['status'] == 'true'
        res = monitor.add(id, want, status)
        if res:
            return Response.success(message='添加成功')
        else:
            return Response.failure(message='商品已存在')