<?php
namespace app\wechatmp\controller;
use app\wechatmp\BaseController;
use think\facade\Session;
use think\facade\Cache;
use think\facade\Cookie;
use app\common\model\User as UserModel;
use app\common\variable\MsgCode;
use GatewayClient\Gateway;
class Base extends BaseController
{
    protected $middleware = ['VerificationWeb'];
    /**
     * [__construct 构造函数]
     * @return [type] [description]
     */
    public function __construct(){
        parent::__construct(App());
    }
    /**
     * [outLogin 注销登录]
     * @return [type] [description]
     */
    public function outLogin()
    {
        Session::delete('User');
        return $this->ajaxReturn();
    }
    /**
     * [ajaxReturn 返回json]
     * @param  integer $code [description]
     * @param  [type]  $data [description]
     * @return [type]        [description]
     */
    public function ajaxReturn($msg='Success',$code=0,$data=[]){
        if (!$code)$code=MsgCode::$success;
        return json(['code'=>$code,'msg'=>$msg,'data'=>$data,'time'=>date('Y-m-d H:i:s')]);
    }
}
