Exemplo n.º 1
0
	public function query($com, $nu, $show = '0', $muti = 1) {
		if(empty($com) || empty($nu)) return FALSE;
		$this->par['type'] = $com;
		$this->par['postid'] = $nu;
		$result =  _dfsockopen($this->url.http_build_query($this->par));
		if($result) {
			$result =  json_decode($result, TRUE);
			if($result['status'] == 0) {
				$this->error = '物流单暂无结果';
				return FALSE;
			} elseif($result['status'] == 2) {
				$this->error = '接口出现异常';
				return FALSE;
			} else {
				unset($result['status']);
				switch ($result['state']) {
					case '0':
						$result['message'] = '在途';
						break;
					case '1':
						$result['message'] = '揽件';
						break;
					case '2':
						$result['message'] = '疑难';
						break;
					case '3':
						$result['message'] = '签收';
						break;
					case '4':
						$result['message'] = '退签';
						break;
					case '5':
						$result['message'] = '派件';
						break;
					case '6':
						$result['message'] = '退回';
						break;
					default:
						$result['message'] = '其他';
						break;
				}
				return $result;
			}
		} else {
			$this->error = '查询失败,请稍候重试';
			return FALSE;
		}
	}
Exemplo n.º 2
0
function dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE', $allowcurl = TRUE, $position = 0)
{
    require_once libfile('function/filesock');
    return _dfsockopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block, $encodetype, $allowcurl, $position);
}
Exemplo n.º 3
0
function dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE, $encodetype = 'URLENCODE', $allowcurl = TRUE)
{
    return _dfsockopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block, $encodetype, $allowcurl);
}
Exemplo n.º 4
0
function dfsockopen($url, $limit = 0, $post = '', $cookie = '', $bysocket = FALSE, $ip = '', $timeout = 15, $block = TRUE)
{
    require_once libfile('function/filesock');
    return _dfsockopen($url, $limit, $post, $cookie, $bysocket, $ip, $timeout, $block);
}
Exemplo n.º 5
0
 private function init($method, $source, $target, $nosuffix = 0)
 {
     //global $_G;
     $this->errorcode = 0;
     if (empty($source)) {
         return -2;
     }
     $parse = parse_url($source);
     if (isset($parse['host'])) {
         if (empty($target)) {
             return -2;
         }
         $data = _dfsockopen($source);
         $this->tmpfile = $source = tempnam('/data/temp/', 'tmpimg_');
         file_put_contents($source, $data);
         if (!$data || $source === FALSE) {
             return -2;
         }
     }
     if ($method == 'thumb') {
         $target = empty($target) ? !$nosuffix ? $this->getimgthumbname($source) : $this->getimgthumbname($source, '.' . $nosuffix . '.jpg', false) : $target;
         //PWEB_UPLOAD_URL
     } elseif ($method == 'watermask') {
         $target = empty($target) ? $source : '/data/' . $target;
     }
     $targetpath = dirname($target);
     if (!is_dir($targetpath)) {
         @mkdir($targetpath, 0777, true);
     }
     clearstatcache();
     if (!is_readable($source) || !is_writable($targetpath)) {
         return -2;
     }
     $imginfo = @getimagesize($source);
     if ($imginfo === FALSE) {
         return -1;
     }
     $this->source = $source;
     $this->target = $target;
     $this->imginfo['width'] = $imginfo[0];
     $this->imginfo['height'] = $imginfo[1];
     $this->imginfo['mime'] = $imginfo['mime'];
     $this->imginfo['size'] = @filesize($source);
     $this->libmethod = $this->param['imagelib'] && $this->param['imageimpath'];
     if (!$this->libmethod) {
         switch ($this->imginfo['mime']) {
             case 'image/jpeg':
                 $this->imagecreatefromfunc = function_exists('imagecreatefromjpeg') ? 'imagecreatefromjpeg' : '';
                 $this->imagefunc = function_exists('imagejpeg') ? 'imagejpeg' : '';
                 break;
             case 'image/gif':
                 $this->imagecreatefromfunc = function_exists('imagecreatefromgif') ? 'imagecreatefromgif' : '';
                 $this->imagefunc = function_exists('imagegif') ? 'imagegif' : '';
                 break;
             case 'image/png':
                 $this->imagecreatefromfunc = function_exists('imagecreatefrompng') ? 'imagecreatefrompng' : '';
                 $this->imagefunc = function_exists('imagepng') ? 'imagepng' : '';
                 break;
         }
     } else {
         $this->imagecreatefromfunc = $this->imagefunc = TRUE;
     }
     if (!$this->libmethod && $this->imginfo['mime'] == 'image/gif') {
         if (!$this->imagecreatefromfunc) {
             return -4;
         }
         if (!($fp = @fopen($source, 'rb'))) {
             return -2;
         }
         $content = fread($fp, $this->imginfo['size']);
         fclose($fp);
         $this->imginfo['animated'] = strpos($content, 'NETSCAPE2.0') === FALSE ? 0 : 1;
     }
     return $this->imagecreatefromfunc ? 1 : -4;
 }