123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- // +----------------------------------------------------------------------
- // | A3Mall
- // +----------------------------------------------------------------------
- // | Copyright (c) 2020 http://www.a3-mall.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Author: xzncit <158373108@qq.com>
- // +----------------------------------------------------------------------
- namespace app\admin\controller\system;
- use app\admin\controller\Auth;
- use mall\library\delivery\aliyun\Aliyun;
- use think\facade\Config;
- use think\facade\Request;
- use mall\response\Response;
- use think\facade\View;
- use app\common\models\Setting as SettingModel;
- class Setting extends Auth {
- /**
- * 站点设置
- * @return string|\think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function index(){
- if(Request::isAjax()){
- SettingModel::saveData(Request::param());
- return Response::returnArray("操作成功!");
- }
- $array = [];
- foreach(["web_name", "web_title", "web_keywords", "web_description", "web_copyright", "web_logo"] as $value){
- $array[$value] = SettingModel::getStringData($value);
- }
- return View::fetch("",[ "data"=>$array ]);
- }
- /**
- * 邮箱设置
- * @return string|\think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function email(){
- if(Request::isAjax()){
- SettingModel::saveData("email",Request::param());
- return Response::returnArray("操作成功!");
- }
- return View::fetch("",[ "data"=>SettingModel::getArrayData("email") ]);
- }
- /**
- * 上传设置
- * @return string|\think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function upload(){
- if(Request::isAjax()){
- SettingModel::saveData("upload",Request::post());
- return Response::returnArray("操作成功!");
- }
- return View::fetch("",[
- "city"=>Config::get("oss.aliyun.city"),
- "data"=>SettingModel::getArrayData("upload")
- ]);
- }
- /**
- * 物流查询
- * @return string|\think\response\Json
- */
- public function delivery(){
- if(Request::isAjax()){
- $post = Request::post();
- Aliyun::setConfig($post);
- return Response::returnArray("操作成功!");
- }
- return View::fetch("",[
- "data"=>Aliyun::getConfig()
- ]);
- }
- /**
- * 联系方式
- * @return string|\think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function address(){
- if(Request::isAjax()){
- SettingModel::saveData("address",Request::post());
- return Response::returnArray("操作成功!");
- }
- return View::fetch("",[ "data"=>SettingModel::getArrayData("address") ]);
- }
- /**
- * 备案信息
- * @return string|\think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function copyright(){
- if(Request::isAjax()){
- SettingModel::saveData("copyright",Request::post());
- return Response::returnArray("操作成功!");
- }
- return View::fetch("",[ "data"=>SettingModel::getArrayData("copyright")["copyright"] ]);
- }
- }
|