You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
PHP
49 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Home\Controller;
|
|
|
|
/**
|
|
* 前台首页控制器
|
|
* 主要获取首页聚合数据
|
|
*/
|
|
class SiteBaseController extends BaseController {
|
|
|
|
//站点申请
|
|
public function index(){
|
|
$model = D('SiteBase');
|
|
$data = $model->get_promote_data();
|
|
|
|
foreach($data as $k => $v) {
|
|
if(strripos($k,'_logo')!==false || strripos($k,'_icon')!==false || strripos($k,'_qrcode') !== false) {
|
|
$fields[] = $k;
|
|
}
|
|
}
|
|
|
|
$this->assign('data',$data);
|
|
$this->assign('fields',$fields);
|
|
$this->meta_title = "基本信息";
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 添加/编辑
|
|
*/
|
|
public function save(){
|
|
$model = D('SiteBase');
|
|
$data = $model->create();
|
|
if(empty($data)){
|
|
$this->error($model->getError());
|
|
}else{
|
|
if(!empty($data['id'])){
|
|
$res = $model->save();
|
|
}else{
|
|
$res = $model->add();
|
|
}
|
|
if($res !== false){
|
|
$this->success('保存成功!');
|
|
}else{
|
|
$this->error('保存失败:'.$model->getError());
|
|
}
|
|
}
|
|
}
|
|
} |