|
- 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: "",
- MediumId: utils.IntToStr(user.MediumId),
- ContactName: "",
- ContactEmail: "",
- ContactPhone: user.Username,
- ContactAddress: "",
- CurrencyConf: "",
- CountryRegion: "",
- }
- MediumListDb := implement.NewMediumListDb(db.Db)
- medium, _ := MediumListDb.GetMediumList(user.MediumId)
- if medium != nil {
- Country := md.Country
- res.CompanyAbbreviation = medium.CompanyAbbreviation
- res.Nickname = medium.CompanyAbbreviation
- res.CompanyName = medium.CompanyName
- for _, v := range Country {
- if utils.StrToInt(v["value"]) == medium.CountryRegionId {
- res.CountryRegion = v["name"]
- }
- }
- }
- NewMediumBankInfoDb := implement.NewMediumBankInfoDb(db.Db)
- bank, _ := NewMediumBankInfoDb.GetMediumBankInfoList(user.MediumId)
- if bank != nil {
- for _, v := range md.CurrencyConf {
- if utils.StrToInt(v["value"]) == bank.CurrencyConf {
- res.CurrencyConf = v["name"]
- }
- }
- }
- NewMediumContactInfoDb := implement.NewMediumContactInfoDb(db.Db)
- contact, _ := NewMediumContactInfoDb.GetMediumContactInfoList(user.MediumId)
- 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
- }
|