查镇级供应链 采购/销售金额

This commit is contained in:
chenbo 2023-12-25 18:02:38 +08:00
parent 597723d90b
commit 66bfb05b8f

View File

@ -391,14 +391,17 @@ class Statistics extends BaseController
} else { } else {
$where[] = ['p.source', '=', 0]; $where[] = ['p.source', '=', 0];
} }
$merchant = Merchant::where('mer_intention_id', $parmas['mer_intention_id'])->find();
$mer_id = Db::name('merchant_intention')->where('mer_intention_id', $parmas['mer_intention_id'])->value('mer_id'); if (empty($merchant) || $merchant['type_id'] == 17) {
return app('json')->success();
}
$mer_id = $merchant['mer_id'];
$where[] = ['p.is_refund', '=', 0]; $where[] = ['p.is_refund', '=', 0];
$count = Db::name('store_order_product')->alias('p') $count = Db::name('store_order_product')->alias('p')
->where($where) ->where($where)
->join('store_order o', 'o.mer_id=' . $mer_id . ' and o.paid=1 and o.is_del=0') ->join('store_order o', 'o.mer_id=' . $mer_id . ' and o.paid=1 and o.is_del=0')
->sum('p.total_price'); ->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')); return app('json')->success(compact('merName', 'count'));
} }
} }