广告平台(站长下代理使用)
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 
 
 

70 líneas
2.0 KiB

  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. }