diff --git a/app/controller/api/Statistics.php b/app/controller/api/Statistics.php index 0024509b..44a8a1f1 100644 --- a/app/controller/api/Statistics.php +++ b/app/controller/api/Statistics.php @@ -391,14 +391,17 @@ class Statistics extends BaseController } else { $where[] = ['p.source', '=', 0]; } - - $mer_id = Db::name('merchant_intention')->where('mer_intention_id', $parmas['mer_intention_id'])->value('mer_id'); + $merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find(); + if (empty($merchant) || $merchant['type_id'] == 17) { + return app('json')->success(); + } + $mer_id = $merchant['mer_id']; $where[] = ['p.is_refund', '=', 0]; $count = Db::name('store_order_product')->alias('p') ->where($where) ->join('store_order o', 'o.mer_id=' . $mer_id . ' and o.paid=1 and o.is_del=0') ->sum('p.total_price'); - $merName = Merchant::where('mer_id', $mer_id)->value('mer_name'); + $merName = $merchant('mer_name'); return app('json')->success(compact('merName', 'count')); } }