作者 陈程

kaquan-0801-7

@@ -399,7 +399,7 @@ class Business extends Base @@ -399,7 +399,7 @@ class Business extends Base
399 //当前店铺下的代理人,及代理人的推广数量,并且是成功购买的数量 399 //当前店铺下的代理人,及代理人的推广数量,并且是成功购买的数量
400 $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){ 400 $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){
401 $ids = Db::name('user')->where(['pid'=>$item['user_id']])->column("id"); 401 $ids = Db::name('user')->where(['pid'=>$item['user_id']])->column("id");
402 - $count = Db::name('verification_order')->where(['user_id'=>['in',$ids],'type'=>['in',['1','4']]])->field("user_id")->select(); 402 + $count = Db::name('verification_order')->where(['user_id'=>['in',$ids],'type'=>['in',['1','4']]])->field("user_id")->group("user_id")->select();
403 $item['count'] = count($count); 403 $item['count'] = count($count);
404 $item['count_id'] = $count; 404 $item['count_id'] = $count;
405 return $item; 405 return $item;
@@ -432,7 +432,10 @@ class Business extends Base @@ -432,7 +432,10 @@ class Business extends Base
432 //if(empty($r1)){ return $this->error('仅店长可查自己店铺信息'); } 432 //if(empty($r1)){ return $this->error('仅店长可查自己店铺信息'); }
433 //当前店铺下的代理人,及代理人的推广数量 433 //当前店铺下的代理人,及代理人的推广数量
434 $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){ 434 $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){
435 - $item['count'] = Db::name('user')->where(['pid'=>$item['user_id']])->count(); 435 + $ids = Db::name('user')->where(['pid'=>$item['user_id']])->column("id");
  436 + $count = Db::name('verification_order')->where(['user_id'=>['in',$ids],'type'=>['in',['1','4']]])->field("user_id")->group("user_id")->select();
  437 + $item['count'] = count($count);
  438 + $item['count_id'] = $count;
436 return $item; 439 return $item;
437 })->toArray(); 440 })->toArray();
438 441