作者 yangfu

1.日志修改

... ... @@ -8,6 +8,7 @@ import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/svr"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
"strings"
"time"
... ... @@ -46,6 +47,10 @@ func Login(header *protocol.RequestHeader, request *protocol.LoginRequest) (rsp
return
}
}
if !partnerInfo.IsEnable() {
err = protocol.NewErrWithMessage(2002) //账号禁用
return
}
switch request.GrantType {
case protocol.LoginByPassword:
if len(partnerInfo.Password) == 0 {
... ... @@ -76,6 +81,7 @@ func SmsCode(request *protocol.SmsCodeRequest) (rsp *protocol.SmsCodeResponse, e
if msg, ok := data["msg"]; ok {
err = protocol.NewCustomMessage(1, msg.(string))
}
log.Error(err, data)
return
}
return
... ...
package domain
//买家
type Buyer struct {
//买家姓名
BuyerName string `json:"buyerName"`
//联系方式
ContactInfo string `json:"contactInfo"`
//收获地址
ShippingAddress string `json:"shippingAddress"`
}
package domain
type Company struct {
Id int64 `json:"id"`
Name string `json:"name"`
Phone string `json:"phone"`
}
... ...
... ... @@ -151,3 +151,13 @@ type DividendOrdersQueryOption struct {
Offset int `json:"offset,omitempty"`
Limit int `json:"limit,omitempty"`
}
//买家
type Buyer struct {
//买家姓名
BuyerName string `json:"buyerName"`
//联系方式
ContactInfo string `json:"contactInfo"`
//收获地址
ShippingAddress string `json:"shippingAddress"`
}
... ...
... ... @@ -88,7 +88,24 @@ func (m *PartnerInfo) PartnerCategoryInfo() *PartnerCategoryInfo {
}
}
//账号是否有效
func (m *PartnerInfo) IsEnable() bool {
return m.Status == 1
}
type PartnerCategoryInfo struct {
Id int `json:"id"`
Name string `json:"name"`
}
type RegionInfo struct {
RegionId int `json:"regionId"`
RegionName string `json:"regionName"`
}
//业务员
type Salesman struct {
//Id int64 `json:"id"`
Name string `json:"name"`
Telephone string `json:"telephone"`
}
... ...
package domain
type RegionInfo struct {
RegionId int `json:"regionId"`
RegionName string `json:"regionName"`
}
package domain
//业务员
type Salesman struct {
//Id int64 `json:"id"`
Name string `json:"name"`
Telephone string `json:"telephone"`
}
package models
type Company struct {
tableName struct{} `pg:"company"`
Id int64 `json:"id"`
Name string `json:"name"`
Phone string `json:"phone"`
}
... ...
... ... @@ -39,7 +39,7 @@ func (this *AuthController) SmsCode() {
}()
var request *protocol.SmsCodeRequest
if err := this.JsonUnmarshal(&request); err != nil {
msg = protocol.BadRequestParam(1)
msg = protocol.BadRequestParam(2)
return
}
if b, m := this.Valid(request); !b {
... ...
... ... @@ -14,6 +14,11 @@ import (
//缓存
var CacheSms = cache.NewMemoryCache()
var (
clientId = "pdf233Znkjo"
clientSecret = "oHexnmeomYdo19NCmdwne83dfj"
)
type BaseController struct {
beego.Controller
}
... ...
... ... @@ -6,6 +6,7 @@ import (
"github.com/astaxie/beego/context"
"github.com/astaxie/beego/logs"
"io/ioutil"
"net/http"
"time"
)
... ... @@ -35,7 +36,7 @@ func CreateResponseLogFilter(logger *logs.BeeLogger) func(ctx *context.Context)
func CreateRequestBodyFilter() func(ctx *context.Context) {
return func(ctx *context.Context) {
if len(ctx.Input.RequestBody) == 0 {
if ctx.Request.Method == "POST" || ctx.Request.Method == "PUT" {
if ctx.Request.Method == http.MethodPost || ctx.Request.Method == http.MethodPut {
body, _ := ioutil.ReadAll(ctx.Request.Body)
if len(body) == 0 {
body = []byte("{}")
... ...
... ... @@ -12,6 +12,7 @@ var errmessge ErrorMap = map[int]string{
1011: "获取验证码次数超出限制,请联系管理员",
1012: "请输入正确的验证码",
2002: "您还不是正式用户,请联系管理员",
2021: "登录失败,手机号或密码错误",
2025: "短信验证码验证失败",
2026: "新密码与确认密码不一致",
... ...