cpprocessor.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. require_once(BASE_CORE_PATH . '/framework/function/http.php');
  3. class processor extends queue\ILooper
  4. {
  5. public function __construct()
  6. {
  7. parent::__construct(new queue\DispatcherServer());
  8. }
  9. protected function handle($msg)
  10. {
  11. if (empty($msg)) {
  12. Log::record('empty body', Log::DEBUG);
  13. }
  14. else
  15. {
  16. foreach ($msg as $key => $params)
  17. {
  18. Log::record("start one", Log::DEBUG);
  19. if (empty($params)) continue;
  20. $method = strtolower($key);
  21. $proxy = new proxy();
  22. go(function () use ($proxy, $params, $method)
  23. {
  24. try
  25. {
  26. if ($method == 'add') {
  27. $proxy->add($params);
  28. } elseif ($method == 'notify') {
  29. } elseif ($method == 'notify_mechant') {
  30. } else {
  31. Log::record("Error msg", Log::DEBUG);
  32. }
  33. } catch (Exception $x) {
  34. Log::record($x->getMessage(), Log::ERR);
  35. }
  36. });
  37. }
  38. }
  39. }
  40. }