Variable.php
1.2 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
<?php
namespace app\admin\controller\vbot;
use app\common\controller\Backend;
/**
* 变量管理
*
* @icon fa fa-circle-o
*/
class Variable extends Backend
{
/**
* vbotVariable模型对象
* @var \app\admin\model\vbotVariable
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\VbotVariable;
$this->view->assign("valueSourceList", $this->model->getValueSourceList());
}
/*
* 获取变量值-用于管理员测试
*/
public function view_variable($ids = null)
{
$row = $this->model->get($ids);
if (!$row) {
$this->error(__('No Results were found'));
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
if (!in_array($row[$this->dataLimitField], $adminIds)) {
$this->error(__('You have no permission'));
}
}
$VbotLib = new \addons\vbot\library\VbotLib();
$row->variable_value = $VbotLib->get_variable_value($row->toArray());
$this->success(null, null, $row);
}
}