Exemplo n.º 1
0
def see_comment():

    token = requst_get_token()
    ok, aid = check_token(token)
    if not ok:
        return jsonify(token_err(""))

    comment = CurriculumComments(aid=aid)
    items = comment.query_user_comments(page=request.args.get("page",1),number=request.args.get("number",10))

    return jsonify(commen_success_res("",items))
Exemplo n.º 2
0
def get_show_study():

    token = requst_get_token()
    ok, aid = check_token(token)
    if not ok:
        return jsonify(token_err(""))

    shop = ShoppingCarts(aid=aid)
    items = shop.get_purchase_curriculums(page=request.args.get("page",1),number=request.args.get("number",10))


    return jsonify(commen_success_res("",items))
Exemplo n.º 3
0
def del_comment():

    form = del_comment_form()
    if not form.validate_for_api():
        return form.bindErr

    token = requst_get_token()
    ok, aid = check_token(token)
    if not ok:
        return jsonify(token_err(""))

    comment = CurriculumComments(id=form.id.data,aid=aid)
    if not comment.del_comment():
        return jsonify(del_err("删除评论失败"))

    return jsonify(commen_success_res("删除评论成功",""))
Exemplo n.º 4
0
def add_comment():

    form = add_comment_form()
    if not form.validate_for_api():
        return form.bindErr

    token = requst_get_token()
    ok, aid = check_token(token)
    if not ok:
        return jsonify(token_err(""))

    comment = CurriculumComments(aid=aid,cid=form.cid.data,number=form.number.data,comment=form.comment.data)
    if not comment.save():
        return jsonify(add_err("该课程已经评论或者评论异常"))

    return jsonify(commen_success_res("评论添加成功",""))
Exemplo n.º 5
0
def modify_user():

    form = modify_info_form()
    if not form.validate_for_api():
        return jsonify(form.bindErr)

    token = requst_get_token()
    ok, aid = check_token(token)
    if not ok:
        return jsonify(token_err(""))

    u = account.query.filter(account.aid == int(aid)).first()
    if not u.modify_user_info(form.nickname.data, form.info.data):
        return jsonify(modify_err(""))

    return jsonify(commen_success_res("修改信息成功", ""))
Exemplo n.º 6
0
def modify_user_password():

    form = modify_pswd_form()
    if not form.validate_for_api():
        return jsonify(form.bindErr)

    token = requst_get_token()
    ok, aid = check_token(token)
    if not ok:
        return jsonify(token_err(""))

    u = account.query.filter(account.aid == int(aid)).first()

    if not u.modify_pswd(form.old.data,form.new.data):
        return jsonify(modify_err(""))

    return jsonify(commen_success_res("密码修改成功",""))
Exemplo n.º 7
0
def logout():
    token = requst_get_token()
    print(token)
    return jsonify(commen_success_res("",""))