|
@@ -46,6 +46,7 @@ class Aatest extends Start_Controller {
|
|
$this->load->_model("Model_logic_ding","logic_ding");
|
|
$this->load->_model("Model_logic_ding","logic_ding");
|
|
$this->load->_model("Model_api",'api');
|
|
$this->load->_model("Model_api",'api');
|
|
$this->load->_model("Model_usps",'usps');
|
|
$this->load->_model("Model_usps",'usps');
|
|
|
|
+ $this->load->_model('Model_emaildata','emaildata');
|
|
}
|
|
}
|
|
|
|
|
|
//定义方法的调用规则 获取URI第二段值
|
|
//定义方法的调用规则 获取URI第二段值
|
|
@@ -123,40 +124,122 @@ class Aatest extends Start_Controller {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- public function _ceshi(){
|
|
|
|
- $arr =[1,2];
|
|
|
|
- var_dump($arr[3]);
|
|
|
|
- // $arr = [
|
|
|
|
- // '4600368432',
|
|
|
|
- // '2800005184',
|
|
|
|
- // '3800007040',
|
|
|
|
- // '3600656330',
|
|
|
|
- // '3600656403',
|
|
|
|
- // '3800006595'
|
|
|
|
- // ];
|
|
|
|
- //$order_list = $this->fullorder->find_all('orderinfo in ('.implode(',',$arr).')');
|
|
|
|
- //foreach ($order_list as $k=>$v){
|
|
|
|
- // $shop = $this->shop->read($v['shop']);
|
|
|
|
- // $this->_klarnadata($v['paypal'],$shop['klarnaname'],$shop['klarnapass'],$v['number']);
|
|
|
|
- // usleep(10);
|
|
|
|
- //}
|
|
|
|
|
|
+ public function _waybillemail($arg_array)
|
|
|
|
+ {
|
|
|
|
+ $urls = array();$sl = 0;$time = time();
|
|
|
|
+ $wid = 2;
|
|
|
|
+ // if(date("H",time()) == '8' && date("i",time()) > '20' && date("i",time()) < '39')//USPS-USA单
|
|
|
|
+ // {
|
|
|
|
+ // $wid = 1;
|
|
|
|
+ // }
|
|
|
|
+ // else if(date("H",time()) == '20' && date("i",time()) > '20' && date("i",time()) < '39')//其他快递
|
|
|
|
+ // {
|
|
|
|
+ // $wid = 2;
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // exit;
|
|
|
|
+ // }
|
|
|
|
+ $notice = $this->notice->find_all("message = '1' and state = '1' and type = '4' and ktime < '$time' and jtime > '$time'");//已有自动发送,这个是物流发送
|
|
|
|
+ foreach ($notice as $key=>$var)
|
|
|
|
+ {
|
|
|
|
+ $this->_waybillfs([
|
|
|
|
+ 'var'=>$var,
|
|
|
|
+ 'wid'=>$wid
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- public function _klarnadata($paypal,$name,$pass,$number)
|
|
|
|
- {
|
|
|
|
- $url = 'https://api-na.klarna.com/ordermanagement/v1/orders/'.$paypal;
|
|
|
|
- $header[] = "Content-Type:application/json";
|
|
|
|
- $header[] = "Authorization: Basic ".base64_encode($name.":".$pass);
|
|
|
|
- $ch = curl_init();
|
|
|
|
- curl_setopt($ch, CURLOPT_URL, $url);
|
|
|
|
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
- curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
|
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
|
|
|
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
|
|
|
- $res = curl_exec($ch);
|
|
|
|
- curl_close($ch);
|
|
|
|
- $res = json_decode($res,true);
|
|
|
|
|
|
|
|
- $this->logic_ding->sendToDing($number."API【2042】".json_encode($res));
|
|
|
|
|
|
+ public function _waybillfs($data)
|
|
|
|
+ {
|
|
|
|
+ if($data)
|
|
|
|
+ {
|
|
|
|
+ $notice = $data['var'];
|
|
|
|
+ $notice['email'] = $this->emaildata->read($notice['email']);
|
|
|
|
+ $wid = $data['wid'];
|
|
|
|
+ $fsjs = "";
|
|
|
|
+ if($wid == 1 && (stripos($notice['express'],',2,') !== false || stripos($notice['express'],',63,') !== false || stripos($notice['express'],',64,') !== false))
|
|
|
|
+ {
|
|
|
|
+ $js = explode(',',trim($notice['js'],','));
|
|
|
|
+ if(count($js) > 1)
|
|
|
|
+ {
|
|
|
|
+ $fsjs = " and (";
|
|
|
|
+ foreach ($js as $v)
|
|
|
|
+ {
|
|
|
|
+ $fsjs .= "js = '$v' or ";
|
|
|
|
+ }
|
|
|
|
+ $fsjs = trim($fsjs,' or ').")" ;
|
|
|
|
+ }
|
|
|
|
+ else if(count($js) == 1)
|
|
|
|
+ {
|
|
|
|
+ $fsjs = " and js = '$js[0]'";
|
|
|
|
+ }
|
|
|
|
+ $where = "(express = '2' or express = '63' or express = '64') and librarytime > '".strtotime(date("Y-m-d 8:30:0",strtotime("-6 day")))."' and librarytime < '".strtotime(date("Y-m-d 8:30:0",time()))."'".$fsjs;//3
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ else if($wid == 2 && stripos($notice['express'],',1,') !== false)
|
|
|
|
+ {
|
|
|
|
+ $where = "express != '2' and express != '63' and express != '64' and printtype = '1' and waybill != '' and librarytime > '".strtotime(date("Y-m-d 20:00:0",strtotime("-6 day")))."' and librarytime < '".strtotime(date("Y-m-d 20:00:0",time()))."'";//4
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ exit;
|
|
|
|
+ }
|
|
|
|
+ $wlfs = array();
|
|
|
|
+ $dd = $this->fullorder->find_all("source != '1' and dlzemail < '1' and shop = '".$notice['shop']."' and library = 2 and ".$where);
|
|
|
|
+ foreach($dd as $v){
|
|
|
|
+ $this->logic_ding->sendToDing($v['orderinfo']."监听邮件发送的异常:订单信息【".json_encode($v,JSON_UNESCAPED_UNICODE)."】");
|
|
|
|
+ }
|
|
|
|
+ // foreach ($dd as $v)
|
|
|
|
+ // {
|
|
|
|
+ // $shop = $this->shop->read($v['shop']);
|
|
|
|
+ // $express = $this->express->read($v['express']);
|
|
|
|
+ // $fs = $this->notice->get_god($v,$shop,$express,$notice);
|
|
|
|
+ // $this->logic_ding->sendToDing($v['orderinfo']."监听邮件发送的异常:订单信息【".json_encode($v,JSON_UNESCAPED_UNICODE)."】获取快递信息【".json_encode($notice,JSON_UNESCAPED_UNICODE)."】返回的信息".json_encode($fs));
|
|
|
|
+ // if($fs == 1)
|
|
|
|
+ // {
|
|
|
|
+ // $this->fullorder->save(array('dlzemail'=>1,'dlzemailtime'=>time()),$v['id']);
|
|
|
|
+
|
|
|
|
+ // //给crm发送信息 先存储数据 后续定时任务执行
|
|
|
|
+ // if($v['shop'] < 10){
|
|
|
|
+
|
|
|
|
+ // $this->zztmpdata->insert([
|
|
|
|
+ // 'type'=>2,
|
|
|
|
+ // 'act_name'=>'crm_order',
|
|
|
|
+ // 'content'=>json_encode($v),
|
|
|
|
+ // 'create_time'=>time()
|
|
|
|
+ // ]);
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // //$pdtime = date('Y-m-d',time());
|
|
|
|
+ // //$folderPath = './data/dlzemail/'.$pdtime; // 文件夹路径
|
|
|
|
+ // //$permissions = 0777; // 权限设置
|
|
|
|
+ // //if (!file_exists($folderPath)) { mkdir($folderPath, $permissions); }//创建文件夹
|
|
|
|
+ // //file_exists($folderPath);
|
|
|
|
+ // if(!is_file("./data/dlzemail/".$v['number'].".txt"))
|
|
|
|
+ // {
|
|
|
|
+ // $myfile = fopen("./data/dlzemail/".$v['number'].".txt", "w") or die("Unable to open file!");
|
|
|
|
+ // fwrite($myfile, json_encode($fs.';'.$v.';'.$shop.';'.$express.';'.$notice));
|
|
|
|
+ // fclose($myfile);
|
|
|
|
+ // }
|
|
|
|
+ // else
|
|
|
|
+ // {
|
|
|
|
+ // $myfile = fopen("./data/dlzemail/".$v['number'].".txt", "a+") or die("Unable to open file!");
|
|
|
|
+ // fwrite($myfile, json_encode($fs.';'.$v.';'.$shop.';'.$express.';'.$notice));
|
|
|
|
+ // fclose($myfile);
|
|
|
|
+ // }
|
|
|
|
+ // $this->fullorder->save(array('dlzemail'=>2,'dlzemailtime'=>time()),$v['id']);
|
|
|
|
+ // }
|
|
|
|
+ // sleep(50);
|
|
|
|
+ // }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|