Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
e7eb4ffc
Commit
e7eb4ffc
authored
Apr 24, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
参数设置修改
parent
d851f513
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
96 additions
and
24 deletions
+96
-24
Setting.php
application/index/controller/Setting.php
+42
-21
SystemConfig.php
application/model/SystemConfig.php
+54
-0
route.php
application/route.php
+0
-1
setting.js
public/resource/js/setting.js
+0
-2
No files found.
application/index/controller/Setting.php
View file @
e7eb4ffc
...
...
@@ -10,35 +10,57 @@ namespace app\index\controller;
use
app\index\extend\Basic
;
use
app\model\SystemConfig
;
use
think\Cache
;
class
Setting
extends
Basic
{
/**
*
页面视图
*
显示视图,新增和编辑设置数据
*
* @return \think\response\View
*/
public
function
index
()
{
return
view
(
'setting/index'
);
}
/**
* 修改和新增
*
* @return \think\Response
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getSetting
()
{
$data
=
[];
if
(
$this
->
request
->
isGet
())
{
$data
=
Cache
::
get
(
'Setting'
);
if
(
$this
->
request
->
isAjax
())
{
$data
=
[];
$config
=
new
SystemConfig
();
if
(
$this
->
request
->
isGet
())
{
//获取数据
$data
=
$config
->
getSetting
();
}
else
{
//新增或编辑数据
$data
[
'is_privacy'
]
=
$this
->
params
[
'is_privacy'
];
$data
[
'day_num'
]
=
$this
->
params
[
'day_num'
];
$data
[
'down_time'
]
=
$this
->
params
[
'down_time'
];
$config_data
=
[];
$config_data
[
0
][
'id'
]
=
1
;
$config_data
[
0
][
'config_name'
]
=
'商铺自动下架天数'
;
$config_data
[
0
][
'config_type'
]
=
10
;
$config_data
[
0
][
'rule'
]
=
json_encode
([
'down_time'
=>
$data
[
'down_time'
]]);
$config_data
[
0
][
'agent_id'
]
=
$this
->
userId
;
$config_data
[
1
][
'id'
]
=
2
;
$config_data
[
1
][
'config_name'
]
=
'隐私号码'
;
$config_data
[
1
][
'config_type'
]
=
20
;
$config_data
[
1
][
'rule'
]
=
json_encode
([
'is_privacy'
=>
$data
[
'is_privacy'
],
'day_num'
=>
$data
[
'day_num'
]
]);
$config_data
[
1
][
'agent_id'
]
=
$this
->
userId
;
$config
->
insertSetting
(
$config_data
,
true
);
Cache
::
set
(
'Setting'
,
$data
);
}
return
$this
->
response
(
200
,
''
,
$data
);
}
else
{
$data
[
'is_privacy'
]
=
$this
->
params
[
'is_privacy'
];
$data
[
'day_num'
]
=
$this
->
params
[
'day_num'
];
$data
[
'down_time'
]
=
$this
->
params
[
'down_time'
];
Cache
::
set
(
'Setting'
,
$data
);
//视图显示
return
view
(
'setting/index'
);
}
return
$this
->
response
(
200
,
''
,
$data
);
}
}
\ No newline at end of file
application/model/SystemConfig.php
0 → 100644
View file @
e7eb4ffc
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/4/24
* Time: 10:12
*/
namespace
app\model
;
class
SystemConfig
extends
BaseModel
{
/**
* 批量插入数据
*
* @param array $data
* @param bool $replace
* @return int|string
*/
public
function
insertSetting
(
array
$data
,
$replace
=
true
)
{
return
$this
->
insertAll
(
$data
,
$replace
);
}
/**
* 获取参数设置
*
* @param array $where
* @param string $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getSetting
(
array
$where
=
[],
string
$field
=
'rule'
)
:
array
{
$data
=
$this
->
field
(
$field
)
->
where
(
$where
)
->
select
();
if
(
$data
!=
NULL
)
{
foreach
(
$data
as
$k
=>
$v
)
{
$result_arr
=
json_decode
(
$v
[
'rule'
],
true
);
foreach
(
$result_arr
as
$kk
=>
$vv
)
{
$result
[
$kk
]
=
$vv
;
}
}
}
else
{
$result
=
[];
}
return
$result
;
}
}
\ No newline at end of file
application/route.php
View file @
e7eb4ffc
...
...
@@ -183,7 +183,6 @@ Route::group('index', [
'useraction_search'
=>
[
'index/remark/useraction_search'
,
[
'method'
=>
'get|post'
]
],
//后台客户详情
'select_by_phone'
=>
[
'index/remark/select_by_phone'
,
[
'method'
=>
'get|post'
]
],
//后台客户详情--客方搜索
'setting_index'
=>
[
'index/Setting/index'
,
[
'method'
=>
'get'
]
],
//全局参数设置页面
'getSetting'
=>
[
'index/Setting/getSetting'
,
[
'method'
=>
'get|post'
]
],
//新增和修改全局参数设置
'getMenu'
=>
[
'index/Auth/getMenu'
,
[
'method'
=>
'get|post'
]
],
//新增和修改全局参数设置
'reportListAttache/:check_status'
=>
[
'index/Finance/reportList'
,
[
'method'
=>
'get'
]
,[
'check_status'
=>
0
]],
//财务 成交报告-未结单-专员审核
...
...
public/resource/js/setting.js
View file @
e7eb4ffc
...
...
@@ -21,7 +21,6 @@ define (['doT', 'text!temp/setting_template_tpl.html', 'css!style/home.css'], fu
$
.
ajax
({
url
:
'/admin.php/index/getSetting'
,
type
:
'GET'
,
async
:
true
,
data
:
param
,
dataType
:
'json'
,
success
:
function
(
data
)
{
...
...
@@ -41,7 +40,6 @@ define (['doT', 'text!temp/setting_template_tpl.html', 'css!style/home.css'], fu
$
.
ajax
({
url
:
'/admin.php/index/getSetting'
,
type
:
'POST'
,
async
:
true
,
data
:
param
,
dataType
:
'json'
,
success
:
function
(
data
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment