| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\admin\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(BASE_UPLOAD_PATH);
- $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 = BASE_UPLOAD_PATH;
- $file = request()->file('site_logo');
- $imgname = "logo";//官网logo
- $file->setSaveName($imgname);//设置保存文件名
- $imgo = $file->move($imgurl,false,false);
- if($imgo){
- $update_array['site_logo'] = $imgurl . '/' .$imgname.'.jpg';
- }
- $files = request()->file('site_logowx');
- $wximgname = "code";//微信二维码
- $files->setSaveName($wximgname);//设置保存文件名
- $imgt = $files->move($imgurl,false,false);
- if($imgt){
- $update_array['site_logowx'] = $imgurl . '/' .$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;
- }
- }
|