MENU navbar-image

Introduction

Owl Admin API 接口文档

欢迎使用 Owl Admin API 接口文档。

该文档提供了所有可用的API接口信息。

Authenticating requests

To authenticate requests, include an Authorization header with the value "Bearer 171|4wDLRqkRn3A5mQm3b5l9gelKO8BijUZKZrgVugt544296a98".

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

通过登录接口获取 token,格式为 Bearer {token}

更新API文档的认证Token

requires authentication

通过手机号获取验证码并登录,然后更新API文档的认证Token

Example request:
const url = new URL(
    "http://127.0.0.1/api/scribe/update-token/13800138000"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/scribe/update-token/13800138000" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "Token更新成功",
    "data": {
        "token": "your_new_token_here"
    }
}
 

Request      

GET api/scribe/update-token/{mobile}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

mobile   string   

手机号码. Example: 13800138000

用户端-地址管理

用户地址相关的API接口

获取默认地址2

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/address/default"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/address/default" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "success",
    "data": {
        "id": 1,
        "user_id": 1,
        "name": "张三",
        "phone": "13800138000",
        "province": "广东省",
        "city": "深圳市",
        "district": "南山区",
        "address": "科技园",
        "is_default": 1,
        "created_at": "2024-01-01 00:00:00",
        "updated_at": "2024-01-01 00:00:00"
    }
}
 

Request      

GET api/address/default

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

添加地址

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/address"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "phone": "13800138000",
    "province": "广东省",
    "city": "深圳市",
    "district": "南山区",
    "longitude": "113.93041",
    "latitude": "22.53332",
    "area_code": "440305",
    "is_default": true,
    "location": "科技园",
    "detail": "科技园南区"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/address" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"phone\": \"13800138000\",
    \"province\": \"广东省\",
    \"city\": \"深圳市\",
    \"district\": \"南山区\",
    \"longitude\": \"113.93041\",
    \"latitude\": \"22.53332\",
    \"area_code\": \"440305\",
    \"is_default\": true,
    \"location\": \"科技园\",
    \"detail\": \"科技园南区\"
}"

Example response (200):


{
    "code": 200,
    "message": "添加成功"
}
 

Request      

POST api/address

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

phone   string   

手机号 Example: 13800138000

province   string   

省份 Example: 广东省

city   string   

城市 Example: 深圳市

district   string   

区县 Example: 南山区

longitude   string   

经度 Example: 113.93041

latitude   string   

纬度 Example: 22.53332

area_code   string   

区划代码 Example: 440305

is_default   boolean   

是否默认地址 Example: true

location   string   

定位地址 Example: 科技园

detail   string   

详细地址 Example: 科技园南区

修改地址

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/address/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "phone": "13800138000",
    "province": "广东省",
    "city": "深圳市",
    "district": "南山区",
    "longitude": "113.93041",
    "latitude": "22.53332",
    "area_code": "440305",
    "is_default": true,
    "location": "科技园",
    "detail": "科技园南区"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "http://127.0.0.1/api/address/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"phone\": \"13800138000\",
    \"province\": \"广东省\",
    \"city\": \"深圳市\",
    \"district\": \"南山区\",
    \"longitude\": \"113.93041\",
    \"latitude\": \"22.53332\",
    \"area_code\": \"440305\",
    \"is_default\": true,
    \"location\": \"科技园\",
    \"detail\": \"科技园南区\"
}"

Example response (200):


{
    "code": 200,
    "message": "修改成功"
}
 

Request      

PUT api/address/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

URL Parameters

id   integer   

地址ID Example: 1

Body Parameters

phone   string   

手机号 Example: 13800138000

province   string   

省份 Example: 广东省

city   string   

城市 Example: 深圳市

district   string   

区县 Example: 南山区

longitude   string   

经度 Example: 113.93041

latitude   string   

纬度 Example: 22.53332

area_code   string   

区划代码 Example: 440305

