... | @@ -232,7 +232,283 @@ pushSession.getRoomUserCount() |
... | @@ -232,7 +232,283 @@ pushSession.getRoomUserCount() |
|
**注意**<br/>
|
|
**注意**<br/>
|
|
**DWTextureView**初始化,具体参考demo
|
|
**DWTextureView**初始化,具体参考demo
|
|
|
|
|
|
|
|
#### 2.3.16 直播带货:
|
|
|
|
|
|
|
|
使用直播带货需引入组件库
|
|
|
|
|
|
|
|
```groovy
|
|
|
|
api ('com.bokecc.module:pushcommercemodule:1.0.0')
|
|
|
|
api ('com.bokecc:basemodule:1.0.1')
|
|
|
|
```
|
|
|
|
需要在应用启动后初始化组件
|
|
|
|
|
|
|
|
```java
|
|
|
|
//基础库初始化
|
|
|
|
InteractSDK.getInstance().init(LoginActivity.this.getApplicationContext());
|
|
|
|
//直播带货组件初始化
|
|
|
|
PushCommerceInteractSDK.getInstance().init(LoginActivity.this.getApplicationContext());
|
|
|
|
```
|
|
|
|
|
|
|
|
##### 2.3.16.1 判断直播带货开关
|
|
|
|
|
|
|
|
```
|
|
|
|
DWPushSession.getInstance().isOpenCommodity()
|
|
|
|
```
|
|
|
|
##### 2.3.16.2 获取互动组件token
|
|
|
|
```
|
|
|
|
DWPushSession.getInstance().getInteractiveToken(new BaseCallback<String>(){
|
|
|
|
@Override
|
|
|
|
public void onError(String error) {
|
|
|
|
}
|
|
|
|
@Override
|
|
|
|
public void onSuccess(String msg) {
|
|
|
|
}
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
##### 2.3.16.3 提供了默认界面样式 可直接使用
|
|
|
|
|
|
|
|
```xml
|
|
|
|
......
|
|
|
|
<com.bokecc.pushcommercelib.view.DefaultCommodityView
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="435dp"
|
|
|
|
android:layout_alignParentBottom="true"
|
|
|
|
android:background="#ffffff"
|
|
|
|
android:visibility="gone"
|
|
|
|
android:id="@+id/commodity_view"
|
|
|
|
/>
|
|
|
|
......
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
//初始化
|
|
|
|
mCommerdityView.initialize(token, new CommerceUiListener() {
|
|
|
|
@Override
|
|
|
|
public void onClose() {
|
|
|
|
//隐藏
|
|
|
|
}
|
|
|
|
});
|
|
|
|
```
|
|
|
|
##### 2.3.16.4 如果需要自定义界面,可参照该文档
|
|
|
|
|
|
|
|
```java
|
|
|
|
//创建管理器
|
|
|
|
LiveCommerceManager commerceManager = new LiveCommerceManagerImpl();
|
|
|
|
//初始化监听
|
|
|
|
commerceManager.init(LiveCommerceListener liveCommerceListener);
|
|
|
|
//设置token
|
|
|
|
commerceManager.setToken(String interactToken);
|
|
|
|
```
|
|
|
|
|
|
|
|
其他api说明
|
|
|
|
|
|
|
|
```
|
|
|
|
public interface LiveCommerceManager {
|
|
|
|
/**
|
|
|
|
* 初始化
|
|
|
|
* @param liveCommerceListener
|
|
|
|
*/
|
|
|
|
void init(LiveCommerceListener liveCommerceListener);
|
|
|
|
/**
|
|
|
|
* 设置token及相关参数
|
|
|
|
* @param interactToken
|
|
|
|
*/
|
|
|
|
void setToken(String interactToken);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取商品列表
|
|
|
|
*/
|
|
|
|
void getCommodityList(int pageNum,int size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 移除商品
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void remove(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 置顶
|
|
|
|
* @param id 商品id
|
|
|
|
*/
|
|
|
|
void stick(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 取消置顶
|
|
|
|
* @param id 商品id
|
|
|
|
*/
|
|
|
|
void unStick(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 推送
|
|
|
|
* @param id 商品id
|
|
|
|
*/
|
|
|
|
void push(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 取消推送
|
|
|
|
* @param id 商品id
|
|
|
|
*/
|
|
|
|
void unPush(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 销毁
|
|
|
|
*/
|
|
|
|
void release();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取导入列表
|
|
|
|
* @param importNum 列表页
|
|
|
|
* @param pageSize 每页数量
|
|
|
|
*/
|
|
|
|
void getImportCommodityList(int importNum, int pageSize);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导入商品
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void importCommodity(long id);
|
|
|
|
```
|
|
|
|
|
|
|
|
```java
|
|
|
|
public interface LiveCommerceListener {
|
|
|
|
/**
|
|
|
|
* 错误
|
|
|
|
* @param code 错误码
|
|
|
|
* @param msg 错误信息
|
|
|
|
*/
|
|
|
|
void onError(int code,String msg);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 商品列表
|
|
|
|
* @param commodityModles
|
|
|
|
* @param total
|
|
|
|
*/
|
|
|
|
void onCommodityList(int total,List<CCCommodityModle> commodityModles);
|
|
|
|
/**
|
|
|
|
* 推送成功
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void onPushSuccess(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 取消推送成功
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void onUnPushSuccess(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 移除成功
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void onRemoveSuccess(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导入成功
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void onImportSuccess(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 置顶成功
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void onStickSuccess(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 取消置顶成功
|
|
|
|
* @param id
|
|
|
|
*/
|
|
|
|
void onUnStickSuccess(long id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导入商品列表
|
|
|
|
* @param totalCount
|
|
|
|
* @param pageCount
|
|
|
|
* @param modles
|
|
|
|
*/
|
|
|
|
void onImportCommodityList(int totalCount, int pageCount, List<CCCommodityManageModle> modles);
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```java
|
|
|
|
public class CCCommodityManageModle {
|
|
|
|
//id
|
|
|
|
private long id;
|
|
|
|
//封面
|
|
|
|
private String cover;
|
|
|
|
//标题
|
|
|
|
private String title;
|
|
|
|
//当前价格 到分
|
|
|
|
private int currentPrice;
|
|
|
|
//原价 到分
|
|
|
|
private int originPrice;
|
|
|
|
//添加时间
|
|
|
|
private long gmtCreate;
|
|
|
|
//是否导入 0未导入 1导入
|
|
|
|
private int bind;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```java
|
|
|
|
public class CCCommodityModle {
|
|
|
|
|
|
|
|
/**商品id*/
|
|
|
|
private long id;
|
|
|
|
/**封面*/
|
|
|
|
private String cover;
|
|
|
|
/**标题*/
|
|
|
|
private String title;
|
|
|
|
/**描述*/
|
|
|
|
private String desc;
|
|
|
|
/***/
|
|
|
|
private String[] tag;
|
|
|
|
/**当前价格*/
|
|
|
|
private int currentPrice;
|
|
|
|
/**原价*/
|
|
|
|
private int originPrice;
|
|
|
|
/**按钮文案*/
|
|
|
|
private String button;
|
|
|
|
/**0-未置顶;1-置顶*/
|
|
|
|
private int top;
|
|
|
|
/**0-未推送;1-推送*/
|
|
|
|
private int push;
|
|
|
|
/**序号*/
|
|
|
|
private int score;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
```java
|
|
|
|
public interface ErrorCode {
|
|
|
|
//获取商品列表失败
|
|
|
|
int GET_COMMONDITY_LIST_ERROR = 1;
|
|
|
|
//api调用频繁
|
|
|
|
int COMMONDITY_OFTEN_ERROR = 2;
|
|
|
|
//移除商品失败
|
|
|
|
int REMOVE_PRODUCTS_ERROR = 3;
|
|
|
|
//取消置顶失败
|
|
|
|
int UNSTICK_PRODUCTS_ERROR = 4;
|
|
|
|
//置顶失败
|
|
|
|
int STICK_PRODUCTS_ERROR = 5;
|
|
|
|
//推送失败
|
|
|
|
int PUSH_PRODUCTS_ERROR = 6;
|
|
|
|
//取消推送失败
|
|
|
|
int UNPUSH_PRODUCTS_ERROR = 7;
|
|
|
|
//获取导入商品列表失败
|
|
|
|
int GET_PRODUCTS_ERROR = 8;
|
|
|
|
//导入商品失败
|
|
|
|
int IMPORT_PRODUCTS_ERROR = 9;
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### 2.4 备注
|
|
### 2.4 备注
|
|
|
|
|
|
必须把DWPushSession与Activity的生命周期进行统一管理,如下
|
|
必须把DWPushSession与Activity的生命周期进行统一管理,如下
|
|
|
|
|
|
```java
|
|
```java
|
... | | ... | |