REAPI/app/setting/controller/MerchantConfig.php

86 lines
2.5 KiB
PHP
Raw Normal View History

2024-11-02 15:27:08 +08:00
<?php
// +----------------------------------------------------------------------
// | ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 代码仓库https://gitee.com/zoujingli/ThinkAdmin
// | github 代码仓库https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
namespace app\setting\controller;
use think\admin\Controller;
/**
* 系统配置
* Class App
* @package app\setting\controller
*/
class MerchantConfig extends Controller
{
/**
* 绑定数据表
* @var string
*/
public $table = 'merchant_system_config';
/**
* 更新配置
* @auth true
* @login true
* @menu true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function index()
{
$this->title = '商户分离系统配置';
$query = $this->_query($this->table);
// $query->equal('mid,cid,pid,account,cash,product_key,isp')->like('order_id,channel_order_id,merchant_order_id,parent_order_id')->dateBetween('create_at,channel_callback_at');
// try{
// $query->order('create_at desc')->page();
// }catch(\Exception $e){
// var_dump($e);exit;
// }
if (input('output') === 'json') {
$result = $query->page(true, false);
$this->success('获取数据列表成功', $result);
} else {
// 新版本中 QueryHelper 对象支持 Layui 表格数据加载
// $query->order('create_at desc')->layTable(function(QueryHelper $query){
// 前置操作,处理 HTML 模型
// });
$res= $query->page();
}
// $this->fetch();
}
/**
* 保存配置
* @auth true
* @login true
* @menu true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function save()
{
if ($this->request->isPost()) {
foreach ($this->request->post() as $k => $v) sysconf($k, $v);
$this->success('更新系统配置成功!');
}
}
}