109 lines
4.3 KiB
PHP
Executable File
109 lines
4.3 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']);
|
|
|
|
ShopConfig::set('policy', 'contactus', $param['contactus']);
|
|
ShopConfig::set('policy', 'community', $param['community']);
|
|
ShopConfig::set('policy', 'privacy', $param['privacy']);
|
|
ShopConfig::set('policy', 'clause', $param['clause']);
|
|
ShopConfig::set('policy', 'consignment', $param['consignment']);
|
|
$url = URL_RELOAD;
|
|
return success('添加成功',$url);
|
|
}
|
|
$config = [
|
|
'procedure' => ShopConfig::get('policy', 'procedure'),
|
|
'rule' => ShopConfig::get('policy', 'rule'),
|
|
'contactus' => ShopConfig::get('policy', 'contactus'),
|
|
'community' => ShopConfig::get('policy', 'community'),
|
|
'privacy' => ShopConfig::get('policy', 'privacy'),
|
|
'clause' => ShopConfig::get('policy', 'clause'),
|
|
'consignment' => ShopConfig::get('policy', 'consignment'),
|
|
];
|
|
$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']);
|
|
ShopConfig::set('website', 'jmnum', $param['jmnum']);
|
|
|
|
ShopConfig::set('website', 'MCHID', $param['MCHID']);
|
|
ShopConfig::set('website', 'WXPAYKEY', $param['WXPAYKEY']);
|
|
ShopConfig::set('website', 'notify_url', $param['notify_url']);
|
|
$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'),
|
|
'jmnum' => ShopConfig::get('website', 'jmnum'),
|
|
'MCHID' => ShopConfig::get('website', 'MCHID'),
|
|
'WXPAYKEY' => ShopConfig::get('website', 'WXPAYKEY'),
|
|
'notify_url' => ShopConfig::get('website', 'notify_url'),
|
|
];
|
|
$this->assign([
|
|
'config' => $config,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
}
|