更新种养殖户统计
This commit is contained in:
parent
637047894e
commit
f363de8995
@ -109,11 +109,11 @@ class Statistics extends BaseController
|
||||
if (isset($parmas['keyword']) && $parmas['keyword'] != '') {
|
||||
$where[] = ['store_name', 'like', '%' . $parmas['keyword'] . '%'];
|
||||
}
|
||||
$count=Db::name('store_product')->where($where)->count();
|
||||
$count = Db::name('store_product')->where($where)->count();
|
||||
$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,'count'=>$count]);
|
||||
return app('json')->success(['page' => $parmas['page'], 'data' => $list, 'count' => $count]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,7 +149,7 @@ class Statistics extends BaseController
|
||||
if (!isset($parmas['goods_id']) || $parmas['goods_id'] == '') {
|
||||
return app('json')->fail('goods_id:格式错误');
|
||||
}
|
||||
$mer_id=Db::name('merchant_intention')->where('mer_intention_id', $parmas['mer_intention_id'])->value('mer_id');
|
||||
$mer_id = Db::name('merchant_intention')->where('mer_intention_id', $parmas['mer_intention_id'])->value('mer_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];
|
||||
@ -231,7 +231,7 @@ class Statistics extends BaseController
|
||||
// return app('json')->fail('type:格式错误');
|
||||
// }
|
||||
$area[] = ['street_id', 'in', explode(',', $parmas['responsible_area'])];
|
||||
$area[] = ['type_id', '=',17];
|
||||
$area[] = ['type_id', '=', 17];
|
||||
|
||||
$merchant = Db::name('merchant')->where($area)->column('mer_id');
|
||||
if (!$merchant) {
|
||||
@ -262,17 +262,52 @@ class Statistics extends BaseController
|
||||
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){
|
||||
$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]);
|
||||
$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]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询镇农科公司负责片区内的种养殖商户和供应链商户交易额
|
||||
*暂无种养殖商户分类
|
||||
*/
|
||||
public function SupplyChainVillageBreedingPriceCount()
|
||||
{
|
||||
$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['village']) || $parmas['village'] == '') {
|
||||
return app('json')->fail('village:格式错误');
|
||||
}
|
||||
$village_id = Db::name('geo_village')->where('village_code', $parmas['village'])->value('village_id');
|
||||
$merchant_category_id = Db::name('merchant_category')->where('code', 'zhongyangzhi')->value('merchant_category_id');
|
||||
$area[] = ['village_id', '=', $village_id];
|
||||
$area[] = ['category_id', '=', $merchant_category_id];
|
||||
|
||||
$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]);
|
||||
}
|
||||
}
|
||||
|
@ -704,6 +704,7 @@ Route::group('api/', function () {
|
||||
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('supply_chain_village_breeding_price_count', '/SupplyChainVillageBreedingPriceCount');
|
||||
Route::get('store_order_user_trade_amount', '/StoreOrderUserTradeAmount');
|
||||
})->prefix('api.Statistics');
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user