createAd.ts 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. import { request } from 'umi';
  2. import { api } from '../api';
  3. /*====================创建广告======================*/
  4. /**
  5. * 获取商品库列表
  6. */
  7. export interface CreateAdProps {
  8. campaignName: string, // 计划名称
  9. campaignType: string, // 计划类型 CAMPAIGN_TYPE_NORMAL CAMPAIGN_TYPE_SEARCH
  10. promotedObjectType: string, // 推广目标类型
  11. dailyBudget?: number, // 推广计划日预算
  12. totalBudget?: number, // 推广计划总预算
  13. speedMode: string, // 投放速度模式
  14. sysAdgroupId: number, // 广告组ID
  15. pageList: any[],//本地落地页详情入口
  16. adqPageList: any[],//云落地页
  17. sysAdgroup: any,//广告组内容
  18. sysTargetingId: number, // 定向包 id
  19. sysTargeting: any, // 定向包内容
  20. adgroupName: string, // 广告名称
  21. configuredStatus: string, // 广告状态
  22. sysAdcreativeId: number, // 创意ID
  23. taskMediaMaps: any[],//创意内容
  24. beginDate?: string, // 开始日期
  25. firstDayBeginTime?: string, //hh:mm:ss 开始时间
  26. endDate?: string, // 结束日期
  27. bidAmount?: number, // 出价
  28. expandEnabled?: boolean, // 自动扩量
  29. expandTargeting?: string[], // 扩量不可突破定向
  30. materialData?: { label: string, name: string, restriction: any, arrayProperty?: any }[] // 创量模式素材
  31. materials?: any[], // 素材
  32. textData?: any[], // 文案所需参数
  33. texts?: any[], // 文案列表
  34. accountCreateLogs: {
  35. adAccountId: number, // 媒体账户ID
  36. userActionSets?: {
  37. id: number,
  38. type: string
  39. }[], // 数据源
  40. conversionId?: number, // 广告组 转化Id
  41. productCatalogId?: number, // 商品库ID
  42. productId?: number, // 商品Id
  43. enterpriseWx?: any[] // 企业微信客服组
  44. customAudience?: number[], // 定向人群
  45. excludedCustomAudience?: number[], // 排除人群
  46. pageId?: number, // 腾讯落地页ID
  47. }[],
  48. model: 'cross' | 'corres'
  49. }
  50. export async function createAdBatchApi(data: CreateAdProps) {
  51. return request(api + `/adq/adCreateTask/createAdBatch`, {
  52. method: 'POST',
  53. data
  54. })
  55. }
  56. /**
  57. * 获取商品列表
  58. * @param data
  59. * @returns
  60. */
  61. export async function getGoodsApi(data: number[]) {
  62. return request(api + `/adq/product/allByAccountWithCatalog`, {
  63. method: 'POST',
  64. data,
  65. });
  66. }
  67. /**
  68. * 同步商品库
  69. * @param data
  70. * @returns
  71. */
  72. export async function synGoodsApi(data: number[]) {
  73. return request(api + `/adq/product/syncProductAndCatalogByAdAccountId`, {
  74. method: 'PUT',
  75. data,
  76. });
  77. }
  78. /**
  79. * 获取数据源
  80. * @param data
  81. * @returns
  82. */
  83. export async function getDataSourceApi(data: { accountIds: number[], promotedObjectType?: string }) {
  84. return request(api + `/adq/userActionSets/allByAccount`, {
  85. method: 'POST',
  86. data
  87. })
  88. }
  89. /**
  90. * 同步数据源
  91. * @param data
  92. * @returns
  93. */
  94. export async function sysDataSourceApi(data: number[]) {
  95. return request(api + `/adq/userActionSets/syncByAdAccountId`, {
  96. method: 'PATCH',
  97. data,
  98. });
  99. }
  100. /**
  101. * 获取转化ID
  102. * @param data
  103. * @returns
  104. */
  105. export async function getIdApi(data: number[]) {
  106. return request(api + `/adq/conversions/allByAccount`, {
  107. method: 'POST',
  108. data,
  109. });
  110. }
  111. /**
  112. * 同步转化ID
  113. * @param data
  114. * @returns
  115. */
  116. export async function sysIdApi(data: number[]) {
  117. return request(api + `/adq/conversions/syncByAdAccountId`, {
  118. method: 'PUT',
  119. data
  120. })
  121. }
  122. /**
  123. * 获取人群包
  124. * @param data
  125. * @returns
  126. */
  127. export async function getCrowdPackApi(data: { accountIds: number[], source?: string }) {
  128. return request(api + `/adq/customAudiences/allByAccount`, {
  129. method: 'POST',
  130. data
  131. })
  132. }
  133. /**
  134. * 同步人群包
  135. * @param data
  136. * @returns
  137. */
  138. export async function sysCrowdPackApi(data: number[]) {
  139. return request(api + `/adq/customAudiences/syncByAdAccountId`, {
  140. method: 'PUT',
  141. data
  142. })
  143. }
  144. /**
  145. * 获取客服组
  146. * @param data
  147. * @returns
  148. */
  149. export async function getCropWechatApi(data: number[]) {
  150. return request(api + `/adq/corpWechatCsgroup/allByAccount`, {
  151. method: 'POST',
  152. data
  153. })
  154. }
  155. /**
  156. * 同步客服组
  157. * @param data
  158. * @returns
  159. */
  160. export async function sysCropWechatApi({ accountId, corpId }: { accountId: number, corpId: number }) {
  161. return request(api + `/adq/corpWechatCsgroup/syncByAccount/${accountId}/${corpId}`, {
  162. method: 'POST'
  163. })
  164. }