This commit is contained in:
mkm 2023-10-20 18:57:29 +08:00
parent b1fdc7fa10
commit 0a247681fb
2 changed files with 11 additions and 14 deletions

View File

@ -186,28 +186,24 @@ class Statistics extends BaseController
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') { if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
return app('json')->fail('end_time:格式错误'); return app('json')->fail('end_time:格式错误');
} }
if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') {
return app('json')->fail('mer_intention_id:格式错误');
}
if (!isset($parmas['goods_id']) || $parmas['goods_id'] == '') { if (!isset($parmas['goods_id']) || $parmas['goods_id'] == '') {
return app('json')->fail('goods_id:格式错误'); return app('json')->fail('goods_id:格式错误');
} }
if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') { // if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') {
$area[] = ['street_id','in',explode(',', $parmas['responsible_area'])]; // $area[] = ['street_id','in',explode(',', $parmas['responsible_area'])];
}else{ // }else{
return app('json')->fail('responsible_area:格式错误'); // return app('json')->fail('responsible_area:格式错误');
} // }
$merchant=Db::name('merchant')->where('street_id','in',$area)->select(); // $merchant=Db::name('merchant')->where('street_id','in',$area)->select();
if(!$merchant){ // if(!$merchant){
return app('json')->fail('responsible_area:格式错误'); // return app('json')->fail('查询商户为空');
// }
}
$where[]=['p.create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]]; $where[]=['p.create_time','between time',[date("Y-m-d H:i:s",$parmas['start_time']),date("Y-m-d H:i:s",$parmas['end_time'])]];
$where[] = ['p.product_id','in',explode(',', $parmas['goods_id'])]; $where[] = ['p.product_id','in',explode(',', $parmas['goods_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 in '.$parmas['mer_intention_id'].' and o.paid=1 and o.is_del=0') // ->join('store_order o','o.mer_id in '.$parmas['mer_intention_id'].' and o.paid=1 and o.is_del=0')
->sum('p.total_price'); ->sum('p.total_price');
return app('json')->success(['procure_amount'=>$count]); return app('json')->success(['procure_amount'=>$count]);
} }

View File

@ -687,6 +687,7 @@ Route::group('api/', function () {
Route::get('supply_chain_product_stock_count', '/SupplyChainProductStockCount'); Route::get('supply_chain_product_stock_count', '/SupplyChainProductStockCount');
Route::get('product_list', '/ProductList'); Route::get('product_list', '/ProductList');
Route::get('supply_chain_product_price_count', '/SupplyChainProductPriceCount'); Route::get('supply_chain_product_price_count', '/SupplyChainProductPriceCount');
Route::get('supply_chain_street_product_price_count', '/SupplyChainStreetProductPriceCount');
})->prefix('api.Statistics'); })->prefix('api.Statistics');
//滑块验证码 //滑块验证码