ADLog.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import { _decorator, Component, Node } from 'cc';
  2. import { Http } from './core/net/Http';
  3. import { g } from './Data/g';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('ADLog')
  6. export class ADLog extends Component {
  7. @property({ type: Http })
  8. public http: Http;
  9. update() {
  10. if (g.adData.interstitalADShow) {
  11. g.adData.ad_type = 2;
  12. g.adData.interstitalADShow = false;
  13. //视频上报
  14. this.http.send("/api/ad/videoLog", { adData: g.adData });
  15. }
  16. if (g.adData.nativeExpressADShow) {
  17. g.adData.ad_type = 3;
  18. g.adData.nativeExpressADShow = false;
  19. //视频上报
  20. this.http.send("/api/ad/videoLog", { adData: g.adData });
  21. }
  22. if (g.adData.splashADShow) {
  23. g.adData.ad_type = 6;
  24. g.adData.splashADShow = false;
  25. //视频上报
  26. this.http.send("/api/ad/videoLog", { adData: g.adData });
  27. }
  28. if (g.adData.bannerADShow) {
  29. g.adData.ad_type = 7;
  30. g.adData.bannerADShow = false;
  31. //视频上报
  32. this.http.send("/api/ad/videoLog", { adData: g.adData });
  33. }
  34. if (g.adData.fullScreenADComplete) {
  35. g.adData.ad_type = 8;
  36. g.adData.fullScreenADComplete = false;
  37. //视频上报
  38. this.http.send("/api/ad/videoLog", { adData: g.adData });
  39. }
  40. if (g.adData.fullScreenADShow) {
  41. g.adData.ad_type = 9;
  42. g.adData.fullScreenADShow = false;
  43. //视频上报
  44. this.http.send("/api/ad/videoLog", { adData: g.adData });
  45. }
  46. if (g.adData.fullScreenADError) {
  47. g.adData.ad_type = 10;
  48. g.adData.fullScreenADError = false;
  49. //视频上报
  50. this.http.send("/api/ad/videoLog", { adData: g.adData });
  51. }
  52. if (g.adData.interstitalADError) {
  53. g.adData.ad_type = 11;
  54. g.adData.interstitalADError = false;
  55. //视频上报
  56. this.http.send("/api/ad/videoLog", { adData: g.adData });
  57. }
  58. if (g.adData.nativeExpressADError) {
  59. g.adData.ad_type = 12;
  60. g.adData.nativeExpressADError = false;
  61. //视频上报
  62. this.http.send("/api/ad/videoLog", { adData: g.adData });
  63. }
  64. }
  65. }