Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
weixin_sdk_release
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
JIRA
JIRA
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
open
weixin_sdk_release
Commits
8c4fe5d5
提交
8c4fe5d5
authored
7月 28, 2022
作者:
wangjin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加视频广告接口
上级
2e950f5f
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
48 行增加
和
4 行删除
+48
-4
SDK.ts
SDK.ts
+48
-4
没有找到文件。
SDK.ts
浏览文件 @
8c4fe5d5
/**
/**
* 鲸鱼游戏微信小游戏接入库
* 鲸鱼游戏微信小游戏接入库
* @author 推广技术部
* @author 推广技术部
* @time: 2022-0
6-27
* @time: 2022-0
7-28
*
*
* 登录接口返回session_key改为login_code
* 登录接口返回session_key改为login_code
*
*
*/
*/
class
WechatSDK
{
class
WechatSDK
{
private
sdkVersion
:
string
=
"3.
0.9
"
;
private
sdkVersion
:
string
=
"3.
1
"
;
public
LaunchOptions
:
Object
;
// 启动参数对象
public
LaunchOptions
:
Object
;
// 启动参数对象
public
SystemInfo
:
Object
;
// 设备信息
public
SystemInfo
:
Object
;
// 设备信息
...
@@ -76,6 +76,7 @@ class WechatSDK {
...
@@ -76,6 +76,7 @@ class WechatSDK {
private
sdkActive
=
async
()
=>
{
private
sdkActive
=
async
()
=>
{
const
{
data
}
=
await
this
.
sdkRequest
(
Links
.
active
,
{
...
this
.
SDKCOMMDATA
,
...
this
.
LoginData
});
const
{
data
}
=
await
this
.
sdkRequest
(
Links
.
active
,
{
...
this
.
SDKCOMMDATA
,
...
this
.
LoginData
});
this
.
LoginData
[
"pay_channel"
]
=
data
.
default_pay_channel
;
this
.
LoginData
[
"pay_channel"
]
=
data
.
default_pay_channel
;
this
.
LoginData
[
"ad_unit_id"
]
=
data
.
ad_unit_id
;
this
.
ActiReport
();
// 上报激活
this
.
ActiReport
();
// 上报激活
return
this
.
sdkLogin
();
return
this
.
sdkLogin
();
};
};
...
@@ -784,8 +785,37 @@ class WechatSDK {
...
@@ -784,8 +785,37 @@ class WechatSDK {
"1000"
:
"参数错误"
,
"1000"
:
"参数错误"
,
"1003"
:
"米大师Portal错误"
,
"1003"
:
"米大师Portal错误"
,
};
};
// 创建视频广告
private
wxVideoAdReward
:
any
=
null
;
// 微信视频广告对象
// 初始化激励视频
public
createWxVideoAd
=
async
(
wxVideoAdParams
?:
wxVideoAd
)
=>
{
this
.
wxVideoAdReward
=
await
(
wx
as
any
).
createRewardedVideoAd
({
adUnitId
:
this
.
LoginData
[
"ad_unit_id"
],
// mp后台配置的广告id
});
this
.
wxVideoAdReward
.
onError
(
err
=>
{
console
.
log
(
'微信激励广告视频播放失败:'
,
err
);
wxVideoAdParams
&&
wxVideoAdParams
.
onError
(
err
);
});
};
public
playAdVideo
=
async
(
Params
:
ProductInfo
,
callback
?:
Function
,
retry
:
number
=
0
)
=>
{
if
(
retry
>
2
)
{
callback
({
status
:
false
});
return
;
}
this
.
wxVideoAdReward
.
load
()
.
then
(()
=>
{
this
.
wxVideoAdReward
.
show
()
.
then
(()
=>
{
console
.
log
(
'微信激励广告视频播放成功'
);
this
.
CustomReport
({
customeventName
:
"adVideoReport"
,
customeventData
:
{...
Params
}
});
// 上报播放完成
callback
({
status
:
true
});
})
.
catch
(
err
=>
this
.
playAdVideo
(
Params
,
retry
++
,
callback
));
});
}
}
}
interface
shareInfo
{
declare
interface
shareInfo
{
title
?:
string
;
title
?:
string
;
image
?:
string
;
image
?:
string
;
imageId
?:
string
;
imageId
?:
string
;
...
@@ -794,9 +824,23 @@ interface shareInfo {
...
@@ -794,9 +824,23 @@ interface shareInfo {
fail
:
any
;
fail
:
any
;
complete
?:
any
;
complete
?:
any
;
}
}
interface
RecorderInfo
{
declare
interface
RecorderInfo
{
duration
:
number
;
duration
:
number
;
}
}
declare
interface
wxVideoAd
{
onError
?:
Function
;
}
declare
interface
ProductInfo
{
money
:
number
product_id
:
string
product_name
:
string
product_num
:
number
app_server
:
string
role_level
:
number
role_name
:
string
}
// SDK后端接口(勿改)
// SDK后端接口(勿改)
const
Links
=
{
const
Links
=
{
init
:
SDKConfig
.
sdk_domain
+
"/weixin/access_token.php"
,
// 获取openid
init
:
SDKConfig
.
sdk_domain
+
"/weixin/access_token.php"
,
// 获取openid
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论