@@ -0,0 +1,52 @@ | |||||
package hdl | |||||
import ( | |||||
"applet/app/e" | |||||
"applet/app/lib/validate" | |||||
"applet/app/md" | |||||
"applet/app/svc" | |||||
"github.com/gin-gonic/gin" | |||||
) | |||||
// AccountBase | |||||
// @Summary 账号信息 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 账号信息 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Success 200 {object} md.AccountBase "具体看返回内容" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/account/base [GET] | |||||
func AccountBase(c *gin.Context) { | |||||
svc.AccountBase(c) | |||||
} | |||||
// AccountUpdatePassword | |||||
// @Summary 企业认证保存 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 资质认证-企业认证保存 | |||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | |||||
// @Accept json | |||||
// @Produce json | |||||
// @Param args body md.AccountUpdatePasswordReq true "请求参数" | |||||
// @Success 200 {string} "具体看返回内容" | |||||
// @Failure 400 {object} md.Response "具体错误" | |||||
// @Router /api/account/update/password [POST] | |||||
func AccountUpdatePassword(c *gin.Context) { | |||||
var req md.AccountUpdatePasswordReq | |||||
err := c.ShouldBindJSON(&req) | |||||
if err != nil { | |||||
err = validate.HandleValidateErr(err) | |||||
err1 := err.(e.E) | |||||
e.OutErr(c, err1.Code, err1.Error()) | |||||
return | |||||
} | |||||
err = svc.AccountUpdatePassword(c, req) | |||||
if err != nil { | |||||
e.OutErr(c, 400, err) | |||||
return | |||||
} | |||||
e.OutSuc(c, "success", nil) | |||||
return | |||||
} |
@@ -10,35 +10,35 @@ import ( | |||||
// QualificationInfo | // QualificationInfo | ||||
// @Summary 基本信息 | // @Summary 基本信息 | ||||
// @Tags 资质认证------嘉俊 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 资质认证-基本信息 | // @Description 资质认证-基本信息 | ||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | // @param Authorization header string true "验证参数Bearer和token空格拼接" | ||||
// @Accept json | // @Accept json | ||||
// @Produce json | // @Produce json | ||||
// @Success 200 {string} "具体看返回内容" | // @Success 200 {string} "具体看返回内容" | ||||
// @Failure 400 {object} md.Response "具体错误" | // @Failure 400 {object} md.Response "具体错误" | ||||
// @Router /api/qualification/info [GET] | |||||
// @Router /api/account/qualification/info [GET] | |||||
func QualificationInfo(c *gin.Context) { | func QualificationInfo(c *gin.Context) { | ||||
svc.QualificationInfo(c) | svc.QualificationInfo(c) | ||||
} | } | ||||
// QualificationSelectBase | // QualificationSelectBase | ||||
// @Summary 认证下拉框选择内容 | // @Summary 认证下拉框选择内容 | ||||
// @Tags 资质认证------嘉俊 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 资质认证-认证下拉框选择内容 | // @Description 资质认证-认证下拉框选择内容 | ||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | // @param Authorization header string true "验证参数Bearer和token空格拼接" | ||||
// @Accept json | // @Accept json | ||||
// @Produce json | // @Produce json | ||||
// @Success 200 {string} "具体看返回内容" | // @Success 200 {string} "具体看返回内容" | ||||
// @Failure 400 {object} md.Response "具体错误" | // @Failure 400 {object} md.Response "具体错误" | ||||
// @Router /api/qualification/select/base [GET] | |||||
// @Router /api/account/qualification/select/base [GET] | |||||
func QualificationSelectBase(c *gin.Context) { | func QualificationSelectBase(c *gin.Context) { | ||||
svc.QualificationSelectBase(c) | svc.QualificationSelectBase(c) | ||||
} | } | ||||
// QualificationEnterpriseSave | // QualificationEnterpriseSave | ||||
// @Summary 企业认证保存 | // @Summary 企业认证保存 | ||||
// @Tags 资质认证------嘉俊 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 资质认证-企业认证保存 | // @Description 资质认证-企业认证保存 | ||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | // @param Authorization header string true "验证参数Bearer和token空格拼接" | ||||
// @Accept json | // @Accept json | ||||
@@ -46,7 +46,7 @@ func QualificationSelectBase(c *gin.Context) { | |||||
// @Param args body md.MediumList true "请求参数" | // @Param args body md.MediumList true "请求参数" | ||||
// @Success 200 {string} "具体看返回内容" | // @Success 200 {string} "具体看返回内容" | ||||
// @Failure 400 {object} md.Response "具体错误" | // @Failure 400 {object} md.Response "具体错误" | ||||
// @Router /api/qualification/enterprise/save [POST] | |||||
// @Router /api/account/qualification/enterprise/save [POST] | |||||
func QualificationEnterpriseSave(c *gin.Context) { | func QualificationEnterpriseSave(c *gin.Context) { | ||||
var req md.MediumList | var req md.MediumList | ||||
err := c.ShouldBindJSON(&req) | err := c.ShouldBindJSON(&req) | ||||
@@ -67,7 +67,7 @@ func QualificationEnterpriseSave(c *gin.Context) { | |||||
// QualificationBankSave | // QualificationBankSave | ||||
// @Summary 银行资质保存 | // @Summary 银行资质保存 | ||||
// @Tags 资质认证------嘉俊 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 资质认证-银行资质保存 | // @Description 资质认证-银行资质保存 | ||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | // @param Authorization header string true "验证参数Bearer和token空格拼接" | ||||
// @Accept json | // @Accept json | ||||
@@ -75,7 +75,7 @@ func QualificationEnterpriseSave(c *gin.Context) { | |||||
// @Param args body md.MediumBankInfo true "请求参数" | // @Param args body md.MediumBankInfo true "请求参数" | ||||
// @Success 200 {string} "具体看返回内容" | // @Success 200 {string} "具体看返回内容" | ||||
// @Failure 400 {object} md.Response "具体错误" | // @Failure 400 {object} md.Response "具体错误" | ||||
// @Router /api/qualification/bank/save [POST] | |||||
// @Router /api/account/qualification/bank/save [POST] | |||||
func QualificationBankSave(c *gin.Context) { | func QualificationBankSave(c *gin.Context) { | ||||
var req md.MediumBankInfo | var req md.MediumBankInfo | ||||
err := c.ShouldBindJSON(&req) | err := c.ShouldBindJSON(&req) | ||||
@@ -96,7 +96,7 @@ func QualificationBankSave(c *gin.Context) { | |||||
// QualificationContactSave | // QualificationContactSave | ||||
// @Summary 联系方式保存 | // @Summary 联系方式保存 | ||||
// @Tags 资质认证------嘉俊 | |||||
// @Tags 账号中心------嘉俊 | |||||
// @Description 资质认证-联系方式保存 | // @Description 资质认证-联系方式保存 | ||||
// @param Authorization header string true "验证参数Bearer和token空格拼接" | // @param Authorization header string true "验证参数Bearer和token空格拼接" | ||||
// @Accept json | // @Accept json | ||||
@@ -104,7 +104,7 @@ func QualificationBankSave(c *gin.Context) { | |||||
// @Param args body md.MediumContactInfo true "请求参数" | // @Param args body md.MediumContactInfo true "请求参数" | ||||
// @Success 200 {string} "具体看返回内容" | // @Success 200 {string} "具体看返回内容" | ||||
// @Failure 400 {object} md.Response "具体错误" | // @Failure 400 {object} md.Response "具体错误" | ||||
// @Router /api/qualification/contact/save [POST] | |||||
// @Router /api/account/qualification/contact/save [POST] | |||||
func QualificationContactSave(c *gin.Context) { | func QualificationContactSave(c *gin.Context) { | ||||
var req md.MediumContactInfo | var req md.MediumContactInfo | ||||
err := c.ShouldBindJSON(&req) | err := c.ShouldBindJSON(&req) | ||||
@@ -40,6 +40,14 @@ func Sms(c *gin.Context) { | |||||
return | return | ||||
} | } | ||||
} | } | ||||
if args.Type == "update_password" { | |||||
admin, _ := svc.CheckUser(c) | |||||
if admin == nil { | |||||
e.OutErr(c, 400, e.NewErr(400, "账号未注册")) | |||||
return | |||||
} | |||||
args.Phone = admin.Username | |||||
} | |||||
NewSysCfgDb := implement2.NewSysCfgDb(svc.MasterDb(c), c.GetString("mid")) | NewSysCfgDb := implement2.NewSysCfgDb(svc.MasterDb(c), c.GetString("mid")) | ||||
key := NewSysCfgDb.SysCfgGetWithDb("mob_app_key") | key := NewSysCfgDb.SysCfgGetWithDb("mob_app_key") | ||||
if key == "" { | if key == "" { | ||||
@@ -0,0 +1,19 @@ | |||||
package md | |||||
type AccountBase struct { | |||||
AdminPhone string `json:"admin_phone" example:"管理员手机号"` | |||||
Nickname string `json:"nickname" example:"昵称"` | |||||
CompanyName string `json:"company_name" example:"公司名称"` | |||||
CompanyAbbreviation string `json:"company_abbreviation" example:"公司简称"` | |||||
MediumId string `json:"medium_id" example:"账户ID"` | |||||
ContactName string `json:"contact_name" example:"联系人"` | |||||
ContactEmail string `json:"contact_email" example:"邮箱"` | |||||
ContactPhone string `json:"contact_phone" example:"联系电话"` | |||||
ContactAddress string `json:"contact_address" example:"联系地址"` | |||||
CurrencyConf string `json:"currency_conf" example:"结算币种"` | |||||
CountryRegion string `json:"country_region" example:"国家地区"` | |||||
} | |||||
type AccountUpdatePasswordReq struct { | |||||
PassWord string `json:"password" example:"登录密码"` | |||||
Captcha string `json:"captcha" example:"验证码"` | |||||
} |
@@ -0,0 +1,12 @@ | |||||
package md | |||||
var Country = []map[string]string{ | |||||
{ | |||||
"value": "1", "name": "中国/国内", | |||||
}, | |||||
} | |||||
var CurrencyConf = []map[string]string{ | |||||
{ | |||||
"value": "0", "name": "人民币", | |||||
}, | |||||
} |
@@ -2,5 +2,5 @@ package md | |||||
type SmsReq struct { | type SmsReq struct { | ||||
Phone string `json:"phone"` | Phone string `json:"phone"` | ||||
Type string `json:"type" example:"手机号登陆:fast_login 注册:register"` | |||||
Type string `json:"type" example:"手机号登陆:fast_login 注册:register 修改密码(不用传手机号):update_password"` | |||||
} | } |
@@ -64,10 +64,11 @@ func route(r *gin.RouterGroup) { | |||||
r.POST("/qiniuyun/upload", hdl.ImgReqUpload) //七牛云上传 | r.POST("/qiniuyun/upload", hdl.ImgReqUpload) //七牛云上传 | ||||
r.POST("/sms", hdl.Sms) //短信发送 | r.POST("/sms", hdl.Sms) //短信发送 | ||||
} | } | ||||
r.Use(mw.Auth) // 以下接口需要JWT验证 | |||||
rRole(r.Group("/role")) //权限管理 | |||||
rQualification(r.Group("/qualification")) //资质 | |||||
rApplication(r.Group("/application")) //应用管理 | |||||
r.Use(mw.Auth) // 以下接口需要JWT验证 | |||||
rRole(r.Group("/role")) //权限管理 | |||||
rApplication(r.Group("/application")) //应用管理 | |||||
rAccount(r.Group("/account")) //账号中心 | |||||
} | } | ||||
func rRole(r *gin.RouterGroup) { | func rRole(r *gin.RouterGroup) { | ||||
@@ -86,12 +87,14 @@ func rRole(r *gin.RouterGroup) { | |||||
r.GET("/adminInfo", hdl.AdminInfo) //获取管理员信息 | r.GET("/adminInfo", hdl.AdminInfo) //获取管理员信息 | ||||
r.POST("/bindAdminRole", hdl.BindAdminRole) //绑定角色 | r.POST("/bindAdminRole", hdl.BindAdminRole) //绑定角色 | ||||
} | } | ||||
func rQualification(r *gin.RouterGroup) { | |||||
r.GET("/info", hdl.QualificationInfo) //资质认证-基本信息 | |||||
r.GET("/select/base", hdl.QualificationSelectBase) //资质认证-认证选择内容 | |||||
r.POST("/enterprise/save", hdl.QualificationEnterpriseSave) //资质认证-企业认证保存 | |||||
r.POST("/bank/save", hdl.QualificationBankSave) //资质认证-银行资质保存 | |||||
r.POST("/contact/save", hdl.QualificationContactSave) //资质认证-联系方式保存 | |||||
func rAccount(r *gin.RouterGroup) { | |||||
r.GET("/base", hdl.AccountBase) //账号信息 | |||||
r.POST("/update/password", hdl.AccountUpdatePassword) //账号信息-修改密码 | |||||
r.GET("/qualification/info", hdl.QualificationInfo) //资质认证-基本信息 | |||||
r.GET("/qualification/select/base", hdl.QualificationSelectBase) //资质认证-认证选择内容 | |||||
r.POST("/qualification/enterprise/save", hdl.QualificationEnterpriseSave) //资质认证-企业认证保存 | |||||
r.POST("/qualification/bank/save", hdl.QualificationBankSave) //资质认证-银行资质保存 | |||||
r.POST("/qualification/contact/save", hdl.QualificationContactSave) //资质认证-联系方式保存 | |||||
} | } | ||||
func rApplication(r *gin.RouterGroup) { | func rApplication(r *gin.RouterGroup) { | ||||
r.POST("/applet/list", hdl.AppletApplicationList) //小程序应用-列表数据 | r.POST("/applet/list", hdl.AppletApplicationList) //小程序应用-列表数据 | ||||
@@ -0,0 +1,69 @@ | |||||
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 | |||||
} |
@@ -65,21 +65,13 @@ func QualificationSelectBase(c *gin.Context) { | |||||
res := map[string]interface{}{ | res := map[string]interface{}{ | ||||
"register_area": country, | "register_area": country, | ||||
"idcard_type": IdcardTypeList, | "idcard_type": IdcardTypeList, | ||||
"country": []map[string]interface{}{ | |||||
{ | |||||
"value": "1", "name": "中国/国内", | |||||
}, | |||||
}, | |||||
"country": md.Country, | |||||
"user_type": []map[string]interface{}{ | "user_type": []map[string]interface{}{ | ||||
{ | { | ||||
"value": "1", "name": "企业", | "value": "1", "name": "企业", | ||||
}, | }, | ||||
}, | }, | ||||
"currency_conf": []map[string]interface{}{ | |||||
{ | |||||
"value": "0", "name": "人民币", | |||||
}, | |||||
}, | |||||
"currency_conf": md.CurrencyConf, | |||||
} | } | ||||
e.OutSuc(c, res, nil) | e.OutSuc(c, res, nil) | ||||
return | return | ||||
@@ -2,10 +2,10 @@ module applet | |||||
go 1.18 | go 1.18 | ||||
//replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models | |||||
replace code.fnuoos.com/zhimeng/model.git => E:/company/ad/models | |||||
require ( | require ( | ||||
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240822095043-f18aa08f09b1 | |||||
code.fnuoos.com/zhimeng/model.git v0.0.3-0.20240823034048-34202e969e8d | |||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | ||||
github.com/boombuler/barcode v1.0.1 | github.com/boombuler/barcode v1.0.1 | ||||
github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 | github.com/dchest/uniuri v0.0.0-20200228104902-7aecb25e1fe5 | ||||