广告平台(站长下代理使用)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 4 месеци
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. AgentId: utils.IntToStr(user.AgentId),
  18. ContactName: "",
  19. ContactEmail: "",
  20. ContactPhone: user.Username,
  21. ContactAddress: "",
  22. CurrencyConf: "",
  23. CountryRegion: "",
  24. }
  25. NewAgentListDb := implement.NewAgentListDb(db.Db)
  26. agent, _ := NewAgentListDb.GetAgentList(user.AgentId)
  27. if agent != nil {
  28. Country := md.Country
  29. res.CompanyAbbreviation = agent.CompanyAbbreviation
  30. res.Nickname = agent.CompanyAbbreviation
  31. res.CompanyName = agent.CompanyName
  32. for _, v := range Country {
  33. if utils.StrToInt(v["value"]) == agent.CountryRegionId {
  34. res.CountryRegion = v["name"]
  35. }
  36. }
  37. }
  38. NewAgentBankInfoDb := implement.NewAgentBankInfoDb(db.Db)
  39. bank, _ := NewAgentBankInfoDb.GetAgentBankInfoList(user.AgentId)
  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. NewAgentContactInfoDb := implement.NewAgentContactInfoDb(db.Db)
  48. contact, _ := NewAgentContactInfoDb.GetAgentContactInfoList(user.AgentId)
  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. }