47 lines
3.7 KiB
PHP
47 lines
3.7 KiB
PHP
<?php
|
||
/** @var array $v */
|
||
$checked = fn($k) => !empty($v[$k]) ? 'checked' : '';
|
||
?>
|
||
<div class="page-head">
|
||
<div><h2>通知设置</h2><p class="muted">配置“新订单 / 新事件”的负责人通知渠道(邮件 + 企业微信)。</p></div>
|
||
</div>
|
||
|
||
<form method="post" action="<?php echo \Core\App::url('PSI/notifications/save'); ?>" class="form-card notify-form">
|
||
<?php echo csrf_field(); ?>
|
||
|
||
<div class="form-section">
|
||
<label class="check"><input type="checkbox" name="notify_enabled" <?php echo $checked('notify_enabled'); ?>> <b>启用事件通知</b></label>
|
||
<small>关闭后仅记录站内紧急事件,不发送邮件 / 微信。</small>
|
||
</div>
|
||
|
||
<fieldset class="form-section">
|
||
<legend>邮件通知</legend>
|
||
<label class="check"><input type="checkbox" name="notify_email_enabled" <?php echo $checked('notify_email_enabled'); ?>> 启用邮件</label>
|
||
<div class="form-row"><label>SMTP 服务器</label><input type="text" name="notify_email_smtp_host" value="<?php echo e($v['notify_email_smtp_host'] ?? ''); ?>" placeholder="如 smtp.exmail.qq.com(留空则使用系统 mail())"></div>
|
||
<div class="form-row"><label>端口</label><input type="text" name="notify_email_smtp_port" value="<?php echo e($v['notify_email_smtp_port'] ?? '465'); ?>" placeholder="465=SSL,587=STARTTLS"></div>
|
||
<div class="form-row"><label>账号</label><input type="text" name="notify_email_smtp_user" value="<?php echo e($v['notify_email_smtp_user'] ?? ''); ?>" placeholder="发信邮箱/账号"></div>
|
||
<div class="form-row"><label>密码 / 授权码</label><input type="password" name="notify_email_smtp_pass" value="<?php echo e($v['notify_email_smtp_pass'] ?? ''); ?>" autocomplete="new-password"></div>
|
||
<div class="form-row"><label>发件人</label><input type="text" name="notify_email_from" value="<?php echo e($v['notify_email_from'] ?? ''); ?>" placeholder="留空则用上面的账号"></div>
|
||
<div class="form-row"><label>负责人邮箱(逗号分隔)</label><input type="text" name="notify_email_to" value="<?php echo e($v['notify_email_to'] ?? ''); ?>" placeholder="a@qq.com, b@qq.com"></div>
|
||
</fieldset>
|
||
|
||
<fieldset class="form-section">
|
||
<legend>企业微信通知</legend>
|
||
<label class="check"><input type="checkbox" name="notify_wechat_enabled" <?php echo $checked('notify_wechat_enabled'); ?>> 启用企业微信(群机器人)</label>
|
||
<div class="form-row"><label>群机器人 Webhook 地址</label><input type="text" name="notify_wechat_webhook" value="<?php echo e($v['notify_wechat_webhook'] ?? ''); ?>" placeholder="https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=..."></div>
|
||
<div class="form-row"><label>被 @ 的手机号/英文 id(逗号分隔)</label><input type="text" name="notify_wechat_mention" value="<?php echo e($v['notify_wechat_mention'] ?? ''); ?>" placeholder="138..., 139...(留空则不@)"></div>
|
||
<small>提示:在企业微信群中添加「群机器人」即可获得 webhook 地址。</small>
|
||
</fieldset>
|
||
|
||
<fieldset class="form-section">
|
||
<legend>低库存预警</legend>
|
||
<label class="check"><input type="checkbox" name="notify_lowstock_enabled" <?php echo $checked('notify_lowstock_enabled'); ?>> 库存跌破阈值时通知</label>
|
||
<div class="form-row"><label>预警阈值</label><input type="text" name="notify_lowstock_threshold" value="<?php echo e($v['notify_lowstock_threshold'] ?? '20'); ?>" placeholder="如 20"></div>
|
||
</fieldset>
|
||
|
||
<div class="form-actions">
|
||
<button class="btn-primary" type="submit">保存设置</button>
|
||
<a class="btn-ghost" href="<?php echo \Core\App::url('PSI/reminders'); ?>">查看紧急提醒</a>
|
||
</div>
|
||
</form>
|