|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package svc
-
- import (
- "applet/app/e"
- "applet/app/md"
- "applet/app/utils"
- db "code.fnuoos.com/zhimeng/model.git/src"
- "code.fnuoos.com/zhimeng/model.git/src/super/implement"
- "github.com/gin-gonic/gin"
- )
-
- func AccountBase(c *gin.Context) {
- user := GetUser(c)
- res := md.AccountBase{
- Nickname: user.Username,
- AdminPhone: user.Username,
- CompanyName: "",
- CompanyAbbreviation: "",
- AgentId: utils.IntToStr(user.AgentId),
- ContactName: "",
- ContactEmail: "",
- ContactPhone: user.Username,
- ContactAddress: "",
- CurrencyConf: "",
- CountryRegion: "",
- }
- NewAgentListDb := implement.NewAgentListDb(db.Db)
- agent, _ := NewAgentListDb.GetAgentList(user.AgentId)
- if agent != nil {
- Country := md.Country
- res.CompanyAbbreviation = agent.CompanyAbbreviation
- res.Nickname = agent.CompanyAbbreviation
- res.CompanyName = agent.CompanyName
- for _, v := range Country {
- if utils.StrToInt(v["value"]) == agent.CountryRegionId {
- res.CountryRegion = v["name"]
- }
- }
- }
- NewAgentBankInfoDb := implement.NewAgentBankInfoDb(db.Db)
- bank, _ := NewAgentBankInfoDb.GetAgentBankInfoList(user.AgentId)
- if bank != nil {
- for _, v := range md.CurrencyConf {
- if utils.StrToInt(v["value"]) == bank.CurrencyConf {
- res.CurrencyConf = v["name"]
- }
- }
- }
- NewAgentContactInfoDb := implement.NewAgentContactInfoDb(db.Db)
- contact, _ := NewAgentContactInfoDb.GetAgentContactInfoList(user.AgentId)
- if contact != nil {
- res.ContactName = contact.Name
- res.ContactAddress = contact.Address
- res.ContactEmail = contact.Email
- res.ContactPhone = contact.Phone
- }
- e.OutSuc(c, res, nil)
- return
- }
- func AccountUpdatePassword(c *gin.Context, req md.AccountUpdatePasswordReq) error {
- user := GetUser(c)
- check, err := SmsCheck(c, user.Username, req.Captcha)
- if check == false {
- return err
- }
- user.Password = utils.Md5(req.PassWord)
- MasterDb(c).Where("id=?", user.Id).Cols("password").Update(user)
- return nil
- }
|