...
|
...
|
@@ -3,9 +3,11 @@ |
|
|
namespace app\admin\controller;
|
|
|
|
|
|
use app\admin\model\AdminLog;
|
|
|
use app\api\controller\inspection\Task;
|
|
|
use app\common\controller\Backend;
|
|
|
use think\Config;
|
|
|
use think\Hook;
|
|
|
use think\Response;
|
|
|
use think\Session;
|
|
|
use think\Validate;
|
|
|
|
...
|
...
|
@@ -137,5 +139,33 @@ class Index extends Backend |
|
|
|
|
|
return $html;
|
|
|
}
|
|
|
// 生成二维码
|
|
|
public function build($text,$label='')
|
|
|
{
|
|
|
|
|
|
$config = get_addon_config('qrcode');
|
|
|
$params = $this->request->get();
|
|
|
$params = array_intersect_key($params, array_flip(['text', 'size', 'padding', 'errorlevel', 'foreground', 'background', 'logo', 'logosize', 'logopath', 'label', 'labelfontsize', 'labelalignment']));
|
|
|
$params['text'] = $text;
|
|
|
$params['label'] = $label;
|
|
|
$qrCode = \addons\qrcode\library\Service::qrcode($params);
|
|
|
$mimetype = $config['format'] == 'png' ? 'image/png' : 'image/svg+xml';
|
|
|
$response = Response::create()->header("Content-Type", $mimetype);
|
|
|
// 写入到文件
|
|
|
if ($config['writefile']) {
|
|
|
$qrcodePath = ROOT_PATH . 'public/uploads/store_qrcode/';
|
|
|
if (!is_dir($qrcodePath)) {
|
|
|
@mkdir($qrcodePath);
|
|
|
}
|
|
|
if (is_really_writable($qrcodePath)) {
|
|
|
$filePath = $qrcodePath . md5(implode('', $params)) . '.' . $config['format'];
|
|
|
$qrCode->writeFile($filePath);
|
|
|
$code_name = md5(implode('', $params)) . '.' . $config['format'];
|
|
|
}
|
|
|
$task=new Task();
|
|
|
$res=$task->fileUpload($code_name);
|
|
|
}
|
|
|
return $res;
|
|
|
|
|
|
}
|
|
|
} |
...
|
...
|
|