Example #1
0
def get():
    try:
        if "user_id" in request.args:
            user_id = request.args.get('user_id')
            info = Actions.user_info({"id": user_id})
        else:
            info = Actions.current_user()
    except Exception as e:
        from App import logger
        logger.exception(e)
        return ResultHandle.fail()
    return ResultHandle.success(data={"info": info})
Example #2
0
def init_all_own():
    from App.PerformanceStatistic.Actions import init_data
    from .Model import User
    lists = User.objects()
    for user in lists:
        init_data(user)
    return ResultHandle.success()
Example #3
0
def dealer_user_lists():
    page = int(request.args.get('page')) or 1
    per_page = int(request.args.get('per_page')) or 1
    account = TokenAction.get_jwt_identity()
    company_id = company_actions.current_cache_dealer_company(
        account=account).get('company_id')
    result = Actions.user_lists(page=int(page),
                                per_page=int(per_page),
                                query={"company": company_id})
    return ResultHandle.response(result)
Example #4
0
def user_lists():
    page = int(request.args.get('page') or 1)
    per_page = int(request.args.get('per_page') or 20)
    query = {}
    if "name" in request.args:
        query["name"] = request.args.get('name')
    if "phone_num" in request.args:
        query["phone_num"] = request.args.get('phone_num')
    result = Actions.user_lists(page=int(page),
                                per_page=int(per_page),
                                query=query)
    return ResultHandle.response(result)
Example #5
0
def user_lists():
    page = request.args.get('page') or 1
    per_page = request.args.get('per_page') or 20
    is_filter_self = request.args.get('is_filter_self') or 0
    is_filter_self = int(is_filter_self)
    filter_users = []
    if is_filter_self == 1:
        filter_users = [Actions.current_user_id()]
    company_id = company_actions.current_company_id()
    result = Actions.user_lists(query={"company": company_id},
                                filter_users=filter_users,
                                page=int(page),
                                per_page=int(per_page))
    return ResultHandle.response(result)
Example #6
0
def delete_user():
    user_id = request.json.get('user_id')
    result = Actions.remove_user(user_id)
    return ResultHandle.response(result)
Example #7
0
def add():
    recvdata = request.json
    result = Actions.add(recvdata)
    return ResultHandle.response(result)
Example #8
0
def update():
    update_body = request.json
    user_id = update_body.pop('user_id')
    result = Actions.update_user(user_id=user_id, update_body=update_body)
    return ResultHandle.response(result)
Example #9
0
def send_message():
    result = action.send_mssage(request.json)
    return result_handle.response(result)
Example #10
0
def send_code():
    result = action.send_verifycode(request.json)
    return result_handle.response(result)