聊天消息记录状态 + 表格导出底层

This commit is contained in:
wong
2025-11-27 17:09:53 +08:00
parent 7e2dd2914d
commit 637dcddee2
5 changed files with 256 additions and 93 deletions

View File

@@ -201,40 +201,38 @@ class UserController extends BaseController
* 修改密码
* @return \think\response\Json
*/
public function modifyPwd()
public function modifyPwd($data = [])
{
// 获取并验证参数
$params = $this->validateModifyPwdParams();
if (!is_array($params)) {
return $params;
if (empty($data)) {
return json_encode(['code' => 400,'msg' => '参数缺失']);
}
$authorization = trim($this->request->header('authorization', $this->authorization));
if (!isset($data['id']) || !isset($data['pwd'])) {
return json_encode(['code' => 401,'msg' => '参数缺失']);
}
$authorization = $this->authorization;
if (empty($authorization)) {
return errorJson('缺少授权信息');
return json_encode(['code' => 400,'msg' => '缺少授权信息']);
}
$headerData = ['client:' . self::CLIENT_TYPE];
$header = setHeader($headerData, $authorization, 'plain');
$headerData = ['client:system'];
$header = setHeader($headerData, $authorization, 'json');
$params = [
'id' => $data['id'],
'newPw' => $data['pwd'],
];
try {
$result = requestCurl($this->baseUrl . 'api/Account/self', $params, 'PUT', $header);
$result = requestCurl($this->baseUrl . 'api/Account/modifypw', $params, 'PUT', $header,'json');
$response = handleApiResponse($result);
if (empty($response)) {
// 获取当前用户信息
$currentUser = CompanyAccountModel::where('token', $authorization)->find();
if ($currentUser) {
recordUserLog($currentUser['id'], $currentUser['userName'], 'MODIFY_PASSWORD', '修改密码成功', [], 200, '修改成功');
}
return successJson(['message' => '修改成功']);
return json_encode(['code' => 200,'msg' => '修改成功']);
}
recordUserLog(0, '', 'MODIFY_PASSWORD', '修改密码失败', $params, 500, $response);
return errorJson($response);
return json_encode(['code' => 400,'msg' => $response]);
} catch (\Exception $e) {
recordUserLog(0, '', 'MODIFY_PASSWORD', '修改密码异常', $params, 500, $e->getMessage());
return errorJson('修改密码失败:' . $e->getMessage());
return json_encode(['code' => 400,'msg' => '修改密码失败:' . $e->getMessage()]);
}
}