优化代码

main
fengxinyhyl 10 months ago
parent 889bb0d3ab
commit 77e29185f0
  1. 15
      app/common/repositories/store/order/StoreOrderCreateRepository.php
  2. 3
      app/controller/merchant/system/Merchant.php
  3. 2
      public/mer.html
  4. 2
      public/system.html

@ -1107,6 +1107,21 @@ class StoreOrderCreateRepository extends StoreOrderRepository
} else if (isset($merchantCart['merchantCategory']['commission_rate']) && $merchantCart['merchantCategory']['commission_rate'] > 0) {
$rate = bcmul($merchantCart['merchantCategory']['commission_rate'], 100, 4);
}
$totalPrice = $merchantCart['order']['total_price'];
$ratePrice = 0;
foreach ($merchantCart['list'] as $item){
$itemRate = $rate;
if($item['productAttr']['product']['commission_rate']){
$itemRate = $item['productAttr']['product']['commission_rate'];
}
$ratePrice += round($item['total_price'] * $itemRate /100, 4);
}
if($ratePrice){
$rate = round($ratePrice/$totalPrice * 100, 4);
}
Log::info("ratePrice is {$ratePrice} and totalPrice is {$totalPrice} and rate is {$rate}");
Log::info("=====order_info merchantCart===== ".json_encode($merchantCart));
$user_address = isset($address) ? ($address['province'] . $address['city'] . $address['district'] . $address['street'] . $address['detail']) : '';
//整理订单数据
$_order = [

@ -88,6 +88,7 @@ class Merchant extends BaseController
'mini_banner',
'mer_keyword',
'mer_address',
'mer_pics',
'long',
'lat',
['delivery_way',[2]],
@ -101,6 +102,7 @@ class Merchant extends BaseController
'mer_certificate' => $data['mer_certificate']
], $this->request->merId());
unset($data['mer_certificate']);
$data['mer_pics'] = implode(',', $data['mer_pics']);
foreach ($data['delivery_way'] as $datum) {
if ($datum == 1) {
@ -151,6 +153,7 @@ class Merchant extends BaseController
$delivery = $repository->get($this->request->merId()) + systemConfig(['tx_map_key']);
$data = array_merge($data,$delivery);
$data['sys_bases_status'] = systemConfig('sys_bases_status') === '0' ? 0 : 1;
$data['mer_pics'] = explode(',', $data['mer_pics']);
$data['assets'] = \app(FinancialRecordRepository::class)->getMerchantStatistics(array('is_mer' => $this->request->merId()));
// $user = \app(UserRepository::class)->getUserByMerId($this->request->merId());

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save