旧版服务端
This commit is contained in:
1 parent
3429c8b402
commit
25bbb5f9c8
971 files changed
+87141
-40
No files matched your search
Executable
+36
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// 获取传入的 OpenID 值
|
||||
$openid = $_GET['openid'];
|
||||
|
||||
// 引用配置,建立数据库连接
|
||||
require_once 'ApiConfig.php';
|
||||
$conn = new mysqli(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_NAME);
|
||||
|
||||
// 检查连接是否成功
|
||||
if ($conn->connect_error) {
|
||||
die("连接失败: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$coursePswdCode=$_GET['coursePswdCode'];
|
||||
$courseEndDate=$_GET['courseEndDate'];
|
||||
$courseInfo=$_GET['courseInfo'];
|
||||
$courseCount=$_GET['courseCount'];
|
||||
//还需要传入旧口令码
|
||||
$oldCoursePswdCode=$_GET['oldCoursePswdCode'];
|
||||
|
||||
// 查询数据库中符合条件的记录
|
||||
$sql = "SELECT * FROM 用户信息 WHERE OpenID='$openid' AND 是否管理员='1'";
|
||||
$result = $conn->query($sql);
|
||||
if ($result->num_rows > 0) {
|
||||
|
||||
// 执行更新操作
|
||||
$sql2 = "UPDATE 课程口令码 SET 口令码 = '$coursePswdCode', 口令结束日期='$courseEndDate', 课程介绍='$courseInfo', 剩余有效次数='$courseCount' WHERE 口令码 = '$oldCoursePswdCode'";
|
||||
if ($conn->query($sql2) === TRUE) {
|
||||
echo json_encode(["result" => "ok"]);
|
||||
}
|
||||
} else {echo json_encode(["result" => null]);}
|
||||
// 关闭数据库连接
|
||||
$conn->close();
|
||||
?>
|
||||
Reference in new issue
Block a user