Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
llewan-weixin-sdk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
llewan
llewan-weixin-sdk
Commits
8910a2ac
Commit
8910a2ac
authored
Nov 15, 2018
by
liuxinjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加分享邀新和邀旧的特殊标记参数
parent
6da7c2ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
114 deletions
+22
-114
sdk.js
assets/llewan-weixin-sdk/sdk.js
+22
-114
No files found.
assets/llewan-weixin-sdk/sdk.js
View file @
8910a2ac
...
@@ -145,6 +145,7 @@ var sdk = {
...
@@ -145,6 +145,7 @@ var sdk = {
if
(
option
.
query
.
share_id
&&
option
.
query
.
uid
){
if
(
option
.
query
.
share_id
&&
option
.
query
.
uid
){
option
.
query
.
share_uid
=
option
.
query
.
uid
;
option
.
query
.
share_uid
=
option
.
query
.
uid
;
option
.
query
.
uid
=
this
.
userid
;
option
.
query
.
uid
=
this
.
userid
;
// console.log('==3统计信息==',option)
// console.log('==3统计信息==',option)
this
.
Post
(
this
.
ip3
+
this
.
Logcommon
,
{
log_type
:
"ShareEnter"
,
data
:
JSON
.
stringify
(
option
)
},
function
(
d
)
{
this
.
Post
(
this
.
ip3
+
this
.
Logcommon
,
{
log_type
:
"ShareEnter"
,
data
:
JSON
.
stringify
(
option
)
},
function
(
d
)
{
// console.log("==3统计信息结果==", d)
// console.log("==3统计信息结果==", d)
...
@@ -155,6 +156,7 @@ var sdk = {
...
@@ -155,6 +156,7 @@ var sdk = {
if
(
option
.
query
.
uid
){
if
(
option
.
query
.
uid
){
option
.
query
.
share_uid
=
option
.
query
.
uid
;
option
.
query
.
share_uid
=
option
.
query
.
uid
;
option
.
query
.
uid
=
self
.
userid
;
option
.
query
.
uid
=
self
.
userid
;
// console.log('==4统计信息==',option)
// console.log('==4统计信息==',option)
self
.
Post
(
self
.
ip3
+
self
.
Logcommon
,
{
log_type
:
"ShareEnter"
,
data
:
JSON
.
stringify
(
option
)
},
function
(
d
)
{
self
.
Post
(
self
.
ip3
+
self
.
Logcommon
,
{
log_type
:
"ShareEnter"
,
data
:
JSON
.
stringify
(
option
)
},
function
(
d
)
{
// console.log("==4统计信息结果==", d)
// console.log("==4统计信息结果==", d)
...
@@ -172,7 +174,7 @@ var sdk = {
...
@@ -172,7 +174,7 @@ var sdk = {
loginData
.
scene
=
option
.
scene
;
loginData
.
scene
=
option
.
scene
;
loginData
.
source_id
=
option
.
query
.
source_id
;
loginData
.
source_id
=
option
.
query
.
source_id
;
loginData
.
source_id2
=
option
.
query
.
source_id2
;
loginData
.
source_id2
=
option
.
query
.
source_id2
;
loginData
.
special_flag
=
option
.
query
.
special_flag
;
self
.
setItem
(
"deviceModel"
,
res
.
model
);
self
.
setItem
(
"deviceModel"
,
res
.
model
);
if
(
sdk_conf
.
game_online
)
if
(
sdk_conf
.
game_online
)
...
@@ -666,6 +668,7 @@ var sdk = {
...
@@ -666,6 +668,7 @@ var sdk = {
* @apiName onShareAppMessage
* @apiName onShareAppMessage
* @api {分享} 注册微信右上角分享 onShareAppMessage(分享)
* @api {分享} 注册微信右上角分享 onShareAppMessage(分享)
* @apiParam {int} type=0 后台自定义的分享类型;例如:0:右上角分享、1:普通分享 2:分享加金币
* @apiParam {int} type=0 后台自定义的分享类型;例如:0:右上角分享、1:普通分享 2:分享加金币
* @apiParam {int} specialFlag=0 特殊标记,例如0:默认、1:邀新好友、2:邀旧好友
* @apiParam {String} [title] 转发标题
* @apiParam {String} [title] 转发标题
* @apiParam {String} [imageUrl] 转发显示图片的链接
* @apiParam {String} [imageUrl] 转发显示图片的链接
* @apiParam {String} [query] 必须是 key1=val1&key2=val2 的格式。
* @apiParam {String} [query] 必须是 key1=val1&key2=val2 的格式。
...
@@ -679,6 +682,7 @@ var sdk = {
...
@@ -679,6 +682,7 @@ var sdk = {
var
self
=
this
;
var
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
//.微信右上角分享
//.微信右上角分享
var
specialFlag
=
0
;
wx
.
showShareMenu
({
withShareTicket
:
true
})
wx
.
showShareMenu
({
withShareTicket
:
true
})
wx
.
onShareAppMessage
(
function
(
res
){
wx
.
onShareAppMessage
(
function
(
res
){
//.默认0:右上角分享
//.默认0:右上角分享
...
@@ -686,6 +690,11 @@ var sdk = {
...
@@ -686,6 +690,11 @@ var sdk = {
if
(
obj
.
type
){
if
(
obj
.
type
){
tpye
=
obj
.
type
;
tpye
=
obj
.
type
;
}
}
if
(
obj
.
specialFlag
){
specialFlag
=
obj
.
specialFlag
;
}
var
shareInfo
=
self
.
getShareByWeight
(
tpye
)
var
shareInfo
=
self
.
getShareByWeight
(
tpye
)
if
(
obj
.
title
){
if
(
obj
.
title
){
...
@@ -695,12 +704,12 @@ var sdk = {
...
@@ -695,12 +704,12 @@ var sdk = {
shareInfo
.
imageUrl
=
obj
.
imageUrl
;
shareInfo
.
imageUrl
=
obj
.
imageUrl
;
}
}
if
(
shareInfo
.
query
){
if
(
shareInfo
.
query
){
shareInfo
.
query
+=
obj
.
query
+
"&share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
shareInfo
.
query
+=
obj
.
query
+
"&share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&special_flag="
+
specialFlag
;
}
else
{
}
else
{
if
(
obj
.
query
){
if
(
obj
.
query
){
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&"
+
obj
.
query
;
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&special_flag="
+
specialFlag
+
"&"
+
obj
.
query
;
}
else
{
}
else
{
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&special_flag="
+
specialFlag
;
}
}
}
}
if
(
obj
.
success
){
if
(
obj
.
success
){
...
@@ -730,6 +739,7 @@ var sdk = {
...
@@ -730,6 +739,7 @@ var sdk = {
* @apiName shareAppMessage
* @apiName shareAppMessage
* @api {分享} 主动拉起微信分享 shareAppMessage(分享)
* @api {分享} 主动拉起微信分享 shareAppMessage(分享)
* @apiParam {int} type=1 后台自定义的分享类型;例如:0:右上角分享、1:普通分享 2:分享加金币
* @apiParam {int} type=1 后台自定义的分享类型;例如:0:右上角分享、1:普通分享 2:分享加金币
* @apiParam {int} specialFlag=0 特殊标记,例如0:默认、1:邀新好友、2:邀旧好友
* @apiParam {String} [title] 转发标题
* @apiParam {String} [title] 转发标题
* @apiParam {String} [imageUrl] 转发显示图片的链接
* @apiParam {String} [imageUrl] 转发显示图片的链接
* @apiParam {String} [query] 必须是 key1=val1&key2=val2 的格式。
* @apiParam {String} [query] 必须是 key1=val1&key2=val2 的格式。
...
@@ -743,9 +753,14 @@ var sdk = {
...
@@ -743,9 +753,14 @@ var sdk = {
var
self
=
this
;
var
self
=
this
;
//.默认1:普通分享
//.默认1:普通分享
var
tpye
=
1
;
var
tpye
=
1
;
var
specialFlag
=
0
;
if
(
obj
.
type
){
if
(
obj
.
type
){
tpye
=
obj
.
type
;
tpye
=
obj
.
type
;
}
}
if
(
obj
.
specialFlag
){
specialFlag
=
obj
.
specialFlag
;
}
var
shareInfo
=
this
.
getShareByWeight
(
tpye
);
var
shareInfo
=
this
.
getShareByWeight
(
tpye
);
if
(
obj
.
title
){
if
(
obj
.
title
){
shareInfo
.
title
=
obj
.
title
;
shareInfo
.
title
=
obj
.
title
;
...
@@ -754,12 +769,12 @@ var sdk = {
...
@@ -754,12 +769,12 @@ var sdk = {
shareInfo
.
imageUrl
=
obj
.
imageUrl
;
shareInfo
.
imageUrl
=
obj
.
imageUrl
;
}
}
if
(
shareInfo
.
query
){
if
(
shareInfo
.
query
){
shareInfo
.
query
+=
obj
.
query
+
"&share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
shareInfo
.
query
+=
obj
.
query
+
"&share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&special_flag="
+
specialFlag
;
}
else
{
}
else
{
if
(
obj
.
query
){
if
(
obj
.
query
){
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&"
+
obj
.
query
;
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&special_flag="
+
specialFlag
+
"&"
+
obj
.
query
;
}
else
{
}
else
{
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&special_flag="
+
specialFlag
;
}
}
}
}
if
(
obj
.
success
){
if
(
obj
.
success
){
...
@@ -783,113 +798,6 @@ var sdk = {
...
@@ -783,113 +798,6 @@ var sdk = {
}
}
},
},
/**
* @apiGroup C
* @apiName aldOnShareAppMessage
* @api {分享} 注册微信右上角分享 aldOnShareAppMessage(分享) 阿拉丁统计
* @apiParam {int} type=0 后台自定义的分享类型;例如:0:右上角分享、1:普通分享 2:分享加金币
* @apiParam {String} [title] 转发标题
* @apiParam {String} [imageUrl] 转发显示图片的链接
* @apiParam {String} [query] 必须是 key1=val1&key2=val2 的格式。
* @apiParam {callback} [success] 成功回调
* @apiParam {callback} [fail] 失败回调
*
* @apiSuccessExample {json} 示例:
* sdk.aldOnShareAppMessage({type: 0, query: "uid=520" });
*/
aldOnShareAppMessage
(
obj
){
var
self
=
this
;
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
//.微信右上角分享
wx
.
showShareMenu
({
withShareTicket
:
true
})
wx
.
aldOnShareAppMessage
(
function
(
res
){
//.默认0:右上角分享
var
tpye
=
0
;
if
(
obj
.
type
){
tpye
=
obj
.
type
;
}
var
shareInfo
=
self
.
getShareByWeight
(
tpye
)
if
(
obj
.
title
){
shareInfo
.
title
=
obj
.
title
;
}
if
(
obj
.
imageUrl
){
shareInfo
.
imageUrl
=
obj
.
imageUrl
;
}
if
(
shareInfo
.
query
){
shareInfo
.
query
+=
obj
.
query
+
"&share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
}
else
{
if
(
obj
.
query
){
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&"
+
obj
.
query
;
}
else
{
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
}
}
if
(
obj
.
success
){
shareInfo
.
successCallback
=
obj
.
success
;
}
if
(
obj
.
fail
){
//微信没有虽然成功回调但是还是有失败回调,避免和微信失败的回调重命名
shareInfo
.
failCallback
=
obj
.
fail
;
}
return
shareInfo
;
})
}
},
/**
* @apiGroup C
* @apiName aldShareAppMessage
* @api {分享} 主动拉起微信分享 aldShareAppMessage(分享) 阿拉丁统计
* @apiParam {int} type=1 后台自定义的分享类型;例如:0:右上角分享、1:普通分享 2:分享加金币
* @apiParam {String} [title] 转发标题
* @apiParam {String} [imageUrl] 转发显示图片的链接
* @apiParam {String} [query] 必须是 key1=val1&key2=val2 的格式。
* @apiParam {callback} [success] 成功回调
* @apiParam {callback} [fail] 失败回调
*
* @apiSuccessExample {json} 示例:
* sdk.aldShareAppMessage({type: 1, query: "uid=520" });
*/
aldShareAppMessage
(
obj
){
var
self
=
this
;
//.默认1:普通分享
var
tpye
=
1
;
if
(
obj
.
type
){
tpye
=
obj
.
type
;
}
var
shareInfo
=
this
.
getShareByWeight
(
tpye
);
if
(
obj
.
title
){
shareInfo
.
title
=
obj
.
title
;
}
if
(
obj
.
imageUrl
){
shareInfo
.
imageUrl
=
obj
.
imageUrl
;
}
if
(
shareInfo
.
query
){
shareInfo
.
query
+=
obj
.
query
+
"&share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
}
else
{
if
(
obj
.
query
){
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
+
"&"
+
obj
.
query
;
}
else
{
shareInfo
.
query
=
"share_id="
+
shareInfo
.
sysid
+
"&uid="
+
self
.
userid
;
}
}
if
(
obj
.
success
){
shareInfo
.
successCallback
=
obj
.
success
;
}
if
(
obj
.
fail
){
//微信没有虽然成功回调但是还是有失败回调,避免和微信失败的回调重命名
shareInfo
.
failCallback
=
obj
.
fail
;
}
console
.
log
(
"sdk 阿拉丁分享"
,
shareInfo
);
if
(
cc
.
sys
.
platform
===
cc
.
sys
.
WECHAT_GAME
)
{
wx
.
aldShareAppMessage
(
shareInfo
);
}
},
/**
/**
* @apiIgnore
* @apiIgnore
* @apiGroup B
* @apiGroup B
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment