@@ -43,7 +43,7 @@ if ($dopost === "get_payments") { | |||||
$configItem->$kk = $ii; | $configItem->$kk = $ii; | ||||
} | } | ||||
} | } | ||||
$cfg = json_encode($configItem); | |||||
$cfg = json_encode($configItem, JSON_UNESCAPED_UNICODE); | |||||
$upQuery = "UPDATE `#@__sys_payment` SET sortrank='$sortrank',status='$status',config='$cfg' WHERE code='$key'; "; | $upQuery = "UPDATE `#@__sys_payment` SET sortrank='$sortrank',status='$status',config='$cfg' WHERE code='$key'; "; | ||||
if (!$dsql->ExecuteNoneQuery($upQuery)) { | if (!$dsql->ExecuteNoneQuery($upQuery)) { | ||||
echo json_encode(array( | echo json_encode(array( | ||||
@@ -56,5 +56,8 @@ if ($dopost === 'alipay') { | |||||
ShowMsg("付款错误", "javascript:;"); | ShowMsg("付款错误", "javascript:;"); | ||||
exit; | exit; | ||||
} | } | ||||
} else { | |||||
ShowMsg("未知支付方式", "javascript:;"); | |||||
exit; | |||||
} | } | ||||
?> | ?> |
@@ -55,13 +55,13 @@ if ($needMoney > 0 || $needRank > 1) { | |||||
if (!is_array($row)) { | if (!is_array($row)) { | ||||
if ($cfg_ml->M_Money == '' || $needMoney > $cfg_ml->M_Money) { | if ($cfg_ml->M_Money == '' || $needMoney > $cfg_ml->M_Money) { | ||||
$msgtitle = "您没有权限浏览文档:{$arctitle} "; | $msgtitle = "您没有权限浏览文档:{$arctitle} "; | ||||
$moremsg = "该文档需要<span class='text-primary'>".$needMoney."</span>金币才能浏览,您目前金币<span class='text-primary'>".$cfg_ml->M_Money."</span>"; | |||||
$moremsg = "该文档需要<span class='text-primary'>".$needMoney."</span>金币才能浏览,您目前金币<span class='text-primary'>".$cfg_ml->M_Money."</span><br><a class='btn btn-success btn-sm' href='{$GLOBALS['cfg_cmsurl']}/user/buy.php' target='_blank'>前去充值</a>"; | |||||
include_once(DEDETEMPLATE.'/plus/view_msg.htm'); | include_once(DEDETEMPLATE.'/plus/view_msg.htm'); | ||||
$arc->Close(); | $arc->Close(); | ||||
exit(); | exit(); | ||||
} else { | } else { | ||||
if ($dopost == 'buy') { | if ($dopost == 'buy') { | ||||
$inquery = "INSERT INTO `#@__member_operation` (mid,oldinfo,money,mtime,buyid,product,pname) VALUES ('".$cfg_ml->M_ID."','$arctitle','$needMoney','".time()."','ARCHIVE".$aid."','archive',''); "; | |||||
$inquery = "INSERT INTO `#@__member_operation` (mid,oldinfo,money,mtime,buyid,product,pname,sta) VALUES ('".$cfg_ml->M_ID."','$arctitle','$needMoney','".time()."','ARCHIVE".$aid."','archive','购买内容',2); "; | |||||
if ($dsql->ExecuteNoneQuery($inquery)) { | if ($dsql->ExecuteNoneQuery($inquery)) { | ||||
$inquery = "UPDATE `#@__member` SET money=money-$needMoney WHERE mid='".$cfg_ml->M_ID."'"; | $inquery = "UPDATE `#@__member` SET money=money-$needMoney WHERE mid='".$cfg_ml->M_ID."'"; | ||||
if (!$dsql->ExecuteNoneQuery($inquery)) { | if (!$dsql->ExecuteNoneQuery($inquery)) { | ||||
@@ -76,7 +76,7 @@ if ($needMoney > 0 || $needRank > 1) { | |||||
} | } | ||||
} | } | ||||
$msgtitle = "扣金币购买阅读"; | $msgtitle = "扣金币购买阅读"; | ||||
$moremsg = "该文档需要付费<span class='text-primary'>".$needMoney."</span>金币,您目前金币<span class='text-primary'>".$cfg_ml->M_Money."</span><br><a href='{$GLOBALS['cfg_cmsurl']}/apps/view.php?aid=".$aid."&dopost=buy' target='_blank'>确认付点阅读</a>"; | |||||
$moremsg = "该文档需要付费<span class='text-primary'>".$needMoney."</span>金币,您目前金币<span class='text-primary'>".$cfg_ml->M_Money."</span><br><a class='btn btn-success btn-sm' href='{$GLOBALS['cfg_cmsurl']}/apps/view.php?aid=".$aid."&dopost=buy' target='_blank'>确认付点阅读</a>"; | |||||
include_once($cfg_basedir.$cfg_templets_dir."/plus/view_msg.htm"); | include_once($cfg_basedir.$cfg_templets_dir."/plus/view_msg.htm"); | ||||
$arc->Close(); | $arc->Close(); | ||||
exit(); | exit(); | ||||
@@ -14,8 +14,8 @@ | |||||
<div class="container py-3"> | <div class="container py-3"> | ||||
<div class="row"> | <div class="row"> | ||||
<div class="col-md-12"> | <div class="col-md-12"> | ||||
<table width="100%" cellpadding="3" cellspacing="1" bgcolor="#DDEAC8" class="table"> | |||||
<tr bgcolor="#EFF4EA"> | |||||
<table width="100%" cellpadding="3" cellspacing="1" class="table table-bordered"> | |||||
<tr> | |||||
<td colspan="2">错误具体提示信息:</td> | <td colspan="2">错误具体提示信息:</td> | ||||
</tr> | </tr> | ||||
<tr> | <tr> | ||||
@@ -42,16 +42,22 @@ if ($dopost === "bank_ok") { | |||||
} | } | ||||
$pInfo = $dsql->GetOne("SELECT * FROM `#@__sys_payment` WHERE id = 1"); | $pInfo = $dsql->GetOne("SELECT * FROM `#@__sys_payment` WHERE id = 1"); | ||||
$pData = (array)json_decode($pInfo['config']); | $pData = (array)json_decode($pInfo['config']); | ||||
$config = array( | |||||
"appid" => $pData['AppID'], | |||||
"mch_id" => $pData['MchID'], | |||||
"mch_key" => $pData['APIv2Secret'], | |||||
); | |||||
$wechat = new \WeChat\Pay($config); | |||||
$options = array( | |||||
'out_trade_no' => $buyid, | |||||
); | |||||
$result = $wechat->queryOrder($options); | |||||
try { | |||||
$config = array( | |||||
"appid" => $pData['AppID'], | |||||
"mch_id" => $pData['MchID'], | |||||
"mch_key" => $pData['APIv2Secret'], | |||||
); | |||||
$wechat = new \WeChat\Pay($config); | |||||
$options = array( | |||||
'out_trade_no' => $buyid, | |||||
); | |||||
$result = $wechat->queryOrder($options); | |||||
} catch (Exception $e) { | |||||
ShowMsg("生成微信支付信息失败,请联系网站管理员", "javascript:;"); | |||||
exit; | |||||
} | |||||
if ($result['return_code'] === "SUCCESS" && $result['trade_state'] === "SUCCESS") { | if ($result['return_code'] === "SUCCESS" && $result['trade_state'] === "SUCCESS") { | ||||
$row = $dsql->GetOne("SELECT * FROM `#@__moneycard_type` WHERE tid='{$moRow['pid']}'"); | $row = $dsql->GetOne("SELECT * FROM `#@__moneycard_type` WHERE tid='{$moRow['pid']}'"); | ||||
$query = "UPDATE `#@__member_operation` SET sta = '2' WHERE buyid = '$buyid'"; | $query = "UPDATE `#@__member_operation` SET sta = '2' WHERE buyid = '$buyid'"; | ||||
@@ -160,16 +166,17 @@ if ($paytype === 0) { | |||||
"mch_id" => $pData['MchID'], | "mch_id" => $pData['MchID'], | ||||
"mch_key" => $pData['APIv2Secret'], | "mch_key" => $pData['APIv2Secret'], | ||||
); | ); | ||||
$wechat = new \WeChat\Pay($config); | |||||
$options = array( | |||||
'product_id' => $buyid, | |||||
'body' => $row['pname'], | |||||
'out_trade_no' => $buyid, | |||||
'total_fee' => $row['money']*100, | |||||
'trade_type' => 'NATIVE', | |||||
'notify_url' => $GLOBALS['cfg_basehost'].$GLOBALS['cfg_phpurl'].'/notify.php?dopost=wechat', | |||||
); | |||||
try { | try { | ||||
$wechat = new \WeChat\Pay($config); | |||||
$options = array( | |||||
'product_id' => $buyid, | |||||
'body' => $row['pname'], | |||||
'out_trade_no' => $buyid, | |||||
'total_fee' => $row['money']*100, | |||||
'trade_type' => 'NATIVE', | |||||
'notify_url' => $GLOBALS['cfg_basehost'].$GLOBALS['cfg_phpurl'].'/notify.php?dopost=wechat', | |||||
); | |||||
//生成预支付码 | //生成预支付码 | ||||
$result = $wechat->createOrder($options); | $result = $wechat->createOrder($options); | ||||
$payurl = $result['code_url']; | $payurl = $result['code_url']; | ||||
@@ -214,7 +221,8 @@ if ($paytype === 0) { | |||||
echo $result; | echo $result; | ||||
} catch (Exception $e) { | } catch (Exception $e) { | ||||
echo $e->getMessage(); | |||||
ShowMsg("生成微信支付信息失败,请联系网站管理员", "javascript:;"); | |||||
exit; | |||||
} | } | ||||
} elseif ($paytype === 3) { | } elseif ($paytype === 3) { | ||||
include_once(DEDEINC.'/libraries/oxwindow.class.php'); | include_once(DEDEINC.'/libraries/oxwindow.class.php'); | ||||
@@ -46,6 +46,6 @@ while ($channel = $dsql->GetArray('addmod')) { | |||||
</ul> | </ul> | ||||
</div> | </div> | ||||
</li> | </li> | ||||
<li class="list-group-item justify-content-between align-items-center rounded <?php if (isset($_menu_edtitem) && $_menu_edtitem === 'base') echo 'active';?>"><a href="edit_baseinfo.php">资料修改</a></li> | |||||
<li class="list-group-item justify-content-between align-items-center rounded <?php if (isset($_menu_edtitem) && $_menu_edtitem === 'base') echo 'active';?>"><a href="<?php echo $cfg_memberurl;?>/edit_baseinfo.php">资料修改</a></li> | |||||
</ul> | </ul> | ||||
</div> | </div> |