/**
  * Bootstrap the application services.
  */
 public function boot(AccountService $account)
 {
     $this->app->singleton('easywechat', function () use($account) {
         $options = $account->getWechatOptions();
         return new \EasyWeChat\Foundation\Application($options);
     });
     // 开放平台授权相关服务
     $this->app->singleton('openauth', function () {
         return new \App\Services\OpenAuth();
     });
 }
Ejemplo n.º 2
0
 /**
  * 清除全部菜单.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function clear()
 {
     try {
         // 当前选中的公众号
         $currentAccount = $this->accountService->chosedAccount();
         $this->menuService->deleteAll($currentAccount);
         return success('清除成功');
     } catch (\Exception $e) {
         return error('清除失败');
     }
 }