add-api-distribution
This commit is contained in:
@@ -82,22 +82,8 @@ class Hdwechat
|
||||
*/
|
||||
function qrcode($filename, $scene, $page, $width)
|
||||
{
|
||||
$file = APPPATH . '../www/api/wx/' . $filename . '.png';
|
||||
$dir = substr($file, 0, strrpos($file, '/'));
|
||||
if (!is_dir($dir)) {
|
||||
$ret = mkdir($dir, 0777, true);// 如果文件夹不存在,将以递归方式创建该文件夹
|
||||
if (!$ret) {
|
||||
debug_log("[error] " . __FUNCTION__ . ": mkdir {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($file)) {
|
||||
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
|
||||
}
|
||||
|
||||
$access_token = $this->access_token();
|
||||
var_dump($access_token);exit;
|
||||
if (!$access_token) {
|
||||
debug_log("[error] " . __FUNCTION__ . ": not access_token", $this->log_file);
|
||||
return array();
|
||||
@@ -123,14 +109,10 @@ class Hdwechat
|
||||
debug_log("[error] " . __FUNCTION__ . ": httpcode:{$code}, response:{$res}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
$ret = file_put_contents($file, $res);
|
||||
if (false === $ret) {
|
||||
debug_log("[error] " . __FUNCTION__ . ": file_put_contents {$ret}, filename:{$filename}, scene:{$scene}, page:{$page}, width:{$width}", $this->log_file);
|
||||
return array();
|
||||
}
|
||||
|
||||
return array('file' => $file, 'url' => 'wx/' . $filename . '.png');
|
||||
$CI = &get_instance();
|
||||
$CI->load->library('qiniu');
|
||||
$ret= $CI->qiniu->save("{$filename}.png", $res);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user