完善配置模块

This commit is contained in:
邹景立 2017-02-21 11:14:04 +08:00
parent 371db9fc70
commit 5ee5f5984a
3 changed files with 155 additions and 12 deletions

View File

@ -16,9 +16,10 @@ class Config extends BasicAdmin {
protected $table = 'SystemConfig';
protected $title = '系统参数配置';
public function index() {
if (!$this->request->isPost()) {
$this->title = '系统参数配置';
parent::_list($this->table);
} else {
$data = $this->request->post();
@ -31,17 +32,19 @@ class Config extends BasicAdmin {
}
public function file() {
if (!$this->request->isPost()) {
$this->title = '文件存储配置';
parent::_list($this->table);
} else {
$data = $this->request->post();
foreach ($data as $key => $vo) {
$_data = ['name' => $key, 'value' => $vo];
Data::save($this->table, $_data, 'name');
}
$this->success('数据修改成功!', '');
}
$this->title = '文件存储配置';
$this->index();
}
public function mail() {
$this->title = '邮箱账号配置';
$this->index();
}
public function sms() {
$this->title = '短信账号配置';
$this->index();
}
}

View File

@ -0,0 +1,61 @@
{extend name="extra@admin/content"}
{block name="content"}
<div class="row">
<div class="col-lg-12">
<form class=" layui-form" data-auto="" method="post">
<fieldset class="layui-elem-field layui-box">
<legend>邮件配置</legend>
<div class="layui-field-box" style="padding-right:35px">
<div class="layui-form-item layui-box">
<label class="layui-form-label">邮件发件人</label>
<div class="layui-input-block">
<input type="text" name="mail_from_name" required="required" title="请输入邮件发件人" placeholder="请输入邮件发件人" value="{:sysconf('mail_from_name')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box">
<label class="layui-form-label">回复收信邮箱</label>
<div class="layui-input-block">
<input type="text" name="mail_reply" required="required" title="请输入回复收信邮箱" placeholder="请输入回复收信邮箱" value="{:sysconf('mail_reply')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box">
<label class="layui-form-label">SMTP服务器</label>
<div class="layui-input-block">
<input type="text" name="mail_smtp_host" required="required" title="请输入SMTP服务器" placeholder="请输入SMTP服务器" value="{:sysconf('mail_smtp_host')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box">
<label class="layui-form-label">SMTP端口号</label>
<div class="layui-input-block">
<input type="text" name="mail_smtp_port" required="required" title="请输入SMTP端口号" placeholder="请输入SMTP端口号" value="{:sysconf('mail_smtp_port')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box">
<label class="layui-form-label">SMTP帐号</label>
<div class="layui-input-block">
<input type="text" name="mail_smtp_username" required="required" title="请输入SMTP帐号" placeholder="请输入SMTP帐号" value="{:sysconf('mail_smtp_username')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box">
<label class="layui-form-label">SMTP密码</label>
<div class="layui-input-block">
<input type="password" name="mail_smtp_password" required="required" title="请输入SMTP密码" placeholder="请输入SMTP密码" value="{:sysconf('mail_smtp_password')}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-box text-center">
<button class="layui-btn" type="submit">立即提交</button>
</div>
</fieldset>
</form>
</div>
</div>
{/block}

View File

@ -0,0 +1,79 @@
{extend name="extra@admin/content"}
{block name="content"}
<div class="row">
<div class="col-lg-12">
<form class=" layui-form" data-auto="" method="post">
<fieldset class="layui-elem-field layui-box">
<legend>短信平台</legend>
<div class="layui-field-box" style="padding-right:35px">
<div class="layui-form-item layui-box">
<label class="layui-form-label">短信平台</label>
<div class="layui-input-block">
<select name="sms_type" lay-filter="sms_type" required="required">
<option {if sysconf('storage_type')!=='zt'}selected{/if} value='zt'>助通短信平台</option>
<option {if sysconf('storage_type')==='ali'}selected{/if} value='ali'>阿里云短信</option>
</select>
</div>
</div>
<div class="layui-form-item layui-box" data-sms-type="zt">
<label class="layui-form-label">平台账号</label>
<div class="layui-input-block">
<input type="text" name="sms_zt_username" required="required" title="请输入短信平台账号" placeholder="请输入短信平台账号" value="{:sysconf('sms_zt_username')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box" data-sms-type="zt">
<label class="layui-form-label">平台密码</label>
<div class="layui-input-block">
<input type="password" name="sms_zt_password" required="required" title="请输入短信平台密码" placeholder="请输入短信平台密码" value="{:sysconf('sms_zt_password')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box" data-sms-type="ali">
<label class="layui-form-label">accessKey</label>
<div class="layui-input-block">
<input type="text" name="sms_ali_key" required="required" title="请输入accessKey" placeholder="请输入accessKey" value="{:sysconf('sms_ali_key')}" class="layui-input">
</div>
</div>
<div class="layui-form-item layui-box" data-sms-type="ali">
<label class="layui-form-label">accessSecret</label>
<div class="layui-input-block">
<input type="text" name="sms_ali_secret" required="required" title="请输入accessSecret" placeholder="请输入accessSecret" value="{:sysconf('sms_ali_secret')}" class="layui-input">
</div>
</div>
</div>
<div class="layui-form-item layui-box text-center">
<button class="layui-btn" type="submit">立即提交</button>
</div>
</fieldset>
</form>
</div>
</div>
{/block}
{block name="script"}
<script>
$(function () {
// 默认初始化布局
initLayout($('[name="sms_type"]').val());
// 表单动态渲染
window.form.render();
/*! 兼听 select 的值变化 */
window.form.on('select(sms_type)', function (data) {
// 重新初始化布局
initLayout(data.value);
});
// 表单初始化布局
function initLayout(storage_type) {
$("[data-sms-type]").not($("[data-sms-type='" + storage_type + "']").show()).hide();
}
});
</script>
{/block}