TestApisController.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace App\Http\Controllers\Wechat\Api;
  3. use App\Http\Controllers\Controller;
  4. use App\Http\Requests;
  5. use Illuminate\Http\Request;
  6. use Illuminate\Http\Response;
  7. use EasyWeChat\Foundation\Application;
  8. use DB;
  9. use Illuminate\Support\Facades\Redis;
  10. use Illuminate\Support\Facades\Storage;
  11. use Illuminate\Support\Facades\Input;
  12. use Illuminate\Support\Facades\Validator;
  13. use Illuminate\Support\Facades\File;
  14. use App\Http\Controllers\WechatController;
  15. use App\Http\Controllers\Wechat\Api\WechatInnerApisController;
  16. /**
  17. * 阅读云相关api接口,和微信无关
  18. * @author zhoulingjie
  19. *
  20. */
  21. class TestApisController extends WechatController
  22. {
  23. public $WechatApi;
  24. function __construct(){
  25. v('TestApisController_construct');
  26. $this->gzh_app_id = $_REQUEST['gzh_app_id'];
  27. parent::__construct($this->gzh_app_id);
  28. // 方便扩展
  29. $this->param = array();
  30. v('$this->param:');v($this->param);
  31. $this->param['app'] = $this->app;
  32. $this->param['gzh_app_id'] = $this->gzh_app_id;
  33. $this->param['openid'] = '';
  34. $this->param['group_api'] = $this->group_api;
  35. $this->param['group'] = $this->group;
  36. $this->WechatApi = new WechatInnerApisController($this->param);
  37. }
  38. /**
  39. * 测试连接远程db
  40. */
  41. static public function test_connect_db()
  42. {
  43. v('test_connect_db');
  44. DB::connection()->enableQuerylog();
  45. $datas = DB::select('select * from users limit 2');
  46. v(DB::getQuerylog());
  47. v('$datas');v($datas);
  48. }
  49. /**
  50. * 测试连接远程redis
  51. */
  52. static public function test_connect_redis()
  53. {
  54. v('test_connect_redis');
  55. Redis::Set('zhoulj_test','zhoulj_test5');
  56. $redis_res = Redis::Get('zhoulj_test');
  57. v('redis_res');v($redis_res);
  58. }
  59. /**
  60. * 测试搜索接口
  61. */
  62. public function test_search()
  63. {
  64. v('test_search');
  65. $result = $this->WechatApi->search_event_content('text','我');
  66. v('$result');v($result);
  67. }
  68. }