Commit db9ed37c by xuzhenhao

修复bug

1 parent 655ad2ed
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
"gopkg.in/gin-gonic/gin.v1" "gopkg.in/gin-gonic/gin.v1"
// "io" // "io"
// "io/ioutil" // "io/ioutil"
// "log" "log"
"net/http" "net/http"
// "net/url" // "net/url"
// "os" // "os"
......
...@@ -102,13 +102,24 @@ func ChangeUserPassword(userName string, originPassword string, newPassword stri ...@@ -102,13 +102,24 @@ func ChangeUserPassword(userName string, originPassword string, newPassword stri
} }
password := MD5(newPassword) password := MD5(newPassword)
sql := ` update icesimba_polysdk_user set user_password = ? where user_name = ?` sql := ` update icesimba_polysdk_user set user_password = ? where user_name = ?`
err = db.Engine.Exec(sql, password, userName) _, err = db.Engine.Exec(sql, password, userName)
if err != nil { if err != nil {
return "104001", err return "104001", err
} }
return return
} }
//添加用户
func InsertUser(userName string, userPassword string) (result interface{}, err error) {
sql := ` insert into icesimba_polysdk_user(user_name,user_password) values(?,?) `
_, err = db.Engine.Exec(sql, userName, userPassword)
if err != nil {
return "104001", err
}
return nil, nil
}
func MD5(str string) string { func MD5(str string) string {
w := md5.New() w := md5.New()
w.Write([]byte(str)) w.Write([]byte(str))
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
_ "github.com/gin-gonic/autotls" _ "github.com/gin-gonic/autotls"
"gopkg.in/gin-gonic/gin.v1" "gopkg.in/gin-gonic/gin.v1"
. "loginserver/apis" . "loginserver/apis"
"net/http" // "net/http"
// "log" // "log"
) )
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!