广告平台(媒体使用)
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

svc_account.go 2.0 KiB

3 miesięcy temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package svc
  2. import (
  3. "applet/app/e"
  4. "applet/app/md"
  5. "applet/app/utils"
  6. db "code.fnuoos.com/zhimeng/model.git/src"
  7. "code.fnuoos.com/zhimeng/model.git/src/super/implement"
  8. "github.com/gin-gonic/gin"
  9. )
  10. func AccountBase(c *gin.Context) {
  11. user := GetUser(c)
  12. res := md.AccountBase{
  13. Nickname: user.Username,
  14. AdminPhone: user.Username,
  15. CompanyName: "",
  16. CompanyAbbreviation: "",
  17. MediumId: utils.IntToStr(user.MediumId),
  18. ContactName: "",
  19. ContactEmail: "",
  20. ContactPhone: user.Username,
  21. ContactAddress: "",
  22. CurrencyConf: "",
  23. CountryRegion: "",
  24. }
  25. MediumListDb := implement.NewMediumListDb(db.Db)
  26. medium, _ := MediumListDb.GetMediumList(user.MediumId)
  27. if medium != nil {
  28. Country := md.Country
  29. res.CompanyAbbreviation = medium.CompanyAbbreviation
  30. res.Nickname = medium.CompanyAbbreviation
  31. res.CompanyName = medium.CompanyName
  32. for _, v := range Country {
  33. if utils.StrToInt(v["value"]) == medium.CountryRegionId {
  34. res.CountryRegion = v["name"]
  35. }
  36. }
  37. }
  38. NewMediumBankInfoDb := implement.NewMediumBankInfoDb(db.Db)
  39. bank, _ := NewMediumBankInfoDb.GetMediumBankInfoList(user.MediumId)
  40. if bank != nil {
  41. for _, v := range md.CurrencyConf {
  42. if utils.StrToInt(v["value"]) == bank.CurrencyConf {
  43. res.CurrencyConf = v["name"]
  44. }
  45. }
  46. }
  47. NewMediumContactInfoDb := implement.NewMediumContactInfoDb(db.Db)
  48. contact, _ := NewMediumContactInfoDb.GetMediumContactInfoList(user.MediumId)
  49. if contact != nil {
  50. res.ContactName = contact.Name
  51. res.ContactAddress = contact.Address
  52. res.ContactEmail = contact.Email
  53. res.ContactPhone = contact.Phone
  54. }
  55. e.OutSuc(c, res, nil)
  56. return
  57. }
  58. func AccountUpdatePassword(c *gin.Context, req md.AccountUpdatePasswordReq) error {
  59. user := GetUser(c)
  60. check, err := SmsCheck(c, user.Username, req.Captcha)
  61. if check == false {
  62. return err
  63. }
  64. user.Password = utils.Md5(req.PassWord)
  65. MasterDb(c).Where("id=?", user.Id).Cols("password").Update(user)
  66. return nil
  67. }