作者 郭文星

123

... ... @@ -192,7 +192,7 @@ return [
'否',
'是',
],
'value' => '0',
'value' => '1',
'rule' => 'required',
'msg' => '',
'tip' => '',
... ... @@ -235,8 +235,7 @@ return [
'title' => '允许的域名列表',
'visible' => 'limitreferer=1',
'type' => 'text',
'content' => [
],
'content' => [],
'value' => '',
'rule' => '',
'msg' => '',
... ...
... ... @@ -106,13 +106,12 @@ class Car extends Backend
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$istrue=$this->model->where("driver_id",$params['driver_id'])->find();
if($istrue){
$this->error("该司机添加车辆");
}
// $istrue=$this->model->where("driver_id",$params['driver_id'])->find();
// if($istrue){
// $this->error("该司机添加车辆");
// }
$route=Db::name("route")->where("id",$params['route_id'])->find();
$driver=Db::name("driver")->where("id",$params['driver_id'])->find();
$result = $this->model->allowField(true)->insertGetId($params);
$index=new Index();
... ... @@ -122,8 +121,8 @@ class Car extends Backend
"name"=>$driver["name"],
"driver_id"=>$driver["id"],
];
$place_image=$index->build($data);
$result = Db::name('driver')->where('id','=',$driver["id"])->update(['place_image'=>$place_image]);
$place_image=$index->build(json_encode($data));
$result = Db::name('driver')->where('id','=',$driver["id"])->update(['place_image'=>$avatar['fileurl']]);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
... ...
... ... @@ -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;
}
}
... ...