
/**
 * 策略数据还原
 * @param strategyList 
 */
export const getPullGroupData = (strategyList: any[]) => {
    const nowTime = Date.now()
    return {
        strategyList: strategyList.map(({ taskDetail, ...item }, index) => {
            const id = item.id || nowTime + (index * 1000)
            const nowTime_inherit = Date.now()
            return {
                ...item,
                id,
                groupObjectList: taskDetail.map(({ externalUserFilter, weChatAppid, mpAccountInfo, msgTagDTO, groupName, isRetry, ...go }, i) => {
                    const id = go.id || nowTime_inherit + (index * 1000) + (i * 100)
                    const inherit: { [x: string]: any } = {
                        ...go,
                        isRetry: isRetry || false,
                        id,
                        weChatAppid: mpAccountInfo?.name ? mpAccountInfo?.name + '_' + mpAccountInfo?.id : undefined,
                        tagDTO: msgTagDTO,
                        groupObjectName: groupName
                    }
                    if (externalUserFilter) {
                        inherit.externalUserType = 'specify'
                        const { configName, ...configContent } = externalUserFilter
                        inherit.externalUserFilter = {
                            configName,
                            configContent
                        }
                    } else {
                        inherit.externalUserType = 'all'
                    }
                    return inherit
                })
            }
        })
    }
}