is_default   boolean   

是否默认地址 Example: true

location   string   

定位地址 Example: 科技园

detail   string   

详细地址 Example: 科技园南区

删除地址

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/address/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "http://127.0.0.1/api/address/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "删除成功"
}
 

Request      

DELETE api/address/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

id   integer   

地址ID Example: 1

设置默认地址

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/address/1/default"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "PUT",
    headers,
}).then(response => response.json());
curl --request PUT \
    "http://127.0.0.1/api/address/1/default" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "设置成功"
}
 

Request      

PUT api/address/{id}/default

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

id   integer   

地址ID Example: 1

用户端-技师定位管理

技师定位相关的API接口

获取定位列表

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/coach/location"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/coach/location" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": [
        {
            "id": 1,
            "type": "home",
            "latitude": 34.0522,
            "longitude": -118.2437,
            "city": "Los Angeles",
            "district": "Downtown",
            "location": "123 Main St",
            "area_code": "90001"
        }
    ]
}
 

Request      

GET api/coach/location

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

创建定位

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/coach/location"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "type": "home",
    "latitude": 34.0522,
    "longitude": -118.2437,
    "city": "Los Angeles",
    "district": "Downtown",
    "location": "123 Main St",
    "area_code": "90001"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/coach/location" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"type\": \"home\",
    \"latitude\": 34.0522,
    \"longitude\": -118.2437,
    \"city\": \"Los Angeles\",
    \"district\": \"Downtown\",
    \"location\": \"123 Main St\",
    \"area_code\": \"90001\"
}"

Example response (200):


{
    "code": 200,
    "message": "创建成功",
    "data": {
        "id": 1,
        "type": "home",
        "latitude": 34.0522,
        "longitude": -118.2437,
        "city": "Los Angeles",
        "district": "Downtown",
        "location": "123 Main St",
        "area_code": "90001"
    }
}
 

Request      

POST api/coach/location

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

type   string   

类型. Example: home

latitude   number   

纬度. Example: 34.0522

longitude   number   

经度. Example: -118.2437

city   string   

市. Example: Los Angeles

district   string   

区. Example: Downtown

location   string   

详细地址. Example: 123 Main St

area_code   string   

区域编码. Example: 90001

删除定位

requires authentication

Example request:
const url = new URL(
    "http://127.0.0.1/api/coach/location/quis"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "coach_id": 1,
    "type": "home"
};

