...
|
...
|
@@ -424,28 +424,17 @@ class Business extends Base |
|
|
->join('verification_store b','a.verification_store_id=b.id')
|
|
|
->field('a.*,b.address,b.name,b.phone')
|
|
|
->where($where)->find();
|
|
|
//参数
|
|
|
$param = request()->param();
|
|
|
//验证
|
|
|
if(empty($param['date'])){$param['date'] = date("Y-m-d"); }
|
|
|
$dates = [strtotime($param['date']." 00:00:00"),strtotime($param['date']." 23:59:59")];
|
|
|
//$r1 = Db::name('_verification_staff')->where(['user_id'=>$user_id,'type'=>'0','verification_store_id'=>$store_id])->find();
|
|
|
//if(empty($r1)){ return $this->error('仅店长可查自己店铺信息'); }
|
|
|
//当前店铺下的代理人,及代理人的推广数量
|
|
|
$rows = Db::name('_verification_staff')->where(['verification_store_id'=>$store_id,'type'=>['in',['0','1','3']]])->field("name,0 as count,user_id")->paginate(1000)->each(function($item) use ($dates){
|
|
|
//一级统计
|
|
|
$count_1 = Db::name('user')->where(['pid'=>$item['user_id'],'updatetime'=>['between',$dates]])->field("id")->select();
|
|
|
$item['count_1'] = count($count_1);
|
|
|
//二级统计
|
|
|
$item['count_2'] = 0;
|
|
|
if(!empty($count_1)){
|
|
|
$ids = array_column($count_1,'id');
|
|
|
$item['count_2'] =Db::name('user')->where(['pid'=>['in',$ids],'updatetime'=>['between',$dates]])->field("id")->count();
|
|
|
}
|
|
|
//全部
|
|
|
$item['count_0'] = $item['count_1']+$item['count_2'];
|
|
|
$rows = Db::name('_verification_staff')->where(['verification_store_id'=>$store_id,'type'=>['in',['0','1','3']]])->field("name,0 as count,user_id")->paginate(1000)->each(function($item){
|
|
|
$item['count'] = Db::name('user')->where(['pid'=>$item['user_id']])->count();
|
|
|
return $item;
|
|
|
})->toArray();
|
|
|
|
|
|
|
|
|
|
|
|
$rows['activity_name']=$activity['title'];
|
|
|
$rows['staff_name']=$activity['name'];
|
|
|
$this->success("查询成功",$rows);
|
...
|
...
|
|