Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dxw_sdk_release
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
JIRA
JIRA
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
open
dxw_sdk_release
Commits
a233380f
提交
a233380f
authored
3月 05, 2020
作者:
王进
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
版本更新:
米大师支付加入pf值 加入用户画像
上级
dad9c9fe
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
23 行增加
和
7 行删除
+23
-7
SDK.ts
SDK.ts
+23
-7
没有找到文件。
SDK.ts
浏览文件 @
a233380f
/**
/**
* 鲸鱼游戏微信小游戏接入库
* 鲸鱼游戏微信小游戏接入库
* @author 推广技术部
* @author 推广技术部
* @time: 20
19-11-14
* @time: 20
20-03-05
*/
*/
class
WechatSDK
{
class
WechatSDK
{
private
sdkVersion
:
string
=
'2.5.
1
'
private
sdkVersion
:
string
=
'2.5.
2
'
public
constructor
()
{
public
constructor
()
{
this
.
sdkInit
();
this
.
sdkInit
();
this
.
timerInit
();
this
.
timerInit
();
...
@@ -33,6 +33,7 @@ class WechatSDK {
...
@@ -33,6 +33,7 @@ class WechatSDK {
_selt
.
ReportParams
.
productCode
=
_selt
.
sdkParams
.
product_code
=
SDKConfig
.
productCode
;
_selt
.
ReportParams
.
productCode
=
_selt
.
sdkParams
.
product_code
=
SDKConfig
.
productCode
;
_selt
.
sdkParams
.
appid
=
SDKConfig
.
appid
;
_selt
.
sdkParams
.
appid
=
SDKConfig
.
appid
;
_selt
.
sdkParams
.
version
=
_selt
.
sdkVersion
;
_selt
.
sdkParams
.
version
=
_selt
.
sdkVersion
;
this
.
getGameLabel
();
const
options
=
_selt
.
getOptionsInfo
();
// 返回参数对象
const
options
=
_selt
.
getOptionsInfo
();
// 返回参数对象
_selt
.
ReportParams
.
from
=
options
.
from
||
0
;
_selt
.
ReportParams
.
from
=
options
.
from
||
0
;
_selt
.
ReportParams
.
tag
=
options
.
tag
||
0
;
_selt
.
ReportParams
.
tag
=
options
.
tag
||
0
;
...
@@ -152,7 +153,9 @@ class WechatSDK {
...
@@ -152,7 +153,9 @@ class WechatSDK {
_selt
.
MidasPaymentParams
.
offerId
=
SDKConfig
.
offerid
;
_selt
.
MidasPaymentParams
.
offerId
=
SDKConfig
.
offerid
;
_selt
.
LoadingOn
();
_selt
.
LoadingOn
();
// 支付前先获取用户订单状态,如果没有未完成订单则继续支付
// 支付前先获取用户订单状态,如果没有未完成订单则继续支付
let
res
=
await
_selt
.
sdkRequest
(
Links
.
order
,
_selt
.
deepCopy
({},
_selt
.
sdkParams
,
Params
)).
catch
(
err
=>
{
let
res
=
await
_selt
.
sdkRequest
(
Links
.
order
,
_selt
.
deepCopy
({
pf
:
_selt
.
MidasPaymentParams
.
platform
},
_selt
.
sdkParams
,
Params
)).
catch
(
err
=>
{
_selt
.
LoadingOff
();
_selt
.
LoadingOff
();
console
.
log
(
"@@SDK异常::payOrder"
,
err
);
console
.
log
(
"@@SDK异常::payOrder"
,
err
);
});
});
...
@@ -351,7 +354,7 @@ class WechatSDK {
...
@@ -351,7 +354,7 @@ class WechatSDK {
env
:
SDKConfig
.
midasPayEnv
,
// 米大师环境
env
:
SDKConfig
.
midasPayEnv
,
// 米大师环境
offerId
:
null
,
// 在米大师侧申请的应用id
offerId
:
null
,
// 在米大师侧申请的应用id
currencyType
:
'CNY'
,
// 币种
currencyType
:
'CNY'
,
// 币种
platform
:
'
android'
,
platform
:
'
'
,
// 客户端平台
buyQuantity
:
10
,
// buyQuantity * 游戏币单价 = 限定的价格等级(1,3,6,8,12,18,25,30,40,45,50,60,68,73,78,88,98,108,118,128,148,168,188,198,328,648)
buyQuantity
:
10
,
// buyQuantity * 游戏币单价 = 限定的价格等级(1,3,6,8,12,18,25,30,40,45,50,60,68,73,78,88,98,108,118,128,148,168,188,198,328,648)
zoneId
:
'1'
,
// 分区ID,默认1
zoneId
:
'1'
,
// 分区ID,默认1
}
}
...
@@ -476,6 +479,7 @@ class WechatSDK {
...
@@ -476,6 +479,7 @@ class WechatSDK {
const
_selt
=
this
const
_selt
=
this
await
(
wx
as
any
).
getSystemInfo
({
await
(
wx
as
any
).
getSystemInfo
({
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
console
.
log
(
res
);
_selt
.
ReportParams
.
model
=
_selt
.
sdkParams
.
equipmentname
=
_selt
.
heartParams
.
info
.
model
=
res
.
model
_selt
.
ReportParams
.
model
=
_selt
.
sdkParams
.
equipmentname
=
_selt
.
heartParams
.
info
.
model
=
res
.
model
_selt
.
ReportParams
.
screenWidth
=
res
.
screenWidth
_selt
.
ReportParams
.
screenWidth
=
res
.
screenWidth
_selt
.
ReportParams
.
screenHeight
=
res
.
screenHeight
_selt
.
ReportParams
.
screenHeight
=
res
.
screenHeight
...
@@ -483,7 +487,8 @@ class WechatSDK {
...
@@ -483,7 +487,8 @@ class WechatSDK {
_selt
.
ReportParams
.
language
=
_selt
.
heartParams
.
language
=
res
.
language
_selt
.
ReportParams
.
language
=
_selt
.
heartParams
.
language
=
res
.
language
_selt
.
ReportParams
.
system
=
_selt
.
sdkParams
.
equipmentos
=
res
.
system
_selt
.
ReportParams
.
system
=
_selt
.
sdkParams
.
equipmentos
=
res
.
system
_selt
.
ReportParams
.
version
=
res
.
version
_selt
.
ReportParams
.
version
=
res
.
version
_selt
.
ReportParams
.
SDKVersion
=
res
.
SDKVersion
_selt
.
ReportParams
.
SDKVersion
=
res
.
sdkVersion
this
.
MidasPaymentParams
.
platform
=
res
.
platform
||
'android'
_selt
.
sdkParams
.
os
=
_selt
.
heartParams
.
osname
=
(
res
.
system
).
split
(
' '
)[
0
].
toLowerCase
()
_selt
.
sdkParams
.
os
=
_selt
.
heartParams
.
osname
=
(
res
.
system
).
split
(
' '
)[
0
].
toLowerCase
()
}
}
})
})
...
@@ -679,8 +684,18 @@ class WechatSDK {
...
@@ -679,8 +684,18 @@ class WechatSDK {
confirmText
:
'确认'
confirmText
:
'确认'
}))
}))
}
}
private
getGameLabel
()
{
const
_selt
=
this
;
try
{
(
wx
as
any
).
getUserGameLabel
({
success
:
function
(
res
)
{
if
(
res
)
_selt
.
ReportParams
.
userGameLabel
=
res
.
label
||
0
;
}
});
}
catch
(
err
)
{
}
}
// 定义wechat方法
// 定义wechat方法
public
async
getUserInfo
():
Promise
<
any
>
{
public
async
getUse
User
rInfo
():
Promise
<
any
>
{
const
_selt
=
this
;
const
_selt
=
this
;
return
new
Promise
(
async
function
(
resolve
,
reject
)
{
return
new
Promise
(
async
function
(
resolve
,
reject
)
{
let
status
=
await
_selt
.
_getSetting
();
let
status
=
await
_selt
.
_getSetting
();
...
@@ -1101,7 +1116,8 @@ class WechatSDK {
...
@@ -1101,7 +1116,8 @@ class WechatSDK {
screenWidth
:
null
,
// 选填,屏幕宽度,微信api获取
screenWidth
:
null
,
// 选填,屏幕宽度,微信api获取
screenHeight
:
null
,
// 选填,屏幕高度,微信api获取
screenHeight
:
null
,
// 选填,屏幕高度,微信api获取
time
:
null
,
// 必填,请求的时间戳(秒)
time
:
null
,
// 必填,请求的时间戳(秒)
sceneId
:
''
// 启动场景值
sceneId
:
''
,
// 启动场景值
userGameLabel
:
''
// 用户画像
}
}
// SDK上报参数
// SDK上报参数
private
sdkParams
=
{
private
sdkParams
=
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论