You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/application/agent/controller/user/Site.php

99 lines
3.9 KiB

10 months ago
<?php
// +----------------------------------------------------------------------
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
// +----------------------------------------------------------------------
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
// +----------------------------------------------------------------------
namespace app\agent\controller\user;
use think\Url;
use service\FormBuilder as Form;
use think\Request;
use service\JsonService as Json;
use service\UploadService as Upload;
use app\agent\controller\AuthController;
use app\admin\model\system\SystemConfig as ConfigModel;
use think\Db;
/**
* 配置列表控制器
* Class SystemConfig
* @package app\admin\controller\setting
*/
class Site extends AuthController
{
/**
* 基础配置
* */
public function index()
{
$mer_list = Db::name('agent_site')->where(array('agent_id'=>$this->merchantId))->find();
$formbuider = [];
$formbuider[] = Form::frameImageOne('logo', '站点Logo', Url::build('admin/widget.images/index', array('fodder' => 'logo')), $mer_list['logo'])->icon('image')->width('70%')->height('500px')->info('站点Logo')->col(13);
$formbuider[] = Form::input('name', '站点名称',$mer_list['name'])->info("站点名称
")->placeholder("请输入站点名称
")->col(13);
$formbuider[] = Form::input('title', '站点标题',$mer_list['title'])->info("站点标题
")->placeholder("请输入站点标题
")->col(13);
$formbuider[] = Form::input('filings', '网站备案',$mer_list['filings'])->info("网站备案
")->placeholder("请输入网站备案
")->col(13);
$formbuider[] = Form::textarea('content', '站点描述', $mer_list['content'])->placeholder('请输入站点描述')->info('站点描述')->rows(6)->col(13);
$formbuider[] = Form::textarea('copyright', '底部版权', $mer_list['copyright'])->placeholder('请输入底部版权')->info('底部版权')->rows(6)->col(13);
$form = Form::make_post_form('编辑配置', $formbuider, Url::build('save_basics'), 2);
$this->assign(compact('form'));
$this->assign('list', []);
return $this->fetch();
}
public function save_basics()
{
$request = Request::instance();
if ($request->isPost()) {
$post = $request->post();
$menus = Db::name('agent_site')->where('agent_id',$this->merchantId)->find();
if($menus){
$post['add_time'] = time();
Db::name('agent_site')->where('agent_id',$this->merchantId)->update($post);
}else{
$post['agent_id'] = $this->merchantId;
$post['add_time'] = time();
Db::name('agent_site')->insert($post);
}
return Json::successful('修改成功');
}
}
/**
* 获取文件名
* */
public function getImageName()
{
$request = Request::instance();
$post = $request->post();
$src = $post['src'];
$data['name'] = basename($src);
exit(json_encode($data));
}
/**
* 上传文件
* @return string
*/
public function file_upload()
{
$res = Upload::file('file', 'config/file');
if (!$res->status) return Json::fail($res->error);
return Json::successful('上传成功!', ['filePath' => $res->filePath]);
}
}