apicp.ResetUser.php 725 Bytes
<?php
    /**
     *  重置用户数据,
     *  姓名头像重置为空,用户可以重新填写
     */

    include "Common/JsonResponse.php";
    include "Common/mysqlHelper.php";
    include "Common/Encrypter.php";

    // 登录验证
    include "AdminAuth.php";

    // 删除的id
    if (!isset($_POST['id'])) {
        JsonResponse::error('id不能为空');
    }
    
    $params[] = $_POST['id'];
    $mysql = new mysqlHelper();
    // pdo保存数据
    $updateSql = "UPDATE `user` SET `realname` = '', headimg = ''  WHERE id = ?;";
    $rowCount = $mysql->update($updateSql, $params);
    if ($rowCount) {
        JsonResponse::result([]);
    } else {
        JsonResponse::error('重置失败');
    }