更新已知问题

This commit is contained in:
evoxwht 2022-03-18 15:28:03 +08:00
parent c68d64c9a2
commit 885fe03cbb
3 changed files with 23 additions and 19 deletions

View File

@ -894,22 +894,26 @@ class StoreOrderRefundServices extends BaseServices
}
$refund_num = bcadd((string)$refund_num, (string)$cart['cart_num'], 0);
}
/** @var StoreOrderSplitServices $storeOrderSpliteServices */
$storeOrderSpliteServices = app()->make(StoreOrderSplitServices::class);
$cartInfos = $storeOrderSpliteServices->getSplitOrderCartInfo($id, $cart_ids, $order);
$total_price = $pay_postage = 0;
foreach ($cartInfos as $cart) {
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
}
$refund_pay_price = bcadd((string)$total_price, (string)$pay_postage, 2);
//订单实际支付金额
$order_pay_price = bcsub((string)bcadd((string)$order['total_price'], (string)$order['pay_postage'], 2), (string)bcadd((string)$order['deduction_price'], (string)$order['coupon_price'], 2), 2);
if ($order_pay_price != $order['pay_price'] && $refund_pay_price != $order_pay_price) {//有改价
$refund_price = bcmul((string)bcdiv((string)$order['pay_price'], (string)$order_pay_price, 4), (string)$refund_pay_price, 2);
} else {
$refund_price = $refund_pay_price;
//总共申请多少件
$total_num = array_sum(array_column($cart_ids, 'cart_num'));
if ($total_num < $order['total_num']) {
/** @var StoreOrderSplitServices $storeOrderSpliteServices */
$storeOrderSpliteServices = app()->make(StoreOrderSplitServices::class);
$cartInfos = $storeOrderSpliteServices->getSplitOrderCartInfo($id, $cart_ids, $order);
$total_price = $pay_postage = 0;
foreach ($cartInfos as $cart) {
$_info = is_string($cart['cart_info']) ? json_decode($cart['cart_info'], true) : $cart['cart_info'];
$total_price = bcadd((string)$total_price, bcmul((string)($_info['truePrice'] ?? 0), (string)$cart['cart_num'], 4), 2);
$pay_postage = bcadd((string)$pay_postage, (string)($_info['postage_price'] ?? 0), 2);
}
$refund_pay_price = bcadd((string)$total_price, (string)$pay_postage, 2);
//订单实际支付金额
$order_pay_price = bcsub((string)bcadd((string)$order['total_price'], (string)$order['pay_postage'], 2), (string)bcadd((string)$order['deduction_price'], (string)$order['coupon_price'], 2), 2);
if ($order_pay_price != $order['pay_price'] && $refund_pay_price != $order_pay_price) {//有改价
$refund_price = bcmul((string)bcdiv((string)$order['pay_price'], (string)$order_pay_price, 4), (string)$refund_pay_price, 2);
} else {
$refund_price = $refund_pay_price;
}
}
} else {
foreach ($cartInfos as $cart) {

View File

@ -187,7 +187,7 @@ class StoreCategoryServices extends BaseServices
*/
public function createData($data)
{
if ($this->dao->getOne(['cate_name' => $data['cate_name']])) {
if ($this->dao->getOne(['cate_name' => $data['cate_name'], 'pid' => $data['pid']])) {
throw new AdminException('该分类已经存在');
}
$data['add_time'] = time();
@ -203,7 +203,7 @@ class StoreCategoryServices extends BaseServices
*/
public function editData($id, $data)
{
$cate = $this->dao->getOne(['cate_name' => $data['cate_name']]);
$cate = $this->dao->getOne(['cate_name' => $data['cate_name'], 'pid' => $data['pid']]);
if ($cate && $cate['id'] != $id) {
throw new AdminException('该分类已存在');
}

View File

@ -252,7 +252,7 @@ class StoreProductServices extends BaseServices
$productInfo['give_integral'] = floatval($productInfo['give_integral']);
$productInfo['presale'] = boolval($productInfo['presale'] ?? 0);
$productInfo['vip_product'] = boolval($productInfo['vip_product'] ?? 0);
$productInfo['presale_time'] = $productInfo['presale_start_time'] == 0 ? [] : [date('Y-m-d M:i:s', $productInfo['presale_start_time']), date('Y-m-d M:i:s', $productInfo['presale_end_time'])];
$productInfo['presale_time'] = $productInfo['presale_start_time'] == 0 ? [] : [date('Y-m-d H:i:s', $productInfo['presale_start_time']), date('Y-m-d H:i:s', $productInfo['presale_end_time'])];
$productInfo['description'] = $storeDescriptionServices->getDescription(['product_id' => $id, 'type' => 0]);
$productInfo['custom_form'] = json_decode($productInfo['custom_form'], true);
/** @var StoreProductAttrServices $storeProductAttrServices */