Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cof_vip
Project
Project
Details
Activity
Releases
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
houdong
cof_vip
Commits
c002f2ce
Commit
c002f2ce
authored
Jul 31, 2023
by
houdong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享测试
parent
78ecd6b5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
11 deletions
+33
-11
app_h5.js
Public/js/app_h5.js
+2
-1
common.php
app/Common/common.php
+1
-0
config.php
app/Conf/config.php
+1
-1
PkTopAction.class.php
app/Lib/Action/Vip/PkTopAction.class.php
+6
-1
ShareModel.class.php
app/Lib/Model/ShareModel.class.php
+18
-7
UserModel.class.php
app/Lib/Model/UserModel.class.php
+3
-1
bottom.html
app/Tpl/Vip/PkTop/bottom.html
+2
-0
No files found.
Public/js/app_h5.js
View file @
c002f2ce
...
@@ -907,7 +907,8 @@ var AppBridge = {
...
@@ -907,7 +907,8 @@ var AppBridge = {
});
});
wx
.
error
(
function
(
res
)
{
wx
.
error
(
function
(
res
)
{
//alert(res);
alert
(
res
);
alert
(
JSON
.
stringify
(
res
));
});
});
},
},
CreateOrder
:
function
(
groupId
,
type
)
{
CreateOrder
:
function
(
groupId
,
type
)
{
...
...
app/Common/common.php
View file @
c002f2ce
...
@@ -1423,6 +1423,7 @@ function trace_log($data,$ext='',$path='',$para=array()) {
...
@@ -1423,6 +1423,7 @@ function trace_log($data,$ext='',$path='',$para=array()) {
$mtime
=
time
();
$mtime
=
time
();
$path
=
empty
(
$path
)
?
APP_PATH
.
'Runtime/Logs/'
:
$path
;
$path
=
empty
(
$path
)
?
APP_PATH
.
'Runtime/Logs/'
:
$path
;
$logfile
=
$path
.
(
$ext
?
$ext
:
''
)
.
'log_'
.
date
(
'Ymd'
,
$mtime
)
.
'.log'
;
$logfile
=
$path
.
(
$ext
?
$ext
:
''
)
.
'log_'
.
date
(
'Ymd'
,
$mtime
)
.
'.log'
;
// var_dump($logfile);exit;
if
(
empty
(
$para
)){
if
(
empty
(
$para
)){
@
file_put_contents
(
$logfile
,
date
(
'Y-m-d H:i:s'
,
$mtime
)
.
"
\t
"
.
$data
.
"
\n
"
,
FILE_APPEND
);
@
file_put_contents
(
$logfile
,
date
(
'Y-m-d H:i:s'
,
$mtime
)
.
"
\t
"
.
$data
.
"
\n
"
,
FILE_APPEND
);
}
else
{
}
else
{
...
...
app/Conf/config.php
View file @
c002f2ce
...
@@ -197,7 +197,7 @@ return array(
...
@@ -197,7 +197,7 @@ return array(
),
),
'WXCONFIG'
=>
[
'WXCONFIG'
=>
[
'AppID'
=>
'wx30d8a92906ae291b'
,
'AppID'
=>
'wx30d8a92906ae291b'
,
'AppSecret'
=>
'
19e95210c22d9a42be2f41d21c083f58
'
,
'AppSecret'
=>
'
2f80d427fd7929b20d8fb9bfa854ae04
'
,
// 'mch_id' => 1534106761,
// 'mch_id' => 1534106761,
// 'key' => 'LI1qR3jkWYB69W3weVBKmwine5dvF2bp6sdo6x3Z70N',
// 'key' => 'LI1qR3jkWYB69W3weVBKmwine5dvF2bp6sdo6x3Z70N',
],
],
...
...
app/Lib/Action/Vip/PkTopAction.class.php
View file @
c002f2ce
...
@@ -631,7 +631,7 @@ class PkTopAction extends IdentityAction{
...
@@ -631,7 +631,7 @@ class PkTopAction extends IdentityAction{
D
(
'User'
)
->
addMoney
(
$userId
,
$userName
,
$mobile
);
D
(
'User'
)
->
addMoney
(
$userId
,
$userName
,
$mobile
);
D
(
'User'
)
->
addInvite
(
$userId
,
$userName
);
D
(
'User'
)
->
addInvite
(
$userId
,
$userName
);
//完成勋章
//完成勋章
D
(
'User'
)
->
finishXunzhang
(
$userId
,
$userName
,
$mobile
,
'cansai'
);
//
D('User')->finishXunzhang($userId,$userName,$mobile,'cansai');
return
[
'status'
=>
1
,
'info'
=>
'参赛成功'
,
'debug'
=>
$userId
];
return
[
'status'
=>
1
,
'info'
=>
'参赛成功'
,
'debug'
=>
$userId
];
...
@@ -882,6 +882,11 @@ class PkTopAction extends IdentityAction{
...
@@ -882,6 +882,11 @@ class PkTopAction extends IdentityAction{
;
;
$this
->
assign
(
'appParam'
,
json_encode
(
$appParam
));
$this
->
assign
(
'appParam'
,
json_encode
(
$appParam
));
//定义在微信分享的显示
$signPackage
=
D
(
'Share'
)
->
getSignPackage
();
$this
->
assign
(
'signPackage'
,
json_encode
(
$signPackage
));
return
$appShareInfo
;
return
$appShareInfo
;
}
}
...
...
app/Lib/Model/ShareModel.class.php
View file @
c002f2ce
...
@@ -8,10 +8,14 @@ class ShareModel extends Model{
...
@@ -8,10 +8,14 @@ class ShareModel extends Model{
private
$appSecret
=
'0b4c9fc96f1a4b32fc2a3793b60244e4'
;
private
$appSecret
=
'0b4c9fc96f1a4b32fc2a3793b60244e4'
;
public
function
_initialize
(
$config
=
''
){
$this
->
appId
=
C
(
'WXCONFIG.AppID'
);
$this
->
appSecret
=
C
(
'WXCONFIG.AppSecret'
);
}
public
function
getSignPackage
()
{
public
function
getSignPackage
()
{
trace_log
(
'getSignPackage'
,
'wxShare_'
);
$jsapiTicket
=
$this
->
getJsApiTicket
();
$jsapiTicket
=
$this
->
getJsApiTicket
();
$protocol
=
(
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
$_SERVER
[
'HTTPS'
]
!==
'off'
||
$_SERVER
[
'SERVER_PORT'
]
==
443
)
?
"https://"
:
"http://"
;
$protocol
=
(
!
empty
(
$_SERVER
[
'HTTPS'
])
&&
$_SERVER
[
'HTTPS'
]
!==
'off'
||
$_SERVER
[
'SERVER_PORT'
]
==
443
)
?
"https://"
:
"http://"
;
...
@@ -50,7 +54,7 @@ class ShareModel extends Model{
...
@@ -50,7 +54,7 @@ class ShareModel extends Model{
public
function
getJsApiTicket
()
{
public
function
getJsApiTicket
()
{
// jsapi_ticket 应该全局存储与更新,以下代码以写入到文件中做示例
// jsapi_ticket 应该全局存储与更新,以下代码以写入到文件中做示例
$data
=
json_decode
(
$this
->
get_php_file
(
"jsapi_ticket4.php"
));
$data
=
json_decode
(
$this
->
get_php_file
(
"
vip_
jsapi_ticket4.php"
));
// var_dump($data);exit;
// var_dump($data);exit;
if
(
!
$data
||
$data
->
expire_time
<
time
())
{
if
(
!
$data
||
$data
->
expire_time
<
time
())
{
$accessToken
=
$this
->
getAccessToken
();
$accessToken
=
$this
->
getAccessToken
();
...
@@ -58,12 +62,15 @@ class ShareModel extends Model{
...
@@ -58,12 +62,15 @@ class ShareModel extends Model{
// $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
// $url = "https://qyapi.weixin.qq.com/cgi-bin/get_jsapi_ticket?access_token=$accessToken";
$url
=
"https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=
$accessToken
"
;
$url
=
"https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi&access_token=
$accessToken
"
;
// var_dump($url);exit;
// var_dump($url);exit;
$res
=
json_decode
(
$this
->
httpGet
(
$url
));
// $res = json_decode($this->httpGet($url));
$httpRes
=
$this
->
httpGet
(
$url
);
$res
=
json_decode
(
$httpRes
);
trace_log
(
"getJsApiTicket,url:"
.
$url
.
',响应'
.
$httpRes
,
'wxShare_'
);
$ticket
=
$res
->
ticket
;
$ticket
=
$res
->
ticket
;
if
(
$ticket
)
{
if
(
$ticket
)
{
$data
->
expire_time
=
time
()
+
7000
;
$data
->
expire_time
=
time
()
+
7000
;
$data
->
jsapi_ticket
=
$ticket
;
$data
->
jsapi_ticket
=
$ticket
;
$this
->
set_php_file
(
"jsapi_ticket4.php"
,
json_encode
(
$data
));
$this
->
set_php_file
(
"
vip_
jsapi_ticket4.php"
,
json_encode
(
$data
));
}
}
}
else
{
}
else
{
$ticket
=
$data
->
jsapi_ticket
;
$ticket
=
$data
->
jsapi_ticket
;
...
@@ -73,19 +80,23 @@ class ShareModel extends Model{
...
@@ -73,19 +80,23 @@ class ShareModel extends Model{
private
function
getAccessToken
()
{
private
function
getAccessToken
()
{
// access_token 应该全局存储与更新,以下代码以写入到文件中做示例
// access_token 应该全局存储与更新,以下代码以写入到文件中做示例
$data
=
json_decode
(
$this
->
get_php_file
(
"access_token4.php"
));
$data
=
json_decode
(
$this
->
get_php_file
(
"
vip_
access_token4.php"
));
if
(
!
$data
||
$data
->
expire_time
<
time
())
{
if
(
!
$data
||
$data
->
expire_time
<
time
())
{
// 如果是企业号用以下URL获取access_token
// 如果是企业号用以下URL获取access_token
// $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this->appId&corpsecret=$this->appSecret";
// $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=$this->appId&corpsecret=$this->appSecret";
$url
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=
$this->appId
&secret=
$this->appSecret
"
;
$url
=
"https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=
$this->appId
&secret=
$this->appSecret
"
;
// var_dump($url);
// var_dump($url);
$res
=
json_decode
(
$this
->
httpGet
(
$url
));
// $res = json_decode($this->httpGet($url));
$httpRes
=
$this
->
httpGet
(
$url
);
$res
=
json_decode
(
$httpRes
);
// var_dump($res);exit;
// var_dump($res);exit;
trace_log
(
"getAccessToken,url:"
.
$url
.
',响应'
.
$httpRes
,
'wxShare_'
);
$access_token
=
$res
->
access_token
;
$access_token
=
$res
->
access_token
;
if
(
$access_token
)
{
if
(
$access_token
)
{
$data
->
expire_time
=
time
()
+
7000
;
$data
->
expire_time
=
time
()
+
7000
;
$data
->
access_token
=
$access_token
;
$data
->
access_token
=
$access_token
;
$this
->
set_php_file
(
"access_token4.php"
,
json_encode
(
$data
));
$this
->
set_php_file
(
"
vip_
access_token4.php"
,
json_encode
(
$data
));
}
}
}
else
{
}
else
{
$access_token
=
$data
->
access_token
;
$access_token
=
$data
->
access_token
;
...
...
app/Lib/Model/UserModel.class.php
View file @
c002f2ce
...
@@ -171,7 +171,7 @@ class UserModel extends Model{
...
@@ -171,7 +171,7 @@ class UserModel extends Model{
return
[
$entrustList
,
$total
?
$total
:
0
];
return
[
$entrustList
,
$total
?
$total
:
0
];
}
}
//完成勋章
//完成勋章
,只有参赛勋章
public
function
finishXunzhang
(
$userId
,
$userName
,
$mobile
,
$xzType
)
{
public
function
finishXunzhang
(
$userId
,
$userName
,
$mobile
,
$xzType
)
{
$level
=
M
(
'XunzhangLevel'
)
->
where
([
'user_id'
=>
$userId
])
->
count
();
$level
=
M
(
'XunzhangLevel'
)
->
where
([
'user_id'
=>
$userId
])
->
count
();
if
(
!
$level
){
if
(
!
$level
){
...
@@ -182,6 +182,8 @@ class UserModel extends Model{
...
@@ -182,6 +182,8 @@ class UserModel extends Model{
if
(
!
$old
){
if
(
!
$old
){
$addData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'xz_id'
=>
$xzid
,
'mobile'
=>
$mobile
];
$addData
=
[
'user_id'
=>
$userId
,
'user_name'
=>
$userName
,
'xz_id'
=>
$xzid
,
'mobile'
=>
$mobile
];
$addData
[
'add_time'
]
=
$addData
[
'finish1_time'
]
=
$addData
[
'finish2_time'
]
=
time
();
$addData
[
'add_time'
]
=
$addData
[
'finish1_time'
]
=
$addData
[
'finish2_time'
]
=
time
();
//直接打开百宝箱,防止重复领取1.88元
$addData
[
'openbox_time'
]
=
time
();
M
(
'XunzhangUser'
)
->
add
(
$addData
);
M
(
'XunzhangUser'
)
->
add
(
$addData
);
}
}
}
}
...
...
app/Tpl/Vip/PkTop/bottom.html
View file @
c002f2ce
...
@@ -200,6 +200,8 @@
...
@@ -200,6 +200,8 @@
});
});
});
});
// //微信内分享
AppBridge
.
wx_share
({
$signPackage
},{
$appParam
});
});
});
...
...
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