diff --git a/app/api/logic/DistributionLogic.php b/app/api/logic/DistributionLogic.php index e731b560..67f9228e 100755 --- a/app/api/logic/DistributionLogic.php +++ b/app/api/logic/DistributionLogic.php @@ -166,10 +166,29 @@ class DistributionLogic extends Logic ['first_leader', '=', $userId], ['del', '=', 0] ])->count(); - $shop_fans = Shop::where([ - ['reference_user_id', '=', $userId], - ['is_freeze', '=', 0] - ])->count(); +// $shop_fans = Shop::where([ +// ['reference_user_id', '=', $userId], +// ['is_freeze', '=', 0] +// ])->count(); + $shop_fans = Db::name("shop_apply") + ->alias("a") + ->join("user b","a.user_id = b.id","left") + ->where("b.first_leader",$userId) + ->where("a.audit_status",2) + ->where("a.del",0) + ->where("b.disable",0) + ->where("b.del",0) + ->count(); + $shop_fans1 = Db::name("local_store") + ->alias("a") + ->join("user b","a.user_id = b.id","left") + ->where("b.first_leader",$userId) + ->where("a.store_state",1) + ->where("a.is_delete",0) + ->where("b.disable",0) + ->where("b.del",0) + ->count(); + $shop_fans = $shop_fans+$shop_fans1; //今天的预估收益(待返佣) $today_earnings = DistributionOrderGoods::whereDay('create_time') ->where(['status' => 1, 'user_id' => $userId])