我有一个代码负责向帐户添加资金。网站页面上有资费套餐,点击支付后,用户切换到支付账单。代码如下: public function pay(Request $request) { $ticketID = $request->get('tickID'); if($ticketID = 1){ $sum = 32; }elseif($ticketID = 2){ $sum = 64; }elseif($ticketID = 3){ $sum = 320; }elseif($ticketID = 4){ $sum = 640; }elseif($ticketID = 5){ $sum = 1600; }elseif($ticketID = 6){ $sum = 3840; }elseif($ticketID = 7){ $sum = 6400; }elseif($ticketID = 8){ $sum = 9600; } $u = $this->user->steamid64; $merchant_id = '423'; $secret_word1 = '432'; $sign = md5($merchant_id.':'.$sum.':'.$secret_word1.':'.$u); $url = 'https://www.free-kassa.ru/merchant/cash.php?m='.$merchant_id.'&oa='.$sum.'&o='.$u.'&s='.$sign.'&lang=ru&i=&em='; $returnValue = [ 'redirect' => $url ]; return $returnValue; } function getIP() { if (isset($_SERVER['HTTP_X_REAL_IP'])) return $_SERVER['HTTP_X_REAL_IP']; return $_SERVER['REMOTE_ADDR']; } public function payaccept(Request $request) { $merchant_id = '534'; $secret_word2 = '423423'; if (!in_array(getIP(), array('144.76.93.115', '144.76.93.119', '78.47.60.198'))) die('hacking attempt!'); $sign = md5($merchant_id.':'.$_REQUEST['AMOUNT'].':'.$merchant_secret_2.':'.$_REQUEST['MERCHANT_ORDER_ID']);函数pay形成链接、金额和数字签名。函数payaccept 函数处理支付,必须将支付信息输入数据库。问题是 $user = User::Where('steamid64',$_REQUEST['MERCHANT_ORDER_ID']);我在帮助 var_dump() 下知道的。此行生成变量 steamid64,但无法在数据库中查找。我该如何解决?
1 回答
人到中年有点甜
TA贡献1895条经验 获得超7个赞
好吧,鉴于您没有放置任何错误消息或日志..我假设错误是这一行:
$user = User::Where('steamid64',$_REQUEST['MERCHANT_ORDER_ID']);
在这里,您正在创建查询...但不执行它。为此,请->first()
在最后添加。
$user = User::Where('steamid64',$_REQUEST['MERCHANT_ORDER_ID'])->first();
然后您将能够调用$user
对象上的方法。
- 1 回答
- 0 关注
- 173 浏览
添加回答
举报
0/150
提交
取消