1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace App\Http\Controllers\Wechat\Command;
- use App\Http\Controllers\WechatController;
- use App\Http\Requests;
- use Illuminate\Http\Request;
- use Illuminate\Http\Response;
- use EasyWeChat\Foundation\Application;
- /**
- * 公众号被封禁检测
- * @author zhoulingjie
- *
- */
- class GzhBanAlertController extends WechatController
- {
-
- public function __construct(Request $request)
- {
- // TODO 加密,检测gzh_app_id合法性
- $this->gzh_app_id =$request->get('gzh_app_id');
- parent::__construct($this->gzh_app_id);
- // 方便扩展
- $param = array();
- $param['app'] = $this->app;
- $param['WechatApi'] = isset($this->WechatApi)?$this->WechatApi:null;
- $param['gzh_app_id'] = $this->gzh_app_id;
- $this->Menu = $this->app->menu;
- }
-
- /**
- http://zydy/api/check_gzh_ban?gzh_app_id=wxdbc486f1b4f6a8c3&api_id=4&from=zhoulj
- 检测公众号是否被封:目前通过菜单
- */
- public function check_gzh_ban(Request $request)
- {
- $result = array('code'=>1,'msg'=>'','data'=>'');
- $gzh_app_id = $request->get('gzh_app_id');
- $from = $request->get('from');
- if(empty($gzh_app_id)){
- $result['code'] = 0;
- $result['msg'] = 'invalid param';
- json_echo($result);
- }
-
- if($from != 'zhoulj'){
- $check_result = $this->check_sign_params($request);
- if($check_result['code'] == 0){
- $result['code'] = 0;
- $result['msg'] = $check_result['msg'];
- json_echo($result);
- }
- }
- $res = '';
- $menus = [];
- try{
- $menus = $this->Menu->current();
- }catch (\Exception $e){}
- $is_menu_open = isset($menus->is_menu_open)?$menus->is_menu_open:1;// 获取不到默认成功?
- $result['data'] = $is_menu_open;
- json_echo($result);
- }
-
- }
|