<?php 
include './head.php';
?>
<style>
.info-up {
    background-color: yellow; /* 浅黄色背景 */
    font-size: 50px;
    color: #d9534f; /* 红色文本 */
    font-weight: bold; /* 粗体文本 */
    padding: 10px 20px; /* 内边距 */
    border-radius: 5px; /* 圆角 */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 阴影效果 */
    cursor: pointer; /* 鼠标悬停时显示手型光标 */
    animation: pulse 0.5s infinite; /* 动画效果 */
}

@keyframes pulse {
    0% {
    color:red;
    padding: 10px 20px; /* 内边距 */
    background-color: yellow;
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
    
    color:white;
    padding: 10000px 20px; /* 内边距 */
    background-color: red;
        transform: scale(1);
        box-shadow: 0 100px 1600px rgba(0, 0, 0, 0.2);
    }
    100% {
    
    color:blue;
    padding: 10px 20px; /* 内边距 */
    background-color: green;
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
}

.info-up:hover {
    background-color: #ffe066; /* 悬停时背景变为更亮的黄色 */
    color: #fff; /* 悬停时文字变为白色 */
}

</style>





<div class="mdui-row">
  <div style="margin-bottom: 10px" class="mdui-col-xs-12 mdui-col-sm-6">
<div class="mdui-card">

  <!-- 卡片头部，包含头像、标题、副标题 -->
  <div class="mdui-card-header">
    <img class="mdui-card-header-avatar" src="https://q1.qlogo.cn/g?b=qq&nk=<?=$user?>&s=640"/>
    <div class="mdui-card-header-title"><?=$user?></div>
    <div class="mdui-card-header-subtitle"><?php
// 获取当前小时
$hour = date("H");

// 根据时间输出更亲切的问候语
if ($hour >= 5 && $hour < 12) {
    echo "早安！新的一天开始啦，希望你今天心情愉快！😊";
} elseif ($hour >= 12 && $hour < 18) {
    echo "下午好！记得休息一下，喝杯茶吧！🍵";
} elseif ($hour >= 18 && $hour < 22) {
    echo "晚上好！一天的忙碌快结束了，放松一下吧！🌙";
} else {
    echo "夜深了，早点休息，愿你做个好梦！💤";
}
?>
</div>
  </div>

  <!-- 卡片的媒体内容，可以包含图片、视频等媒体内容，以及标题、副标题 -->
  <div class="mdui-card-media">
    <img src="http://api.fuxsto.cn/img.php"/>

    <!-- 卡片中可以包含一个或多个菜单按钮 -->
    <div class="mdui-card-menu">
      <button class="mdui-btn mdui-btn-icon mdui-text-color-white">
        <i class="mdui-icon material-icons">share</i>
      </button>
    </div>
  </div>

  <!-- 卡片的标题和副标题 -->
  <div class="mdui-card-primary">
    <div class="mdui-card-primary-title">用户中心</div>
    <div class="mdui-card-primary-subtitle mdui-typo"><code>上次签到:</code><kbd><?=$tok_time?></kbd></div>
  </div>
  
  <div class="mdui-card-content mdui-typo">
  <kbd>活动:</kbd><a href="./bilibili.fx">Bilibili关注领积分</a><br>
<kbd>通知:</kbd>为了获取<code>最新消息/维护通知/更新通知</code>请您加入我们的<a href="http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=IF5-kVyF00H61BKQqUh8t2QDMJpmeJKG&authKey=VN3ikcvQDYQY%2FlJdfYcxUyhDJn%2F1s8RRhmtQqnslh3ICaQjgbsofHR5j6AHY5%2FSC&noverify=0&group_code=675417215">官方Q群</a>
</div>
   <!-- 卡片的按钮 -->
  <div class="mdui-card-actions">
  
  
  <?php 
function isAtLeastOneDayApart($date1, $date2) {
    // 创建 DateTime 对象
    $dt1 = new DateTime($date1);
    $dt2 = new DateTime($date2);

    // 计算日期差
    $interval = $dt1->diff($dt2);

    // 判断间隔的天数是否大于等于1
    return $interval->days >= 1; 
}
// 获取当前时间并格式化为 'Y-m-d'
$currentDate = date('Y-m-d');
// 示例日期
$date1 = $tok_time;
$date2 = $currentDate;

if (isAtLeastOneDayApart($date1, $date2)) {

$out = <<<EOD


    <button mdui-dialog="{target: '#cap',history: false}" class="mdui-btn mdui-ripple mdui-float-right">签到一下</button>

EOD;
} else {


$out = <<<EOD


    <button class="mdui-btn mdui-ripple mdui-float-right">今日已签到</button>

EOD;


}

echo $out;

?>
  
  
  
    </div>

</div>
</div>

<div class="mdui-dialog" id="cap">
    
   <form action="./bi_get.fx" method="POST">
    <div class="mdui-card">
  <div class="mdui-card-media">
    <img src="./cap.fx"/>
    <div class="mdui-card-media-covered mdui-card-media-covered-gradient">
    </div>
  </div>
  <div class="mdui-card-content">
  <div class="rk-in-gray-bg mdui-textfield mdui-textfield-floating-label">
  <div class="rk-in-la">
  <label style="" class="mdui-textfield-label">请输入验证码</label>
  </div>
  <input class="rk-in-la mdui-textfield-input" name="cap" type="txt" />
</div>
<br>
<div id="rk-form-load" class="rk-a-hidden mdui-spinner mdui-spinner-colorful"></div>
<button style="margin-bottom: 15px;" class="mdui-float-right mdui-hoverable mdui-text-color-blue-a200 mdui-btn mdui-color-theme-accent mdui-ripple" type="submit"><div class="mdui-ripple-wave mdui-ripple-wave-fill" style="width: 121.166px; height: 121.166px; margin-top: -60.5828px; margin-left: -60.5828px; left: 47.0689px; top: 17.3311px; transform: translate3d(10.7781px, 0.668884px, 0px) scale(1.01);"></div>
    <i class="mdui-icon mdui-icon-left material-icons">assistant_photo</i> 立即验证
    </button>
    
    </div>
    
  </div>
  
   </form>
  </div>
  


    
    
    
    
    
    
    

  <div style="margin-bottom: 10px" class="mdui-col-xs-12 mdui-col-sm-6">  
    <div class="mdui-card">
      <div mdui-dialog="{target: '#Star_bi',history: false}" class="mdui-list-item mdui-ripple">
    <i class="mdui-list-item-avatar mdui-icon material-icons mdui-color-blue mdui-text-color-white">copyright</i>
    <div class="mdui-list-item-content">
      <div class="mdui-list-item-title"><?=$bi?></div>
      <div class="mdui-list-item-text">积分</div>
    </div>
    <i mdui-tooltip="{content: '获取'}" class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-grey-400">add_circle_outline</i>
  </div>
    
      <div mdui-dialog="{target: '#pay',history: false}" class="mdui-list-item mdui-ripple">
    <i class="mdui-list-item-avatar mdui-icon material-icons mdui-color-blue mdui-text-color-white">star</i>
    <div class="mdui-list-item-content">
      <div class="mdui-list-item-title"><?=$Star?></div>
      <div class="mdui-list-item-text">Star</div>
    </div>
    <i mdui-tooltip="{content: '获取'}" class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-grey-400">add_circle_outline</i>
  </div>
    </div>
   <br>
     <div id="main" class="mdui-card mdui-list" style="padding:0px">
 
 
 <div class="mdui-progress">
  <div class="mdui-progress-indeterminate"></div>
</div>
 
  </div>
  

<script>
    // 定义一个函数用来获取产品数据并生成HTML
    function fetchProducts() {
        // 使用fetch API从API端点获取数据
        fetch('./get_my_products.fx')
            .then(response => response.json())
            .then(data => {
                const productList = document.getElementById('main');

                        productList.innerHTML = "";
                // 遍历每个产品对象并生成HTML
                for (const id in data) {
                    if (data.hasOwnProperty(id)) {
                        const product = data[id];
                        const name = product.name || '未知产品';
                        const status = product.status || '未知状态';

                        // 根据status选择颜色
                        let colorClass;
                        switch (status) {
                            case '已激活':
                                colorClass = 'mdui-color-blue';
                                break;
                            case '待开通':
                                colorClass = 'mdui-color-yellow';
                                break;
                            case '已到期':
                                colorClass = 'mdui-color-red';
                                break;
                            default:
                                colorClass = 'mdui-color-grey';
                                break;
                        }

                        // 创建每个产品的HTML结构
                        const productItem = `
                            <a href="./show_product.fx?id=${id}" class="mdui-list-item mdui-ripple">
                                <i class="mdui-list-item-avatar ${colorClass} mdui-icon material-icons mdui-text-color-white">dns</i>
                                <div class="mdui-list-item-content">
                                    <div class="mdui-list-item-title">${name}</div>
                                    <div class="mdui-list-item-text">${id}</div>
                                </div>
                                <i class="mdui-list-item-icon mdui-icon material-icons mdui-text-color-grey-400">assistant_photo</i>
                            </a>
                        `;

                        // 将生成的HTML插入到列表中
                        productList.innerHTML += productItem;
                    }
                }
            })
            .catch(error => {
                console.error('获取产品数据时出错:', error);
            });
    }

    // 页面加载完毕后获取产品数据
    document.addEventListener('DOMContentLoaded', fetchProducts);
</script>

     <div class="mdui-card">



</div>
        </div>
    
</div>


  
  <div class="mdui-dialog mdui-card " id="pay">
     
<div class="mdui-card-media">
    <img src="https://api.fuxsto.cn/img.php"/>
    <div class="mdui-card-media-covered mdui-card-media-covered-gradient">
      <div class="mdui-card-primary">
        <div class="mdui-card-primary-title">捐赠</div>
        <div class="mdui-typo mdui-card-primary-subtitle"><code>1元</code>=<code>1Star</code>=<code>1500积分</code></div>
      </div>
    </div>
  </div>
  
   <form normal action='https://cdn.fuxsto.cn/epayapi.php' class="mdui-card-content" method='POST' target="_blank">

  <!-- 金额 -->
  <div class="rk-in-gray-bg mdui-textfield mdui-textfield-floating-label">
    <div class="rk-in-la">
      <label class="mdui-textfield-label">金额</label>
    </div>
    <input type="float" class="rk-in-la mdui-textfield-input" name="WIDtotal_fee"/>
  </div>
<br>
  <!-- 订单号 -->
    
   <input name="WIDsubject" value="<?php echo 'Fuxsto Host 充值'; ?>" style="position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none;" 
           readonly/>
  
   <input name="WIDout_trade_no" value="<?php echo date('YmdHis').mt_rand(100,999); ?>" style="position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none;" 
           readonly/>
  
   <input name="user" value="<?php echo $user; ?>" style="position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none;" 
           readonly/>
  
   
   <input name="pass" value="<?php echo $pass; ?>" style="position: absolute; width: 0; height: 0; opacity: 0; pointer-events: none;" 
           readonly/>
  
  <!-- 捐赠方式 -->
  
<select name="type" class="mdui-select" mdui-select="{position: 'top'}">
                  <option value="alipay">支付宝</option>   <option value="wxpay">微信(无法回调,正在修复,非必要请勿使用)</option>
         
</select>

  <br>
  <br>
  <!-- 提交按钮 -->
  <button type="submit" class="mdui-btn-block mdui-hoverable mdui-text-color-blue-a200 mdui-btn mdui-color-theme-accent mdui-ripple">
    提交
  </button>

</form>
</div>


 
  <div class="mdui-dialog" id="Star_bi">
    
   <form action="./trade_Star_bi.php" method="POST">
    <div class="mdui-card">
  <div class="mdui-card-content">
  <div class="rk-in-gray-bg mdui-textfield mdui-textfield-floating-label">
  <div class="rk-in-la">
  <label style="" class="mdui-textfield-label">请输入Star数,1:1500</label>
  </div>
  <input class="rk-in-la mdui-textfield-input" name="Star" type="number" />
</div>
<br>
<div id="rk-form-load" class="rk-a-hidden mdui-spinner mdui-spinner-colorful"></div>
<button style="margin-bottom: 15px;" class="mdui-float-right mdui-hoverable mdui-text-color-blue-a200 mdui-btn mdui-color-theme-accent mdui-ripple" type="submit">
    <i class="mdui-icon mdui-icon-left material-icons">assistant_photo</i> 立即兑换
    </button>
    
    </div>
    
  </div>
  
   </form>
  </div>
  
  
  
  
 
 
 