作者 王智

修改

@@ -416,9 +416,9 @@ class Common extends Api @@ -416,9 +416,9 @@ class Common extends Api
416 if ($params['type'] == 2) { 416 if ($params['type'] == 2) {
417 $res = Db::name('agreement')->where('id', $params['id'])->update(['status' => 4, 'updatetime' => time()]); 417 $res = Db::name('agreement')->where('id', $params['id'])->update(['status' => 4, 'updatetime' => time()]);
418 //拒绝签订协议 给予用户退款 418 //拒绝签订协议 给予用户退款
419 - $OrderSn = Db::name('agreement')->where('id', $params['id'])->value('OrderSn'); 419 + $OrderSn = Db::name('agreement')->where('id', $params['id'])->find();
420 $PayOrderInfo = Db::name('pay_order')->where('OrderSn', $OrderSn)->where('type', 1)->find(); 420 $PayOrderInfo = Db::name('pay_order')->where('OrderSn', $OrderSn)->where('type', 1)->find();
421 - $TuiMoney = $PayOrderInfo['UpMoney'] + $PayOrderInfo['Money']; 421 + $TuiMoney = $OrderSn['UpMoney'] + $OrderSn['Money'];
422 //配置 422 //配置
423 $config = [ 423 $config = [
424 'app_id' => 'wx6a9080f20326f817', 424 'app_id' => 'wx6a9080f20326f817',
@@ -433,7 +433,7 @@ class Common extends Api @@ -433,7 +433,7 @@ class Common extends Api
433 try { 433 try {
434 $result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney * 100); // 总金额 100, 退款 80,操作员:商户号 434 $result = $app->refund->byTransactionId($PayOrderInfo['WeChatOrder'], $PayOrderInfo['PayOrder'], $PayOrderInfo['money'] * 100, $TuiMoney * 100); // 总金额 100, 退款 80,操作员:商户号
435 //更改订单状态为已退款 435 //更改订单状态为已退款
436 - Db::name('pay_order')->where('OrderSn', $OrderSn)->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]); 436 + Db::name('pay_order')->where('OrderSn', $OrderSn['OrderSn'])->where('PayOrder', $PayOrderInfo['PayOrder'])->update(['type' => 0]);
437 } catch (Exception $e) { 437 } catch (Exception $e) {
438 $e->getMessage(); 438 $e->getMessage();
439 } 439 }