config
This commit is contained in:
parent
cb72a026e7
commit
2f4654d02a
|
@ -5,10 +5,10 @@ return [
|
|||
*/
|
||||
'work' => [
|
||||
//企业ID
|
||||
'corp_id' => '',
|
||||
'corp_id' => env('WECHAT_WORK_CORP_ID'),
|
||||
//企业内各个应用的 secrets
|
||||
'secrets' => [
|
||||
'auth' => '',
|
||||
'miniprogram' => env('WECHAT_WORK_SECRET_MINIPROGRAM'),
|
||||
'contact' => env('WECHAT_WORK_SECRET_CONTACT'),
|
||||
'external_contact' => env('WECHAT_WORK_SECRET_EXTERNAL_CONTACT'),
|
||||
],
|
|
@ -1 +1,39 @@
|
|||
<?php
|
||||
<?php
|
||||
|
||||
namespace Wechat\ServiceProvider;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class WechatServiceProvider extends ServiceProvider
|
||||
{
|
||||
|
||||
public function setupConfig()
|
||||
{
|
||||
$source = realpath(__DIR__ . '/../../config/wx.php');
|
||||
|
||||
if ($this->app instanceof LaravelApplication && $this->app->runningInConsole()) {
|
||||
$this->publishes([$source => config_path('wx.php')], 'wx');
|
||||
} elseif ($this->app instanceof LumenApplication) {
|
||||
$this->app->configure('wx');
|
||||
}
|
||||
|
||||
$this->mergeConfigFrom($source, 'rpc');
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
$config = config['wx'];
|
||||
|
||||
if (isset($config['work'])) {
|
||||
|
||||
foreach ($config['work']['secrets'] as $key => $item) {
|
||||
$this->app->singleton('wx.work.' . $key, function () {
|
||||
return new ucwords($key);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user