Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

建议webapi可以一个端口输出所有JSON信息 #20

Open
Epxir opened this issue Apr 23, 2022 · 4 comments
Open

建议webapi可以一个端口输出所有JSON信息 #20

Epxir opened this issue Apr 23, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@Epxir
Copy link

Epxir commented Apr 23, 2022

这样直接在网页上就可以直接添加用户了,前端监控的代码量也少得多,方便和朋友一起用!
建议直接整合到 start.sh !
简单做了一个
8c15h-wt3q2

@moeshin moeshin added the enhancement New feature or request label Apr 23, 2022
@Epxir
Copy link
Author

Epxir commented Apr 23, 2022

没接触过html和php,这两天摸索着做的,大家想用的话自取!
创建index.php,放入代码即可

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>超星自动签到状态</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css" />
</head>
<body>
<?php
$data = file_get_contents('http://localhost:5743/status');
$arr = json_decode($data,true);
$status = $arr['cxAutoSignEnabled'];
if ($status==1) {
  $status = "正在运行";
} else {
  $status = "停止运行";
}
    echo <<<END
    <div class="mdui-container">
    <div class="mdui-panel" mdui-panel >
      <div class="mdui-panel-item">                       
        <div class="mdui-panel-item-header">
          <div class="mdui-panel-item-title">帅哥</div>
          <div class="mdui-panel-item-summary">运行状态:$status</div>
          <i class="mdui-panel-item-arrow mdui-icon material-icons">keyboard_arrow_down</i>
        </div>
        <div class="mdui-panel-item-body">
          <div class="mdui-panel-item-actions">
          <form method="post">
            <button class="mdui-btn mdui-ripple" type="submit" name="button1">开启</button>
            <button class="mdui-btn mdui-ripple" type="submit" name="button2">关闭</button>
          </form>
          </div>
        </div>
      </div>
    </div>
  </div>
END;
if(isset($_POST['button1'])) {
  fopen("http://localhost:5743/status/enable","r");
  header('location: '.$_SERVER['HTTP_REFERER']);
}
if(isset($_POST['button2'])) {
  fopen("http://localhost:5743/status/disable","r");
  header('location: '.$_SERVER['HTTP_REFERER']);
}
?>
<script src="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
</body>
</html>

@Epxir
Copy link
Author

Epxir commented Jun 16, 2022

搞起来搞起来

@moeshin
Copy link
Owner

moeshin commented Jun 17, 2022

C# WEB 不会搞,用 Go 重写了一个,BUG 多多:https://github.com/moeshin/cx-im

@Epxir
Copy link
Author

Epxir commented Jul 3, 2022

C# WEB 不会搞,用 Go 重写了一个,BUG 多多:https://github.com/moeshin/cx-im

搞复杂了啊,这个的输出信息改一下就行了,不用写网页

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants