Exemplo n.º 1
0
def create_operation_log(module,
                         object_id,
                         action_flag,
                         platform,
                         user,
                         change_message,
                         remark=None,
                         extras=None):
    """
    创建操作日志
    :param module: 操作模块
    :param object_id: 对象id
    :param action_flag:  操作类型
    :param platform: 操作平台
    :param user: 操作用户
    :param change_message: 日志信息
    :param remark: 备注
    :param extras: 补充信息 json格式
    :return:
    """
    data = {
        'module': module,
        'key': object_id,
        'action_flag': action_flag,
        'platform': platform,
        'operator': user.id,
        'operator_name': user.username,
        'change_message': change_message,
        'remark': remark,
        'extras': extras
    }
    is_success, _ = send_request(OPERATION_API, None, 'POST', data=data)
    return is_success
Exemplo n.º 2
0
def get_supplier_id(request, company):
    if company:
        token = request.META.get('HTTP_AUTHORIZATION')
        is_success, data = send_request(SUPPLIER_API, token, params={'company': company})
        if is_success:
            return [item['id'] for item in data]
        return []
Exemplo n.º 3
0
def get_creator_id(request, username):
    if username:
        token = request.META.get('HTTP_AUTHORIZATION')
        is_success, data = send_request(OPERATOR_API, token, params={'username': username})
        if is_success:
            return [item['id'] for item in data]
        return []
Exemplo n.º 4
0
def get_goods_stock(request, gnos):
    token = request.META.get('HTTP_AUTHORIZATION')
    is_success, data = send_request(STOCK_API, token, params={'gno_list': gnos})
    if is_success:
        return data
    return {}