152 lines
5.4 KiB
PHP
Executable File
152 lines
5.4 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 shouyi(Request $request, ShopConfig $model, ShopConfigValidate $validate)
|
|
{
|
|
if ($request->isPost()) {
|
|
$param = $request->param();
|
|
ShopConfig::set('shouyi', 'time', $param['time']);
|
|
ShopConfig::set('shouyi', 'num', $param['num']);
|
|
$url = URL_RELOAD;
|
|
return success('添加成功',$url);
|
|
}
|
|
$config = [
|
|
'time' => ShopConfig::get('shouyi', 'time'),
|
|
'num' => ShopConfig::get('shouyi', 'num'),
|
|
];
|
|
$this->assign([
|
|
'config' => $config,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
//分销管理
|
|
public function fenxiao(Request $request, ShopConfig $model, ShopConfigValidate $validate)
|
|
{
|
|
if ($request->isPost()) {
|
|
$param = $request->param();
|
|
ShopConfig::set('fenxiao', 'first_ratio', $param['first_ratio']);
|
|
ShopConfig::set('fenxiao', 'second_ratio', $param['second_ratio']);
|
|
ShopConfig::set('fenxiao', 'number', $param['number']);
|
|
$url = URL_RELOAD;
|
|
return success('添加成功',$url);
|
|
}
|
|
$config = [
|
|
'first_ratio' => ShopConfig::get('fenxiao', 'first_ratio'),
|
|
'second_ratio' => ShopConfig::get('fenxiao', 'second_ratio'),
|
|
'number' => ShopConfig::get('fenxiao', 'number'),
|
|
];
|
|
$this->assign([
|
|
'config' => $config,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
|
|
//政策协议
|
|
public function policy(Request $request, ShopConfig $model, ShopConfigValidate $validate)
|
|
{
|
|
if ($request->isPost()) {
|
|
$param = $request->param();
|
|
ShopConfig::set('policy', 'integral_rule', $param['integral_rule']);
|
|
$url = URL_RELOAD;
|
|
return success('添加成功',$url);
|
|
}
|
|
$config = [
|
|
'integral_rule' => ShopConfig::get('policy', 'integral_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 goods(Request $request, Goods $gmodel, ShopConfigValidate $validate)
|
|
{
|
|
if ($request->isPost()) {
|
|
$param = $request->param();
|
|
ShopConfig::set('goods', 'goods_id', $param['goods_id']);
|
|
ShopConfig::set('goods', 'day', $param['day']);
|
|
ShopConfig::set('goods', 'is_withdraw', $param['is_withdraw']);
|
|
ShopConfig::set('goods', 'is_first', $param['is_first']);
|
|
ShopConfig::set('goods', 'is_open', $param['is_open']);
|
|
$url = URL_RELOAD;
|
|
return success('添加成功',$url);
|
|
}
|
|
$config = [
|
|
'goods_id' => ShopConfig::get('goods', 'goods_id'),
|
|
'day' => ShopConfig::get('goods', 'day'),
|
|
'is_withdraw' => ShopConfig::get('goods', 'is_withdraw'),
|
|
'is_first' => ShopConfig::get('goods', 'is_first'),
|
|
'is_open' => ShopConfig::get('goods', 'is_open'),
|
|
'goods_list'=>Goods::all(),
|
|
];
|
|
$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', 'tel', $param['tel']);
|
|
$url = URL_RELOAD;
|
|
return success('添加成功',$url);
|
|
}
|
|
$config = [
|
|
'APPID' => ShopConfig::get('website', 'APPID'),
|
|
'APPSECRET' => ShopConfig::get('website', 'APPSECRET'),
|
|
'img_url' => ShopConfig::get('website', 'img_url'),
|
|
'tel' => ShopConfig::get('website', 'tel'),
|
|
];
|
|
$this->assign([
|
|
'config' => $config,
|
|
]);
|
|
return $this->fetch();
|
|
}
|
|
}
|