AgentTest.php 893 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php /*
  2. * Copyright (C) 2017 All rights reserved.
  3. *
  4. * @File AgentTest.php
  5. * @Brief
  6. * @Author abelzhu, abelzhu@tencent.com
  7. * @Version 1.0
  8. * @Date 2017-12-26
  9. *
  10. */
  11. include_once("../src/CorpAPI.class.php");
  12. include_once("../src/ServiceCorpAPI.class.php");
  13. include_once("../src/ServiceProviderAPI.class.php");
  14. $config = require('./config.php');
  15. //
  16. $api = new CorpAPI($config['CORP_ID'], $config['APP_SECRET']);
  17. // ------------------------- 应用管理 --------------------------------------
  18. try {
  19. //
  20. $agent = new Agent();
  21. {
  22. $agent->agentid = $config['APP_ID'];
  23. $agent->description = "I'm description";
  24. }
  25. $api->AgentSet($agent);
  26. //
  27. $agent = $api->AgentGet($config['APP_ID']);
  28. var_dump($agent);
  29. //
  30. $agentList = $api->AgentGetList();
  31. var_dump($agentList);
  32. } catch (Exception $e) {
  33. echo $e->getMessage() . "\n";
  34. }