StarApi.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. const Api = require('./Api');
  2. class StarApi {
  3. /**
  4. * 获取所有标注(可以签约的明星)信息
  5. */
  6. static getSignStars(success, fail) {
  7. let url = "/star/getSignStars";
  8. Api.httpGet(this.setRequestBody(url, {}, success, fail));
  9. }
  10. /// 获取所有明星
  11. static getAllStars(success, fail) {
  12. let url = "/star/getAllStars";
  13. Api.httpGet(this.setRequestBody(url, {}, success, fail));
  14. }
  15. /// 购买某个明星
  16. static buyStar(starId, success, fail) {
  17. let url = "/star/buyStar";
  18. let body = {
  19. "starId": starId,
  20. };
  21. Api.httpPost(this.setRequestBody(url, body, success, fail));
  22. }
  23. /// 从房间召回某个明星
  24. static recallStar(starId, success, fail) {
  25. let url = "/star/delStarRoom";
  26. let body = {
  27. "starId": starId,
  28. };
  29. Api.httpPost(this.setRequestBody(url, body, success, fail));
  30. }
  31. /// 把某个明星随机分配到房间
  32. static dispatchStar(starId, success, fail) {
  33. let url = "/star/starRoom";
  34. let body = {
  35. "starId": starId,
  36. };
  37. Api.httpPost(this.setRequestBody(url, body, success, fail));
  38. }
  39. /// 召回全部明星
  40. static recallAllStar(success, fail) {
  41. let url = "/star/delAllStarRoom";
  42. Api.httpPost(this.setRequestBody(url, {}, success, fail));
  43. }
  44. static setRequestBody(url, data, success, fail) {
  45. let requestBody = {
  46. url: url,
  47. data: data,
  48. success: success,
  49. fail: fail,
  50. complete: () => {
  51. }
  52. };
  53. return requestBody;
  54. }
  55. }
  56. module.exports = StarApi;