Exemplo n.º 1
0
def product_add():
    params = get_params()
    params["publisher_id"] = get_user_info()["user_id"]
    state = add_product_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "添加失败!"))
Exemplo n.º 2
0
def commit_add():
    params = get_params()
    params["user_id"] = get_user_info()["user_id"]
    state = add_comment_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "添加失败!"))
Exemplo n.º 3
0
def password_forget():
    """
    忘记密码 密码修改
    :return:
    """
    params = get_params()
    telephone = get_params()["telephone"]
    # redis验证码和前端验证码比较
    code = redis_server.get(redis_pre['register_sms'] + str(telephone))
    if code and int(params["code"]) == int(code):
        redis_server.delete(redis_pre['register_sms'] + str(telephone))
        return forget_password_service(telephone, params["password"])
    return False, msg.A_CODE_TIMEOUT
Exemplo n.º 4
0
def question_list():
    params = get_params()
    state, result, total = list_question_service(params)
    if state:
        return build_ret(success=state, msg='操作成功', total=total, data=result)
    else:
        return err_ret(msg.ERROR(1, "查询失败!"))
Exemplo n.º 5
0
def admin_report_list():
    params = get_params()
    state, result, total = list_report(params)
    if state:
        return build_ret(success=state, msg='操作成功', total=total, data=result)
    else:
        return err_ret(msg.ERROR(1, "查询失败!"))
Exemplo n.º 6
0
def admin_product_list():
    params = get_params()
    state, result, total = all_product_service(params)
    if state:
        return build_ret(success=state, msg='操作成功', total=total, data=result)
    else:
        return err_ret(msg.ERROR(1, "查询失败!"))
Exemplo n.º 7
0
def commit_delete():
    state = delete_comment_service(get_params()["id"],
                                   get_user_info()["user_id"])
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "删除失败!"))
Exemplo n.º 8
0
def reply_thumb():
    params = get_params()
    state, result = thumb_reply_service(params)

    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(result)
Exemplo n.º 9
0
def chat_add():
    state = add_chat_service(get_params())
    if state is True:
        return success_ret(msg.SUCCESS)
    elif state == 2:
        return err_ret(msg.ERROR(1, "不能发给自己!"))
    else:
        return err_ret(msg.ERROR(1, "发送失败!"))
Exemplo n.º 10
0
def product_list():
    params = get_params()
    params["user_id"] = get_user_info()["user_id"]
    state, result, total = list_product_service(params)
    if state:
        return build_ret(success=state, msg='操作成功', total=total, data=result)
    else:
        return err_ret(msg.ERROR(1, "查询失败!"))
Exemplo n.º 11
0
def user_modify():
    """
    用户编辑
    :return:
    """
    params = get_params()
    telephone = get_user_info()["telephone"]
    return modify_service(telephone, params)
Exemplo n.º 12
0
def password_modify():
    """
    密码修改
    :return:
    """
    params = get_params()
    telephone = get_user_info()["telephone"]
    return modify_password_service(telephone, params["password"],
                                   params["old_password"])
Exemplo n.º 13
0
def admin_login():
    params = get_params()
    state, token = admin_login_service(params["username"], params["password"])
    if state:
        resp = success_ret(msg.LOGIN_SUCCESS)
        response = make_response(resp)
        response.headers['authorization'] = token
        return response
    else:
        return err_ret(msg.A_LOGIN_ERR)
Exemplo n.º 14
0
def admin_question_modify():
    """
    id:1,
    status:2, 2违规
    :return:
    """
    state = modify_question_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))
Exemplo n.º 15
0
def admin_product_modify():
    """
    "id":465464,
    "status": 2,
    :return:
    """
    state = modify_product_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))
Exemplo n.º 16
0
def login_pretreat():
    """
    登录处理
    :return:state, token
    """
    params = get_params()
    state, result = login_service(params['telephone'])
    if state:
        if result["password"] == params['password']:
            token = en_token(user_id=result["id"],
                             telephone=params['telephone'])
            redis_server.set(redis_pre['token_pix'] + params['telephone'],
                             token)
            return True, token

    return False, None
Exemplo n.º 17
0
def ver_code():
    """
    验证码
    :return:
    """
    params = get_params()
    telephone = params["telephone"]
    code = dict()
    code["code"] = generate_code()
    redis_server.set(redis_pre['register_sms'] + str(telephone), code["code"],
                     60)
    # 阿里大鱼发送验证码
    result = json.loads(send(code["code"], str(telephone)))
    print result
    if result["Code"] == "OK":
        return True
    return False
Exemplo n.º 18
0
def user_register():
    """
    注册
    :return:
    """
    params = get_params()
    telephone = params["telephone"]
    # redis验证码和前端验证码比较
    code = redis_server.get(redis_pre['register_sms'] + str(telephone))
    if code and int(params["code"]) == int(code):
        redis_server.delete(redis_pre['register_sms'] + str(telephone))
        state, result = register(params["telephone"], params["password"])
        if state:
            token = en_token(user_id=result, telephone=params['telephone'])
            redis_server.set(redis_pre['token_pix'] + params['telephone'],
                             token)
            return True, token
        return state, result
    return False, msg.A_CODE_TIMEOUT
Exemplo n.º 19
0
def report_add():
    add_report(get_params())
    return success_ret(msg.SUCCESS)
Exemplo n.º 20
0
def order_deliver():
    state = deliver_order_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))
Exemplo n.º 21
0
def product_detail():
    params = get_params()
    result = detail_product_service(params["id"])

    return build_ret(success=True, msg='操作成功', total=1, data=result)
Exemplo n.º 22
0
def admin_order_modify():
    state = status_order_admin(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))
Exemplo n.º 23
0
def product_delete():
    state = delete_product_service(get_params()["id"])
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "删除失败!"))
Exemplo n.º 24
0
def product_modify():
    state = modify_product_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))
Exemplo n.º 25
0
def admin_carousel_add():
    add_carousel(get_params())
    return success_ret(msg.SUCCESS)
Exemplo n.º 26
0
def admin_carousel_delete():
    delete_carousel(get_params()["id"])
    return success_ret(msg.SUCCESS)
Exemplo n.º 27
0
def reply_add():
    state = add_reply_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "添加失败!"))
Exemplo n.º 28
0
def order_add():
    state = add_order_service(get_params()["items"])
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "添加失败!"))
Exemplo n.º 29
0
def question_modify():
    state = modify_question_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))
Exemplo n.º 30
0
def admin_reply_modify():
    state = report_reply_service(get_params())
    if state:
        return success_ret(msg.SUCCESS)
    else:
        return err_ret(msg.ERROR(1, "修改失败!"))