Skip to content

Commit b57dd7a

Browse files
committed
update readme, add license
1 parent 4f6e33f commit b57dd7a

File tree

7 files changed

+275
-240
lines changed

7 files changed

+275
-240
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Zhiwei Li
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 7 additions & 240 deletions
Original file line numberDiff line numberDiff line change
@@ -1,247 +1,14 @@
11
# live-server
22

3-
Deploy: fab -H [email protected] deploy
3+
* [live-server](https://github.com/lzwjava/live-server)
4+
* [live-web](https://github.com/lzwjava/live-web)
5+
* [live-mobile-web](https://github.com/lzwjava/live-mobile-web)
46

5-
Install dependencies: composer install, composer update
6-
7-
8-
# Model
9-
10-
## live
11-
12-
```
13-
{
14-
"amount": 100, // 门票,当 needPay = 0 时无作用
15-
"attendanceCount": 1, // 当前参与的人数
16-
"attendanceId": 880, // 报名对应的 ID
17-
"beginTs": "2017-01-16 16:23:18",
18-
"canJoin": true, // 是否能够进入房间,报名之后为 true
19-
"conversationId": "587c82f661ff4b006b5ef3a0", // 聊天用的对话 ID
20-
"coverUrl": "http://obcbndtjd.bkt.clouddn.com/2.pic_hd.jpg", // 封面图
21-
"created": "2017-01-16 16:23:18",
22-
"detail": "\u6211\u662f\u5468\u5b50\u656c\uff0c\u4ee5\u592a\u8d44\u672c\u521b\u59cb\u4eba\u517c", // 主播详情
23-
"endTs": "2017-01-16 16:23:18",
24-
"flvUrl": "http://pili-live-hls.quzhiboapp.com/qulive/QcmSl5MK.flv", // 桌面用的播放地址
25-
"hlsUrl": "http://pili-live-hls.quzhiboapp.com/qulive/QcmSl5MK.m3u8", // 微信网页用的播放地址
26-
"liveId": 2454, // 直播 ID
27-
"maxPeople": 2000, // 最多报名人数,客户端用不上
28-
"needPay": 0, // 是否需要付费
29-
"notice": "", // 房间公告
30-
"owner": { // 主播信息
31-
"avatarUrl": "http://i.quzhiboapp.com/defaultAvatar1.png",
32-
"userId": 5071,
33-
"username": "36702744"
34-
},
35-
"ownerId": 5071,
36-
"planTs": "2017-01-16 17:23:18", // 计划的直播时间
37-
"previewUrl": "",
38-
"realAmount": 100, // 实际的门票价格,可能由于用户分享而较低
39-
"rtmpKey": "QcmSl5MK",
40-
"rtmpUrl": "rtmp://xycdn.quzhiboapp.com/live/QcmSl5MK", // iOS 的直播地址
41-
"shareIcon": 0, // 0 为分享的时候显示主播头像,1 为显示直播封面
42-
"shareId": null,
43-
"speakerIntro": "\u6211\u662f\u609f\u7a7a\uff0c\u70ed\u7231\u65c5\u884c\uff0c\u5c0f", // 主播简介
44-
"status": 10,
45-
"subject": "C++ \u7f16\u7a0b", // 直播标题
46-
"updated": "2017-01-16 16:23:18",
47-
"videoUrl": "http://video-qncdn.quzhiboapp.com/QcmSl5MK.mp4", // 过时字段,不再用
48-
"pushUrl": "rtmp://cheer.quzhiboapp.com/live/cknfu6za" // 推流地址
49-
}
50-
```
51-
52-
在没有报名的时候,将没有 rtmpKey、rtmpUrl、hlsUrl、flvUrl 等字段, canJoin 为 false ,报名之后才有这些字段。
53-
54-
# API
55-
56-
## users/isRegister
57-
58-
根据手机号码判断是否已注册
59-
60-
示例:
61-
62-
curl -X GET http://localhost:3005/users/isRegister map[mobilePhoneNumber:[13274100361]]
63-
64-
response: {"status":"success","result":false,"error":""}
65-
66-
## qrcodes
67-
68-
上传扫描的二维码编号,绑定用户。
69-
70-
示例:
71-
72-
curl -X POST http://localhost:3005/qrcodes map[code:[quzhibo-YFn0NE6UFXUQJonbNVdWTxti1wDpUo3q]]
73-
74-
response: {"status":"success","result":{},"error":""}
75-
76-
## attendances
77-
78-
用 live.needPay 来判断是否需要付费报名。
79-
80-
1)付费报名直播。
81-
82-
示例:
83-
84-
curl -X POST http://localhost:3005/attendances map[liveId:[2452] channel:[alipay_app]]
85-
86-
response:
87-
88-
```
89-
{
90-
"error": "",
91-
"result": "partner=\"2088421737526755\"&service=\"mobile.securitypay.pay\"&notify_url=\"http://api.quzhiboapp.com/rewards/notify\"&_input_charset=\"utf-8\"&it_b_pay=\"30m\"&show_url=\"m.alipay.com\"&total_fee=\"1.00\"&body=\"855919044 \u53c2\u52a0\u76f4\u64ad C++ \u7f16\u7a0b\"&out_trade_no=\"OrVUbkuyR7rab1Fu\"&seller_id=\"[email protected]\"&subject=\"\u53c2\u52a0\u76f4\u64ad\"&payment_type=\"1\"&sign_type=\"RSA\"&sign=\"RmXFHW224ehmvAMBnVtfq6tCxAyiS8MhG9yy63DG8MMiI%2BiD7gfXddDQSz%2Ff7oXx6vaSynlldD85YETCiTN6HyEj51PfYiefPQKFjuT4OL%2BJ4iQYdn3BcUUs8BrSWT8b6dx5TNZpGpexmXo4AP3GmBH%2BSgJuy%2Foqj81Q%2FZUzrVg%3D\"",
92-
"status": "success"
93-
}
94-
```
95-
96-
result 为支付宝需要的 dataString。 直接调用支付宝 SDK 的 [Alipay payOrder:dataString] 即可。
97-
98-
2)免费报名直播
99-
100-
curl -X POST http://localhost:3005/attendances map[liveId:[2454]]
101-
102-
response:
103-
104-
```
105-
{"status":"success","result":{},"error":""}
106-
```
107-
108-
109-
## lives/:liveId
110-
111-
获取 live 详情。
112-
113-
示例:
114-
115-
curl -X GET http://localhost:3005/lives/158 map[]
116-
117-
response:
118-
```
119-
{
120-
"error": "",
121-
"result": {
122-
"amount": 0,
123-
"attendanceCount": 0,
124-
"attendanceId": null, // 是否报名
125-
"beginTs": "2016-09-04 18:33:12",
126-
"canJoin": false, //表示是否可以加入直播间,主播和报名者可以进入
127-
"conversationId": "57cbf868a22b9d006b9e6cf2", // 聊天室 ID
128-
"coverUrl": "",
129-
"detail": "",
130-
"endTs": "2016-09-04 18:33:12",
131-
"liveId": 244,
132-
"maxPeople": 300,
133-
"owner": {
134-
"avatarUrl": "http://obcbndtjd.bkt.clouddn.com/defaultAvatar1.png",
135-
"userId": 637,
136-
"username": "606473635"
137-
},
138-
"ownerId": 637,
139-
"planTs": "2016-09-04 18:33:12",
140-
"status": 1,
141-
"subject": "606473635\u7684\u76f4\u64ad"
142-
},
143-
"status": "success"
144-
}
145-
146-
```
147-
148-
149-
## lives/attended
150-
151-
我报名过的直播
152-
153-
curl -X GET http://localhost:3005/lives/attended map[]
154-
155-
response:
156-
157-
```
158-
{
159-
"error": "",
160-
"result": [
161-
{
162-
"amount": 100,
163-
"attendanceCount": 1,
164-
"attendanceId": 43,
165-
"beginTs": "2016-08-27 16:34:30",
166-
"canJoin": true,
167-
"coverUrl": "http://obcbndtjd.bkt.clouddn.com/2.pic_hd.jpg",
168-
"detail": "\u8fd9\u6b21\u4e3b\u8981\u8bb2\u4e0b\u591a\u5e74\u6765 C++ \u7684\u7f16\u7a0b\u5b9e\u6218",
169-
"endTs": "2016-08-27 16:34:30",
170-
"liveId": 181,
171-
"owner": {
172-
"avatarUrl": "http://obcbndtjd.bkt.clouddn.com/defaultAvatar1.png",
173-
"userId": 546,
174-
"username": "88090"
175-
},
176-
"ownerId": 546,
177-
"planTs": "2016-08-27 17:34:30",
178-
"rtmpKey": "TIiUM1fz",
179-
"rtmpUrl": "rtmp://quzhiboapp.com/live/TIiUM1fz",
180-
"status": 2,
181-
"subject": "C++ \u7f16\u7a0b"
182-
}
183-
],
184-
"status": "success"
185-
}
186-
```
187-
188-
## lives/me
189-
190-
我发起的直播
191-
192-
curl -X GET http://localhost:3005/lives/me map[]
193-
194-
195-
## wechat/bind
196-
197-
绑定微信
198-
199-
curl -X GET http://localhost:3005/wechat/bind map[code:[021mZiQa0Ralxu1L7kNa0RgeQa0mZiQP]]
200-
201-
绑定成功,user 字段中会带有一个 `unionId`
202-
203-
## lives/:liveId/videos
204-
205-
获取直播的回放列表
206-
207-
curl -X GET http://localhost:3005/lives/2456/videos map[]
208-
209-
response:
210-
211-
```
212-
{
213-
"error": "",
214-
"result": [
215-
{
216-
"created": "2017-01-17 04:57:50",
217-
"fileName": "RNo7vjSK",
218-
"liveId": 2456,
219-
"title": "C++ \u7f16\u7a0b",
220-
"updated": "2017-01-17 04:57:50",
221-
"url": "http://video-qncdn.quzhiboapp.com/RNo7vjSK.mp4", // 用这个地址来播放
222-
"videoId": 110
223-
}
224-
],
225-
"status": "success"
226-
}
227-
```
228-
229-
多数直播都是只有一个回放,只有在 《iDev苹果开发者大会》这个直播里有多个回放。暂时忽略多个回放的情况。默认选择第一个回放为回放视频。
230-
231-
## lives/:liveId/notify
232-
233-
发送微信通知
234-
235-
curl -X GET http://localhost:3005/lives/2552/notify
236-
237-
response:
238-
239-
```
240-
{"status":"success","result":{"succeedCount":1,"total":1},"error":""}
241-
```
242-
243-
因为发送用户微信通知还是比较谨慎的,要弹出对话框确认一下,「您已准备好开播,确认发送通知吗?」。接着,因为可能执行发送通知的时间比较长,不用提示用户成功通知的观众数succeedCount,接着提示「正在通知观众们赶来」即可。
7+
![img1](./img/img1.jpg)
2448

9+
![img2](./img/img2.jpg)
24510

11+
![img3](./img/img3.jpg)
24612

13+
![img14](./img/img4.jpg)
24714

0 commit comments

Comments
 (0)