load->library('session'); $this->load->_model('Model_whlabel','whlabel'); $this->load->_model('Model_warehouse','warehouse'); $this->load->_model('Model_productprice','productprice'); $this->load->_model('Model_excel','excel'); $this->load->_model('Model_fullorder','fullorder'); $this->load->_model('Model_fullordertt','fullordertt'); $this->load->_model('Model_fullordersmt','fullordersmt'); $this->load->_model('Model_outbound','outbound'); $this->load->_model('Model_express','express'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_typeclass','typeclass'); $this->load->_model('Model_country','country'); $this->load->_model('Model_kdniao','kdniao'); $this->load->_model('Model_notice','notice'); $this->load->_model('Model_dhl','dhl'); $this->load->_model('Model_dhlhz','dhlhz'); $this->load->_model('Model_usps','usps'); $this->load->_model('Model_fedex','fedex'); $this->load->_model('Model_fedex_cby','fedex_cby'); $this->load->_model('Model_ups','ups'); $this->load->_model('Model_ali','ali'); $this->load->_model('Model_dpd','dpd'); $this->load->_model('Model_shop','shop'); $this->load->_model('Model_user','user'); $this->load->_model('Model_whlabel','whlabel'); $this->load->_model('Model_specialstock','specialstock'); $this->load->_model('Model_ck','ck'); $this->load->_model('Model_whlabellabel','whlabellabel'); $this->load->_model('Model_apiyy','apiyy'); $this->load->helper('url'); $this->load->_model('Model_whlabel_fc','whlabel_fc'); $this->load->_model('Model_systemtransfer','systemtransfer'); $this->load->_model('Model_classid','classid'); $this->load->_model('Model_allocation','allocation'); $this->load->_model('Model_fullorderxw','fullorderxw'); $this->load->_model('Model_fullorderpaypal','fullorderpaypal'); //$this->load->_model('Model_fedexv1','fedexv1'); $this->load->_model('Model_logic_crm','logic_crm'); $this->load->_model("Model_fullorder","fullorder"); $this->load->_model("Model_express","express"); $this->load->_model("Model_logic_ding","logic_ding"); $this->load->_model("Model_api",'api'); $this->load->_model("Model_usps",'usps'); } //定义方法的调用规则 获取URI第二段值 public function _remap($arg,$arg_array) { if($arg == 'fout') { $this->_fout(); }else if($arg == 'ceshi') { $this->_ceshi(); }else{ $this->_a($arg_array); } } public function _a($arg_array){ $dtc = array(); /* 订单号加入键值-j */ /* 匹配加入 */ $dictionaries = $this->typeclass->find_all('spare!= "" and classid != 1 and classid != 2 and classid != 3 and classid != 4 and classid != 5 and classid != 11 and classid != 16 and classid != 17 and classid != 20 and classid != 21 and classid != 23 and classid != 24 and classid != 29 and classid != 30 and classid != 31 and classid != 32 and classid != 36'); // and (classid=13 or classid=22 or classid=8 or classid=15 or classid=27 or classid=25 or classid=26 or classid=18 or classid=14 or classid=9 or classid=12 or classid=10 or classid=6 or classid=100 or classid=999) foreach ($dictionaries as $v) { if(stripos($v['spare'],'|') !== false)//如果有多个值 { $v['spare'] = explode('|',$v['spare']); foreach ($v['spare'] as $k=>$vs) { if(stripos($v['zh'],'|') !== false) { $vzh = explode('|',$v['zh']); $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$vzh[$k],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$vs); } else { $dtc[strtolower($vs)] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$vs); } } } else { $dtc[strtolower($v['spare'])] = array('classid'=>$v['classid'],'zh'=>$v['zh'],'id'=>$v['id'],'jm'=>$v['jm'],'spare'=>$v['spare']); } } $dtctitle = []; $dictionaries2 = $this->typeclass->find_all(); foreach ($dictionaries2 as $v) { $dtctitle[$v['id']] = $v['title']; } echo "
";
		$sku = "Free,Gift--PackQQS,NW--3+Ori6*6C-22 24 26-20-6*6C";
		$sl = "1;1;1;";
		$r = $this->api->matching($sl,$sku,$dtc,"","",$dtctitle,$shop=[],$extra = [
			"price"=>"565.7700",
			"row_total"=>"565.7700"
		]);
		var_dump($r['title']);
		$r = $r['product'];
		$rr = explode(";",$r);
		print_r($rr);
	
	    
    }
	public function _fout()
	{
		$waybill = $this->input->get('waybill');
		$this->usps->get_new_logistics($waybill);
        //$this->fedexv1->makeAccessToken();
		
	}
	
	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 _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));
	}
}