/** * 获得所有公众号 * @return mixed */ public function getMps() { return WeixinMp::all(); }
/** * 获取当前用户拥有的公众号 * @author Hanxiang */ private static function getCurrentWxMps() { $user = Auth::user(); $wx_mps = []; if ($user->role == User::ROLE_COMMON_USER) { $apps = App::where('user_id', $user->id)->get(); if ($apps) { foreach ($apps as $a) { $wx_mps = WeixinMp::where('app_id', $a->id)->get(); } } } else { $wx_mps = WeixinMp::all(); } return $wx_mps; }