Api.php 923 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php namespace Api\Lib;
  2. use Dever;
  3. class Api extends Platform
  4. {
  5. protected $type = 'api';
  6. # 执行某个接口
  7. public function run($id, $param = array())
  8. {
  9. $state = $this->setting($id, $param);
  10. if (!$state) {
  11. return $state;
  12. }
  13. return $this->curl();
  14. }
  15. # 跳转
  16. public function jump($id, $param = array())
  17. {
  18. $state = $this->setting($id, $param);
  19. if (!$state) {
  20. return $state;
  21. }
  22. return $this->location();
  23. }
  24. # 生成回调
  25. protected function createNotify($field)
  26. {
  27. $encode = $this->info['id'];
  28. if (isset($field['notify'])) {
  29. $encode .= '|' . $field['notify'];
  30. }
  31. $encode = \Dever\Helper\Str::encode($encode);
  32. return Dever::url('api/notify.common', array('s' => $encode), false, 'package/api/');
  33. }
  34. }