正在显示
1 个修改的文件
包含
5 行增加
和
16 行删除
| @@ -424,28 +424,17 @@ class Business extends Base | @@ -424,28 +424,17 @@ class Business extends Base | ||
| 424 | ->join('verification_store b','a.verification_store_id=b.id') | 424 | ->join('verification_store b','a.verification_store_id=b.id') |
| 425 | ->field('a.*,b.address,b.name,b.phone') | 425 | ->field('a.*,b.address,b.name,b.phone') |
| 426 | ->where($where)->find(); | 426 | ->where($where)->find(); |
| 427 | - //参数 | ||
| 428 | - $param = request()->param(); | ||
| 429 | //验证 | 427 | //验证 |
| 430 | - if(empty($param['date'])){$param['date'] = date("Y-m-d"); } | ||
| 431 | - $dates = [strtotime($param['date']." 00:00:00"),strtotime($param['date']." 23:59:59")]; | ||
| 432 | //$r1 = Db::name('_verification_staff')->where(['user_id'=>$user_id,'type'=>'0','verification_store_id'=>$store_id])->find(); | 428 | //$r1 = Db::name('_verification_staff')->where(['user_id'=>$user_id,'type'=>'0','verification_store_id'=>$store_id])->find(); |
| 433 | //if(empty($r1)){ return $this->error('仅店长可查自己店铺信息'); } | 429 | //if(empty($r1)){ return $this->error('仅店长可查自己店铺信息'); } |
| 434 | //当前店铺下的代理人,及代理人的推广数量 | 430 | //当前店铺下的代理人,及代理人的推广数量 |
| 435 | - $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){ | ||
| 436 | - //一级统计 | ||
| 437 | - $count_1 = Db::name('user')->where(['pid'=>$item['user_id'],'updatetime'=>['between',$dates]])->field("id")->select(); | ||
| 438 | - $item['count_1'] = count($count_1); | ||
| 439 | - //二级统计 | ||
| 440 | - $item['count_2'] = 0; | ||
| 441 | - if(!empty($count_1)){ | ||
| 442 | - $ids = array_column($count_1,'id'); | ||
| 443 | - $item['count_2'] =Db::name('user')->where(['pid'=>['in',$ids],'updatetime'=>['between',$dates]])->field("id")->count(); | ||
| 444 | - } | ||
| 445 | - //全部 | ||
| 446 | - $item['count_0'] = $item['count_1']+$item['count_2']; | 431 | + $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){ |
| 432 | + $item['count'] = Db::name('user')->where(['pid'=>$item['user_id']])->count(); | ||
| 447 | return $item; | 433 | return $item; |
| 448 | })->toArray(); | 434 | })->toArray(); |
| 435 | + | ||
| 436 | + | ||
| 437 | + | ||
| 449 | $rows['activity_name']=$activity['title']; | 438 | $rows['activity_name']=$activity['title']; |
| 450 | $rows['staff_name']=$activity['name']; | 439 | $rows['staff_name']=$activity['name']; |
| 451 | $this->success("查询成功",$rows); | 440 | $this->success("查询成功",$rows); |
-
请 注册 或 登录 后发表评论