xieruidong 2 years ago
parent
commit
f5cde29fbf
2 changed files with 25 additions and 0 deletions
  1. 22 0
      application/common/model/Admin.php
  2. 3 0
      application/common/service/OrderService.php

+ 22 - 0
application/common/model/Admin.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+/**
+ */
+class Admin extends Model
+{
+    /**
+     * @param $amount
+     * @return int|string
+     */
+    public static function getCmn($amount){
+        $per=config('site.manager_commission_per')?:0;
+        if($per<=0){
+            return 0;
+        }
+        return bcmul($amount,$per/100);
+    }
+}

+ 3 - 0
application/common/service/OrderService.php

@@ -1,6 +1,7 @@
 <?php
 namespace app\common\service;
 
+use app\common\model\Admin;
 use app\common\model\GoodsCart;
 use app\common\model\GoodsSku;
 use app\common\model\User;
@@ -213,6 +214,7 @@ class OrderService extends BaseService {
             $goods['amount_total']=bcadd($goods['amount_total'],$goods['amount_install']);
             $goods['amount_pay']=bcAddAll($goods['amount_goods_real'],$goods['amount_install']);
             $goods['amount_discount']=bcAddAll($goods['amount_coupon'],$goods['amount_coupon_kill'],$goods['amount_coupon_level']);
+            $goods['amount_cmn']=Admin::getCmn($goods['amount_pay']);
 
             $info['amount_pay']=bcadd($info['amount_pay'],$goods['amount_pay']);
             $info['amount_total']=bcadd($info['amount_total'],$goods['amount_total']);
@@ -221,6 +223,7 @@ class OrderService extends BaseService {
             $info['amount_coupon_level']=bcadd($info['amount_coupon_level'],$goods['amount_coupon_level']);
             $info['amount_install']=bcadd($info['amount_install'],$goods['amount_install']);
             $info['amount_discount']=bcadd($info['amount_discount'],$goods['amount_discount']);
+            $info['amount_cmn']=bcadd($info['amount_cmn'],$goods['amount_cmn']);
         }
         if($this->coupon_use && !$injectCoupon){
             $this->error('优惠券不符合使用规则');