<?php

namespace App\Http\Controllers\Wechat\Api;

use App\Http\Controllers\Controller;
use App\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use EasyWeChat\Foundation\Application;
use DB;
use Illuminate\Support\Facades\Redis;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\File;
use App\Http\Controllers\WechatController;
use App\Http\Controllers\Wechat\Api\WechatInnerApisController;


/**
 * 阅读云相关api接口,和微信无关
 * @author zhoulingjie
 *
 */
class TestApisController extends WechatController
{
   public $WechatApi;
   function __construct(){
	   	v('TestApisController_construct');
	   	$this->gzh_app_id = $_REQUEST['gzh_app_id'];
	   	
	   	parent::__construct($this->gzh_app_id);
	   	// 方便扩展
	   	$this->param = array();
	   	v('$this->param:');v($this->param);
	   	$this->param['app'] = $this->app;
	   	$this->param['gzh_app_id'] = $this->gzh_app_id;
	   	$this->param['openid'] = '';
	   	$this->param['group_api'] = $this->group_api;
	   	$this->param['group'] = $this->group;
	   	$this->WechatApi = new WechatInnerApisController($this->param);
   }
   
    /**
     * 测试连接远程db
     */
    static public function test_connect_db()
    {
    	 v('test_connect_db');
    	 DB::connection()->enableQuerylog();
    	 $datas = DB::select('select * from users limit 2');
    	 v(DB::getQuerylog());
    	 v('$datas');v($datas);
    }
    
    /**
     * 测试连接远程redis
     */
    static public function test_connect_redis()
    {
    	v('test_connect_redis');
    	Redis::Set('zhoulj_test','zhoulj_test5');
    	$redis_res = Redis::Get('zhoulj_test');
    	v('redis_res');v($redis_res);
    }
    
    /**
     * 测试搜索接口
     */
    public function test_search()
    {
    	v('test_search');
    	$result = $this->WechatApi->search_event_content('text','我');
    	v('$result');v($result);
    }
 
}