作者 tangxvhui

更新调整依赖

... ... @@ -26,3 +26,4 @@ opp
/*.exe~
logs
tmp
/partner
\ No newline at end of file
... ...
... ... @@ -3,24 +3,24 @@ module gitlab.fjmaimaimai.com/mmm-go/partner
go 1.14
require (
github.com/Shopify/sarama v1.26.4
github.com/Shopify/sarama v1.38.1
github.com/ajg/form v1.5.1 // indirect
github.com/astaxie/beego v1.12.3
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
github.com/gavv/httpexpect v2.0.0+incompatible
github.com/gin-gonic/gin v1.5.0
github.com/go-pg/pg/v10 v10.0.0-beta.2
github.com/gin-gonic/gin v1.9.1
github.com/go-pg/pg/v10 v10.11.2
github.com/imkira/go-interpol v1.1.0 // indirect
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9
github.com/moul/http2curl v1.0.0 // indirect
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shopspring/decimal v1.2.0
github.com/onsi/ginkgo v1.16.5
github.com/onsi/gomega v1.30.0
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shopspring/decimal v1.3.1
github.com/tiptok/gocomm v1.0.5
github.com/valyala/fasthttp v1.19.0 // indirect
github.com/valyala/fasthttp v1.50.0 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
github.com/yudai/gojsondiff v1.0.0 // indirect
... ...
不能预览此文件类型
... ... @@ -2,6 +2,9 @@ package domain_service
import (
"fmt"
"strings"
"time"
"github.com/tiptok/gocomm/xa/eda"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
... ... @@ -14,8 +17,6 @@ import (
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/auth"
"strings"
"time"
)
type PgLoginService struct {
... ... @@ -182,7 +183,7 @@ func (svr *PgLoginService) PartnerLogin(phone string, password string) (err erro
return
}
//管理层登录
// 管理层登录
func (svr *PgLoginService) ManagerLogin(phone string, password string) (err error) {
if len(svr.Users) == 0 {
//子账号
... ... @@ -198,7 +199,7 @@ func (svr *PgLoginService) ManagerLogin(phone string, password string) (err erro
return
}
//合伙人统计信息
// 合伙人统计信息
func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) {
response := make(map[string]interface{})
response["id"] = protocolx.AdminTypePartner
... ... @@ -564,7 +565,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
// 用户在正常公司存在且无效或者存在非高管或者不存在、合伙人在正常公司存在且无效或者不存在、合伙人在游客公司不存在、注册合伙人到游客公司
if !isGuestPartner && (isUser && !isUserAvailable || isUser && !isUserSenior || !isUser) && (isPartner && !isPartnerAvailable || !isPartner) {
id := time.Now().Unix()
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
m := &models.PartnerInfo{
Id: id,
CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
PartnerName: phone,
... ... @@ -581,14 +582,16 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
UpdateAt: time.Now(),
PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}},
Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}},
})
}
_, errPartner = svr.transactionContext.PgDd.Model(m).Insert()
}
// 合伙人不存在、用户存在、非高管(普通用户)-> 注册用户
// 合伙人不存在、用户不存在(游客)-> 注册用户
if errPartner != nil && errUser == nil {
id := time.Now().Unix()
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
m := &models.PartnerInfo{
Id: id,
CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
PartnerName: phone,
... ... @@ -605,7 +608,8 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
UpdateAt: time.Now(),
PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}},
Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}},
})
}
_, errPartner = svr.transactionContext.PgDd.Model(&m).Insert()
}
return errPartner
... ... @@ -688,7 +692,7 @@ func (svr *PgLoginService) RegistryGuest(phone string) error {
// 注册用户
if errUser != nil && errPartner != nil {
id := time.Now().Unix()
errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{
m := &models.PartnerInfo{
Id: id,
CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
PartnerName: phone,
... ... @@ -705,7 +709,8 @@ func (svr *PgLoginService) RegistryGuest(phone string) error {
UpdateAt: time.Now(),
PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}},
Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}},
})
}
_, errPartner = svr.transactionContext.PgDd.Model(m).Insert()
}
// 删除用户
... ...
... ... @@ -3,6 +3,7 @@ package pg
import (
"context"
"fmt"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
... ... @@ -38,7 +39,7 @@ func init() {
(*models.PartnerCategoryInfo)(nil),
(*models.Users)(nil),
} {
err := DB.CreateTable(model, &orm.CreateTableOptions{
err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
Temp: false,
IfNotExists: true,
FKConstraints: true,
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
... ... @@ -23,12 +24,12 @@ func (repository *BusinessBonusRepository) Save(dm *domain.BusinessBonus) (*doma
return nil, err
}
if dm.Identify() == nil {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -22,12 +22,12 @@ func (repository *CompanyRepository) Save(dm *domain.Company) (*domain.Company,
return nil, err
}
if dm.Id == 0 {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -21,12 +21,12 @@ func (repository *ImCustomerServiceRepository) Save(dm *domain.ImCustomerService
return nil, err
}
if dm.Identify() == nil {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -21,12 +21,12 @@ func (repository *ImInfoRepository) Save(dm *domain.ImInfo) (*domain.ImInfo, err
return nil, err
}
if dm.Identify() == nil {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"encoding/json"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
... ... @@ -28,12 +29,12 @@ func (repository *OrderBaseRepository) Save(dm *domain.OrderBase) (*domain.Order
// return dm, err
//}
//m.Id = dm.Id
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -25,12 +25,12 @@ func (repository *OrderGoodRepository) Save(dm *domain.OrderGood) (*domain.Order
// return dm, err
//}
//m.Id = dm.Id
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
... ... @@ -23,12 +24,12 @@ func (repository *PartnerCategoryInfoRepository) Save(dm *domain.PartnerCategory
return nil, err
}
if dm.Identify() == nil {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -27,12 +27,12 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) (*domain.P
// return dm, err
//}
//m.Id = dm.Id
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -25,12 +25,12 @@ func (repository *PartnerSubAccountRepository) Save(dm *domain.PartnerSubAccount
return dm, err
}
m.Id = dm.Id
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"fmt"
"github.com/tiptok/gocomm/common"
. "github.com/tiptok/gocomm/pkg/orm/pgx"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
... ... @@ -23,12 +24,12 @@ func (repository *SysMessageConsumeRepository) Save(dm *domain.SysMessageConsume
return nil, err
}
if dm.Identify() == nil {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"fmt"
"github.com/tiptok/gocomm/common"
. "github.com/tiptok/gocomm/pkg/orm/pgx"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
... ... @@ -23,7 +24,7 @@ func (repository *SysMessageProduceRepository) Save(dm *domain.SysMessageProduce
return nil, err
}
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
... ...
... ... @@ -2,6 +2,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
... ... @@ -23,12 +24,12 @@ func (repository *UsersRepository) Save(dm *domain.Users) (*domain.Users, error)
return nil, err
}
if dm.Identify() == nil {
if err = tx.Insert(m); err != nil {
if _, err = tx.Model(m).Returning("*").Insert(m); err != nil {
return nil, err
}
return dm, nil
}
if err = tx.Update(m); err != nil {
if _, err = tx.Model(m).Update(m); err != nil {
return nil, err
}
return dm, nil
... ...