xsy.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. import request from '@/utils/request'
  2. /**
  3. * 查询销售易账号列表
  4. */
  5. export function listXsyAccount(query) {
  6. return request({
  7. url: '/xsy/account/list',
  8. method: 'get',
  9. params: query
  10. })
  11. }
  12. /**
  13. * 查询销售易账号详情
  14. */
  15. export function getXsyAccount(id) {
  16. return request({
  17. url: '/xsy/account/get/' + id,
  18. method: 'get'
  19. })
  20. }
  21. /**
  22. * 新增销售易账号
  23. */
  24. export function addXsyAccount(data) {
  25. return request({
  26. url: '/xsy/account/add',
  27. method: 'post',
  28. data: data
  29. })
  30. }
  31. /**
  32. * 修改销售易账号
  33. */
  34. export function updateXsyAccount(data) {
  35. return request({
  36. url: '/xsy/account/update',
  37. method: 'post',
  38. data: data
  39. })
  40. }
  41. /**
  42. * 删除销售易账号
  43. */
  44. export function delXsyAccount(id) {
  45. return request({
  46. url: '/xsy/account/delete/' + id,
  47. method: 'post'
  48. })
  49. }
  50. /**
  51. * 启用/禁用销售易账号
  52. */
  53. export function updateXsyAccountStatus(id, status) {
  54. return request({
  55. url: '/xsy/account/status',
  56. method: 'post',
  57. params: {
  58. id: id,
  59. status: status
  60. }
  61. })
  62. }
  63. /**
  64. * 获取授权地址
  65. */
  66. export function getXsyAuthUrl(accountId) {
  67. return request({
  68. url: '/xiaoShouYi/auth/url/' + accountId,
  69. method: 'get'
  70. })
  71. }
  72. /**
  73. * 绑定销售易账号
  74. */
  75. export function bindXsyAccount(data) {
  76. return request({
  77. url: '/xsy/companyBind/bind',
  78. method: 'post',
  79. data: data
  80. })
  81. }
  82. export function unbindXsyAccount(data) {
  83. return request({
  84. url: '/xsy/companyBind/unbind',
  85. method: 'post',
  86. data: data
  87. })
  88. }
  89. /**
  90. * 查询绑定关系
  91. */
  92. export function getXsyBind(companyUserId) {
  93. return request({
  94. url: '/xsy/bind/get',
  95. method: 'get',
  96. params: {
  97. companyUserId: companyUserId
  98. }
  99. })
  100. }
  101. /**
  102. * 获取授权URL(新接口)
  103. */
  104. export function getXsyOauthUrl(accountId) {
  105. return request({
  106. url: '/xiaoShouYi/New/auth/url/' + accountId,
  107. method: 'get'
  108. })
  109. }
  110. /**
  111. * 生成素材追踪链接
  112. */
  113. export function generateXsyLink(companyUserId, data) {
  114. return request({
  115. url: '/xiaoShouYi/New/generateLink',
  116. method: 'post',
  117. params: {
  118. companyUserId: companyUserId
  119. },
  120. data: data
  121. })
  122. }
  123. /**
  124. * 发送确认
  125. */
  126. export function sendXsyConfirm(companyUserId, forwardId, forwardType) {
  127. return request({
  128. url: '/xiaoShouYi/New/sendConfirm',
  129. method: 'post',
  130. params: {
  131. companyUserId: companyUserId,
  132. forwardId: forwardId,
  133. forwardType: forwardType
  134. }
  135. })
  136. }
  137. /**
  138. * 查询素材列表
  139. */
  140. export function queryXsyMaterials(companyUserId, data) {
  141. return request({
  142. url: '/xiaoShouYi/New/materials/query',
  143. method: 'post',
  144. params: {
  145. companyUserId: companyUserId
  146. },
  147. data: data
  148. })
  149. }
  150. /**
  151. * 上传素材文件
  152. */
  153. export function uploadXsyFile(companyUserId, file, isVideo) {
  154. const formData = new FormData()
  155. formData.append('file', file)
  156. formData.append('isVideo', isVideo == null ? false : isVideo)
  157. return request({
  158. url: '/xiaoShouYi/New/uploadFile?companyUserId=' + companyUserId,
  159. method: 'post',
  160. data: formData,
  161. headers: {
  162. 'Content-Type': 'multipart/form-data'
  163. }
  164. })
  165. }
  166. /**
  167. * 创建素材
  168. */
  169. export function createXsyMaterial(companyUserId, data) {
  170. return request({
  171. url: '/xiaoShouYi/New/createMaterial',
  172. method: 'post',
  173. params: {
  174. companyUserId: companyUserId
  175. },
  176. data: data
  177. })
  178. }
  179. /**
  180. * 上传并创建素材
  181. */
  182. export function createXsyMaterialWithUpload(params) {
  183. const formData = new FormData()
  184. formData.append('companyUserId', params.companyUserId)
  185. formData.append('file', params.file)
  186. formData.append('isVideo', params.isVideo == null ? false : params.isVideo)
  187. formData.append('corpName', params.corpName)
  188. formData.append('materialType', params.materialType)
  189. formData.append('categoryName', params.categoryName)
  190. formData.append('title', params.title)
  191. return request({
  192. url: '/xiaoShouYi/New/createMaterialWithUpload',
  193. method: 'post',
  194. data: formData,
  195. headers: {
  196. 'Content-Type': 'multipart/form-data'
  197. }
  198. })
  199. }
  200. /**
  201. * 完整流程:生成链接并发送确认
  202. */
  203. export function fullProcessXsy(companyUserId, data) {
  204. return request({
  205. url: '/xiaoShouYi/New/fullProcess',
  206. method: 'post',
  207. params: {
  208. companyUserId: companyUserId
  209. },
  210. data: data
  211. })
  212. }