mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
feat: add free charge price mode for product buy page (#3015)
* feat: add free charge price mode for product buy page * fix: improve code format
This commit is contained in:
@ -687,7 +687,7 @@ func UpdateUser(id string, user *User, columns []string, isAdmin bool) (bool, er
|
||||
}
|
||||
}
|
||||
if isAdmin {
|
||||
columns = append(columns, "name", "id", "email", "phone", "country_code", "type")
|
||||
columns = append(columns, "name", "id", "email", "phone", "country_code", "type", "balance")
|
||||
}
|
||||
|
||||
columns = append(columns, "updated_time")
|
||||
@ -1157,3 +1157,13 @@ func GenerateIdForNewUser(application *Application) (string, error) {
|
||||
res := strconv.Itoa(lastUserId + 1)
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func updateUserBalance(owner string, name string, balance float64) error {
|
||||
user, err := getUser(owner, name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
user.Balance += balance
|
||||
_, err = UpdateUser(user.GetId(), user, []string{"balance"}, true)
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user