This commit is contained in:
彭桃 2023-02-14 20:28:12 +08:00
parent cf81c9f4eb
commit 707f0eaf31

View File

@ -755,23 +755,30 @@ class Statistics extends BaseController
public function get_num17($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['a.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['a.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['a.village_id', '=', $village_id];
}
$return = [
['value'=>835,'name'=>'萝卜'],
['value'=>124,'name'=>'白菜'],
['value'=>187,'name'=>'芋头'],
['value'=>251,'name'=>'地瓜'],
['value'=>902,'name'=>'土豆'],
['value'=>214,'name'=>'山药'],
];
$return = Db::connect('shop')->table('eb_product_order_log')->alias('a')
->join('eb_store_product b','a.product_id = b.product_id')
->where($where)
->group('a.product_id')
->field("count('a.id') as value ,b.store_name as name")
->order('value desc')
->limit('6')
->select();
// $return = [
// ['value'=>835,'name'=>'萝卜'],
// ['value'=>124,'name'=>'白菜'],
// ['value'=>187,'name'=>'芋头'],
// ['value'=>251,'name'=>'地瓜'],
// ['value'=>902,'name'=>'土豆'],
// ['value'=>214,'name'=>'山药'],
// ];
$this->apiSuccess('获取成功',$return);
}
@ -873,197 +880,54 @@ class Statistics extends BaseController
public function get_num21($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['a.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['a.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['a.village_id', '=', $village_id];
}
$return = [
[
'name'=>'萝卜',
'demand'=>7852,
'minnum'=>
[['month'=>'1月','value'=>'661'],
['month'=>'2月','value'=>'356'],
['month'=>'3月','value'=>'415'],
['month'=>'4月','value'=>'258'],
['month'=>'5月','value'=>'779'],
['month'=>'6月','value'=>'1465'],
['month'=>'7月','value'=>'668'],
['month'=>'8月','value'=>'571'],
['month'=>'9月','value'=>'498'],
['month'=>'10月','value'=>'587'],
['month'=>'11月','value'=>'881'],
['month'=>'12月','value'=>'1008']],
'maxnum'=>
[['month'=>'1月','value'=>'879'],
['month'=>'2月','value'=>'521'],
['month'=>'3月','value'=>'754'],
['month'=>'4月','value'=>'369'],
['month'=>'5月','value'=>'916'],
['month'=>'6月','value'=>'1874'],
['month'=>'7月','value'=>'837'],
['month'=>'8月','value'=>'667'],
['month'=>'9月','value'=>'547'],
['month'=>'10月','value'=>'741'],
['month'=>'11月','value'=>'983'],
['month'=>'12月','value'=>'1150']],
],
[
'name'=>'白菜',
'demand'=>8869,
'minnum'=>
[['month'=>'1月','value'=>'123'],
['month'=>'2月','value'=>'456'],
['month'=>'3月','value'=>'789'],
['month'=>'4月','value'=>'147'],
['month'=>'5月','value'=>'258'],
['month'=>'6月','value'=>'369'],
['month'=>'7月','value'=>'159'],
['month'=>'8月','value'=>'267'],
['month'=>'9月','value'=>'367'],
['month'=>'10月','value'=>'541'],
['month'=>'11月','value'=>'354'],
['month'=>'12月','value'=>'897']],
'maxnum'=>
[['month'=>'1月','value'=>'879'],
['month'=>'2月','value'=>'897'],
['month'=>'3月','value'=>'1053'],
['month'=>'4月','value'=>'354'],
['month'=>'5月','value'=>'535'],
['month'=>'6月','value'=>'774'],
['month'=>'7月','value'=>'337'],
['month'=>'8月','value'=>'410'],
['month'=>'9月','value'=>'468'],
['month'=>'10月','value'=>'600'],
['month'=>'11月','value'=>'883'],
['month'=>'12月','value'=>'1100']],
],
[
'name'=>'芋头',
'demand'=>2356,
'minnum'=>
[['month'=>'1月','value'=>'245'],
['month'=>'2月','value'=>'245'],
['month'=>'3月','value'=>'411'],
['month'=>'4月','value'=>'246'],
['month'=>'5月','value'=>'631'],
['month'=>'6月','value'=>'1234'],
['month'=>'7月','value'=>'546'],
['month'=>'8月','value'=>'246'],
['month'=>'9月','value'=>'356'],
['month'=>'10月','value'=>'466'],
['month'=>'11月','value'=>'744'],
['month'=>'12月','value'=>'998']],
'maxnum'=>
[['month'=>'1月','value'=>'879'],
['month'=>'2月','value'=>'511'],
['month'=>'3月','value'=>'754'],
['month'=>'4月','value'=>'469'],
['month'=>'5月','value'=>'916'],
['month'=>'6月','value'=>'1474'],
['month'=>'7月','value'=>'887'],
['month'=>'8月','value'=>'710'],
['month'=>'9月','value'=>'678'],
['month'=>'10月','value'=>'854'],
['month'=>'11月','value'=>'983'],
['month'=>'12月','value'=>'1005']],
],
[
'name'=>'地瓜',
'demand'=>3641,
'minnum'=>
[['month'=>'1月','value'=>'255'],
['month'=>'2月','value'=>'324'],
['month'=>'3月','value'=>'124'],
['month'=>'4月','value'=>'235'],
['month'=>'5月','value'=>'364'],
['month'=>'6月','value'=>'688'],
['month'=>'7月','value'=>'678'],
['month'=>'8月','value'=>'471'],
['month'=>'9月','value'=>'468'],
['month'=>'10月','value'=>'510'],
['month'=>'11月','value'=>'789'],
['month'=>'12月','value'=>'986']],
'maxnum'=>
[['month'=>'1月','value'=>'899'],
['month'=>'2月','value'=>'531'],
['month'=>'3月','value'=>'759'],
['month'=>'4月','value'=>'569'],
['month'=>'5月','value'=>'946'],
['month'=>'6月','value'=>'1474'],
['month'=>'7月','value'=>'737'],
['month'=>'8月','value'=>'610'],
['month'=>'9月','value'=>'538'],
['month'=>'10月','value'=>'700'],
['month'=>'11月','value'=>'911'],
['month'=>'12月','value'=>'1050']],
],
[
'name'=>'土豆',
'demand'=>5345,
'minnum'=>
[['month'=>'1月','value'=>'468'],
['month'=>'2月','value'=>'315'],
['month'=>'3月','value'=>'409'],
['month'=>'4月','value'=>'268'],
['month'=>'5月','value'=>'756'],
['month'=>'6月','value'=>'1126'],
['month'=>'7月','value'=>'641'],
['month'=>'8月','value'=>'552'],
['month'=>'9月','value'=>'483'],
['month'=>'10月','value'=>'568'],
['month'=>'11月','value'=>'821'],
['month'=>'12月','value'=>'896']],
'maxnum'=>
[['month'=>'1月','value'=>'879'],
['month'=>'2月','value'=>'551'],
['month'=>'3月','value'=>'756'],
['month'=>'4月','value'=>'389'],
['month'=>'5月','value'=>'946'],
['month'=>'6月','value'=>'1474'],
['month'=>'7月','value'=>'847'],
['month'=>'8月','value'=>'720'],
['month'=>'9月','value'=>'668'],
['month'=>'10月','value'=>'830'],
['month'=>'11月','value'=>'993'],
['month'=>'12月','value'=>'1260']],
],
[
'name'=>'山药',
'demand'=>6548,
'minnum'=>
[['month'=>'1月','value'=>'578'],
['month'=>'2月','value'=>'316'],
['month'=>'3月','value'=>'409'],
['month'=>'4月','value'=>'249'],
['month'=>'5月','value'=>'789'],
['month'=>'6月','value'=>'1420'],
['month'=>'7月','value'=>'647'],
['month'=>'8月','value'=>'561'],
['month'=>'9月','value'=>'478'],
['month'=>'10月','value'=>'513'],
['month'=>'11月','value'=>'841'],
['month'=>'12月','value'=>'889']],
'maxnum'=>
[['month'=>'1月','value'=>'889'],
['month'=>'2月','value'=>'531'],
['month'=>'3月','value'=>'774'],
['month'=>'4月','value'=>'569'],
['month'=>'5月','value'=>'910'],
['month'=>'6月','value'=>'1574'],
['month'=>'7月','value'=>'857'],
['month'=>'8月','value'=>'740'],
['month'=>'9月','value'=>'648'],
['month'=>'10月','value'=>'810'],
['month'=>'11月','value'=>'983'],
['month'=>'12月','value'=>'1241']],
],
];
$return = Db::connect('shop')->table('eb_product_order_log')->alias('a')
->join('eb_store_product b','a.product_id = b.product_id')
->where ($where)
->group('a.product_id')
->field("count('a.id') as value ,b.store_name as name,price,ot_price")
->order('value desc')
->select()
->toarray();
foreach ($return as $k =>$v){
$return[$k]['demand'] = '';
$return[$k]['minnum'] = [
['month'=>'1月','value'=>0],
['month'=>'2月','value'=>$v['price']],
['month'=>'3月','value'=>0],
['month'=>'4月','value'=>0],
['month'=>'5月','value'=>0],
['month'=>'6月','value'=>0],
['month'=>'7月','value'=>0],
['month'=>'8月','value'=>0],
['month'=>'9月','value'=>0],
['month'=>'10月','value'=>0],
['month'=>'11月','value'=>0],
['month'=>'12月','value'=>0]
];
$return[$k]['maxnum'] = [
['month'=>'1月','value'=>0],
['month'=>'2月','value'=>$v['ot_price']],
['month'=>'3月','value'=>0],
['month'=>'4月','value'=>0],
['month'=>'5月','value'=>0],
['month'=>'6月','value'=>0],
['month'=>'7月','value'=>0],
['month'=>'8月','value'=>0],
['month'=>'9月','value'=>0],
['month'=>'10月','value'=>0],
['month'=>'11月','value'=>0],
['month'=>'12月','value'=>0]
];
}
$this->apiSuccess('获取成功',$return);
}
@ -1072,22 +936,52 @@ class Statistics extends BaseController
public function get_num22($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['s.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['s.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['s.village_id', '=', $village_id];
}
$m_7=Db::connect('shop')->table('eb_merchant_address')
->alias('s')
->where($where)
->join(['eb_merchant'=>'m'],'s.mer_id=m.mer_id and type_id=7')
->count();
$m_6=Db::connect('shop')->table('eb_merchant_address')
->alias('s')
->where($where)
->join(['eb_merchant'=>'m'],'s.mer_id=m.mer_id and type_id=6')
->count();
$m_5=Db::connect('shop')->table('eb_merchant_address')
->alias('s')
->where($where)
->join(['eb_merchant'=>'m'],'s.mer_id=m.mer_id and type_id=5')
->count();
$m_4=Db::connect('shop')->table('eb_merchant_address')
->alias('s')
->where($where)
->join(['eb_merchant'=>'m'],'s.mer_id=m.mer_id and type_id=4')
->count();
$m_3=Db::connect('shop')->table('eb_merchant_address')
->alias('s')
->where($where)
->join(['eb_merchant'=>'m'],'s.mer_id=m.mer_id and type_id=3')
->count();
$m_2=Db::connect('shop')->table('eb_merchant_address')
->alias('s')
->where($where)
->join(['eb_merchant'=>'m'],'s.mer_id=m.mer_id and type_id=2')
->count();
$return = [
['value'=>50,'name'=>'养鸡'],
['value'=>48,'name'=>'养鸭'],
['value'=>28,'name'=>'养鹅'],
['value'=>10,'name'=>'养羊'],
['value'=>8,'name'=>'养虾'],
['value'=>30,'name'=>'养鱼'],
['value'=>$m_7,'name'=>'种植企业'],
['value'=>$m_6,'name'=>'养殖企业'],
['value'=>$m_5,'name'=>'加工企业'],
['value'=>$m_2,'name'=>'厂家直销'],
['value'=>$m_4,'name'=>'个人小店'],
['value'=>$m_3,'name'=>'旗舰店'],
];
$this->apiSuccess('获取成功',$return);
}
@ -1104,19 +998,60 @@ class Statistics extends BaseController
if ($village_id){
$where[] = ['village_id', '=', $village_id];
}
$where[] = ['mer_type_id', '=', 6];
$m_1=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_2=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_3=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_4=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_5=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_6=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_7=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_8=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_9=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_10=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_11=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_12=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$return = [
[
'name'=>'鸡',
'data'=>[1200,2000,1800,1560,1896,2100,1952,1635,1874,2011,1921,1932]
],
[
'name'=>'鸭',
'data'=> [1124,1567,1800,1304,1596,2020,2158,1678,1999,1206,1479,2214]
],
[
'name'=>'鹅',
'data'=> [1323,756,1346,886,896,1100,952,635,874,1411,921,932]
'name'=>'产量',
'data'=> [$m_1,$m_2,$m_3,$m_4,$m_5,$m_6,$m_7,$m_8,$m_9,$m_10,$m_11,$m_12]
]
];
$this->apiSuccess('获取成功',$return);
@ -1134,11 +1069,12 @@ class Statistics extends BaseController
if ($village_id){
$where[] = ['village_id', '=', $village_id];
}
$where[] = ['mer_type_id', '=', 7];
$m=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->count();
$return = [
['name' => '鸡','value'=>40],
['name' => '鸭','value'=>50],
['name' => '鹅','value'=>10],
['name' => '种植','value'=>$m],
];
$this->apiSuccess('获取成功',$return);
}
@ -1148,29 +1084,38 @@ class Statistics extends BaseController
public function get_num25($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['a.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['a.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['a.village_id', '=', $village_id];
}
$return['data'] = [
['name' => '土豆','value'=>90,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z5.png'],
['name' => '番茄','value'=>34,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z1.png'],
['name' => '红薯','value'=>64,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z2.png'],
['name' => '山药','value'=>15,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z4.png'],
['name' => '白菜','value'=>78,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z3.png'],
];
$return['img'] = [
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z5.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z1.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z2.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z4.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z3.png',
];
$return['data'] = Db::connect('shop')->table('eb_product_order_log')->alias('a')
->join('eb_store_product b','a.product_id = b.product_id')
->where($where)
->group('a.product_id')
->field("count('a.id') as value ,b.store_name as name,image as img")
->order('value desc')
->limit('5')
->select()
->toarray();
$return['img'] = array_column($return['data'],'img');
// $return['data'] = [
// ['name' => '土豆','value'=>90,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z5.png'],
// ['name' => '番茄','value'=>34,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z1.png'],
// ['name' => '红薯','value'=>64,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z2.png'],
// ['name' => '山药','value'=>15,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z4.png'],
// ['name' => '白菜','value'=>78,'img'=>'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z3.png'],
// ];
// $return['img'] = [
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z5.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z1.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z2.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z4.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/z3.png',
// ];
$this->apiSuccess('获取成功',$return);
}
@ -1179,28 +1124,37 @@ class Statistics extends BaseController
public function get_num26($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['a.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['a.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['a.village_id', '=', $village_id];
}
$return = [
['value'=>3.50,'name'=>'黄瓜'],
['value'=>1.60,'name'=>'白萝卜'],
['value'=>2.30,'name'=>'茄子'],
['value'=>3.50,'name'=>'西红柿'],
['value'=>4.50,'name'=>'长豆角'],
['value'=>2.10,'name'=>'土豆'],
['value'=>2.10,'name'=>'胡萝卜'],
];
$return['data'] = Db::connect('shop')->table('eb_product_order_log')->alias('a')
->join('eb_store_product b','a.product_id = b.product_id')
->where($where)
->group('a.product_id')
->field("b.store_name as name,price")
->limit('7')
->select()
->toarray();
// $return = [
// ['value'=>3.50,'name'=>'黄瓜'],
// ['value'=>1.60,'name'=>'白萝卜'],
// ['value'=>2.30,'name'=>'茄子'],
// ['value'=>3.50,'name'=>'西红柿'],
// ['value'=>4.50,'name'=>'长豆角'],
// ['value'=>2.10,'name'=>'土豆'],
// ['value'=>2.10,'name'=>'胡萝卜'],
// ];
$this->apiSuccess('获取成功',$return);
}
//新农产品市场行情
//镇公司农产品市场行情
public function get_num27($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
@ -1212,37 +1166,85 @@ class Statistics extends BaseController
if ($village_id){
$where[] = ['village_id', '=', $village_id];
}
$where[] = ['mer_type_id', 'in', [6,7]];
$m_1=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_2=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_3=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_4=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_5=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_6=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_7=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_8=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_9=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_10=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_11=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$m_12=Db::connect('shop')->table('eb_merchant_address')
->where($where)
->whereMonth('create_time', date('Y').'-01')
->count();
$return = [
[
'name'=>'萝卜',
'demand'=>7852,
'minnum'=>
[['value'=>'661'],
['value'=>'356'],
['value'=>'415'],
['value'=>'258'],
['value'=>'779'],
['value'=>'1465'],
['value'=>'668'],
['value'=>'571'],
['value'=>'498'],
['value'=>'587'],
['value'=>'881'],
['value'=>'1008']],
[['value'=>$m_1],
['value'=>$m_2],
['value'=>$m_3],
['value'=>$m_4],
['value'=>$m_5],
['value'=>$m_6],
['value'=>$m_7],
['value'=>$m_8],
['value'=>$m_9],
['value'=>$m_10],
['value'=>$m_11],
['value'=>$m_12]],
'maxnum'=>
[['value'=>'879'],
['value'=>'521'],
['value'=>'754'],
['value'=>'369'],
['value'=>'916'],
['value'=>'1874'],
['value'=>'837'],
['value'=>'667'],
['value'=>'547'],
['value'=>'741'],
['value'=>'983'],
['value'=>'1150']],
[['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0],
['value'=>0]],
],
];
$this->apiSuccess('获取成功',$return);
@ -1252,27 +1254,37 @@ class Statistics extends BaseController
public function get_num28($area_id=0,$street_id=0,$village_id=0){
$where = [];
if ($area_id){
$where[] = ['area_id', '=', $area_id];
$where[] = ['a.area_id', '=', $area_id];
}
if ($street_id){
$where[] = ['street_id', '=', $street_id];
$where[] = ['a.street_id', '=', $street_id];
}
if ($village_id){
$where[] = ['village_id', '=', $village_id];
$where[] = ['a.village_id', '=', $village_id];
}
$return = [
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_baicai.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_dadou.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_fanqie.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_gaoliang.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_hongshu.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_huluobo.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_qiezi.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_shanyao.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_tudou.png',
'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_xiaomai.png',
];
$return = Db::connect('shop')->table('eb_product_order_log')->alias('a')
->join('eb_store_product b','a.product_id = b.product_id')
->where ($where)
->group('a.product_id')
->field("count('a.id') as value,image")
->order('value desc')
->limit('10')
->select()
->toarray();
$return = array_column($return,'image');
// $return = [
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_baicai.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_dadou.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_fanqie.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_gaoliang.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_hongshu.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_huluobo.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_qiezi.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_shanyao.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_tudou.png',
// 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/s_xiaomai.png',
// ];
$this->apiSuccess('获取成功',$return);
}