AdminWebdataController.php
1.8 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
<?php
/**
* 网站配置
* Author : xiaojie
* DateTime: 2018/12/03 14:01
*/
namespace app\portal\controller;
use app\portal\model\WebdataModel;
use cmf\controller\AdminBaseController;
/**
* Class AdminWebdataController
* @package app\portal\controller
* @adminMenuRoot(
* 'name' =>'网站配置',
* 'action' =>'default',
* 'parent' =>'',
* 'display'=> true,
* 'order' => 30,
* 'icon' =>'th',
* 'remark' =>'网站配置'
* )
*/
class AdminWebdataController extends AdminBaseController
{
/**
* 展会倒计时
* @adminMenu(
* 'name' => '展会倒计时',
* 'parent' => 'portal/AdminWebdata/default',
* 'display'=> true,
* 'hasView'=> true,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '展会倒计时',
* 'param' => ''
* )
*/
public function index()
{
$webdataModel = new WebdataModel();
$info = $webdataModel->where('id',1)->find();
$info['start_time'] = date('Y-m-d',$info['start_time']);
$this->assign('info',$info);
return $this->fetch();
}
/**
* 保存
* @adminMenu(
* 'name' => '保存',
* 'parent' => 'index',
* 'display'=> false,
* 'hasView'=> false,
* 'order' => 10000,
* 'icon' => '',
* 'remark' => '保存',
* 'param' => ''
* )
*/
public function edit()
{
$webdataModel = new WebdataModel();
$param = $this->request->param();
$param['start_time'] = strtotime($param['start_time']);
$res = $webdataModel->isUpdate(true)->save($param);
if($res){
$this->success('保存成功');
}
$this->error('请稍后重试');
}
}