Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改密码功能不能使用 #15

Open
clyuz opened this issue Mar 12, 2021 · 2 comments
Open

修改密码功能不能使用 #15

clyuz opened this issue Mar 12, 2021 · 2 comments

Comments

@clyuz
Copy link

clyuz commented Mar 12, 2021

刚开始学习go 使用这个项目的时候 发现修改密码功能一直操作不成功,
调试代码发现无法解决以下问题

  1. 对比过实体和数据库结构 均一致
  2. 代码调试看不到问题出在哪

2021-03-12 17:53:43.758 [ERRO] Password error sql: expected 27 arguments, got 28, UPDATE sys_userSETstatus=10,tel='123',back_site_id=5,real_name='系统管理员',depart_id=10001,address='',uuid='94091b1fa6ac4a27a06c0b92155aea6a',endtime='',user_type=1,remark='时间是最好的老师,但遗憾的是——最后他把所有的学生都弄死了',enable=1,update_time='2021-03-12 17:53:40',create_time='2017-03-19 20:41:25',create_id=1,id=1,password='ef694f728a44575bedc8ee7caa2d5c48',thirdid='',email='[email protected]',title_url='',theme='flat',create_site_id=1,project_id=1,username='admin',salt='1111',project_name='test',update_id=1 WHERE id` IN (1)
Stack:

  1. gmanager/app/api/user.(*Action).Password

    XXXXXXX/src/gmanager/app/api/user/userAction.go:210`

@clyuz
Copy link
Author

clyuz commented Mar 12, 2021

问题已经定位到
在user_entity.go文件中

func (r *Entity) Update() (result sql.Result, err error) {
return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
}
这段代码中 gdb.GetWhereConditionOfStruct(r) 返回三个参数: 字段 值 错误参数
而在Where函数接收参数时如下段代码
在user_model.go文件中
func (m *arModel) Where(where interface{}, args ...interface{}) *arModel {
return &arModel{m.M.Where(where, args...)}
}
误将error返回的nil添加到值中 导致参数多于需要的个数
望解决!

@zcool321
Copy link
Collaborator

应该是版本问题~很久没维护了,后面抽时间测测

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants