邀请记录列表

HTTP Request

GET /api/admin/invitations

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述
exhibition_id 展会id
recommend_user_phone 邀请人手机号
user_phone 被邀请人手机号
created_at_gtq 注册时间左边界(>=)
created_at_ltq 注册时间右边界(<=)
approve_status 审批状态
page 页码
per_page 每页的数量
export_format 导出专用参数,不是导出不需传此参数,目前支持: xlsx

返回数据

{
  "code": 0, 
  "message": "success", 
  "remark": "成功", 
  "data": {
    "total_count": 13, 
    "total_pages": 1, 
    "next_page": null, 
    "prev_page": null, 
    "current_page": 1, 
    "per_page": 15, 
    "page": 1, 
    "models": [
      {
        "id": 13, 
        "created_at": "2024-10-09T09:46:19.913+08:00",  // 注册时间
        "approve_status": "applying", // 审批状态
        "approve_description": "xxx", // 审批原因
        "user": { // 被邀请人信息
          "id": 42, 
          "phone": "18229866151",
          "company_name": "18229866151", // 公司名称
          "department": "18229866151", // 部门
          "position": "18229866151", // 职位
          "area": "18229866151", // 地区
        }, 
        "recommend_user": { // 邀请人信息
          "id": 12, 
          "phone": "13918305498"
        }, 
        "exhibition": { // 展会信息
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 12, 
        "created_at": "2024-10-09T09:46:19.909+08:00", 
        "user": {
          "id": 41, 
          "phone": "13761697577"
        }, 
        "recommend_user": {
          "id": 12, 
          "phone": "13918305498"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 11, 
        "created_at": "2024-10-09T09:46:19.904+08:00", 
        "user": {
          "id": 40, 
          "phone": "18516214971"
        }, 
        "recommend_user": {
          "id": 12, 
          "phone": "13918305498"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 10, 
        "created_at": "2024-10-09T09:46:19.900+08:00", 
        "user": {
          "id": 38, 
          "phone": "15512341234"
        }, 
        "recommend_user": {
          "id": 21, 
          "phone": "17737530328"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 9, 
        "created_at": "2024-10-09T09:46:19.897+08:00", 
        "user": {
          "id": 37, 
          "phone": "13526268477"
        }, 
        "recommend_user": {
          "id": 21, 
          "phone": "17737530328"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 8, 
        "created_at": "2024-10-09T09:46:19.893+08:00", 
        "user": {
          "id": 36, 
          "phone": "19900000001"
        }, 
        "recommend_user": {
          "id": 21, 
          "phone": "17737530328"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 7, 
        "created_at": "2024-10-09T09:46:19.885+08:00", 
        "user": {
          "id": 35, 
          "phone": "18679655243"
        }, 
        "recommend_user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 6, 
        "created_at": "2024-10-09T09:46:19.881+08:00", 
        "user": {
          "id": 25, 
          "phone": "18679655711"
        }, 
        "recommend_user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 5, 
        "created_at": "2024-10-09T09:46:19.878+08:00", 
        "user": {
          "id": 30, 
          "phone": "17737530322"
        }, 
        "recommend_user": {
          "id": 28, 
          "phone": "17737530321"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 4, 
        "created_at": "2024-10-09T09:46:19.874+08:00", 
        "user": {
          "id": 34, 
          "phone": "18679655707"
        }, 
        "recommend_user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 3, 
        "created_at": "2024-10-09T09:46:19.870+08:00", 
        "user": {
          "id": 29, 
          "phone": "18679655606"
        }, 
        "recommend_user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 2, 
        "created_at": "2024-10-09T09:46:19.862+08:00", 
        "user": {
          "id": 23, 
          "phone": "18679655703"
        }, 
        "recommend_user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }, 
      {
        "id": 1, 
        "created_at": "2024-10-09T09:46:19.846+08:00", 
        "user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "recommend_user": {
          "id": 2, 
          "phone": "18679655704"
        }, 
        "exhibition": {
          "id": 41296, 
          "name": "物联传媒测试"
        }
      }
    ]
  }
}

导出返回数据

// 成功
{
    "code": 0,
    "message": "success",
    "remark": "导出任务已经加入队列,请耐心等待",
    "data": {
        "uuid": "2b44ca0c-5a69-49aa-8c2d-811a38107cf5"
    }
}

// 失败
{
    "code": 401,
    "message": "你没有应用导出的权限",
    "remark": "你没有应用导出的权限",
    "error": "errors/unauthorized_error"
}

{
    "code": -1,
    "message": "failure",
    "remark": "当前用户已经有导出任务排队或执行,请稍后再试",
    "error": "standard_error"
}

{
    "code": -1,
    "message": "failure",
    "remark": "该用户已经超过当日导出最大次数50,当前任务不允许执行",
    "error": "standard_error"
}

导出websocket channel subscribe

function withFayeClient(callback) {
  var init_faye = function () {
    if(!window.initFaye) {
      window.initFaye = $.ajax({
        url: 'https://faye-dev.ikcrm.com/faye/client.js',
        cache: true,
        dataType: "script"
      }).done(function() {
        window.fayeClient = new Faye.Client("https://faye-dev.ikcrm.com/faye");
      });
    }

    window.initFaye.done(callback);
  }

  setTimeout(init_faye, 400);
}


_function = function() {
  console.log('subscribeAsyncToFaye: ' + new Date())

  var channel = "/export/1" // 这里的channel取值为全局变量里的export_channel
  window.fayeClient.subscribe(channel, function(data) {
    // 这里的 data是后端导出任务实时推送的进度数据
    console.log("======.",data)
  })
}

withFayeClient(_function.bind(this))

后端导出任务实时推送的进度数据的几种格式

 // 1. 准备开始
 {
    "status": "starting",
    "file_url": null,
    "progress": 1,
    "service": "Exports::ApplyExhibitionStand",
    "uuid": "0e659a8b-7a0b-4190-bbe9-89ccf95733de",
    "count": null,
    "file_size": null
  }

  // 2. 开始
  {
    "status": "start",
    "file_url": null,
    "progress": 3,
    "service": "Exports::ApplyExhibitionStand",
    "uuid": "0e659a8b-7a0b-4190-bbe9-89ccf95733de",
    "count": 6,
    "file_size": null
 }

 // 3. 写入数据到文件
  {
    "status": "writing_file",
    "file_url": null,
    "progress": 73,
    "service": "Exports::ApplyExhibitionStand",
    "uuid": "0e659a8b-7a0b-4190-bbe9-89ccf95733de",
    "count": 6,
    "file_size": null
  }

  // 4.1. 上传写入完成的文件到七牛
  {
    "status": "before_upload",
    "file_url": null,
    "progress": 73,
    "service": "Exports::ApplyExhibitionStand",
    "uuid": "0e659a8b-7a0b-4190-bbe9-89ccf95733de",
    "count": 6,
    "file_size": 4202
  }

  // 4.2. 上传写入完成的文件到七牛失败
  {
    "status": "upload_failure",
    "file_url": null,
    "progress": 73,
    "service": "Exports::ApplyExhibitionStand",
    "uuid": "0e659a8b-7a0b-4190-bbe9-89ccf95733de",
    "count": 6,
    "file_size": 4202
  }

  // 5. 导出任务完成
  {
    "status": "success",
    "file_url": "http://apaas-dev.weiwenjia.com/export/1693363081_0e659a8b-7a0b-4190-bbe9-89ccf95733de.xlsx",
    "progress": 100,
    "service": "Exports::ApplyExhibitionStand",
    "uuid": "0e659a8b-7a0b-4190-bbe9-89ccf95733de",
    "count": 6,
    "file_size": 4202
 }

审批通过

HTTP Request

PUT /api/admin/invitations/:id/approve

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

Body Parameters

字段名 是否必填 描述
approve_description 通过原因

请求正文

{
    "approve_description": "xxxxx"
}

返回数据

{
  "code": 0, 
  "message": "success", 
  "remark": "成功", 
  "data": {
    "id": 13, 
    "created_at": "2024-10-09T09:46:19.913+08:00",  // 注册时间
    "approve_status": "applying", // 审批状态
    "approve_description": "xxx", // 审批原因
    "user": { // 被邀请人信息
      "id": 42, 
      "phone": "18229866151",
      "company_name": "18229866151", // 公司名称
      "department": "18229866151", // 部门
      "position": "18229866151", // 职位
      "area": "18229866151", // 地区
    }, 
    "recommend_user": { // 邀请人信息
      "id": 12, 
      "phone": "13918305498"
    }, 
    "exhibition": { // 展会信息
      "id": 41296, 
      "name": "物联传媒测试"
    }
  }
}

审批否决

HTTP Request

PUT /api/admin/invitations/:id/reject

HEADERS

字段名 是否必填 描述
ACCESS-TOKEN true 授权token(aPaas提供)

URL Parameters

字段名 必填 描述

Body Parameters

字段名 是否必填 描述
approve_description 否决原因

请求正文

{
    "approve_description": "xxxxx"
}

返回数据

{
  "code": 0, 
  "message": "success", 
  "remark": "成功", 
  "data": {
    "id": 13, 
    "created_at": "2024-10-09T09:46:19.913+08:00",  // 注册时间
    "approve_status": "applying", // 审批状态
    "approve_description": "xxx", // 审批原因
    "user": { // 被邀请人信息
      "id": 42, 
      "phone": "18229866151",
      "company_name": "18229866151", // 公司名称
      "department": "18229866151", // 部门
      "position": "18229866151", // 职位
      "area": "18229866151", // 地区
    }, 
    "recommend_user": { // 邀请人信息
      "id": 12, 
      "phone": "13918305498"
    }, 
    "exhibition": { // 展会信息
      "id": 41296, 
      "name": "物联传媒测试"
    }
  }
}
文档更新时间: 2025-06-09 13:59   作者:李辉