Interaction Reception Module
The Interaction Reception Module is primarily used to receive and process various interactive features in the live room, including check-in, card push, conditional lottery, product library, and other modules.
I. Interaction Configuration
1.1 Get Interaction Settings
Used to retrieve the interactive feature information configured in the management backend.
Api Method: getInteractSetting(): InteractSetting
Return Value Description: InteractSetting type, detailed type description as follows
| Property Name | Description | Type |
|---|---|---|
productEnabled |
Product library switch | boolean |
productTrackEnabled |
Product library data reporting switch | boolean |
productLinkJumpTipEnabled |
Product library link redirect prompt switch | boolean |
productHotEffectEnabled |
Hot-selling product effect switch | boolean |
productHotEffectTips |
Hot-selling product effect prompt | ProductHotEffectTips |
Example:
const settingInfo = watchCore.interactReceive.getInteractSetting();
console.log('商品库开关', settingInfo.productEnabled);
1.2 Get Pendant List
Description: Retrieves the list of pendants in the live room, including pendants for welfare lotteries, etc.
Api Method: getPendantList(): Promise<InteractPendantItem[]>
Return Value Description: Pendant list data, Promise<InteractPendantItem[]> type
Example:
const pendantList = await watchCore.interactReceive.getPendantList();
console.log('挂件列表', pendantList);
II. Event Description
2.1 Product Library Click Event
Description: Triggered when a viewer clicks on a product.
Event: InteractReceiveEvents.ProductClick
Callback Parameters: Object object, detailed type description as follows
| Property Name | Description | Type |
|---|---|---|
nickname |
User nickname | string |
name |
Product name | string |
type |
Product type | 'delivery' |
Example:
watchCore.interactReceive.eventEmitter.on(InteractReceiveEvents.ProductClick, (data) => {
toast.info(`${data.nickname}点击了${data.name}`);
});
2.2 Product Library Switch Change Event
Description: Triggered when the product library switch in the management backend is changed.
Event: InteractReceiveEvents.ProductEnabledChange
Callback Parameters: Object object, detailed type description as follows
| Property Name | Description | Type |
|---|---|---|
productEnabled |
Product library switch | boolean |
Example:
watchCore.interactReceive.eventEmitter.on(InteractReceiveEvents.ProductEnabledChange, (data) => {
if (data.productEnabled) {
console.log('商品库打开,显示商品库');
} else {
console.log('商品库关闭,隐藏商品库');
}
});
III. Module List
| Module Name | Function Description |
|---|---|
| Check-in | Handles the check-in functionality in the live room, including retrieving check-in information, performing check-in operations, etc. |
| Card Push | Receives and processes the card push functionality in the live room, including retrieving card information, recording claim status, etc. |
| Conditional Lottery | Provides lottery-related functionality in the live room, including initializing the lottery, retrieving lottery information, participating in the lottery, etc. |
| Product Library | Provides product display and interaction functionality in the live room, including retrieving product lists, product tags, etc. |
