xieruidong 2 年之前
父节点
当前提交
798eeeba69
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. 1 0
      application/admin/controller/Goods.php
  2. 8 1
      application/common/model/Refund.php

+ 1 - 0
application/admin/controller/Goods.php

@@ -254,6 +254,7 @@ class Goods extends Backend
             ->sum('num');
         $svcNum=Refund::whereBetween('create_time',$timeArr)
             ->where('goods_id',$row['id'])
+            ->filterRefund()
             ->sum('num');
         $this->assign('svcPer',$goodsNum?bcdiv($svcNum,$goodsNum)*100:0);
 

+ 8 - 1
application/common/model/Refund.php

@@ -3,12 +3,14 @@
 namespace app\common\model;
 
 use app\common\service\OrderRefundService;
+use think\db\Query;
 use think\Model;
 
 /**
  * 短信验证码
  * @property Orders orders
  * @property User user
+ * @method static static|Query FilterRefund()
  */
 class Refund Extends Model
 {
@@ -145,7 +147,12 @@ class Refund Extends Model
 
 
 
-
+    /**
+     * 售后中及已售后的
+     */
+    public function scopeFilterRefund(Query $query){
+        $query->whereBetween("{$this->getTable()}.refund_status",[self::REFUND_ING,self::REFUND_PASS]);
+    }