123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php defined('BASEPATH') OR exit('No direct script access allowed');
- /**
- * 该类执行队列使用
- */
- class Queueu9 extends Start_Controller {
- private $url = "http://git.wepolicy.cn/";
- private $api = 20250217;
- public function __construct(){
- parent::__construct();
- $this->load->_model("Model_zzquque_u9",'zzquque_u9');
- $this->load->_model("Model_aaconf","aaconf");
- $this->load->_model("Model_logic_u9xg",'logic_u9xg');
- $this->load->_model("Model_logic_order","logic_order");
- }
-
- //定义方法的调用规则 获取URI第二段值
- public function _remap($arg,$arg_array)
- {
- $api = $this->input->get('api',true);
- if($api != $this->api){
- exit('No direct script access allowed');
- }
- if($arg == 'xdls')//执行小单的流转到临时仓的队列
- {
- $this->xdls();
- }
- if($arg == 'xdlsbe')//执行小单的流转到临时仓的队列
- {
- $this->xdlsBeforeSh();
- }
- if($arg == 'xdlsaf')//执行小单的流转到临时仓的队列
- {
- $this->xdlsAfterSh();
- }
- else
- {
- $this->_index();
- }
- }
- public function _index(){
- //执行第一步的参数
- // $list = $this->zzquque_u9->find_all();
- // $do_list = [];
- // foreach($list as $k=>$v){
- // $tmp_info = $this->logic_order->getInfoByType($v['platform'],$v['order_no']);
- // $tmp_info['zq_u9_id'] = $v['id'];
- // $do_list[] = $tmp_info;
- // }
- // $this->logic_u9xg->xdlsOneStep($do_list);
-
- //执行第二步的参数
- // $list = $this->zzquque_u9->find_all("dc_status = 1 and xs_status = 1 and cg_status = 1 and type = 10 and update_time <=".(time() - 300));
-
- // $this->logic_u9xg->xdlsTwoStep($list);
- //执行第三部参数
- // $list = $this->zzquque_u9->find_all();
- // $this->logic_u9xg->xdlsThreeStep($list);
- //执行第四部的参数 生成销售单
- // $list = $this->zzquque_u9->find_all();
- // $do_list = [];
- // foreach($list as $k=>$v){
- // $tmp_info = $this->logic_order->getInfoByType($v['platform'],$v['order_no']);
- // $tmp_info['zq_u9_id'] = $v['id'];
- // $do_list[] = $tmp_info;
- // }
- // $this->logic_u9xg->xdlsFourStep($do_list);
- //执行第五步骤 审核销售单 并同时生成标准出货单
- // $list = $this->zzquque_u9->find_all();
- // $this->logic_u9xg->xdlsFivestep($list);
- $list = $this->zzquque_u9->find_all("bzch_status = 1");
- $this->logic_u9xg->xdlsSixStep($list);
- exit('No direct script access allowed index'."<br/>");
- }
- //执行小单的流转到临时仓的队列 计划10分钟一次
- public function xdls(){
- $mh = curl_multi_init();
-
- // 创建多个 cURL 资源
- $ch1 = curl_init();
- curl_setopt($ch1, CURLOPT_URL, $this->url."queueu9/xdlsbe?api=".$this->api."&rqyz1=".date("Ymd"));
- curl_multi_add_handle($mh, $ch1);
-
- $ch2 = curl_init();
- curl_setopt($ch2, CURLOPT_URL, $this->url."queueu9/xdlsaf?api=".$this->api."&rqyz1=".date("Ymd"));
- curl_multi_add_handle($mh, $ch2);
-
- // 执行句柄
- $running = null;
- do {
- $mrc = curl_multi_exec($mh, $running);
- } while ($mrc == CURLM_OK && $running > 0);
-
- // 关闭句柄
- curl_multi_remove_handle($mh, $ch1);
- curl_multi_remove_handle($mh, $ch2);
- curl_multi_close($mh);
- exit("Queue execution completed"."<br/>");
- }
-
- public function xdlsBeforeSh(){
- $rqyz = $this->input->get('rqyz',true);
- if($rqyz != date("Ymd")){
- exit('No direct script access allowed before'."<br/>");
- }
- if(!$this->aaconf->u9xg()){
- exit('This feature is not available <br/>');
- }
- //10 代表了是小单 type类型可在model中的getType()查看到
- $list = $this->zzquque_u9->find_all("type = 10 and status = 0 and sh_flag = 0","*",null,0,100);
- if(empty($list)){
- exit("No data to be executed at the moment <br/>");
- }
- foreach($list as $k=>$v){
- $this->xdlsBeforeShDetail($v);
- }
- exit("Data execution completed <br/>");
- }
- public function xdlsBeforeShDetail($info){
-
- }
- public function xdlsAfterSh(){
- $rqyz = $this->input->get('rqyz',true);
- if($rqyz != date("Ymd")){
- exit('No direct script access allowed after'."<br/>");
- }
- if(!$this->aaconf->u9xg()){
- exit('This feature is not available');
- }
- //10 代表了是小单 type类型可在model中的getType()查看到
- $list = $this->zzquque_u9->find_all("type = 10 and status = 1 and sh_flag = 1 and sh_status = 0","*",null,0,100);
- if(empty($list)){
- exit("No data to be executed at the moment");
- }
- }
- }
|