AdminContactController.php
1.5 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
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 小夏 < 449134904@qq.com>
// +----------------------------------------------------------------------
namespace app\portal\controller;
use app\portal\model\ContactModel;
use cmf\controller\AdminBaseController;
class AdminContactController extends AdminBaseController
{
//联系我们
//编辑页面
public function edit(){
$contactModel = new ContactModel();
$post = $contactModel->where('id',1)->find();
$this->assign('post',$post);
return $this->fetch();
}
//编辑提交
public function editPost(){
$data = $this->request->param();
$result = $this->validate($data, 'AdminContact.edit');
if ($result !== true) {
$this->error($result);
}
$contactModel = new ContactModel();
// 显式指定更新数据操作
$res = $contactModel->isUpdate(true)->save($data);
if($res){
$this->success('保存成功!');
}else{
$this->error('失败');
}
}
}