AdminEquipmentController.php
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* Created by PhpStorm.
* User: ruidiudiu
* Date: 2018/11/20
* Time: 16:33
*/
namespace app\portal\controller;
use app\portal\model\EquipmentModel;
use cmf\controller\AdminBaseController;
use QRcode;
/**
* Class AdminEquipmentController
* @package app\portal\controller
* @adminMenuRoot(
* 'name' =>'设备管理',
* 'action' =>'index',
* 'parent' =>'',
* 'display'=> true,
* 'order' => 30,
* 'icon' =>'th',
* 'remark' =>'设备管理'
* )
*/
class AdminEquipmentController extends AdminBaseController{
public function index(){
$Equipment=new EquipmentModel();
$data=$Equipment->paginate(10);
$this->assign('data',$data);
return $this->fetch();
}
//批量导入设备信息
//生成二维码
public function createQrCode($value){
import('phpqrcode.qrlib',VENDOR_PATH,'.php');
// $value= "http://www.baidu.com";
$name=date('YmdHis').rand(1000,9999);
$filename='qrCode/'.$name.'.png';
$filePath = 'upload/'.$filename; // 生成的文件名
$errorCorrectionLevel = 'L';//容错级别
$matrixPointSize = 6;//生成图片大小
QRcode::png($value,$filePath, $errorCorrectionLevel, $matrixPointSize, 2);
return $filename;
}
}