|
@@ -0,0 +1,75 @@
|
|
|
+<?php
|
|
|
+defined('BASEPATH') or exit('No direct script access allowed');
|
|
|
+/**
|
|
|
+ * 此类是为了解决erp没有队列的问题,为了解决这个问题,先写一下这个类,避免后期写那么多定时任务类 这里只能解决每间隔多少时间执行一会的
|
|
|
+ */
|
|
|
+class Zzjobs extends Start_Controller
|
|
|
+{
|
|
|
+ private $serect_str = "yskxcx";
|
|
|
+ private $user_agent = 'Xcly251618/Yskxcx (Erp)';
|
|
|
+ private $api = "Yskxcx25.424";
|
|
|
+ private $ip = ['127.0.0.1','47.105.156.18'];
|
|
|
+ public function __construct()
|
|
|
+ {
|
|
|
+ parent::__construct();
|
|
|
+ $this->load->_model('Model_fullorder','fullorder');
|
|
|
+ }
|
|
|
+ public function _remap($arg, $arg_array)
|
|
|
+ {
|
|
|
+ $ip = $_SERVER['REMOTE_ADDR'];
|
|
|
+
|
|
|
+ if(!in_array($ip,$this->ip)){
|
|
|
+ exit("Unauthorized access");
|
|
|
+ }
|
|
|
+ $user_agent = empty($_SERVER['HTTP_USER_AGENT'])?"":$_SERVER['HTTP_USER_AGENT'];
|
|
|
+ $token = empty($_SERVER['HTTP_X_AUTH_TOKEN'])?"":$_SERVER['HTTP_X_AUTH_TOKEN'];
|
|
|
+ $time = $this->input->get('time',true);
|
|
|
+ $api = $this->input->get('api',true);
|
|
|
+ $this->checkAuth($user_agent,$token,$time,$api);
|
|
|
+ if ($arg == 'jobs') //调出单
|
|
|
+ {
|
|
|
+ $this->_doRenwu();
|
|
|
+ } else {
|
|
|
+ $this->_index();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 校验是否有权限可以执行
|
|
|
+ * $user_agent 自定义的请求客户端名称
|
|
|
+ * $token 自定义的清华客户端的token
|
|
|
+ * $time 请求的时间
|
|
|
+ *
|
|
|
+ */
|
|
|
+ private function checkAuth($user_agent,$token,$time,$api){
|
|
|
+ if($api != $this->api){
|
|
|
+ exit("Access denied due to insufficient permissions");
|
|
|
+ }
|
|
|
+ $check_str = date("Ymd")."¥_".$this->serect_str."_¥".$time;
|
|
|
+ if(empty($user_agent)){
|
|
|
+ exit('No direct script access allowed');
|
|
|
+ }
|
|
|
+ if($user_agent != $this->user_agent){
|
|
|
+ exit('Illegal request');
|
|
|
+ }
|
|
|
+ if(empty($token)){
|
|
|
+ exit('No access permission');
|
|
|
+ }
|
|
|
+
|
|
|
+ $sercet_str = md5($check_str);
|
|
|
+
|
|
|
+ if($sercet_str != $token){
|
|
|
+ exit("Request permission is illegal");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ private function _index() {}
|
|
|
+
|
|
|
+
|
|
|
+ private function _doRenwu(){
|
|
|
+ //必须是云尚快线 打印
|
|
|
+ $list = $this->fullorder->find_all("express = 71 and print = 3 and library = 2 and expressstate < 6");
|
|
|
+ print_r(count($list));
|
|
|
+
|
|
|
+ }
|
|
|
+}
|