diff --git a/app/api/controller/User.php b/app/api/controller/User.php index e2733deb..da9c1835 100755 --- a/app/api/controller/User.php +++ b/app/api/controller/User.php @@ -236,21 +236,39 @@ class User extends Api a.first_leader = '.$user_id.' and a.disable = 0 and a.del = 0 and b.del=0 and b.audit_status = 2 limit ".$p.",".$size; $lists = Db::query($sql); - $sql = "SELECT count(*) as cont FROM ls_user a,ls_shop_apply b WHERE a.id = b.user_id and - a.first_leader = '.$user_id.' and a.disable = 0 and a.del = 0 and b.del=0 - and b.audit_status = 2 group by a.first_leader"; - $count = Db::query($sql); - $count = $count[0]['cont']; +// $sql = "SELECT count(*) as cont FROM ls_user a,ls_shop_apply b WHERE a.id = b.user_id and +// a.first_leader = '.$user_id.' and a.disable = 0 and a.del = 0 and b.del=0 +// and b.audit_status = 2 group by a.first_leader"; + $count = Db::name("shop_apply") + ->alias("a") + ->where("user","a.user_id = b.id","left") + ->where("a.first_leader",$user_id) + ->where("a.disable",0) + ->where("a.del",0) + ->where("b.del",0) + ->where("b.audit_status",2) + ->count(); +// $count = Db::query($sql); +// $count = $count[0]['cont']; }else{ $sql = "SELECT * FROM ls_user a,ls_local_store b WHERE a.id = b.user_id and a.first_leader = '.$user_id.' and a.disable = 0 and a.del = 0 and b.is_delete=0 and b.store_state = 1 limit ".$p.",".$size; $lists = Db::query($sql); - $sql = "SELECT count(*) as cont FROM ls_user a,ls_local_store b WHERE a.id = b.user_id and - a.first_leader = '.$user_id.' and a.disable = 0 and a.del = 0 and b.is_delete=0 - and b.store_state = 1 group by a.first_leader"; - $count = Db::query($sql); - $count = $count[0]['cont']; +// $sql = "SELECT count(*) as cont FROM ls_user a,ls_local_store b WHERE a.id = b.user_id and +// a.first_leader = '.$user_id.' and a.disable = 0 and a.del = 0 and b.is_delete=0 +// and b.store_state = 1 group by a.first_leader"; +// $count = Db::query($sql); +// $count = $count[0]['cont']; + $count = Db::name("local_store") + ->alias("a") + ->where("user","a.user_id = b.id","left") + ->where("a.first_leader",$user_id) + ->where("a.disable",0) + ->where("a.del",0) + ->where("b.is_delete",0) + ->where("b.store_state",1) + ->count(); } $data = [ 'list' => $lists,