Queueu9.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php defined('BASEPATH') OR exit('No direct script access allowed');
  2. /**
  3. * 该类执行队列使用
  4. */
  5. class Queueu9 extends Start_Controller {
  6. private $url = "http://git.wepolicy.cn/";
  7. private $api = 20250217;
  8. public function __construct(){
  9. parent::__construct();
  10. $this->load->_model("Model_zzquque_u9",'zzquque_u9');
  11. $this->load->_model("Model_aaconf","aaconf");
  12. $this->load->_model("Model_logic_u9xg",'logic_u9xg');
  13. }
  14. //定义方法的调用规则 获取URI第二段值
  15. public function _remap($arg,$arg_array)
  16. {
  17. $api = $this->input->get('api',true);
  18. if($api != $this->api){
  19. exit('No direct script access allowed');
  20. }
  21. if($arg == 'xdls')//执行小单的流转到临时仓的队列
  22. {
  23. $this->xdls();
  24. }
  25. if($arg == 'xdlsbe')//执行小单的流转到临时仓的队列
  26. {
  27. $this->xdlsBeforeSh();
  28. }
  29. if($arg == 'xdlsaf')//执行小单的流转到临时仓的队列
  30. {
  31. $this->xdlsAfterSh();
  32. }
  33. else
  34. {
  35. $this->_index();
  36. }
  37. }
  38. public function _index(){
  39. $this->logic_u9xg->xdlsBeforeCreate([]);
  40. exit('No direct script access allowed index'."<br/>");
  41. }
  42. //执行小单的流转到临时仓的队列 计划10分钟一次
  43. public function xdls(){
  44. $mh = curl_multi_init();
  45. // 创建多个 cURL 资源
  46. $ch1 = curl_init();
  47. curl_setopt($ch1, CURLOPT_URL, $this->url."queueu9/xdlsbe?api=".$this->api."&rqyz1=".date("Ymd"));
  48. curl_multi_add_handle($mh, $ch1);
  49. $ch2 = curl_init();
  50. curl_setopt($ch2, CURLOPT_URL, $this->url."queueu9/xdlsaf?api=".$this->api."&rqyz1=".date("Ymd"));
  51. curl_multi_add_handle($mh, $ch2);
  52. // 执行句柄
  53. $running = null;
  54. do {
  55. $mrc = curl_multi_exec($mh, $running);
  56. } while ($mrc == CURLM_OK && $running > 0);
  57. // 关闭句柄
  58. curl_multi_remove_handle($mh, $ch1);
  59. curl_multi_remove_handle($mh, $ch2);
  60. curl_multi_close($mh);
  61. exit("Queue execution completed"."<br/>");
  62. }
  63. public function xdlsBeforeSh(){
  64. $rqyz = $this->input->get('rqyz',true);
  65. if($rqyz != date("Ymd")){
  66. exit('No direct script access allowed before'."<br/>");
  67. }
  68. if(!$this->aaconf->u9xg()){
  69. exit('This feature is not available <br/>');
  70. }
  71. //10 代表了是小单 type类型可在model中的getType()查看到
  72. $list = $this->zzquque_u9->find_all("type = 10 and status = 0 and sh_flag = 0","*",null,0,100);
  73. if(empty($list)){
  74. exit("No data to be executed at the moment <br/>");
  75. }
  76. foreach($list as $k=>$v){
  77. $this->xdlsBeforeShDetail($v);
  78. }
  79. exit("Data execution completed <br/>");
  80. }
  81. public function xdlsBeforeShDetail($info){
  82. }
  83. public function xdlsAfterSh(){
  84. $rqyz = $this->input->get('rqyz',true);
  85. if($rqyz != date("Ymd")){
  86. exit('No direct script access allowed after'."<br/>");
  87. }
  88. if(!$this->aaconf->u9xg()){
  89. exit('This feature is not available');
  90. }
  91. //10 代表了是小单 type类型可在model中的getType()查看到
  92. $list = $this->zzquque_u9->find_all("type = 10 and status = 1 and sh_flag = 1 and sh_status = 0","*",null,0,100);
  93. if(empty($list)){
  94. exit("No data to be executed at the moment");
  95. }
  96. }
  97. }