Commit ef9c3d895d581e8e42acdc3c154ccf604ff7cf65

Authored by 宋庆平
1 parent f8b795fa

x

sdk/Analytics.ts
@@ -85,6 +85,16 @@ export class Analytics { @@ -85,6 +85,16 @@ export class Analytics {
85 clientLog(content, level = LogLevel.debug) { 85 clientLog(content, level = LogLevel.debug) {
86 return WXSDK.stat.clientLog(content, level) 86 return WXSDK.stat.clientLog(content, level)
87 } 87 }
  88 + /**
  89 + * 资源上报
  90 + * @param id 1体力 2经验 3钻石
  91 + * @param typ 1增加 2减少
  92 + * @param nums 增加或减少的数量
  93 + * @param gsne 消耗场景
  94 + */
  95 + consume(id: number, typ: number, nums: number, gsne: string) {
  96 + return WXSDK.stat.consume(id, typ, nums, gsne)
  97 + }
88 98
89 99
90 } 100 }
wxsdk/base/SDKConst.ts
1 // 游戏配置数据 只需要改动这里的配置信息 1 // 游戏配置数据 只需要改动这里的配置信息
2 // 游戏配置数据 只需要改动这里的配置信息 2 // 游戏配置数据 只需要改动这里的配置信息
3 export const GAMEDATA = { 3 export const GAMEDATA = {
4 - game_id: '10001',//游戏id  
5 - channel_id: '10001',//渠道id 暂时和游戏id一致  
6 - version: '1.0.1', //版本号 中台控制正式还是测试服,尽量保持和小游戏版本一致  
7 - appkey: 'd959274a83ea3b95bd1d9b765683eff6',//中台appkey  
8 - interstitialAdId: 'adunit-4bd19de3c351233e',//插屏ID  
9 - bannerId: 'adunit-25341fff11681315',//banner  
10 - gridId: 'adunit-491a39ffc9a330a5',//格子  
11 - customId: 'adunit-193590de82ede6a4',//原生模板单个  
12 - customIds: 'adunit-c905cad189ee8a74',//原生模板多个  
13 - shareMessageToFriend: { // 暂时只支持一个场景值  
14 - scene: 0, //定向分享场景值1-50 配>0的会初始化  
15 - sharekey: 'shareMessageToFriendScene',//定向分享对应后台的分享key  
16 - share_id: 26,//定向分享对应后台的分享key  
17 - },  
18 - default_share: { //默认分享数据在拉取不到中台分享数据的时候用  
19 - content: '全新版本的连连消,等你来玩!',//分享标题 *找运营提供  
20 - icon: 'xxxx',//分享图链接 *找运营提供  
21 - id: '9999',//默认id 写死9999  
22 - key: 'default',//默认分享key 写死default  
23 - title: '默认',//无需修改  
24 - typ: 1,//分享类型 写死1  
25 - videoid: '',//默认的视频广告id 填空就行  
26 - },  
27 - MidasPay: { // 米大师虚拟支付配置 *找运营提供  
28 - OfferId: "9999999999", // 在米大师申请的应用id *找运营提供  
29 - ZoneId: "1", // 分区ID,默认:1  
30 - Mode: "game", // 默认:game  
31 - CurrencyType: "CNY", // 默认:CNY  
32 - Platform: '' // 申请接入时的平台  
33 - }  
34 } 4 }
35 5
36 6
37 // sdk版本 7 // sdk版本
38 -export const SDKVersion = 'v1.0.4'; 8 +export const SDKVersion = 'v1.0.5';
39 // 是否打印 9 // 是否打印
40 export const __LOG__ = false; 10 export const __LOG__ = false;
41 // 是否mock 11 // 是否mock
@@ -88,6 +58,7 @@ export const HostKeys = { @@ -88,6 +58,7 @@ export const HostKeys = {
88 level: 'logstores/level/track', //关卡打点 58 level: 'logstores/level/track', //关卡打点
89 role: 'logstores/role/track', //创建角色 59 role: 'logstores/role/track', //创建角色
90 client_log: 'logstores/client_log/track', //客户端日志 60 client_log: 'logstores/client_log/track', //客户端日志
  61 + consume: 'logstores/consume/track', //资源上报
91 62
92 //登录 63 //登录
93 Login: 'api/login', //登录 64 Login: 'api/login', //登录
@@ -111,7 +82,6 @@ export const HostKeys = { @@ -111,7 +82,6 @@ export const HostKeys = {
111 orderReport: 'api/order/v2/mimas', //订单信息上报 82 orderReport: 'api/order/v2/mimas', //订单信息上报
112 orderQuery: 'api/order/query', //订单信息查询 83 orderQuery: 'api/order/query', //订单信息查询
113 preorder: 'api/order/v2/preorder', //获取支付方式 84 preorder: 'api/order/v2/preorder', //获取支付方式
114 -  
115 }; 85 };
116 86
117 // 本地存储keys 87 // 本地存储keys
wxsdk/http/SDKApi.ts
@@ -66,6 +66,8 @@ export class SDKApi { @@ -66,6 +66,8 @@ export class SDKApi {
66 66
67 public static client_log = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.client_log, ...args); 67 public static client_log = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.client_log, ...args);
68 68
  69 + public static consume = (...args) => SDKHttp.httpGet(DataService.I.DotApi, HostKeys.consume, ...args);
  70 +
69 71
70 // OrderApi 72 // OrderApi
71 public static pay = (...args) => SDKHttp.httpPost(DataService.I.OrderApi, HostKeys.orderReport, ...args); 73 public static pay = (...args) => SDKHttp.httpPost(DataService.I.OrderApi, HostKeys.orderReport, ...args);
wxsdk/service/LogService.ts
@@ -483,7 +483,23 @@ export default class LogService { @@ -483,7 +483,23 @@ export default class LogService {
483 console.log(content); 483 console.log(content);
484 break; 484 break;
485 } 485 }
486 - 486 + }
  487 + /**
  488 + * 资源上报
  489 + * @param id 1体力 2经验 3钻石
  490 + * @param typ 1增加 2减少
  491 + * @param nums 增加或减少的数量
  492 + * @param gsne 消耗场景
  493 + */
  494 + consume(id: number, typ: number, nums: number, gsne: string) {
  495 + let fun = () => SDKApi.consume({
  496 + ...this.buildParams(),
  497 + id,
  498 + typ,
  499 + nums,
  500 + gsne
  501 + })
  502 + this.checkLogin(fun);
487 } 503 }
488 504
489 505