Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
Compass
Overview
Overview
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
zong
Compass
Commits
d8f0b87a
Commit
d8f0b87a
authored
Mar 12, 2020
by
biao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
11
parent
a53deaf3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
7 deletions
+27
-7
ajax_buy_user_member.php
src/user/if/ajax_buy_user_member.php
+27
-7
No files found.
src/user/if/ajax_
update
_user_member.php
→
src/user/if/ajax_
buy
_user_member.php
View file @
d8f0b87a
...
...
@@ -4,17 +4,19 @@
require_once
(
"../user_include.inc"
);
$unionId
=
ParamUtil
::
getRequestString
(
"unionId"
,
0
);
$openId
=
ParamUtil
::
getRequestString
(
"openId"
,
0
);
ErrorLogger
::
doOutput
(
"Compass...ajax_update_user_member.php....Start."
,
0
);
ErrorLogger
::
doOutput
(
"Compass...ajax_update_user_member.php....unionId="
.
$unionId
,
0
);
//参数验证
if
(
empty
(
$unionId
))
{
if
(
empty
(
$unionId
)
||
empty
(
$openId
)
)
{
responseNG
(
"参数错误!"
);
}
//检索用户是否存在
$param
[
'unionid'
]
=
$unionId
;
$param
[
'openId'
]
=
$openId
;
$param
[
'delete_flg'
]
=
false
;
$tmpUserMstList
=
UserMst
::
getList
(
$param
,
'id'
,
'desc'
,
0
,
1
);
if
(
empty
(
$tmpUserMstList
))
{
...
...
@@ -22,23 +24,41 @@ if(empty($tmpUserMstList)) {
}
//调用支付
//生成临时订单
$orderNo
=
"B"
.
date
(
"YmdHis"
)
.
"_"
.
$userMst
->
id
;
//调用微信支付接口
$tools
=
new
JsApiPay
();
$input
=
new
WxPayUnifiedOrder
();
$input
->
SetBody
(
"志愿者会员购买"
);
$input
->
SetAttach
(
"志愿者会员购买"
);
$input
->
SetOut_trade_no
(
$orderNo
);
$input
->
SetTotal_fee
(
$
200
*
100
);
//折算到分
$input
->
SetTime_start
(
date
(
"YmdHis"
));
$input
->
SetTime_expire
(
date
(
"YmdHis"
,
time
()
+
800
));
$input
->
SetGoods_tag
(
"志愿者会员购买"
);
$input
->
SetNotify_url
(
"https://"
.
SSL_PATH
.
"/api/api_wx_pay_notify.php"
);
$input
->
SetTrade_type
(
"JSAPI"
);
$input
->
SetOpenid
(
$userMst
->
openid
);
$order
=
WxPayApi
::
unifiedOrder
(
$input
);
$jsApiParameters
=
$tools
->
GetJsApiParameters
(
$order
);
ErrorLogger
::
doOutput
(
$jsApiParameters
);
ErrorLogger
::
doOutput
(
"Compass...ajax_set_buy_media.php.php....End."
,
0
);
$user
=
$tmpUserMstList
[
0
];
$user
->
is_member
=
true
;
$user
->
save
();
ErrorLogger
::
doOutput
(
"Compass...ajax_update_user_member.php....End."
,
0
);
responseOK
(
"更新成功!"
);
responseOK
(
$jsApiParameters
);
function
responseNG
(
$message
)
{
$result
=
array
(
"status"
=>
"NG"
,
"message"
=>
$message
);
print
json_encode
(
$result
);
exit
;
}
function
responseOK
(
$
message
)
{
$result
=
array
(
"status"
=>
"OK"
,
"
message"
=>
$message
);
function
responseOK
(
$
result
)
{
$result
=
array
(
"status"
=>
"OK"
,
"
result"
=>
$result
);
print
json_encode
(
$result
);
exit
;
}
...
...
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