<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>个人资料</title>
    <link rel="stylesheet" href="/component/pear/css/pear.css" />
    <link rel="stylesheet" href="/admin/css/other/person.css" />
    <style>
        .userset {
            position: absolute;
            right: 20px;
            top: 20px;
            z-index: 999;
        }
    
        label {
            display: flex !important;
            align-items: center;
            justify-content: center;
        }
    </style>
</head>

<body class="pear-container">
    <div style="padding: 8px;">
        <div class="layui-row layui-col-space16">
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="userset"><a href="javascript:;" lay-on="setUser" title="设置">
                            <span class="icon pear-icon pear-icon-setting" style="font-size: 20px;"></span></a></div>
                    <div class="layui-card-body" style="padding: 25px;">
                        <div class="text-center layui-text">
                            <div class="user-info-head" id="userInfoHead">
                                <img src="/admin/images/avatar.jpg" id="userAvatar" width="115px" height="115px" alt="">
                            </div>
                            <h2 style="padding-top: 20px;font-size: 20px;">
                                <?php echo $nickname ?>
                            </h2>
                            <p style="padding-top: 8px;margin-top: 10px;font-size: 16px;">
                                <?php echo $username ?>
                            </p>
                        </div>
                    </div>
                    <div class="layui-elip"
                        style="height: 45px;border-top: 1px whitesmoke solid;text-align: center;line-height: 45px;font-size: 13.5px; padding: 0 32px;">
                        <span id="yiyan"></span>
                    </div>
                </div>
    
                <div class="layui-card">
                    <div class="layui-card-header">支付API配置<span class="layui-font-gray"> · 易支付接口标准</span></div>
                    <div class="layui-card-body">
                        <div class="layui-form layui-form-pane">
                            <div class="layui-form-item" pane>
                                <label class="layui-form-label">API 接口</label>
                                <div class="layui-input-block">
                                    <div class="layui-form-mid" style="margin-left: 10px;color: #5f5f5f;float: none;">
                                        <?php echo $url ?>
                                        <a href="javascript:;" lay-on="copyinfo" data-info="<?php echo $url ?>"
                                            style="float: right;" title="复制"><span
                                                class="icon pear-icon pear-icon-survey"></span></a>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item" pane>
                                <label class="layui-form-label">商户 PID</label>
                                <div class="layui-input-block">
                                    <div class="layui-form-mid" style="margin-left: 10px;color: #5f5f5f;float: none;">
                                        <?php echo $pid ?>
                                        <a href="javascript:;" lay-on="copyinfo" data-info="<?php echo $pid ?>"
                                            style="float: right;" title="复制"><span
                                                class="icon pear-icon pear-icon-survey"></span></a>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-form-item" pane>
                                <label class="layui-form-label">商户密钥 <a href="javascript:;" lay-on="resetKey"
                                        title="重置密钥"><span class="icon pear-icon pear-icon-refresh"></span></a></label>
                                <div class="layui-input-block">
                                    <div class="layui-form-mid layui-elip"
                                        style="margin-left: 10px;color: #5f5f5f;float: none;">
                                        <?php echo $secret_key ?>
                                        <a href="javascript:;" lay-on="copyinfo" data-info="<?php echo $secret_key ?>"
                                            style="float: right;" title="复制"><span
                                                class="icon pear-icon pear-icon-survey"></span></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
    
                <div class="layui-card">
                    <div class="layui-card-header">聚合码定时任务<span class="layui-font-gray"> · 监控有效期订单</span></div>
                    <div class="layui-card-body">
                        <div class="layui-form layui-form-pane">
                            <div class="layui-form-item" pane>
                                <label class="layui-form-label">订单监控</label>
                                <div class="layui-input-block">
                                    <div class="layui-form-mid layui-elip"
                                        style="margin-left: 10px;color: #5f5f5f;float: none;">
                                        <?php echo $orderurl ?>
                                        <a href="javascript:;" lay-on="copyinfo" data-info="<?php echo $orderurl ?>"
                                            style="float: right;" title="复制"><span
                                                class="icon pear-icon pear-icon-survey"></span></a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-col-md6">
    
                <div class="layui-card">
                    <div class="layui-card-header">收款码监控配置<span class="layui-font-gray"> · SmsForwarder</span></div>
                    <div class="layui-card-body">
                        <fieldset class="layui-elem-field">
                            <legend style="font-size: 14px;">发送通道配置</legend>
                            <div class="layui-field-box">
                                <div class="layui-form layui-form-pane">
                                    <div class="layui-form-item" pane>
                                        <label class="layui-form-label">Webhook</label>
                                        <div class="layui-input-block">
                                            <div class="layui-form-mid layui-elip"
                                                style="margin-left: 10px;color: #5f5f5f;float: none;">
                                                <?php echo $url . 'mpayNotify' ?>
                                                <a href="javascript:;" lay-on="copyinfo"
                                                    data-info="<?php echo $url . 'mpayNotify' ?>" style="float: right;"
                                                    title="复制"><span class="icon pear-icon pear-icon-survey"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item" pane>
                                        <label class="layui-form-label">消息模版</label>
                                        <div class="layui-input-block">
                                            <div class="layui-form-mid layui-elip"
                                                style="margin-left: 10px;color: #5f5f5f;float: none;">
                                                {"action": "mpay","data": "[msg]","time":"[timestamp]","sign": "[sign]"}
                                                <a href="javascript:;" lay-on="copyinfo"
                                                    data-info='{"action": "mpay","data": "[msg]","time":"[timestamp]","sign": "[sign]"}'
                                                    style="float: right;" title="复制"><span
                                                        class="icon pear-icon pear-icon-survey"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item" pane>
                                        <label class="layui-form-label">Secret</label>
                                        <div class="layui-input-block">
                                            <div class="layui-form-mid layui-elip"
                                                style="margin-left: 10px;color: #5f5f5f;float: none;">
                                                <?php echo $secret_key ?>
                                                <a href="javascript:;" lay-on="copyinfo"
                                                    data-info="<?php echo $secret_key ?>" style="float: right;"
                                                    title="复制"><span class="icon pear-icon pear-icon-survey"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item" pane>
                                        <label class="layui-form-label">成功关键字</label>
                                        <div class="layui-input-block">
                                            <div class="layui-form-mid layui-elip"
                                                style="margin-left: 10px;color: #5f5f5f;float: none;">
                                                200
                                                <a href="javascript:;" lay-on="copyinfo" data-info="200"
                                                    style="float: right;" title="复制"><span
                                                        class="icon pear-icon pear-icon-survey"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                        <fieldset class="layui-elem-field">
                            <legend style="font-size: 14px;">应用转发规则·多重匹配</legend>
                            <div class="layui-field-box">
                                <div class="layui-form layui-form-pane">
                                    <div class="layui-form-item" pane>
                                        <label class="layui-form-label">微信支付</label>
                                        <div class="layui-input-block">
                                            <div class="layui-form-mid layui-elip"
                                                style="margin-left: 10px;color: #5f5f5f;float: none;">
                                                <?php echo '并且 是 APP包名 相等 com.tencent.mm<br />并且 是 通知标题 相等 微信支付<br />&nbsp;或者 是 通知标题 相等 微信收款助手' ?>
                                                <a href="javascript:;" lay-on="copyinfo"
                                                    data-info='<?php echo "并且 是 APP包名 相等 com.tencent.mm\n并且 是 通知标题 相等 微信支付\n 或者 是 通知标题 相等 微信收款助手" ?>'
                                                    style="float: right;" title="复制"><span
                                                        class="icon pear-icon pear-icon-survey"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-form-item" pane>
                                        <label class="layui-form-label">支付宝</label>
                                        <div class="layui-input-block">
                                            <div class="layui-form-mid layui-elip"
                                                style="margin-left: 10px;color: #5f5f5f;float: none;">
                                                <?php echo '并且 是 APP包名 相等 com.eg.android.AlipayGphone<br />并且 是 通知标题 包含 成功收款' ?>
                                                <a href="javascript:;" lay-on="copyinfo"
                                                    data-info='<?php echo "并且 是 APP包名 相等 com.eg.android.AlipayGphone\n并且 是 通知标题 包含 成功收款" ?>'
                                                    style="float: right;" title="复制"><span
                                                        class="icon pear-icon pear-icon-survey"></span></a>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </div>
    
            </div>
        </div>
    </div>
    <script src="/component/layui/layui.js"></script>
    <script src="/component/pear/pear.js"></script>
    <script>
        layui.use(['layer', 'util'], () => {
            let util = layui.util;
            let layer = layui.layer;

            util.on({
                'copyinfo': (ele) => {
                    const info = ele.attr('data-info');
                    if (navigator.clipboard) {
                        navigator.clipboard.writeText(info).then(() => {
                            layer.msg('复制成功');
                        });
                    } else {
                        layer.msg('复制失败，请手动复制');
                    }
                },
                'resetKey': (ele) => {
                    layer.confirm('重置密钥后，将无法使用原密钥，是否继续？', { icon: 3, title: '重置密钥' }, function (index) {
                        layer.close(index);
                        tool.resetKey();
                    });
                },
                'setUser': (ele) => {
                    tool.setUser();
                }
            });

            let tool = {};
            tool.resetKey = async (id) => {
                const res = await fetch(`/api/user/resetKey?id=${id}`);
                const data = await res.json();
                if (data.code === 0) {
                    layer.msg('密钥重置成功');
                    location.reload();
                }
            }
            tool.setUser = async () => {
                layer.open({
                    id: 'iframe-set-user',
                    type: 2,
                    title: '修改',
                    shade: 0.1,
                    area: ['500px', '400px'],
                    content: `/User/setUser`,
                });
            }

        });
        fetch('https://v1.hitokoto.cn?c=d&c=i&c=k&encode=text').then(res => res.text()).then(data => { document.getElementById('yiyan').innerHTML = data || '人无横财不富，马无夜草不肥'; })


    </script>
</body>

</html>