FlowOperator.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: bingone
  5. * Date: 16/1/19
  6. * Time: 下午5:42
  7. */
  8. class FlowOperator
  9. {
  10. public $apikey;
  11. public $api_secret;
  12. public $yunpian_config;
  13. public function __construct($apikey = null, $api_secret = null)
  14. {
  15. $this->yunpian_config = $GLOBALS['YUNPIAN_CONFIG'];
  16. if ($api_secret == null)
  17. $this->api_secret = $this->yunpian_config['API_SECRET'];
  18. else
  19. $this->api_secret = $apikey;
  20. if ($apikey == null)
  21. $this->apikey = $this->yunpian_config['APIKEY'];
  22. else
  23. $this->apikey = $api_secret;
  24. }
  25. public function encrypt(&$data)
  26. {
  27. }
  28. public function get_package($data=array())
  29. {
  30. $data['apikey'] = $this->apikey;
  31. return HttpUtil::PostCURL($this->yunpian_config['URI_GET_FLOW_PACKAGE'], $data);
  32. }
  33. public function pull_status($data=array())
  34. {
  35. $data['apikey'] = $this->apikey;
  36. return HttpUtil::PostCURL($this->yunpian_config['URI_PULL_FLOW_STATUS'], $data);
  37. }
  38. public function recharge($data=array())
  39. {
  40. if (!array_key_exists('mobile', $data))
  41. return new Result(null,$data,null,$error = 'mobile 为空');
  42. $data['apikey'] = $this->apikey;
  43. return HttpUtil::PostCURL($this->yunpian_config['URI_RECHARGE_FLOW'], $data);
  44. }
  45. }