正在显示
1 个修改的文件
包含
12 行增加
和
1 行删除
@@ -13,6 +13,7 @@ use think\Hook; | @@ -13,6 +13,7 @@ use think\Hook; | ||
13 | use EasyWeChat\Foundation\Application; | 13 | use EasyWeChat\Foundation\Application; |
14 | use think\Db; | 14 | use think\Db; |
15 | use app\common\model\Attachment; | 15 | use app\common\model\Attachment; |
16 | +use think\Log; | ||
16 | use think\process\exception\Timeout; | 17 | use think\process\exception\Timeout; |
17 | 18 | ||
18 | /** | 19 | /** |
@@ -480,6 +481,10 @@ class Common extends Api | @@ -480,6 +481,10 @@ class Common extends Api | ||
480 | */ | 481 | */ |
481 | public function TuikuanOperation() | 482 | public function TuikuanOperation() |
482 | { | 483 | { |
484 | + Log::init([ | ||
485 | + 'path' => LOG_PATH . 'tuikuanLog', | ||
486 | + 'type' => 'file' | ||
487 | + ]); | ||
483 | $UserId = $this->IsToken($this->request->header()); | 488 | $UserId = $this->IsToken($this->request->header()); |
484 | $params = $this->request->param(); | 489 | $params = $this->request->param(); |
485 | $IsSeller = Db::name('agreement') | 490 | $IsSeller = Db::name('agreement') |
@@ -506,6 +511,10 @@ class Common extends Api | @@ -506,6 +511,10 @@ class Common extends Api | ||
506 | $PayOrderInfo = Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('type', 1)->select(); | 511 | $PayOrderInfo = Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('type', 1)->select(); |
507 | // $TuiMoney = $OrderSn['UpMoney'] + $OrderSn['Money']; | 512 | // $TuiMoney = $OrderSn['UpMoney'] + $OrderSn['Money']; |
508 | $TuiMoney = round(($OrderSn['UpMoney'] * $params['bili'] + $OrderSn['Money']), 2); | 513 | $TuiMoney = round(($OrderSn['UpMoney'] * $params['bili'] + $OrderSn['Money']), 2); |
514 | + log::write('押金' . $params['UpMoney']); | ||
515 | + log::write('剩余租金' . $params['Money']); | ||
516 | + log::write('比例' . $params['bili']); | ||
517 | + log::write('应退金额' . $TuiMoney); | ||
509 | //配置 | 518 | //配置 |
510 | $config = [ | 519 | $config = [ |
511 | 'app_id' => 'wx6a9080f20326f817', | 520 | 'app_id' => 'wx6a9080f20326f817', |
@@ -524,6 +533,7 @@ class Common extends Api | @@ -524,6 +533,7 @@ class Common extends Api | ||
524 | // Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]); | 533 | // Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]); |
525 | 534 | ||
526 | foreach ($PayOrderInfo as $k => $v) { | 535 | foreach ($PayOrderInfo as $k => $v) { |
536 | + log::write('循环次数' . $k . '剩余应退金额' . $TuiMoney); | ||
527 | $result = $payment->refundByTransactionId($v['WeChatOrder'], $v['PayOrder'], $v['money'] * 100, (($TuiMoney > $v['money']) ? $v['money'] : $TuiMoney) * 100); // 总金额 100, 退款 80,操作员:商户号 | 537 | $result = $payment->refundByTransactionId($v['WeChatOrder'], $v['PayOrder'], $v['money'] * 100, (($TuiMoney > $v['money']) ? $v['money'] : $TuiMoney) * 100); // 总金额 100, 退款 80,操作员:商户号 |
528 | //更改订单状态为已退款 | 538 | //更改订单状态为已退款 |
529 | Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('PayOrder', $v['PayOrder'])->update(['type' => 0]); | 539 | Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('PayOrder', $v['PayOrder'])->update(['type' => 0]); |
@@ -531,7 +541,8 @@ class Common extends Api | @@ -531,7 +541,8 @@ class Common extends Api | ||
531 | $this->error('退款失败', 0); | 541 | $this->error('退款失败', 0); |
532 | die; | 542 | die; |
533 | } | 543 | } |
534 | - $TuiMoney = ($TuiMoney > $v['money']) ? $TuiMoney - $v['money'] : 0; | 544 | + $TuiMoney = ($TuiMoney > $v['money']) ? ($TuiMoney - $v['money']) : 0; |
545 | + log::write('循环次数' . $k . '退款后剩余应退金额' . $TuiMoney); | ||
535 | if ($TuiMoney == 0) { | 546 | if ($TuiMoney == 0) { |
536 | break; | 547 | break; |
537 | } | 548 | } |
-
请 注册 或 登录 后发表评论