fetch(url, {
    method: "DELETE",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request DELETE \
    "http://127.0.0.1/api/coach/location/quis" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"coach_id\": 1,
    \"type\": \"home\"
}"

Example response (200):


{
    "code": 200,
    "message": "删除成功",
    "data": null
}
 

Request      

DELETE api/coach/location/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

URL Parameters

id   string   

The ID of the location. Example: quis

Body Parameters

coach_id   integer   

技师ID. Example: 1

type   string   

类型. Example: home

用户端-技师管理

技师相关的API接口

获取技师列表

requires authentication

根据经纬度获取技师列表

Example request:
const url = new URL(
    "http://127.0.0.1/api/coach"
);

const params = {
    "latitude": "34.0522",
    "longitude": "-118.2437",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/coach?latitude=34.0522&longitude=-118.2437" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": [
        {
            "id": 1,
            "name": "技师A",
            "latitude": 34.0522,
            "longitude": -118.2437
        }
    ]
}
 

Request      

GET api/coach

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Query Parameters

latitude   number   

纬度. Example: 34.0522

longitude   number   

经度. Example: -118.2437

获取技师详情

requires authentication

根据ID获取技师的详细信息

Example request:
const url = new URL(
    "http://127.0.0.1/api/coach/1"
);

const params = {
    "latitude": "34.0522",
    "longitude": "-118.2437",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/coach/1?latitude=34.0522&longitude=-118.2437" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": {
        "id": 1,
        "name": "技师A",
        "latitude": 34.0522,
        "longitude": -118.2437,
        "details": "详细信息"
    }
}
 

Request      

GET api/coach/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

id   integer   

技师ID. Example: 1

Query Parameters

latitude   number  optional  

纬度. Example: 34.0522

longitude   number  optional  

经度. Example: -118.2437

用户端-用户管理

用户相关的API接口

获取用户信息

requires authentication

获取当前用户的信息

Example request:
const url = new URL(
    "http://127.0.0.1/api/user"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/user" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": {
        "id": 1,
        "mobile": "13800138000",
        "nickname": "用户昵称"
    }
}
 

Request      

GET api/user

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

修改用户信息

requires authentication

修改当前用户的信息

Example request:
const url = new URL(
    "http://127.0.0.1/api/user"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "nickname": "用户昵称",
    "avatar": "https:\/\/example.com\/avatar.jpg"
};

fetch(url, {
    method: "PUT",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request PUT \
    "http://127.0.0.1/api/user" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"nickname\": \"用户昵称\",
    \"avatar\": \"https:\\/\\/example.com\\/avatar.jpg\"
}"

Example response (200):


{
    "code": 200,
    "message": "修改成功",
    "data": null
}
 

Request      

PUT api/user

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

nickname   string  optional  

用户昵称. Example: 用户昵称

avatar   string  optional  

用户头像. Example: https://example.com/avatar.jpg

获取用户钱包

requires authentication

获取当前用户的钱包信息

Example request:
const url = new URL(
    "http://127.0.0.1/api/user/wallet"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/user/wallet" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": {
        "balance": 100,
        "freeze": 0
    }
}
 

Request      

GET api/user/wallet

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

用户提现

requires authentication

提现用户的余额

Example request:
const url = new URL(
    "http://127.0.0.1/api/user/withdraw"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "amount": "100.00",
    "type": "wechat",
    "area_code": "330100"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/user/withdraw" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"amount\": \"100.00\",
    \"type\": \"wechat\",
    \"area_code\": \"330100\"
}"

Example response (200):


{
    "code": 200,
    "message": "提现成功",
    "data": null
}
 

Request      

POST api/user/withdraw

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

amount   decimal  optional  

提现金额. Example: 100.00

type   string  optional  

提现方式. Example: wechat

area_code   string  optional  

行政区划代码. Example: 330100

申请成为技师

requires authentication

申请成为技师

Example request:
const url = new URL(
    "http://127.0.0.1/api/user/apply-coach"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "13800138000",
    "gender": "male",
    "work_years": "5",
    "intention_city": "杭州"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/user/apply-coach" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"13800138000\",
    \"gender\": \"male\",
    \"work_years\": \"5\",
    \"intention_city\": \"杭州\"
}"

Example response (200):


{
    "code": 200,
    "message": "申请成功",
    "data": null
}
 

Request      

POST api/user/apply-coach

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

mobile   string  optional  

手机号. Example: 13800138000

gender   string  optional  

性别. Example: male

work_years   string  optional  

工作年限. Example: 5

intention_city   string  optional  

意向城市. Example: 杭州

用户端-订单管理

订单相关的API接口

订单初始化

requires authentication

初始化订单

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/initialize"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "coach_id": 1,
    "area_code": "370602",
    "project_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/orders/initialize" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"coach_id\": 1,
    \"area_code\": \"370602\",
    \"project_id\": 1
}"

Example response (200):


{
    "status": "success",
    "data": {}
}
 

Request      

POST api/orders/initialize

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

coach_id   integer   

技师ID. Example: 1

area_code   string   

区划代码. Example: 370602

project_id   integer   

项目ID. Example: 1

创建订单

requires authentication

创建订单

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/create"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "project_id": 1,
    "address_id": 1,
    "coach_id": 6,
    "use_balance": false,
    "service_time": "2024-01-01 10:00:00",
    "order_id": null
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/orders/create" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"project_id\": 1,
    \"address_id\": 1,
    \"coach_id\": 6,
    \"use_balance\": false,
    \"service_time\": \"2024-01-01 10:00:00\",
    \"order_id\": null
}"

