processor.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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. $method = strtolower($key);
  20. $proxy = new proxy();
  21. if($method == 'add')
  22. {
  23. try {
  24. $proxy->add($params);
  25. }
  26. catch (Exception $x) {
  27. Log::record($x->getMessage(),Log::ERR);
  28. }
  29. // go(function () use ($proxy,$params)
  30. // {
  31. // try {
  32. // $proxy->add($params);
  33. // }
  34. // catch (Exception $x) {
  35. // Log::record($x->getMessage(),Log::ERR);
  36. // }
  37. // });
  38. }
  39. elseif($method == 'notify') {
  40. }
  41. elseif($method == 'notify_mechant') {
  42. }
  43. else {
  44. Log::record("Error msg",Log::DEBUG);
  45. }
  46. }
  47. }
  48. }
  49. }