更新
This commit is contained in:
parent
44aef5f3fa
commit
f099acb853
@ -34,14 +34,14 @@ class Statistics extends BaseController
|
||||
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||
return app('json')->fail('end_time:格式错误');
|
||||
}
|
||||
$where[]=['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[] = ['create_time', 'between time', [date("Y-m-d H:i:s", $parmas['start_time']), date("Y-m-d H:i:s", $parmas['end_time'])]];
|
||||
if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') {
|
||||
$where[] = [$type,'in',explode(',', $parmas['responsible_area'])];
|
||||
$where[] = [$type, 'in', explode(',', $parmas['responsible_area'])];
|
||||
}
|
||||
$where[]=['is_del','=',0];
|
||||
$where[]=['status','=',1];
|
||||
$count=Db::name('merchant')->where($where)->count();
|
||||
return app('json')->success(['count'=>$count]);
|
||||
$where[] = ['is_del', '=', 0];
|
||||
$where[] = ['status', '=', 1];
|
||||
$count = Db::name('merchant')->where($where)->count();
|
||||
return app('json')->success(['count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,14 +60,14 @@ class Statistics extends BaseController
|
||||
if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') {
|
||||
return app('json')->fail('mer_intention_id:格式错误');
|
||||
}
|
||||
$where[]=['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[] = ['mer_id','=',$parmas['mer_intention_id']];
|
||||
$where[]=['mer_status','=',1];
|
||||
$where[]=['status','=',1];
|
||||
$where[]=['is_used','=',1];
|
||||
$where[]=['is_show','=',1];
|
||||
$count=Db::name('store_product')->where($where)->count();
|
||||
return app('json')->success(['count'=>$count]);
|
||||
$where[] = ['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[] = ['mer_id', '=', $parmas['mer_intention_id']];
|
||||
$where[] = ['mer_status', '=', 1];
|
||||
$where[] = ['status', '=', 1];
|
||||
$where[] = ['is_used', '=', 1];
|
||||
$where[] = ['is_show', '=', 1];
|
||||
$count = Db::name('store_product')->where($where)->count();
|
||||
return app('json')->success(['count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,33 +86,33 @@ class Statistics extends BaseController
|
||||
if (!isset($parmas['mer_intention_id']) || $parmas['mer_intention_id'] == '') {
|
||||
return app('json')->fail('mer_intention_id:格式错误');
|
||||
}
|
||||
$where[]=['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[] = ['mer_id','=',$parmas['mer_intention_id']];
|
||||
$count=Db::name('store_product_stock')->where($where)->count();
|
||||
return app('json')->success(['count'=>$count]);
|
||||
$where[] = ['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[] = ['mer_id', '=', $parmas['mer_intention_id']];
|
||||
$count = Db::name('store_product_stock')->where($where)->count();
|
||||
return app('json')->success(['count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
public function ProductList(){
|
||||
public function ProductList()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
|
||||
if (!isset($parmas['page']) || $parmas['page'] == '') {
|
||||
return app('json')->fail('page:格式错误');
|
||||
}
|
||||
$where[]=['mer_status','=',1];
|
||||
$where[]=['status','=',1];
|
||||
$where[]=['is_used','=',1];
|
||||
$where[]=['is_show','=',1];
|
||||
if (isset($parmas['keyword']) &&$parmas['keyword'] != '') {
|
||||
$where[] = ['store_name','like','%'.$parmas['keyword'].'%'];
|
||||
$where[] = ['mer_status', '=', 1];
|
||||
$where[] = ['status', '=', 1];
|
||||
$where[] = ['is_used', '=', 1];
|
||||
$where[] = ['is_show', '=', 1];
|
||||
if (isset($parmas['keyword']) && $parmas['keyword'] != '') {
|
||||
$where[] = ['store_name', 'like', '%' . $parmas['keyword'] . '%'];
|
||||
}
|
||||
$list=Db::name('store_product')->where($where)->page($parmas['page'])
|
||||
->field('product_id,store_name,image,price')
|
||||
->limit(10)->select();
|
||||
return app('json')->success(['page'=>$parmas['page'],'data'=>$list]);
|
||||
|
||||
$list = Db::name('store_product')->where($where)->page($parmas['page'])
|
||||
->field('product_id,store_name,image,price')
|
||||
->limit(10)->select();
|
||||
return app('json')->success(['page' => $parmas['page'], 'data' => $list]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -124,17 +124,17 @@ class Statistics extends BaseController
|
||||
if (isset($parmas['type']) && $parmas['type'] != '') {
|
||||
switch ($parmas['type']) {
|
||||
case 200:
|
||||
$where[] = ['p.source','=',200];
|
||||
$where[] = ['p.source', '=', 200];
|
||||
break;
|
||||
case 300:
|
||||
$where[] = ['p.source','=',300];
|
||||
$where[] = ['p.source', '=', 300];
|
||||
break;
|
||||
default:
|
||||
return app('json')->fail('type:格式错误');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$where[] = ['p.source','=',0];
|
||||
$where[] = ['p.source', '=', 0];
|
||||
}
|
||||
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||
return app('json')->fail('start_time:格式错误');
|
||||
@ -149,17 +149,17 @@ class Statistics extends BaseController
|
||||
return app('json')->fail('goods_id:格式错误');
|
||||
}
|
||||
|
||||
$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.is_refund','=',0];
|
||||
$count=Db::name('store_order_product')->alias('p')
|
||||
->where($where)
|
||||
->join('store_order o','o.mer_id='.$parmas['mer_intention_id'].' and o.paid=1 and o.is_del=0')
|
||||
->sum('p.total_price');
|
||||
return app('json')->success(['procure_amount'=>$count]);
|
||||
$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.is_refund', '=', 0];
|
||||
$count = Db::name('store_order_product')->alias('p')
|
||||
->where($where)
|
||||
->join('store_order o', 'o.mer_id=' . $parmas['mer_intention_id'] . ' and o.paid=1 and o.is_del=0')
|
||||
->sum('p.total_price');
|
||||
return app('json')->success(['procure_amount' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 镇一般商户采购金额和销售金额统计
|
||||
*/
|
||||
public function SupplyChainStreetProductPriceCount()
|
||||
@ -168,17 +168,17 @@ class Statistics extends BaseController
|
||||
if (isset($parmas['type']) && $parmas['type'] != '') {
|
||||
switch ($parmas['type']) {
|
||||
case 200:
|
||||
$where[] = ['p.source','=',200];
|
||||
$where[] = ['p.source', '=', 200];
|
||||
break;
|
||||
case 300:
|
||||
$where[] = ['p.source','=',300];
|
||||
$where[] = ['p.source', '=', 300];
|
||||
break;
|
||||
default:
|
||||
return app('json')->fail('type:格式错误');
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$where[] = ['p.source','=',0];
|
||||
$where[] = ['p.source', '=', 0];
|
||||
}
|
||||
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||
return app('json')->fail('start_time:格式错误');
|
||||
@ -190,22 +190,88 @@ class Statistics extends BaseController
|
||||
return app('json')->fail('goods_id:格式错误');
|
||||
}
|
||||
if (isset($parmas['responsible_area']) && $parmas['responsible_area'] != '') {
|
||||
$area[] = ['street_id','in',explode(',', $parmas['responsible_area'])];
|
||||
}else{
|
||||
$area[] = ['street_id', 'in', explode(',', $parmas['responsible_area'])];
|
||||
} else {
|
||||
return app('json')->fail('responsible_area:格式错误');
|
||||
}
|
||||
$merchant=Db::name('merchant')->where($area)->column('mer_id');
|
||||
if(!$merchant){
|
||||
$merchant = Db::name('merchant')->where($area)->column('mer_id');
|
||||
if (!$merchant) {
|
||||
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.product_id','in',explode(',', $parmas['goods_id'])];
|
||||
$where[] = ['p.is_refund','=',0];
|
||||
$count=Db::name('store_order_product')->alias('p')
|
||||
->where($where)
|
||||
->join('store_order o','o.mer_id in ('.implode(',',$merchant).') and o.paid=1 and o.is_del=0')
|
||||
->sum('p.total_price');
|
||||
return app('json')->success(['procure_amount'=>$count]);
|
||||
$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.is_refund', '=', 0];
|
||||
$count = Db::name('store_order_product')->alias('p')
|
||||
->where($where)
|
||||
->join('store_order o', 'o.mer_id in (' . implode(',', $merchant) . ') and o.paid=1 and o.is_del=0')
|
||||
->sum('p.total_price');
|
||||
return app('json')->success(['procure_amount' => $count]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询镇农科公司负责片区内的种养殖商户和供应链商户交易额
|
||||
*暂无种养殖商户分类
|
||||
*/
|
||||
public function SupplyChainBreedingStreetProductCount()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
|
||||
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||
return app('json')->fail('start_time:格式错误');
|
||||
}
|
||||
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||
return app('json')->fail('end_time:格式错误');
|
||||
}
|
||||
if (!isset($parmas['responsible_area']) || $parmas['responsible_area'] == '') {
|
||||
return app('json')->fail('responsible_area:格式错误');
|
||||
}
|
||||
// if (!isset($parmas['type']) || $parmas['type'] == '') {
|
||||
// return app('json')->fail('type:格式错误');
|
||||
// }
|
||||
$area[] = ['street_id', 'in', explode(',', $parmas['responsible_area'])];
|
||||
$area[] = ['type_id', '=',17];
|
||||
|
||||
$merchant = Db::name('merchant')->where($area)->column('mer_id');
|
||||
if (!$merchant) {
|
||||
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.is_refund', '=', 0];
|
||||
$count = Db::name('store_order_product')->alias('p')
|
||||
->where($where)
|
||||
->join('store_order o', 'o.mer_id in (' . implode(',', $merchant) . ') and o.paid=1 and o.is_del=0')
|
||||
->sum('p.total_price');
|
||||
return app('json')->success(['trade_amount' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询手机号用户的交易金额
|
||||
*/
|
||||
public function StoreOrderUserTradeAmount()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
|
||||
if (!isset($parmas['start_time']) || $parmas['start_time'] == '') {
|
||||
return app('json')->fail('start_time:格式错误');
|
||||
}
|
||||
if (!isset($parmas['end_time']) || $parmas['end_time'] == '') {
|
||||
return app('json')->fail('end_time:格式错误');
|
||||
}
|
||||
if (!isset($parmas['phone']) || $parmas['phone'] == '') {
|
||||
return app('json')->fail('phone:格式错误');
|
||||
}
|
||||
$user_id= Db::name('user')->where('account',$parmas['phone'])->value('uid');
|
||||
if(!$user_id){
|
||||
return app('json')->fail('查询的手机号用户不存在');
|
||||
}
|
||||
$where[]=['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[]=['paid','=',1];
|
||||
$where[]=['status','<>',-1];
|
||||
$where[]=['uid','=',$user_id];
|
||||
$count=Db::name('store_order')
|
||||
->where($where)
|
||||
->sum('pay_price');
|
||||
return app('json')->success(['trade_amount'=>$count]);
|
||||
}
|
||||
}
|
||||
|
@ -701,6 +701,8 @@ Route::group('api/', function () {
|
||||
Route::get('product_list', '/ProductList');
|
||||
Route::get('supply_chain_product_price_count', '/SupplyChainProductPriceCount');
|
||||
Route::get('supply_chain_street_product_price_count', '/SupplyChainStreetProductPriceCount');
|
||||
Route::get('supply_chain_breeding_street_product_count', '/SupplyChainBreedingStreetProductCount');
|
||||
Route::get('store_order_user_trade_amount', '/StoreOrderUserTradeAmount');
|
||||
})->prefix('api.Statistics');
|
||||
|
||||
//滑块验证码
|
||||
|
Loading…
x
Reference in New Issue
Block a user