Commit 5cba5d0c authored by wanjilong's avatar wanjilong

add: pay_v2 to pay

parent 0d759b99
......@@ -6,5 +6,5 @@ use Api\PhpUtils\Mysql\MysqlBase;
class CallbackLog extends MysqlBase
{
const TABLE_NAME = 'callback_log';
const CONFIG_INDEX = 'pay_v2';
const CONFIG_INDEX = 'pay';
}
......@@ -7,7 +7,7 @@ use App\Exception\custom\PayException;
class PayOrder extends MysqlBase
{
const TABLE_NAME = 'pay_order';
const CONFIG_INDEX = 'pay_v2';
const CONFIG_INDEX = 'pay';
/**
* @param $order_id
......
......@@ -6,5 +6,5 @@ use Api\PhpUtils\Mysql\MysqlBase;
class PayOrderClearing extends MysqlBase
{
const TABLE_NAME = 'pay_order_clearing';
const CONFIG_INDEX = 'pay_v2';
const CONFIG_INDEX = 'pay';
}
......@@ -7,7 +7,7 @@ use App\Exception\BaseException;
class PayOrderClearingItem extends MysqlBase
{
const TABLE_NAME = 'pay_order_clearing_item';
const CONFIG_INDEX = 'pay_v2';
const CONFIG_INDEX = 'pay';
public static function marketSaleCount($accountId) {
......
......@@ -6,5 +6,5 @@ use Api\PhpUtils\Mysql\MysqlBase;
class PayOrderItem extends MysqlBase
{
const TABLE_NAME = 'pay_order_item';
const CONFIG_INDEX = 'pay_v2';
const CONFIG_INDEX = 'pay';
}
......@@ -6,5 +6,5 @@ use Api\PhpUtils\Mysql\MysqlBase;
class RefundOrder extends MysqlBase
{
const TABLE_NAME = 'refund_order';
const CONFIG_INDEX = 'pay_v2';
const CONFIG_INDEX = 'pay';
}
......@@ -1014,92 +1014,93 @@ class PayService
//商家资金需要显示商品名称
$remark = $r['goods_name'] ?? '';
if(mb_strlen($remark) > 100) {
if (mb_strlen($remark) > 100) {
$remark = mb_substr($remark, 0, 100) . '...';
}
if(!empty($r['clear_price'])) {
if (!empty($r['clear_price'])) {
$clear_payment = $r['goods_num'] * $r['clear_price'];
$platform_amount = $current_tip - $clear_payment;
if(!empty($r['clear_price'])) {
$clear_payment = $r['goods_num'] * $r['clear_price'];
} else {
$clear_payment = $current_tip;
$platform_amount = 0;
}
if (!empty($r['clear_price'])) {
$clear_payment = $r['goods_num'] * $r['clear_price'];
} else {
$clear_payment = $current_tip;
$platform_amount = 0;
}
if($platform_amount < 0) {
throw new PayException(['cus'=>12]); //结算价不能大于商家分成部分
}
if ($platform_amount < 0) {
throw new PayException(['cus' => 12]); //结算价不能大于商家分成部分
}
if ($platform_amount > 0) {
//结算价剩余部分返回平台
$platform['amount'] += $platform_amount;
$this->clear_items_list[] = [
'pay_order_clearing_item_id' => array_shift($this->gen_ids),
'pay_order_clearing_id' => $p_clearing_id,
'pay_order_id' => $this->pay_order['pay_order_id'],
'order_id' => $this->pay_order['order_id'],
'order_item_id' => $r['order_item_id'],
'account_id' => $platform['account_id'],
'account_type' => $platform['account_type'],
'pay_amount' => $platform_amount,
'clear_payment' => 0, //商品结算价格
'pay_type' => $platform['pay_type'],
'pay_sub_type' => $platform['pay_sub_type'],
'remark' => '',
];
} else {
}
if($platform_amount > 0) {
//结算价剩余部分返回平台
$platform['amount'] += $platform_amount;
$this->clear_items_list[] = [
'pay_order_clearing_item_id' => array_shift($this->gen_ids),
'pay_order_clearing_id' => $p_clearing_id,
'pay_order_clearing_id' => $m_clearing_id,
'pay_order_id' => $this->pay_order['pay_order_id'],
'order_id' => $this->pay_order['order_id'],
'order_item_id' => $r['order_item_id'],
'account_id' => $platform['account_id'],
'account_type' => $platform['account_type'],
'pay_amount' => $platform_amount,
'clear_payment' => 0, //商品结算价格
'pay_type' => $platform['pay_type'],
'pay_sub_type' => $platform['pay_sub_type'],
'remark' => '',
'account_id' => $merchant['account_id'],
'account_type' => $merchant['account_type'],
'pay_amount' => $clear_payment, //商品结算价格
'clear_payment' => 0,
'pay_type' => $merchant['pay_type'],
'pay_sub_type' => $merchant['pay_sub_type'],
'remark' => $remark,
];
$merchant['amount'] += $clear_payment;
} else{}
//收集金额用于分拆计算
$cleared_amount += $r['payment'];
$cleared_tip += $current_tip;
}
$this->clear_items_list[] = [
'pay_order_clearing_item_id' => array_shift($this->gen_ids),
//商户收益
$this->clear_list[] = [
'pay_order_clearing_id' => $m_clearing_id,
'pay_order_id' => $this->pay_order['pay_order_id'],
'order_id' => $this->pay_order['order_id'],
'order_item_id' => $r['order_item_id'],
'account_id' => $merchant['account_id'],
'account_type' => $merchant['account_type'],
'pay_amount' => $clear_payment, //商品结算价格
'clear_payment' => 0,
'pay_amount' => $merchant['amount'],
'pay_type' => $merchant['pay_type'],
'pay_sub_type' => $merchant['pay_sub_type'],
'remark' => $remark,
];
$merchant['amount'] += $clear_payment;
//收集金额用于分拆计算
$cleared_amount += $r['payment'];
$cleared_tip += $current_tip;
}
//商户收益
$this->clear_list[] = [
'pay_order_clearing_id' => $m_clearing_id,
'pay_order_id' => $this->pay_order['pay_order_id'],
'order_id' => $this->pay_order['order_id'],
'account_id' => $merchant['account_id'],
'account_type' => $merchant['account_type'],
'pay_amount' => $merchant['amount'],
'pay_type' => $merchant['pay_type'],
'pay_sub_type' => $merchant['pay_sub_type'],
];
//结算价格收益返回平台
if($platform['amount'] > 0) {
$this->clear_list[] = [
'pay_order_clearing_id' => $p_clearing_id,
'pay_order_id' => $this->pay_order['pay_order_id'],
'order_id' => $this->pay_order['order_id'],
'account_id' => $platform['account_id'],
'account_type' => $platform['account_type'],
'pay_amount' => $platform['amount'],
'pay_type' => $platform['pay_type'],
'pay_sub_type' => $platform['pay_sub_type'],
];
//结算价格收益返回平台
if ($platform['amount'] > 0) {
$this->clear_list[] = [
'pay_order_clearing_id' => $p_clearing_id,
'pay_order_id' => $this->pay_order['pay_order_id'],
'order_id' => $this->pay_order['order_id'],
'account_id' => $platform['account_id'],
'account_type' => $platform['account_type'],
'pay_amount' => $platform['amount'],
'pay_type' => $platform['pay_type'],
'pay_sub_type' => $platform['pay_sub_type'],
];
}
}
return $merchant_cash;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment