$wechatAccount->wechat_app_id, "secret"=>$wechatAccount->wechat_app_secret, "response_type"=>"array", "token"=>$wechatAccount->wechat_app_token, "aes_key"=>$wechatAccount->wechat_app_aes_key ]; return Factory::officialAccount($config); } /** * 获取微信公众号对象 * @param $id int 公众号ID * @return \EasyWeChat\OfficialAccount\Application * @throws CommonException */ public static function getAppByID($id) { $wechatAccount = WechatAccountModel::findById($id); if(!$wechatAccount){ throw new CommonException(ErrorEnum::ERROR_ACCOUNT_EXIST); } $config = [ "app_id"=>$wechatAccount->wechat_app_id, "secret"=>$wechatAccount->wechat_app_secret, "response_type"=>"array", "token"=>$wechatAccount->wechat_app_token, "aes_key"=>$wechatAccount->wechat_app_aes_key ]; return Factory::officialAccount($config); } }