This commit is contained in:
sjk
2026-01-10 21:46:50 +08:00
parent 3b66018271
commit 213229953b
14 changed files with 1499 additions and 282 deletions

View File

@@ -781,6 +781,31 @@ func (ctrl *EmployeeController) SaveQRCodeLogin(c *gin.Context) {
common.SuccessWithMessage(c, "绑定成功", nil)
}
// SaveLogin 保存验证码登录的绑定信息
func (ctrl *EmployeeController) SaveLogin(c *gin.Context) {
var req struct {
EmployeeID int `json:"employee_id" binding:"required"`
CookiesFull []interface{} `json:"cookies_full"`
StorageState map[string]interface{} `json:"storage_state"`
StorageStatePath string `json:"storage_state_path"`
UserInfo map[string]interface{} `json:"user_info"` // 新增: 用户信息
}
if err := c.ShouldBindJSON(&req); err != nil {
common.Error(c, common.CodeInvalidParams, "参数错误")
return
}
// 调用service层保存
err := ctrl.service.SaveLogin(req.EmployeeID, req.CookiesFull, req.StorageState, req.StorageStatePath, req.UserInfo)
if err != nil {
common.Error(c, common.CodeInternalError, err.Error())
return
}
common.SuccessWithMessage(c, "绑定成功", nil)
}
// StartQRCodeLogin 启动扫码登录转发到Python服务
func (ctrl *EmployeeController) StartQRCodeLogin(c *gin.Context) {
employeeID := c.GetInt("employee_id")