# 活动数据相关

# api域:

const activityServices = kreator.services.activity;

# activityServices.getDShopConfig(param: GetDShopConfigRequest)

获取DShop活动配置信息

# 请求入参

GetDShopConfigRequest类型:

参数 类型 描述 用途
actId string 活动ID 必传参数
pageId string 页面ID 必传参数
dshopStoreId string 请求类型 可选参数。若不传则默认传cookie内的storeId。
source string 页面来源 可选参数,不传则默认使用2.
tempid string 页面uuid 可选参数,不传则默认使用cookie内的tempid。
token string 登录token 可选参数,不传则默认使用当前cookie内的登录token

# 返回值:

HttpResponseOptions 基础请求响应体

activityServices.getDShopConfig({
    storeId: 112,
    platform: 1,
}).then((res) => {
    console.log(res);
});

# activityServices.renderDShopData(RenderDShopRequest)

将DSHOP数据渲染为楼层界面至页面上

# 请求入参

RenderDShopRequest

参数 类型 描述 用途
actStoreInfos Object 活动楼层数据 必传参数,注意DSHOP接口获取的是JSONString,需要手动Parse。
pageData Object 活动页面信息 必传参数,注意DSHOP接口获取的是JSONString,需要手动Parse。

# 返回值:

activityServices.getDShopConfig({
    actId: 65122,
    pageId: 333732,
}).then((res) => {
    const data = res.data;
    activityServices.renderDShopData({
      actStoreInfos: JSON.parse(data.renderData),
      pageData: JSON.parse(data.renderStore),
    });
});

# 注意:

DShop是强制依赖kayak的工程,脱离kayak体系Dshop将无法完成渲染。因此只有基于kayak搭建的工程可以通过该Api完成Dshop活动的注入渲染。

# activityServices.getData4RenderDShop(param: GetDShopConfigRequest & RenderDShopRequest)

获取DShop数据,并直接完成渲染操作。
该Api为getDShopConfig与renderDShopData的组合调用。

# 请求入参

参数 类型 描述 用途
actId string 活动ID 必传参数
pageId string 页面ID 必传参数
dshopStoreId string 请求类型 可选参数。若不传则默认传cookie内的storeId。
source string 页面来源 可选参数,不传则默认使用2.
tempid string 页面uuid 可选参数,不传则默认使用cookie内的tempid。
token string 登录token 可选参数,不传则默认使用当前cookie内的登录token
        activityServices.getData4RenderDShop({
          actId: 65122,
          pageId: 333732,
        });