| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace app\user\controller;
- use think\Lang;
- use think\File;
- class Config extends AdminControl {
- public function _initialize() {
- parent::_initialize();
- Lang::load(APP_PATH . 'admin/lang/' . config('default_lang') . '/config.lang.php');
- }
- /**
- * 网站配置
- * @return mixed
- */
- public function index() {
- // var_dump(PUBLIC_PATH . DS .DIR_STATIC );
- // var_dump(DS_THEME_STYLE_URL . 'images');
- $model_config = model('config');
- $allpower = $this->qxhans();
- $this->assign('allpower',$allpower);
- if (!request()->isPost()) {
- $list_config = $model_config->getListConfig();
- $this->assign('list_config', $list_config);
- $this->setAdminCurItem('index');
- return $this->fetch();
- } else {
- $update_array = array();
- $update_array['site_state'] = isset($_POST['site_state']) ? '1' : '';
- $update_array['site_name'] = $_POST['site_name'];
- $update_array['icp_number'] = $_POST['icp_number'];
- $update_array['site_phone'] = $_POST['site_phone'];
- $update_array['flow_static_code'] = $_POST['flow_static_code'];
- $update_array['fax'] = $_POST['fax'];
- $imgurl = DS_THEME_STYLE_URL . 'images';
- $numurl = '/static/home/images';
- $file = request()->file('site_logo');
- if($file){
- $imgname = "logo";//官网logo
- $file = $file->setSaveName($imgname);//设置保存文件名
- $imgo = $file->move($imgurl, $savename = false, $replace = true);
- if($imgo){
- $update_array['site_logo'] = $imgname.'.png';
- }
- }
- $files = request()->file('site_logowx');
- if($files){
- $wximgname = "code";//微信二维码
- $files = $files->setSaveName($wximgname);//设置保存文件名
- $imgt = $files->move($imgurl, $savename = false, $replace = true);
- if($imgt){
- $update_array['site_logowx'] = $wximgname.'.png';
- }
- }
-
- $files = request()->file('site_logowb');
- if($files){
- $wximgname = "blog";//微信二维码
- $files = $files->setSaveName($wximgname);//设置保存文件名
- $imgt = $files->move($imgurl, $savename = false, $replace = true);
- if($imgt){
- $update_array['site_logowb'] = $wximgname.'.png';
- }
- }
- $result = $model_config->updateConfig($update_array);
- if ($result === true) {
- $this->log(lang('ds_edit') . lang('dis_dump'), 1);
- $this->success('修改成功', 'Config/index');
- } else {
- $this->log(lang('ds_edit') . lang('dis_dump'), 0);
- $this->error(lang('修改失败'));
- }
- }
- }
- /**
- * 获取卖家栏目列表,针对控制器下的栏目
- */
- protected function getAdminItemList() {
- $menu_array = array(
- array(
- 'name' => 'base',
- 'text' => lang('site_set'),
- 'url' => url('Admin/Config/index')
- ),
- );
- return $menu_array;
- }
- }
|