|
|
|
## 推流直播带货功能接入文档
|
|
|
|
|
|
|
|
[TOC]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 时序图
|
|
|
|
|
|
|
|
![](image/推流直播带货功能时序图.png)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 接入方式
|
|
|
|
|
|
|
|
#### 本地集成
|
|
|
|
|
|
|
|
| 新增依赖库(动态库) | 接入方式 | 签名选择 |
|
|
|
|
| -------------------------------- | ------------------------------------------------------------ | ------------ |
|
|
|
|
| HDSLivePushStoreModule.framework | 下载zip包中 SDK文件夹下 HDSLivePushStoreModule 文件夹下,将framework拖入项目中 | Embed & Sign |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### cocoapods 集成
|
|
|
|
|
|
|
|
| 新增依赖库(动态库) | 接入方式 | 是否必须 |
|
|
|
|
| -------------------------------- | -------------------------------------------------- | -------- |
|
|
|
|
| HDSLivePushStoreModule.framework | 在Podfile文件中添加: pod 'HDSLivePushStoreModule' | 是 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 新增 API
|
|
|
|
|
|
|
|
### ---------------- 前置条件 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 房间互动功能配置信息(代理方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ----------------------------- | ------------ | ---------------------- |
|
|
|
|
| (void)onInteractionConfigure: | 互动功能配置 | HDLiveKit/CCPushUtil.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 房间互动配置
|
|
|
|
/// @param model 配置项
|
|
|
|
- (void)onInteractionConfigure:(HDSInteractionConfigureModel *)model;
|
|
|
|
```
|
|
|
|
|
|
|
|
##### HDSInteractionConfigureModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ----------------- | ---- | -------------------------- | -------------------------- |
|
|
|
|
| isLiveStoreSwitch | BOOL | 直播带货开关 0:关闭 1:开启 | HDLiveKit/PushParameters.h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 获取互动组件Token(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| --------------------------------- | ------------------ | ---------------------- |
|
|
|
|
| (void)getInteractionToken: token: | 获取互动组件 token | HDLiveKit/CCPushUtil.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 获取互动token
|
|
|
|
/// @param closure 操作回调
|
|
|
|
/// @param token interactionTokenBlock token回调 "completeHandler回调中 result == YES ,返回token ,result == NO时返回@""(空字符串) "
|
|
|
|
- (void)getInteractionToken:(completeHandler)closure token:(interactionTokenBlock)token;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 初始化直播带货组件 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 初始化直播带货组件SDK(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------------------------------------- | ------------------ | --------------------------------------------- |
|
|
|
|
| (instancetype)initLivePushStoreFuncWithConfig: closure: | 初始化直播带货功能 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 初始化
|
|
|
|
/// @param config 配置项
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (instancetype)initLivePushStoreFuncWithConfig:(HDSLivePushStoreFuncConfig *)config
|
|
|
|
closure:(completeHandler)closure;
|
|
|
|
```
|
|
|
|
|
|
|
|
##### HDSLiveStoreFuncConfig
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ----- | ------ | ----- | --------------------------------------------------- |
|
|
|
|
| token | String | token | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 获取商品列表 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 获取商品列表(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------------------------------- | ------------ | --------------------------------------------- |
|
|
|
|
| (void)getItemList: pageSize: closure: itemsModel: | 获取商品列表 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 获取商品列表
|
|
|
|
/// @param pageNum 页码 (从 1 开始)
|
|
|
|
/// @param pageSize 每页展示条数
|
|
|
|
/// @param closure 操作回调
|
|
|
|
/// @param itemsClosure 商品列表回调
|
|
|
|
- (void)getItemList:(NSInteger)pageNum
|
|
|
|
pageSize:(NSInteger)pageSize
|
|
|
|
closure:(completeHandler)closure
|
|
|
|
itemsModel:(itemListClosure)itemsClosure;
|
|
|
|
```
|
|
|
|
|
|
|
|
```objc
|
|
|
|
typedef void (^itemListClosure)(HDSItemListModel *model);
|
|
|
|
```
|
|
|
|
|
|
|
|
##### HDSItemListModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ---------- | ------------------------------------ | -------- | --------------------------------------------------- |
|
|
|
|
| records | HDSSingleItemModel(Array) | 商品列表 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| pagination | HDSItemPageInformationModel(Model) | 分页信息 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
###### HDSSingleItemModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ------------ | ------- | ------------------- | --------------------------------------------------- |
|
|
|
|
| id | String | 商品id | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| title | String | 商品名称 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| cover | String | 商品图片 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| desc | String | 商品描述 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| tags | Array | 商品标签 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| originPrice | Double | 商品原价(单位:分) | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| currentPrice | Double | 商品现价(单位:分) | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| buttonTitle | String | 按钮文案 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| top | Bool | 是否置顶 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| push | Bool | 是否推送 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| score | Integer | 商品序号 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
###### HDSItemPageInformationModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ---------- | ------- | ------------------ | --------------------------------------------------- |
|
|
|
|
| pageNo | Integer | 当前页 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| pageSize | Integer | 每页显示的数据条数 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| totalCount | Integer | 商品总数 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| pageCount | Integer | 总页码 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 获取导入商品列表 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 获取导入商品列表 (主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------------------------------------------ | ---------------- | --------------------------------------------- |
|
|
|
|
| (void)getImportItemList: pageSize: closure: importItemsModel: | 获取导入商品列表 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 获取导入商品列表
|
|
|
|
/// @param pageNum 页码 (从 1 开始)
|
|
|
|
/// @param pageSize 每页展示条数
|
|
|
|
/// @param closure 操作回调
|
|
|
|
/// @param importItemsClosure 商品列表回调
|
|
|
|
- (void)getImportItemList:(NSInteger)pageNum
|
|
|
|
pageSize:(NSInteger)pageSize
|
|
|
|
closure:(completeHandler)closure
|
|
|
|
importItemsModel:(importItemListClosure)importItemsClosure;
|
|
|
|
```
|
|
|
|
|
|
|
|
```objc
|
|
|
|
typedef void (^importItemListClosure)(HDSImportItemListModel *model);
|
|
|
|
```
|
|
|
|
|
|
|
|
##### HDSImportItemListModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ---------- | ------------------------------------ | -------- | --------------------------------------------------- |
|
|
|
|
| records | HDSImportSingleItemModel(Array) | 商品列表 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| pagination | HDSItemPageInformationModel(Model) | 分页信息 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
###### HDSImportSingleItemModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ------------ | ------- | ---------------------------- | --------------------------------------------------- |
|
|
|
|
| id | String | 商品id | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| title | String | 商品名称 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| cover | String | 商品图片 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| originPrice | Double | 商品原价(单位:分) | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| currentPrice | Double | 商品现价(单位:分) | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| gmtCreate | Integer | 添加时间 (ms) | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| bind | Integer | 导入标记:0-未导入;1-已导入 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
###### HDSItemPageInformationModel
|
|
|
|
|
|
|
|
| 参数 | 类型 | 注释 | 所在类文件 |
|
|
|
|
| ---------- | ------- | ------------------ | --------------------------------------------------- |
|
|
|
|
| pageNo | Integer | 当前页 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| pageSize | Integer | 每页显示的数据条数 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| totalCount | Integer | 商品总数 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
| pageCount | Integer | 总页码 | HDSLivePushStoreModule/HDSLivePushStoreFuncConfig.h |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 导入商品 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 导入商品(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| -------------------------- | -------- | --------------------------------------------- |
|
|
|
|
| (void)importItem: closure: | 导入商品 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 导入商品
|
|
|
|
/// @param itemId 商品ID
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (void)importItem:(NSString *)itemId closure:(completeHandler)closure;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 删除商品 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 删除商品(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| -------------------------- | -------- | --------------------------------------------- |
|
|
|
|
| (void)removeItem: closure: | 删除商品 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 移除商品
|
|
|
|
/// @param itemId 商品ID
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (void)removeItem:(NSString *)itemId closure:(completeHandler)closure;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 推送商品 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 推送商品(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------ | -------- | --------------------------------------------- |
|
|
|
|
| (void)pushItem: closure: | 推送商品 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 推送商品
|
|
|
|
/// @param itemId 商品ID
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (void)pushItem:(NSString *)itemId closure:(completeHandler)closure;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 取消推送 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 取消推送(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------------ | -------- | --------------------------------------------- |
|
|
|
|
| (void)cancelPushItem: closure: | 取消推送 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 取消推送
|
|
|
|
/// @param itemId 商品ID
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (void)cancelPushItem:(NSString *)itemId closure:(completeHandler)closure;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 置顶商品 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 置顶商品(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------- | -------- | --------------------------------------------- |
|
|
|
|
| (void)toTopItem: closure: | 置顶商品 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 置顶商品
|
|
|
|
/// @param itemId 商品ID
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (void)toTopItem:(NSString *)itemId closure:(completeHandler)closure;
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### ---------------- 取消置顶 ----------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### 取消置顶(主动方法)
|
|
|
|
|
|
|
|
| 方法 | 注释 | 所在类文件 |
|
|
|
|
| ------------------------------- | -------- | --------------------------------------------- |
|
|
|
|
| (void)cancelToTopItem: closure: | 取消置顶 | HDSLivePushStoreModule/HDSLivePushStoreFunc.h |
|
|
|
|
|
|
|
|
示例代码
|
|
|
|
|
|
|
|
```objc
|
|
|
|
/// 取消置顶
|
|
|
|
/// @param itemId 商品ID
|
|
|
|
/// @param closure 操作回调
|
|
|
|
- (void)cancelToTopItem:(NSString *)itemId closure:(completeHandler)closure;
|
|
|
|
``` |