Config.php
3.16 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
namespace app\api\controller\kuerp\order;
use app\common\controller\Api;
use app\api\model\kuerp\Systems as Systems;
/**
* 系统配置接口
*/
class Config extends Api
{
protected $noNeedRight = '*';
protected $noNeedLogin = '*';
/**
* 获取系统配置详情
* @ApiMethod (POST)
* @param int $id 系统配置ID
*/
public function getdetail()
{
if ($this->request->isPost()) {
$name = $this->request->post('name');
$result = Systems::getDetail($name);
$this->success('查询成功',$result,200);
}else{
$this->error('请求方式错误','',250);
}
}
/**
* 添加系统配置
* @ApiMethod (POST)
* @param array $detail 系统配置数据
*/
public function adddetail()
{
if ($this->request->isPost()) {
$detail = $this->request->post();
foreach ($detail as $k=>$v){
$detail[$k] = is_array($v)?$v:html_entity_decode($v);
}
$ret = Systems::addDetail($detail);
if($ret['status']==200){
$this->success('添加成功',$ret['msg'],200);
}else{
$this->error($ret['msg'],'',$ret['status']);
}
}else{
$this->error('请求方式错误','',250);
}
}
/**
* 更新系统配置
* @ApiMethod (POST)
* @param array $detail 系统配置数据
*/
public function editdetail()
{
if ($this->request->isPost()) {
$detail = $this->request->post();
foreach ($detail as $k=>$v){
$detail[$k] = is_array($v)?$v:html_entity_decode($v);
}
$ret = Systems::editDetail($detail);
if($ret['status']==200){
$this->success('更新成功','',200);
}else{
$this->error($ret['msg'],'',$ret['status']);
}
}else{
$this->error('请求方式错误','',250);
}
}
/**
* 系统配置
* @ApiMethod (POST)
* @param int $name 系统配置name
*/
public function getSet()
{
if ($this->request->isPost()) {
$name = $this->request->post('name');
$ret = \think\Db::name('kuerp_user_config')->where(['name'=>$name])->value('value');
$this->success('查询成功',$ret,200);
}else{
$this->error('请求方式错误','',250);
}
}
/**
* 系统配置
* @ApiMethod (POST)
* @param int $name 系统配置name
*/
public function getConfig()
{
if ($this->request->isPost()) {
$name = $this->request->post('name');
$ret = \think\Db::name('kuerp_user_sets')->where(['name'=>['in',$name]])->column('value','name');
if($ret){
$this->success('查询成功',$ret,200);
}else{
$this->error('查询失败','',400);
}
}else{
$this->error('请求方式错误','',250);
}
}
}