Example response (200):


{
    "status": "success",
    "data": {}
}
 

Request      

POST api/orders/create

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

project_id   integer   

项目ID. Example: 1

address_id   integer   

地址ID. Example: 1

coach_id   integer   

技师ID. Example: 6

use_balance   boolean  optional  

使用余额. Example: false

service_time   datetime   

服务时间. Example: 2024-01-01 10:00:00

order_id   integer  optional  

订单ID.

取消订单

requires authentication

取消订单

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/cancel"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "order_id": 123
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/orders/cancel" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"order_id\": 123
}"

Example response (200):


{
    "status": "success",
    "data": {}
}
 

Request      

POST api/orders/cancel

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

order_id   integer   

订单ID. Example: 123

结束订单

requires authentication

结束订单

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/finish"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "order_id": 1
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/orders/finish" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"order_id\": 1
}"

Example response (200):


{
    "status": "success",
    "data": {}
}
 

Request      

POST api/orders/finish

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

order_id   integer   

订单ID. Example: 1

确认技师离开

requires authentication

确认技师离开

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/confirm-leave"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "order_id": 123
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/orders/confirm-leave" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"order_id\": 123
}"

Example response (200):


{
    "status": "success",
    "data": {}
}
 

Request      

POST api/orders/confirm-leave

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

order_id   integer   

订单ID. Example: 123

获取订单列表

requires authentication

获取订单列表

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/list"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/orders/list" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "status": "success",
    "data": []
}
 

Request      

GET api/orders/list

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

获取订单详情

requires authentication

获取订单详情

Example request:
const url = new URL(
    "http://127.0.0.1/api/orders/detail/1"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/orders/detail/1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "status": "success",
    "data": {}
}
 

Request      

GET api/orders/detail/{id}

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

id   string   

订单ID. Example: 1

用户端-项目管理

项目相关的API接口

获取项目列表

requires authentication

根据区域代码获取项目列表

Example request:
const url = new URL(
    "http://127.0.0.1/api/project"
);

const params = {
    "area_code": "330100",
    "project_cate_id": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/project?area_code=330100&project_cate_id=1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "项目名称",
                "description": "项目描述",
                "price": "100.00",
                "duration": 60,
                "category": {
                    "id": 1,
                    "name": "分类名称"
                }
            }
        ],
        "total": 10,
        "per_page": 10
    }
}
 

Request      

GET api/project

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Query Parameters

area_code   string  optional  

区域代码. Example: 330100

project_cate_id   integer  optional  

项目分类ID. Example: 1

获取项目详情

requires authentication

获取指定项目的详细信息

Example request:
const url = new URL(
    "http://127.0.0.1/api/project/1/detail"
);

const params = {
    "area_code": "330100",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/project/1/detail?area_code=330100" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": {
        "id": 1,
        "name": "项目名称",
        "description": "项目描述",
        "price": "100.00",
        "duration": 60,
        "category": {
            "id": 1,
            "name": "分类名称"
        },
        "agent": {
            "id": 1,
            "name": "代理商名称",
            "contact": "联系人",
            "mobile": "13800138000"
        }
    }
}
 

Example response (400):


{
    "code": 400,
    "message": "该区域暂无代理商"
}
 

Example response (404):


{
    "code": 404,
    "message": "项目不存在"
}
 

Request      

GET api/project/{id}/detail

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

URL Parameters

id   integer   

项目ID. Example: 1

Query Parameters

area_code   string   

区域代码. Example: 330100

获取技师项目列表

requires authentication

获取指定技师已开通的项目列表

Example request:
const url = new URL(
    "http://127.0.0.1/api/project/coach-list"
);

