dggjimai/application/admin/controller/ShopConfigController.php

89 lines
3.1 KiB
PHP
Executable File

<?php
/**
* 配置表控制器
*/
namespace app\admin\controller;
use think\Request;
use app\common\model\ShopConfig;
use app\common\model\Goods;
use app\common\validate\ShopConfigValidate;
class ShopConfigController extends Controller
{
//政策协议
public function policy(Request $request, ShopConfig $model, ShopConfigValidate $validate)
{
if ($request->isPost()) {
$param = $request->param();
ShopConfig::set('policy', 'procedure', $param['procedure']);
ShopConfig::set('policy', 'rule', $param['rule']);
$url = URL_RELOAD;
return success('添加成功',$url);
}
$config = [
'procedure' => ShopConfig::get('policy', 'procedure'),
'rule' => ShopConfig::get('policy', 'rule'),
];
$this->assign([
'config' => $config,
]);
return $this->fetch();
}
//会员提现
public function withdraw(Request $request, ShopConfig $model, ShopConfigValidate $validate)
{
if ($request->isPost()) {
$param = $request->param();
ShopConfig::set('withdraw', 'min_withdraw', $param['min_withdraw']);
ShopConfig::set('withdraw', 'max_withdraw', $param['max_withdraw']);
ShopConfig::set('withdraw', 'poundage', $param['poundage']);
ShopConfig::set('withdraw', 'poundage_type', $param['poundage_type']);
$url = URL_RELOAD;
return success('添加成功',$url);
}
$config = [
'min_withdraw' => ShopConfig::get('withdraw', 'min_withdraw'),
'max_withdraw' => ShopConfig::get('withdraw', 'max_withdraw'),
'poundage' => ShopConfig::get('withdraw', 'poundage'),
'poundage_type' => ShopConfig::get('withdraw', 'poundage_type'),
];
$this->assign([
'config' => $config,
]);
return $this->fetch();
}
//网站设置
public function website(Request $request, ShopConfig $model, ShopConfigValidate $validate)
{
if ($request->isPost()) {
$param = $request->param();
ShopConfig::set('website', 'APPID', $param['APPID']);
ShopConfig::set('website', 'APPSECRET', $param['APPSECRET']);
ShopConfig::set('website', 'img_url', $param['img_url']);
ShopConfig::set('website', 'size', $param['size']);
ShopConfig::set('website', 'size_img', $param['size_img']);
ShopConfig::set('website', 'channel', $param['channel']);
$url = URL_RELOAD;
return success('添加成功',$url);
}
$config = [
'APPID' => ShopConfig::get('website', 'APPID'),
'APPSECRET' => ShopConfig::get('website', 'APPSECRET'),
'img_url' => ShopConfig::get('website', 'img_url'),
'size' => ShopConfig::get('website', 'size'),
'size_img' => ShopConfig::get('website', 'size_img'),
'channel' => ShopConfig::get('website', 'channel'),
];
$this->assign([
'config' => $config,
]);
return $this->fetch();
}
}