const params = {
    "coach_id": "1",
    "area_code": "330100",
    "project_cate_id": "1",
};
Object.keys(params)
    .forEach(key => url.searchParams.append(key, params[key]));

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "GET",
    headers,
}).then(response => response.json());
curl --request GET \
    --get "http://127.0.0.1/api/project/coach-list?coach_id=1&area_code=330100&project_cate_id=1" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "获取成功",
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "项目名称",
                "description": "项目描述",
                "price": "100.00",
                "duration": 60,
                "category": {
                    "id": 1,
                    "name": "分类名称"
                }
            }
        ],
        "total": 10,
        "per_page": 10
    }
}
 

Example response (404):


{
    "code": 404,
    "message": "技师不存在或未通过认证"
}
 

Request      

GET api/project/coach-list

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Query Parameters

coach_id   integer   

技师ID. Example: 1

area_code   string   

区域代码. Example: 330100

project_cate_id   integer  optional  

项目分类ID. Example: 1

账户管理

包含登录、注册、账户管理等基础功能

发送验证码

requires authentication

向指定手机号发送验证码

Example request:
const url = new URL(
    "http://127.0.0.1/api/account/send-code"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "13800138000"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/account/send-code" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"13800138000\"
}"

Example response (200):


{
    "code": 200,
    "message": "验证码发送成功",
    "data": null
}
 

Request      

POST api/account/send-code

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

mobile   string   

手机号码. Example: 13800138000

用户登录

requires authentication

使用手机号和验证码登录账户

Example request:
const url = new URL(
    "http://127.0.0.1/api/account/login"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "mobile": "13800138000",
    "code": "123456"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/account/login" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"mobile\": \"13800138000\",
    \"code\": \"123456\"
}"

Example response (200):


{
    "code": 200,
    "message": "登录成功",
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "user": {
            "id": 1,
            "mobile": "13800138000",
            "nickname": "用户昵称"
        }
    }
}
 

Request      

POST api/account/login

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

mobile   string   

手机号码. Example: 13800138000

code   string   

验证码. Example: 123456

微信登录

requires authentication

使用微信openid登录账户

Example request:
const url = new URL(
    "http://127.0.0.1/api/account/wx-login"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Content-Type": "application/json",
    "Accept": "application/json",
};

let body = {
    "openid": "wx_123456789"
};

fetch(url, {
    method: "POST",
    headers,
    body: JSON.stringify(body),
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/account/wx-login" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}" \
    --header "Content-Type: application/json" \
    --data "{
    \"openid\": \"wx_123456789\"
}"

Example response (200):


{
    "code": 200,
    "message": "登录成功",
    "data": {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
        "user": {
            "id": 1,
            "openid": "wx_123456789",
            "nickname": "微信昵称"
        }
    }
}
 

Request      

POST api/account/wx-login

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

Content-Type      

Example: application/json

Body Parameters

openid   string   

微信openid. Example: wx_123456789

用户退出

requires authentication

退出当前账户登录状态

Example request:
const url = new URL(
    "http://127.0.0.1/api/account/logout"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "POST",
    headers,
}).then(response => response.json());
curl --request POST \
    "http://127.0.0.1/api/account/logout" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "退出成功",
    "data": null
}
 

Request      

POST api/account/logout

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}

用户注销

requires authentication

永久注销当前账户

Example request:
const url = new URL(
    "http://127.0.0.1/api/account"
);

const headers = {
    "Authorization": "Bearer {YOUR_AUTH_KEY}",
    "Accept": "application/json",
};

fetch(url, {
    method: "DELETE",
    headers,
}).then(response => response.json());
curl --request DELETE \
    "http://127.0.0.1/api/account" \
    --header "Authorization: Bearer {YOUR_AUTH_KEY}"

Example response (200):


{
    "code": 200,
    "message": "注销成功",
    "data": null
}
 

Request      

DELETE api/account

Headers

Authorization      

Example: Bearer {YOUR_AUTH_KEY}