作者 tangxvhui

Merge branch 'test'

正在显示 40 个修改的文件 包含 542 行增加94 行删除
@@ -26,3 +26,4 @@ opp @@ -26,3 +26,4 @@ opp
26 /*.exe~ 26 /*.exe~
27 logs 27 logs
28 tmp 28 tmp
  29 +/partner
1 -FROM 192.168.0.243:5000/mmm/mmmpartner:base 1 +FROM golang:1.19-alpine
2 ENV APP_DIR $GOPATH/src/partner 2 ENV APP_DIR $GOPATH/src/partner
3 RUN mkdir -p $APP_DIR 3 RUN mkdir -p $APP_DIR
4 WORKDIR $APP_DIR/ 4 WORKDIR $APP_DIR/
1 # 合伙人项目 1 # 合伙人项目
2 2
3 -### 系统架构 3 +### 对应的管理后台项目
4 4
5 -### 领域驱动设计 5 +http://gitlab.fjmaimaimai.com/mmm-go/partnermg
6 6
7 -### 核心登录流程 7 +### app对接的测试环境
  8 +```
  9 +服务端地址 http://mmm-partner-test.fjmaimaimai.com/
  10 +日志文件地址 http://mmm-partner-test.fjmaimaimai.com/log?id=12345
8 11
  12 +```
  13 +### app 对接的正式环境
  14 +```
  15 +服务端地址 https://public-interface.fjmaimaimai.com/mmm-partner
  16 +
  17 +```
@@ -3,7 +3,7 @@ runmode = "${RUN_MODE||dev}" @@ -3,7 +3,7 @@ runmode = "${RUN_MODE||dev}"
3 httpport = "${HTTP_PORT||8082}" 3 httpport = "${HTTP_PORT||8082}"
4 4
5 #开启https 5 #开启https
6 -EnableHTTPS = true 6 +EnableHTTPS = false
7 HTTPSPort = "443" 7 HTTPSPort = "443"
8 HTTPSCertFile = "conf/fjmaimaimai.com_pem.crt" 8 HTTPSCertFile = "conf/fjmaimaimai.com_pem.crt"
9 HTTPSKeyFile = "conf/fjmaimaimai.com_rsa.key" 9 HTTPSKeyFile = "conf/fjmaimaimai.com_rsa.key"
@@ -52,9 +52,9 @@ spec: @@ -52,9 +52,9 @@ spec:
52 ports: 52 ports:
53 - containerPort: 8082 53 - containerPort: 8082
54 - containerPort: 443 54 - containerPort: 443
55 -# volumeMounts:  
56 -# - mountPath: /opt/logs  
57 -# name: accesslogs 55 + # volumeMounts:
  56 + # - mountPath: /opt/logs
  57 + # name: accesslogs
58 env: 58 env:
59 - name: HTTP_PORT 59 - name: HTTP_PORT
60 value: "8082" 60 value: "8082"
@@ -84,6 +84,8 @@ spec: @@ -84,6 +84,8 @@ spec:
84 value: "https://mmm-open-api-dev.fjmaimaimai.com" 84 value: "https://mmm-open-api-dev.fjmaimaimai.com"
85 - name: UCENTER_SERVICE_HOST 85 - name: UCENTER_SERVICE_HOST
86 value: "https://suplus-ucenter-dev.fjmaimaimai.com" 86 value: "https://suplus-ucenter-dev.fjmaimaimai.com"
  87 + - name: SERVICE_RUNMOD
  88 + value: "dev"
87 - name: BUSINESS_ADMIN_SERVICE_HOST 89 - name: BUSINESS_ADMIN_SERVICE_HOST
88 valueFrom: 90 valueFrom:
89 configMapKeyRef: 91 configMapKeyRef:
@@ -84,6 +84,8 @@ spec: @@ -84,6 +84,8 @@ spec:
84 value: "https://public-interface.fjmaimaimai.com/openapi" 84 value: "https://public-interface.fjmaimaimai.com/openapi"
85 - name: UCENTER_SERVICE_HOST 85 - name: UCENTER_SERVICE_HOST
86 value: "https://suplus-ucenter-prd.fjmaimaimai.com" 86 value: "https://suplus-ucenter-prd.fjmaimaimai.com"
  87 + - name: SERVICE_RUNMOD
  88 + value: "prd"
87 - name: BUSINESS_ADMIN_SERVICE_HOST 89 - name: BUSINESS_ADMIN_SERVICE_HOST
88 valueFrom: 90 valueFrom:
89 configMapKeyRef: 91 configMapKeyRef:
@@ -52,9 +52,9 @@ spec: @@ -52,9 +52,9 @@ spec:
52 ports: 52 ports:
53 - containerPort: 8082 53 - containerPort: 8082
54 - containerPort: 443 54 - containerPort: 443
55 -# volumeMounts:  
56 -# - mountPath: /opt/logs  
57 -# name: accesslogs 55 + # volumeMounts:
  56 + # - mountPath: /opt/logs
  57 + # name: accesslogs
58 env: 58 env:
59 - name: HTTP_PORT 59 - name: HTTP_PORT
60 value: "8082" 60 value: "8082"
@@ -84,6 +84,8 @@ spec: @@ -84,6 +84,8 @@ spec:
84 value: "https://mmm-open-api-dev.fjmaimaimai.com" 84 value: "https://mmm-open-api-dev.fjmaimaimai.com"
85 - name: UCENTER_SERVICE_HOST 85 - name: UCENTER_SERVICE_HOST
86 value: "https://suplus-ucenter-test.fjmaimaimai.com" 86 value: "https://suplus-ucenter-test.fjmaimaimai.com"
  87 + - name: SERVICE_RUNMOD
  88 + value: "dev"
87 - name: BUSINESS_ADMIN_SERVICE_HOST 89 - name: BUSINESS_ADMIN_SERVICE_HOST
88 valueFrom: 90 valueFrom:
89 configMapKeyRef: 91 configMapKeyRef:
1 module gitlab.fjmaimaimai.com/mmm-go/partner 1 module gitlab.fjmaimaimai.com/mmm-go/partner
2 2
3 -go 1.14 3 +go 1.19
4 4
5 require ( 5 require (
6 - github.com/Shopify/sarama v1.26.4  
7 - github.com/ajg/form v1.5.1 // indirect 6 + github.com/Shopify/sarama v1.38.1
8 github.com/astaxie/beego v1.12.3 7 github.com/astaxie/beego v1.12.3
9 github.com/dgrijalva/jwt-go v3.2.0+incompatible 8 github.com/dgrijalva/jwt-go v3.2.0+incompatible
10 - github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect  
11 github.com/gavv/httpexpect v2.0.0+incompatible 9 github.com/gavv/httpexpect v2.0.0+incompatible
12 - github.com/gin-gonic/gin v1.5.0  
13 - github.com/go-pg/pg/v10 v10.0.0-beta.2  
14 - github.com/imkira/go-interpol v1.1.0 // indirect  
15 - github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect 10 + github.com/gin-gonic/gin v1.9.1
  11 + github.com/go-pg/pg/v10 v10.11.2
16 github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 12 github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9
17 - github.com/moul/http2curl v1.0.0 // indirect  
18 - github.com/onsi/ginkgo v1.15.0  
19 - github.com/onsi/gomega v1.10.5  
20 - github.com/sergi/go-diff v1.1.0 // indirect  
21 - github.com/shopspring/decimal v1.2.0 13 + github.com/onsi/ginkgo v1.16.5
  14 + github.com/onsi/gomega v1.30.0
  15 + github.com/shopspring/decimal v1.3.1
22 github.com/tiptok/gocomm v1.0.5 16 github.com/tiptok/gocomm v1.0.5
23 - github.com/valyala/fasthttp v1.19.0 // indirect 17 +)
  18 +
  19 +require (
  20 + github.com/ajg/form v1.5.1 // indirect
  21 + github.com/andybalholm/brotli v1.0.5 // indirect
  22 + github.com/beorn7/perks v1.0.1 // indirect
  23 + github.com/bytedance/sonic v1.9.1 // indirect
  24 + github.com/cespare/xxhash/v2 v2.1.1 // indirect
  25 + github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
  26 + github.com/davecgh/go-spew v1.1.1 // indirect
  27 + github.com/eapache/go-resiliency v1.3.0 // indirect
  28 + github.com/eapache/go-xerial-snappy v0.0.0-20230111030713-bf00bc1b83b6 // indirect
  29 + github.com/eapache/queue v1.1.0 // indirect
  30 + github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect
  31 + github.com/fatih/structs v0.0.0-20180123065059-ebf56d35bba7 // indirect
  32 + github.com/fsnotify/fsnotify v1.4.9 // indirect
  33 + github.com/gabriel-vasile/mimetype v1.4.2 // indirect
  34 + github.com/garyburd/redigo v1.6.0 // indirect
  35 + github.com/gin-contrib/sse v0.1.0 // indirect
  36 + github.com/go-pg/zerochecker v0.2.0 // indirect
  37 + github.com/go-playground/locales v0.14.1 // indirect
  38 + github.com/go-playground/universal-translator v0.18.1 // indirect
  39 + github.com/go-playground/validator/v10 v10.14.0 // indirect
  40 + github.com/goccy/go-json v0.10.2 // indirect
  41 + github.com/golang/protobuf v1.5.3 // indirect
  42 + github.com/golang/snappy v0.0.4 // indirect
  43 + github.com/google/go-cmp v0.6.0 // indirect
  44 + github.com/google/go-querystring v0.0.0-20170111101155-53e6ce116135 // indirect
  45 + github.com/gorilla/websocket v1.4.2 // indirect
  46 + github.com/hashicorp/errwrap v1.0.0 // indirect
  47 + github.com/hashicorp/go-multierror v1.1.1 // indirect
  48 + github.com/hashicorp/go-uuid v1.0.3 // indirect
  49 + github.com/hashicorp/golang-lru v0.5.4 // indirect
  50 + github.com/hashicorp/hcl v1.0.0 // indirect
  51 + github.com/imkira/go-interpol v1.1.0 // indirect
  52 + github.com/jcmturner/aescts/v2 v2.0.0 // indirect
  53 + github.com/jcmturner/dnsutils/v2 v2.0.0 // indirect
  54 + github.com/jcmturner/gofork v1.7.6 // indirect
  55 + github.com/jcmturner/gokrb5/v8 v8.4.3 // indirect
  56 + github.com/jcmturner/rpc/v2 v2.0.3 // indirect
  57 + github.com/jinzhu/inflection v1.0.0 // indirect
  58 + github.com/json-iterator/go v1.1.12 // indirect
  59 + github.com/klauspost/compress v1.16.3 // indirect
  60 + github.com/klauspost/cpuid/v2 v2.2.4 // indirect
  61 + github.com/leodido/go-urn v1.2.4 // indirect
  62 + github.com/magiconair/properties v1.8.1 // indirect
  63 + github.com/mattn/go-isatty v0.0.19 // indirect
  64 + github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
  65 + github.com/mitchellh/mapstructure v1.1.2 // indirect
  66 + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
  67 + github.com/modern-go/reflect2 v1.0.2 // indirect
  68 + github.com/moul/http2curl v1.0.0 // indirect
  69 + github.com/nxadm/tail v1.4.8 // indirect
  70 + github.com/pelletier/go-toml v1.2.0 // indirect
  71 + github.com/pelletier/go-toml/v2 v2.0.8 // indirect
  72 + github.com/pierrec/lz4/v4 v4.1.17 // indirect
  73 + github.com/pmezard/go-difflib v1.0.0 // indirect
  74 + github.com/prometheus/client_golang v1.7.0 // indirect
  75 + github.com/prometheus/client_model v0.2.0 // indirect
  76 + github.com/prometheus/common v0.10.0 // indirect
  77 + github.com/prometheus/procfs v0.1.3 // indirect
  78 + github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
  79 + github.com/rogpeppe/go-internal v1.11.0 // indirect
  80 + github.com/sergi/go-diff v1.3.1 // indirect
  81 + github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
  82 + github.com/sony/sonyflake v1.0.0 // indirect
  83 + github.com/spf13/afero v1.1.2 // indirect
  84 + github.com/spf13/cast v1.3.0 // indirect
  85 + github.com/spf13/jwalterweatherman v1.0.0 // indirect
  86 + github.com/spf13/pflag v1.0.3 // indirect
  87 + github.com/spf13/viper v1.4.0 // indirect
  88 + github.com/stretchr/testify v1.8.3 // indirect
  89 + github.com/tmthrgd/go-hex v0.0.0-20190904060850-447a3041c3bc // indirect
  90 + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
  91 + github.com/ugorji/go/codec v1.2.11 // indirect
  92 + github.com/valyala/bytebufferpool v1.0.0 // indirect
  93 + github.com/valyala/fasthttp v1.50.0 // indirect
  94 + github.com/vmihailenco/bufpool v0.1.11 // indirect
  95 + github.com/vmihailenco/msgpack/v5 v5.3.4 // indirect
  96 + github.com/vmihailenco/tagparser v0.1.2 // indirect
  97 + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
  98 + github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
  99 + github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
24 github.com/xeipuuv/gojsonschema v1.2.0 // indirect 100 github.com/xeipuuv/gojsonschema v1.2.0 // indirect
25 github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect 101 github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect
26 github.com/yudai/gojsondiff v1.0.0 // indirect 102 github.com/yudai/gojsondiff v1.0.0 // indirect
27 github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect 103 github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect
28 github.com/yudai/pp v2.0.1+incompatible // indirect 104 github.com/yudai/pp v2.0.1+incompatible // indirect
  105 + golang.org/x/arch v0.3.0 // indirect
  106 + golang.org/x/crypto v0.14.0 // indirect
  107 + golang.org/x/net v0.17.0 // indirect
  108 + golang.org/x/sys v0.13.0 // indirect
  109 + golang.org/x/text v0.13.0 // indirect
  110 + google.golang.org/protobuf v1.30.0 // indirect
  111 + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
  112 + gopkg.in/yaml.v2 v2.4.0 // indirect
  113 + gopkg.in/yaml.v3 v3.0.1 // indirect
  114 + mellium.im/sasl v0.3.1 // indirect
29 ) 115 )
@@ -4,11 +4,10 @@ import ( @@ -4,11 +4,10 @@ import (
4 "github.com/astaxie/beego" 4 "github.com/astaxie/beego"
5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/event" 5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/event"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" 6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
7 - _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"  
8 _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" 7 _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg"
9 _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/redis" 8 _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/redis"
10 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" 9 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
11 - //"gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/ginsvr" 10 +
12 _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/appsvr" 11 _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/appsvr"
13 ) 12 )
14 13
@@ -18,13 +17,9 @@ func main() { @@ -18,13 +17,9 @@ func main() {
18 }() 17 }()
19 log.Info("app start!") 18 log.Info("app start!")
20 log.Info(constant.POSTGRESQL_DB_NAME) 19 log.Info(constant.POSTGRESQL_DB_NAME)
21 - //ginsvr.Run()  
22 20
23 //注册事件 21 //注册事件
24 event.InitEventCenter() 22 event.InitEventCenter()
25 23
26 - //启动kafaka消息订阅  
27 - //go sarama.Run()  
28 -  
29 beego.Run() 24 beego.Run()
30 } 25 }
不能预览此文件类型
@@ -226,6 +226,7 @@ func RefreshToken(request *protocol.RefreshTokenRequest) (rsp *protocol.RefreshT @@ -226,6 +226,7 @@ func RefreshToken(request *protocol.RefreshTokenRequest) (rsp *protocol.RefreshT
226 226
227 // 验证短信验证码 T 227 // 验证短信验证码 T
228 func CheckSmsCode(phone, code string) (result bool, err error) { 228 func CheckSmsCode(phone, code string) (result bool, err error) {
  229 +
229 sms, _ := factory.CreateSmsCodeService() 230 sms, _ := factory.CreateSmsCodeService()
230 var data map[string]interface{} 231 var data map[string]interface{}
231 data, err = sms.CheckSmsCode(phone, code) 232 data, err = sms.CheckSmsCode(phone, code)
@@ -2,12 +2,13 @@ package dividend @@ -2,12 +2,13 @@ package dividend
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "time"
  6 +
5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/factory" 7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/factory"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils" 9 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" 10 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
9 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" 11 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
10 - "time"  
11 ) 12 )
12 13
13 // 分红统计 14 // 分红统计
@@ -25,7 +26,13 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis @@ -25,7 +26,13 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis
25 }() 26 }()
26 27
27 // 事业分红统计-查询订单 28 // 事业分红统计-查询订单
28 - _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(domain.OrderQueryOption{PartnerId: request.PartnerId, EndTime: utils.GetDayEnd(), SortBySalesTime: domain.DESC, OrderTypes: domain.UserOrderTypes(domain.Career)})) 29 + _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(
  30 + domain.OrderQueryOption{
  31 + PartnerId: request.PartnerId,
  32 + EndTime: utils.GetDayEnd(),
  33 + SortBySalesTime: domain.DESC,
  34 + OrderTypes: domain.UserOrderTypes(domain.Career),
  35 + }))
29 if e != nil { 36 if e != nil {
30 log.Error(e) 37 log.Error(e)
31 } 38 }
@@ -122,8 +129,8 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon @@ -122,8 +129,8 @@ func AllBonusStatics(orders []*domain.OrderBase, action int) (bonus protocol.Bon
122 } 129 }
123 130
124 // 订单-季度分红统计 131 // 订单-季度分红统计
125 -func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []protocol.Bonus) {  
126 - bonus = make([]protocol.Bonus, 4) 132 +func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus [4]protocol.Bonus) {
  133 + bonus = [4]protocol.Bonus{}
127 for i := range orders { 134 for i := range orders {
128 o := orders[i] 135 o := orders[i]
129 quarter := quarter(o.SaleDate) 136 quarter := quarter(o.SaleDate)
  1 +package dividend
  2 +
  3 +import (
  4 + "fmt"
  5 + "time"
  6 +
  7 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/factory"
  8 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
  9 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/utils"
  10 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
  11 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
  12 +)
  13 +
  14 +// 分红统计
  15 +func StatisticsV2(header *protocol.RequestHeader, request *protocol.DividendStatisticsRequest) (rsp *protocol.DividendStatisticsV2Response, err error) {
  16 + var (
  17 + transactionContext, _ = factory.CreateTransactionContext(nil)
  18 + OrderBaseResponsitory, _ = factory.CreateOrderBaseRepository(transactionContext)
  19 + )
  20 + if err = transactionContext.StartTransaction(); err != nil {
  21 + return nil, err
  22 + }
  23 + defer func() {
  24 + transactionContext.RollbackTransaction()
  25 + }()
  26 +
  27 + // 事业分红统计-查询订单
  28 + _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(
  29 + domain.OrderQueryOption{
  30 + PartnerId: request.PartnerId,
  31 + EndTime: utils.GetDayEnd(),
  32 + SortBySalesTime: domain.DESC,
  33 + OrderTypes: domain.UserOrderTypes(domain.Career),
  34 + }))
  35 + if e != nil {
  36 + log.Error(e)
  37 + }
  38 + err = transactionContext.CommitTransaction()
  39 + if err != nil {
  40 + return nil, err
  41 + }
  42 + //获取营销年
  43 + t := time.Now()
  44 + var last time.Time
  45 + var first time.Time
  46 + boundDate := time.Date(t.Year(), time.March, 31, 23, 59, 59, 0, time.Local) // 营销年界限
  47 + fmt.Println("营销年界限:", boundDate)
  48 + if t.Before(boundDate) || t.Equal(boundDate) {
  49 + first = time.Date(t.Year()-1, time.April, 1, 0, 0, 0, 0, time.Local)
  50 + last = time.Date(t.Year(), time.March, 31, 23, 59, 59, 0, time.Local)
  51 + } else if t.After(boundDate) {
  52 + first = time.Date(t.Year(), time.April, 1, 0, 0, 0, 0, time.Local)
  53 + last = time.Date(t.Year()+1, time.March, 31, 23, 59, 59, 0, time.Local)
  54 + }
  55 + fmt.Println("当前营销年起始:", first, last)
  56 + // 请求开始时间和结束时间都为0时,默认从营销年开始统计
  57 + if request.StartTime == 0 && request.EndTime == 0 {
  58 + request.StartTime = first.Unix() * 1000
  59 + request.EndTime = last.Unix() * 1000
  60 + } else if request.StartTime > 0 && request.EndTime > 0 { // 判断结束时间是否超过今天,超过今天的结束时间到今天为止
  61 + currentDayEnd := utils.GetDayEnd().Unix() * 1000
  62 + if request.EndTime >= currentDayEnd {
  63 + request.EndTime = currentDayEnd
  64 + }
  65 + }
  66 +
  67 + fmt.Println("StartTime: ", request.StartTime)
  68 + fmt.Println("EndTime: ", request.EndTime)
  69 +
  70 + var orderBetween []*domain.OrderBase
  71 + for i := range orderAll {
  72 + if orderAll[i].SaleDate.Unix() >= (request.StartTime/1000) && orderAll[i].SaleDate.Unix() < (request.EndTime/1000) {
  73 + orderBetween = append(orderBetween, orderAll[i])
  74 + }
  75 + }
  76 +
  77 + //0:全部分类,
  78 + //Career int = 1 //事业
  79 + //Business int = 2 //业务
  80 + //Develop int = 3 //研发
  81 + //App int = 4 //业务产品-应用
  82 + //累计分红
  83 + var (
  84 + bonusAll protocol.Bonus
  85 + bonusAllCareer protocol.Bonus
  86 + bonusAllBusiness protocol.Bonus
  87 + bonusAllDevelop protocol.Bonus
  88 + bonusAllApp protocol.Bonus
  89 + )
  90 + {
  91 + for _, val := range orderAll {
  92 + static := val.OrderBonusStatic()
  93 + bonusAll.Received = utils.Decimal(bonusAll.Received + static.OrderBonusReceive())
  94 + bonusAll.Outstanding = utils.Decimal(bonusAll.Outstanding + static.OrderBonusWait())
  95 + bonusAll.Receivable = utils.Decimal(bonusAll.Receivable + static.OrderTotalReceivable())
  96 + if val.PartnerCategory == nil {
  97 + continue
  98 + }
  99 + switch val.PartnerCategory.Id {
  100 + case int64(domain.Career):
  101 + bonusAllCareer.Received = utils.Decimal(bonusAllCareer.Received + static.OrderBonusReceive())
  102 + bonusAllCareer.Outstanding = utils.Decimal(bonusAllCareer.Outstanding + static.OrderBonusWait())
  103 + bonusAllCareer.Receivable = utils.Decimal(bonusAllCareer.Receivable + static.OrderTotalReceivable())
  104 + case int64(domain.Business):
  105 + bonusAllBusiness.Received = utils.Decimal(bonusAllBusiness.Received + static.OrderBonusReceive())
  106 + bonusAllBusiness.Outstanding = utils.Decimal(bonusAllBusiness.Outstanding + static.OrderBonusWait())
  107 + bonusAllBusiness.Receivable = utils.Decimal(bonusAllBusiness.Receivable + static.OrderTotalReceivable())
  108 + case int64(domain.App):
  109 + bonusAllApp.Received = utils.Decimal(bonusAllApp.Received + static.OrderBonusReceive())
  110 + bonusAllApp.Outstanding = utils.Decimal(bonusAllApp.Outstanding + static.OrderBonusWait())
  111 + bonusAllApp.Receivable = utils.Decimal(bonusAllApp.Receivable + static.OrderTotalReceivable())
  112 + case int64(domain.Develop):
  113 + bonusAllDevelop.Received = utils.Decimal(bonusAllDevelop.Received + static.OrderBonusReceive())
  114 + bonusAllDevelop.Outstanding = utils.Decimal(bonusAllDevelop.Outstanding + static.OrderBonusWait())
  115 + bonusAllDevelop.Receivable = utils.Decimal(bonusAllDevelop.Receivable + static.OrderTotalReceivable())
  116 + }
  117 + }
  118 + }
  119 + //0:全部分类,
  120 + //Career int = 1 //事业
  121 + //Business int = 2 //业务
  122 + //Develop int = 3 //研发
  123 + //App int = 4 //业务产品-应用
  124 + //季度分红
  125 + var (
  126 + bonusQuarters = [4]protocol.Bonus{}
  127 + bonusQuartersCareer = [4]protocol.Bonus{}
  128 + bonusQuartersBusiness = [4]protocol.Bonus{}
  129 + bonusQuartersDevelop = [4]protocol.Bonus{}
  130 + bonusQuartersApp = [4]protocol.Bonus{}
  131 + )
  132 + {
  133 + var (
  134 + quarterNum int // 对应季度在数组中的位置
  135 + )
  136 + for _, val := range orderBetween {
  137 + quarterNum = quarter(val.SaleDate)
  138 + static := val.OrderBonusStatic()
  139 + bonusQuarters[quarterNum].Receivable = utils.Decimal(bonusQuarters[quarterNum].Receivable + static.OrderTotalReceivable())
  140 + bonusQuarters[quarterNum].Received = utils.Decimal(bonusQuarters[quarterNum].Received + static.OrderBonusReceive())
  141 + bonusQuarters[quarterNum].Outstanding = utils.Decimal(bonusQuarters[quarterNum].Outstanding + static.OrderBonusWait())
  142 + if val.PartnerCategory == nil {
  143 + continue
  144 + }
  145 + // 分类合并计数
  146 + switch val.PartnerCategory.Id {
  147 + case int64(domain.Career):
  148 + bonusQuartersCareer[quarterNum].Receivable = utils.Decimal(bonusQuartersCareer[quarterNum].Receivable + static.OrderTotalReceivable())
  149 + bonusQuartersCareer[quarterNum].Received = utils.Decimal(bonusQuartersCareer[quarterNum].Received + static.OrderBonusReceive())
  150 + bonusQuartersCareer[quarterNum].Outstanding = utils.Decimal(bonusQuartersCareer[quarterNum].Outstanding + static.OrderBonusWait())
  151 +
  152 + case int64(domain.Business):
  153 + bonusQuartersBusiness[quarterNum].Receivable = utils.Decimal(bonusQuartersBusiness[quarterNum].Receivable + static.OrderTotalReceivable())
  154 + bonusQuartersBusiness[quarterNum].Received = utils.Decimal(bonusQuartersBusiness[quarterNum].Received + static.OrderBonusReceive())
  155 + bonusQuartersBusiness[quarterNum].Outstanding = utils.Decimal(bonusQuartersBusiness[quarterNum].Outstanding + static.OrderBonusWait())
  156 +
  157 + case int64(domain.App):
  158 + bonusQuartersApp[quarterNum].Receivable = utils.Decimal(bonusQuartersApp[quarterNum].Receivable + static.OrderTotalReceivable())
  159 + bonusQuartersApp[quarterNum].Received = utils.Decimal(bonusQuartersApp[quarterNum].Received + static.OrderBonusReceive())
  160 + bonusQuartersApp[quarterNum].Outstanding = utils.Decimal(bonusQuartersApp[quarterNum].Outstanding + static.OrderBonusWait())
  161 +
  162 + case int64(domain.Develop):
  163 + bonusQuartersDevelop[quarterNum].Receivable = utils.Decimal(bonusQuartersDevelop[quarterNum].Receivable + static.OrderTotalReceivable())
  164 + bonusQuartersDevelop[quarterNum].Received = utils.Decimal(bonusQuartersDevelop[quarterNum].Received + static.OrderBonusReceive())
  165 + bonusQuartersDevelop[quarterNum].Outstanding = utils.Decimal(bonusQuartersDevelop[quarterNum].Outstanding + static.OrderBonusWait())
  166 +
  167 + }
  168 + }
  169 + }
  170 +
  171 + // 处理分月份的
  172 + //月度分红
  173 + var (
  174 + bonusMonths = [12]protocol.Bonus{}
  175 + bonusMonthsCareer = [12]protocol.Bonus{}
  176 + bonusMonthsBusiness = [12]protocol.Bonus{}
  177 + bonusMonthsDevelop = [12]protocol.Bonus{}
  178 + bonusMonthsApp = [12]protocol.Bonus{}
  179 + )
  180 +
  181 + {
  182 + //按照自然年过滤数据
  183 + yearNum := time.Unix(request.StartTime/1000, 0).Local().Year()
  184 + var monthNum int //对应月份在数组中的位置
  185 + for i, val := range orderAll {
  186 + if orderAll[i].SaleDate.Year() != yearNum {
  187 + continue
  188 + }
  189 + monthNum = int(val.SaleDate.Month()) - 1
  190 + static := val.OrderBonusStatic()
  191 + bonusMonths[monthNum].Receivable = utils.Decimal(bonusMonths[monthNum].Receivable + static.OrderTotalReceivable())
  192 + bonusMonths[monthNum].Received = utils.Decimal(bonusMonths[monthNum].Received + static.OrderBonusReceive())
  193 + bonusMonths[monthNum].Outstanding = utils.Decimal(bonusMonths[monthNum].Outstanding + static.OrderBonusWait())
  194 + if val.PartnerCategory == nil {
  195 + continue
  196 + }
  197 + // 分类合并计数
  198 + switch val.PartnerCategory.Id {
  199 + case int64(domain.Career):
  200 + bonusMonthsCareer[monthNum].Receivable = utils.Decimal(bonusMonthsCareer[monthNum].Receivable + static.OrderTotalReceivable())
  201 + bonusMonthsCareer[monthNum].Received = utils.Decimal(bonusMonthsCareer[monthNum].Received + static.OrderBonusReceive())
  202 + bonusMonthsCareer[monthNum].Outstanding = utils.Decimal(bonusMonthsCareer[monthNum].Outstanding + static.OrderBonusWait())
  203 + case int64(domain.Business):
  204 + bonusMonthsBusiness[monthNum].Receivable = utils.Decimal(bonusMonthsBusiness[monthNum].Receivable + static.OrderTotalReceivable())
  205 + bonusMonthsBusiness[monthNum].Received = utils.Decimal(bonusMonthsBusiness[monthNum].Received + static.OrderBonusReceive())
  206 + bonusMonthsBusiness[monthNum].Outstanding = utils.Decimal(bonusMonthsBusiness[monthNum].Outstanding + static.OrderBonusWait())
  207 + case int64(domain.App):
  208 + bonusMonthsApp[monthNum].Receivable = utils.Decimal(bonusMonthsApp[monthNum].Receivable + static.OrderTotalReceivable())
  209 + bonusMonthsApp[monthNum].Received = utils.Decimal(bonusMonthsApp[monthNum].Received + static.OrderBonusReceive())
  210 + bonusMonthsApp[monthNum].Outstanding = utils.Decimal(bonusMonthsApp[monthNum].Outstanding + static.OrderBonusWait())
  211 + case int64(domain.Develop):
  212 + bonusMonthsDevelop[monthNum].Receivable = utils.Decimal(bonusMonthsDevelop[monthNum].Receivable + static.OrderTotalReceivable())
  213 + bonusMonthsDevelop[monthNum].Received = utils.Decimal(bonusMonthsDevelop[monthNum].Received + static.OrderBonusReceive())
  214 + bonusMonthsDevelop[monthNum].Outstanding = utils.Decimal(bonusMonthsDevelop[monthNum].Outstanding + static.OrderBonusWait())
  215 + }
  216 + }
  217 + }
  218 + // 整理输出数据
  219 + rsp = &protocol.DividendStatisticsV2Response{
  220 + Statistics: protocol.DividendStatistics{
  221 + Received: bonusAll.Received,
  222 + Outstanding: bonusAll.Outstanding,
  223 + Receivable: bonusAll.Receivable,
  224 + Quarters: bonusQuarters,
  225 + Months: bonusMonths,
  226 + },
  227 + StatisticsCareer: protocol.DividendStatistics{
  228 + Received: bonusAllCareer.Received,
  229 + Outstanding: bonusAllCareer.Outstanding,
  230 + Receivable: bonusAllCareer.Receivable,
  231 + Quarters: bonusQuartersCareer,
  232 + Months: bonusMonthsCareer,
  233 + },
  234 + StatisticsBusiness: protocol.DividendStatistics{
  235 + Received: bonusAllBusiness.Received,
  236 + Outstanding: bonusAllBusiness.Outstanding,
  237 + Receivable: bonusAllBusiness.Receivable,
  238 + Quarters: bonusQuartersBusiness,
  239 + Months: bonusMonthsBusiness,
  240 + },
  241 + StatisticsDevelop: protocol.DividendStatistics{
  242 + Received: bonusAllDevelop.Received,
  243 + Outstanding: bonusAllDevelop.Outstanding,
  244 + Receivable: bonusAllDevelop.Receivable,
  245 + Quarters: bonusQuartersDevelop,
  246 + Months: bonusMonthsDevelop,
  247 + },
  248 + StatisticsApp: protocol.DividendStatistics{
  249 + Received: bonusAllApp.Received,
  250 + Outstanding: bonusAllApp.Outstanding,
  251 + Receivable: bonusAllApp.Receivable,
  252 + Quarters: bonusQuartersApp,
  253 + Months: bonusMonthsApp,
  254 + },
  255 + Timestamp: 0,
  256 + }
  257 + rsp.Timestamp = time.Now().Unix() * 1000
  258 +
  259 + return rsp, nil
  260 +}
1 package factory 1 package factory
2 2
3 import ( 3 import (
  4 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
4 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain/service" 5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain/service"
5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/svr" 6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/svr"
6 ) 7 )
7 8
8 func CreateSmsCodeService() (service.SmsCodeService, error) { 9 func CreateSmsCodeService() (service.SmsCodeService, error) {
  10 + if constant.SERVICE_RUNMOD == "dev" {
  11 + return svr.NewHttplibMmmSmsApiEmpty(), nil
  12 + }
9 return svr.NewHttplibMmmSmsApiServiceGateway(), nil 13 return svr.NewHttplibMmmSmsApiServiceGateway(), nil
10 } 14 }
@@ -62,5 +62,11 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.OrderStatist @@ -62,5 +62,11 @@ func StatisticsV2(header *protocol.RequestHeader, request *protocol.OrderStatist
62 ) 62 )
63 63
64 err = transactionContext.CommitTransaction() 64 err = transactionContext.CommitTransaction()
  65 + // 合并全部的
  66 + rsp.All.CumulativeMoney = rsp.Career.CumulativeMoney + rsp.Business.CumulativeMoney + rsp.Develop.CumulativeMoney + rsp.App.CumulativeMoney
  67 + rsp.All.CumulativeQuantity = rsp.Career.CumulativeQuantity + rsp.Business.CumulativeQuantity + rsp.Develop.CumulativeQuantity + rsp.App.CumulativeQuantity
  68 + rsp.All.Percent = 100
  69 + rsp.All.TodayRealMoney = rsp.Career.TodayRealMoney + rsp.Business.TodayRealMoney + rsp.Develop.TodayRealMoney + rsp.App.TodayRealMoney
  70 + rsp.All.TodayRealQuantity = rsp.Career.TodayRealQuantity + rsp.Business.TodayRealQuantity + rsp.Develop.TodayRealQuantity + rsp.App.TodayRealQuantity
65 return 71 return
66 } 72 }
@@ -7,6 +7,8 @@ import ( @@ -7,6 +7,8 @@ import (
7 7
8 const SERVICE_NAME = "partner" 8 const SERVICE_NAME = "partner"
9 9
  10 +var SERVICE_RUNMOD = "dev"
  11 +
10 var LOG_LEVEL = "debug" 12 var LOG_LEVEL = "debug"
11 var LOG_File = "logs/app.log" 13 var LOG_File = "logs/app.log"
12 var LOG_PREFIX = "[partner_dev]" 14 var LOG_PREFIX = "[partner_dev]"
@@ -41,4 +43,8 @@ func init() { @@ -41,4 +43,8 @@ func init() {
41 if v := os.Getenv("DEFAULT_GUEST_COMPANY"); v != "" { 43 if v := os.Getenv("DEFAULT_GUEST_COMPANY"); v != "" {
42 DEFAULT_GUEST_COMPANY, _ = strconv.Atoi(v) 44 DEFAULT_GUEST_COMPANY, _ = strconv.Atoi(v)
43 } 45 }
  46 +
  47 + if v := os.Getenv("SERVICE_RUNMOD"); v != "" {
  48 + SERVICE_RUNMOD = v
  49 + }
44 } 50 }
@@ -4,9 +4,9 @@ import "os" @@ -4,9 +4,9 @@ import "os"
4 4
5 var POSTGRESQL_DB_NAME = "partner_test" //partner_test/partner_dev 5 var POSTGRESQL_DB_NAME = "partner_test" //partner_test/partner_dev
6 var POSTGRESQL_USER = "postgres" //postgres 6 var POSTGRESQL_USER = "postgres" //postgres
7 -var POSTGRESQL_PASSWORD = "1993618jack" //pgsql@123/1993618jack/eagle1010  
8 -var POSTGRESQL_HOST = "127.0.0.1" //127.0.0.1/114.55.200.59  
9 -var POSTGRESQL_PORT = "5432" //5432/31543 7 +var POSTGRESQL_PASSWORD = "eagle1010" //pgsql@123/1993618jack/eagle1010
  8 +var POSTGRESQL_HOST = "114.55.200.59" //127.0.0.1/114.55.200.59
  9 +var POSTGRESQL_PORT = "31543" //5432/31543
10 var DISABLE_CREATE_TABLE = true 10 var DISABLE_CREATE_TABLE = true
11 var DISABLE_SQL_GENERATE_PRINT = false 11 var DISABLE_SQL_GENERATE_PRINT = false
12 12
@@ -25,8 +25,8 @@ func (m *PartnerCategoryInfo) Identify() interface{} { @@ -25,8 +25,8 @@ func (m *PartnerCategoryInfo) Identify() interface{} {
25 } 25 }
26 26
27 const ( 27 const (
28 - Career = iota + 1  
29 - Business  
30 - Develop  
31 - App 28 + Career int = 1 //事业
  29 + Business int = 2 //业务
  30 + Develop int = 3 //研发
  31 + App int = 4 //业务产品-应用
32 ) 32 )
@@ -2,6 +2,9 @@ package domain_service @@ -2,6 +2,9 @@ package domain_service
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 + "strings"
  6 + "time"
  7 +
5 "github.com/tiptok/gocomm/xa/eda" 8 "github.com/tiptok/gocomm/xa/eda"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" 9 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 10 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
@@ -14,8 +17,6 @@ import ( @@ -14,8 +17,6 @@ import (
14 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log" 17 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
15 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" 18 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
16 protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/auth" 19 protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/auth"
17 - "strings"  
18 - "time"  
19 ) 20 )
20 21
21 type PgLoginService struct { 22 type PgLoginService struct {
@@ -182,7 +183,7 @@ func (svr *PgLoginService) PartnerLogin(phone string, password string) (err erro @@ -182,7 +183,7 @@ func (svr *PgLoginService) PartnerLogin(phone string, password string) (err erro
182 return 183 return
183 } 184 }
184 185
185 -//管理层登录 186 +// 管理层登录
186 func (svr *PgLoginService) ManagerLogin(phone string, password string) (err error) { 187 func (svr *PgLoginService) ManagerLogin(phone string, password string) (err error) {
187 if len(svr.Users) == 0 { 188 if len(svr.Users) == 0 {
188 //子账号 189 //子账号
@@ -198,7 +199,7 @@ func (svr *PgLoginService) ManagerLogin(phone string, password string) (err erro @@ -198,7 +199,7 @@ func (svr *PgLoginService) ManagerLogin(phone string, password string) (err erro
198 return 199 return
199 } 200 }
200 201
201 -//合伙人统计信息 202 +// 合伙人统计信息
202 func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) { 203 func (svr *PgLoginService) PartnerStaticInfo() (interface{}, error) {
203 response := make(map[string]interface{}) 204 response := make(map[string]interface{})
204 response["id"] = protocolx.AdminTypePartner 205 response["id"] = protocolx.AdminTypePartner
@@ -564,7 +565,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error { @@ -564,7 +565,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
564 // 用户在正常公司存在且无效或者存在非高管或者不存在、合伙人在正常公司存在且无效或者不存在、合伙人在游客公司不存在、注册合伙人到游客公司 565 // 用户在正常公司存在且无效或者存在非高管或者不存在、合伙人在正常公司存在且无效或者不存在、合伙人在游客公司不存在、注册合伙人到游客公司
565 if !isGuestPartner && (isUser && !isUserAvailable || isUser && !isUserSenior || !isUser) && (isPartner && !isPartnerAvailable || !isPartner) { 566 if !isGuestPartner && (isUser && !isUserAvailable || isUser && !isUserSenior || !isUser) && (isPartner && !isPartnerAvailable || !isPartner) {
566 id := time.Now().Unix() 567 id := time.Now().Unix()
567 - errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ 568 + m := &models.PartnerInfo{
568 Id: id, 569 Id: id,
569 CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), 570 CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
570 PartnerName: phone, 571 PartnerName: phone,
@@ -581,14 +582,16 @@ func (svr *PgLoginService) RegistryUser(phone string) error { @@ -581,14 +582,16 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
581 UpdateAt: time.Now(), 582 UpdateAt: time.Now(),
582 PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}}, 583 PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}},
583 Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}}, 584 Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}},
584 - }) 585 + }
  586 + _, errPartner = svr.transactionContext.PgDd.Model(m).Insert()
585 } 587 }
586 588
587 // 合伙人不存在、用户存在、非高管(普通用户)-> 注册用户 589 // 合伙人不存在、用户存在、非高管(普通用户)-> 注册用户
588 // 合伙人不存在、用户不存在(游客)-> 注册用户 590 // 合伙人不存在、用户不存在(游客)-> 注册用户
589 if errPartner != nil && errUser == nil { 591 if errPartner != nil && errUser == nil {
590 id := time.Now().Unix() 592 id := time.Now().Unix()
591 - errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ 593 +
  594 + m := &models.PartnerInfo{
592 Id: id, 595 Id: id,
593 CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), 596 CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
594 PartnerName: phone, 597 PartnerName: phone,
@@ -605,7 +608,8 @@ func (svr *PgLoginService) RegistryUser(phone string) error { @@ -605,7 +608,8 @@ func (svr *PgLoginService) RegistryUser(phone string) error {
605 UpdateAt: time.Now(), 608 UpdateAt: time.Now(),
606 PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}}, 609 PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}},
607 Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}}, 610 Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}},
608 - }) 611 + }
  612 + _, errPartner = svr.transactionContext.PgDd.Model(&m).Insert()
609 } 613 }
610 614
611 return errPartner 615 return errPartner
@@ -688,7 +692,7 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { @@ -688,7 +692,7 @@ func (svr *PgLoginService) RegistryGuest(phone string) error {
688 // 注册用户 692 // 注册用户
689 if errUser != nil && errPartner != nil { 693 if errUser != nil && errPartner != nil {
690 id := time.Now().Unix() 694 id := time.Now().Unix()
691 - errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ 695 + m := &models.PartnerInfo{
692 Id: id, 696 Id: id,
693 CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), 697 CompanyId: int64(constant.DEFAULT_GUEST_COMPANY),
694 PartnerName: phone, 698 PartnerName: phone,
@@ -705,7 +709,8 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { @@ -705,7 +709,8 @@ func (svr *PgLoginService) RegistryGuest(phone string) error {
705 UpdateAt: time.Now(), 709 UpdateAt: time.Now(),
706 PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}}, 710 PartnerCategoryInfos: []*domain.PartnerCategoryInfo{{Id: 1, Code: phone}},
707 Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}}, 711 Salesman: []*domain.Salesman{{Name: phone, Telephone: phone}},
708 - }) 712 + }
  713 + _, errPartner = svr.transactionContext.PgDd.Model(m).Insert()
709 } 714 }
710 715
711 // 删除用户 716 // 删除用户
@@ -3,6 +3,7 @@ package pg @@ -3,6 +3,7 @@ package pg
3 import ( 3 import (
4 "context" 4 "context"
5 "fmt" 5 "fmt"
  6 +
6 "github.com/go-pg/pg/v10" 7 "github.com/go-pg/pg/v10"
7 "github.com/go-pg/pg/v10/orm" 8 "github.com/go-pg/pg/v10/orm"
8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant" 9 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
@@ -38,7 +39,7 @@ func init() { @@ -38,7 +39,7 @@ func init() {
38 (*models.PartnerCategoryInfo)(nil), 39 (*models.PartnerCategoryInfo)(nil),
39 (*models.Users)(nil), 40 (*models.Users)(nil),
40 } { 41 } {
41 - err := DB.CreateTable(model, &orm.CreateTableOptions{ 42 + err := DB.Model(model).CreateTable(&orm.CreateTableOptions{
42 Temp: false, 43 Temp: false,
43 IfNotExists: true, 44 IfNotExists: true,
44 FKConstraints: true, 45 FKConstraints: true,
@@ -2,6 +2,7 @@ package repository @@ -2,6 +2,7 @@ package repository
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/go-pg/pg/v10" 6 "github.com/go-pg/pg/v10"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
@@ -23,12 +24,12 @@ func (repository *BusinessBonusRepository) Save(dm *domain.BusinessBonus) (*doma @@ -23,12 +24,12 @@ func (repository *BusinessBonusRepository) Save(dm *domain.BusinessBonus) (*doma
23 return nil, err 24 return nil, err
24 } 25 }
25 if dm.Identify() == nil { 26 if dm.Identify() == nil {
26 - if err = tx.Insert(m); err != nil { 27 + if _, err = tx.Model(m).Returning("id").Insert(); err != nil {
27 return nil, err 28 return nil, err
28 } 29 }
29 return dm, nil 30 return dm, nil
30 } 31 }
31 - if err = tx.Update(m); err != nil { 32 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
32 return nil, err 33 return nil, err
33 } 34 }
34 return dm, nil 35 return dm, nil
@@ -22,12 +22,12 @@ func (repository *CompanyRepository) Save(dm *domain.Company) (*domain.Company, @@ -22,12 +22,12 @@ func (repository *CompanyRepository) Save(dm *domain.Company) (*domain.Company,
22 return nil, err 22 return nil, err
23 } 23 }
24 if dm.Id == 0 { 24 if dm.Id == 0 {
25 - if err = tx.Insert(m); err != nil { 25 + if _, err = tx.Model(m).Returning("id").Insert(); err != nil {
26 return nil, err 26 return nil, err
27 } 27 }
28 return dm, nil 28 return dm, nil
29 } 29 }
30 - if err = tx.Update(m); err != nil { 30 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
31 return nil, err 31 return nil, err
32 } 32 }
33 return dm, nil 33 return dm, nil
@@ -21,12 +21,12 @@ func (repository *ImCustomerServiceRepository) Save(dm *domain.ImCustomerService @@ -21,12 +21,12 @@ func (repository *ImCustomerServiceRepository) Save(dm *domain.ImCustomerService
21 return nil, err 21 return nil, err
22 } 22 }
23 if dm.Identify() == nil { 23 if dm.Identify() == nil {
24 - if err = tx.Insert(m); err != nil { 24 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
25 return nil, err 25 return nil, err
26 } 26 }
27 return dm, nil 27 return dm, nil
28 } 28 }
29 - if err = tx.Update(m); err != nil { 29 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
30 return nil, err 30 return nil, err
31 } 31 }
32 return dm, nil 32 return dm, nil
@@ -21,12 +21,12 @@ func (repository *ImInfoRepository) Save(dm *domain.ImInfo) (*domain.ImInfo, err @@ -21,12 +21,12 @@ func (repository *ImInfoRepository) Save(dm *domain.ImInfo) (*domain.ImInfo, err
21 return nil, err 21 return nil, err
22 } 22 }
23 if dm.Identify() == nil { 23 if dm.Identify() == nil {
24 - if err = tx.Insert(m); err != nil { 24 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
25 return nil, err 25 return nil, err
26 } 26 }
27 return dm, nil 27 return dm, nil
28 } 28 }
29 - if err = tx.Update(m); err != nil { 29 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
30 return nil, err 30 return nil, err
31 } 31 }
32 return dm, nil 32 return dm, nil
@@ -2,6 +2,7 @@ package repository @@ -2,6 +2,7 @@ package repository
2 2
3 import ( 3 import (
4 "encoding/json" 4 "encoding/json"
  5 +
5 "github.com/go-pg/pg/v10" 6 "github.com/go-pg/pg/v10"
6 "github.com/go-pg/pg/v10/orm" 7 "github.com/go-pg/pg/v10/orm"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
@@ -28,12 +29,12 @@ func (repository *OrderBaseRepository) Save(dm *domain.OrderBase) (*domain.Order @@ -28,12 +29,12 @@ func (repository *OrderBaseRepository) Save(dm *domain.OrderBase) (*domain.Order
28 // return dm, err 29 // return dm, err
29 //} 30 //}
30 //m.Id = dm.Id 31 //m.Id = dm.Id
31 - if err = tx.Insert(m); err != nil { 32 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
32 return nil, err 33 return nil, err
33 } 34 }
34 return dm, nil 35 return dm, nil
35 } 36 }
36 - if err = tx.Update(m); err != nil { 37 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
37 return nil, err 38 return nil, err
38 } 39 }
39 return dm, nil 40 return dm, nil
@@ -25,12 +25,12 @@ func (repository *OrderGoodRepository) Save(dm *domain.OrderGood) (*domain.Order @@ -25,12 +25,12 @@ func (repository *OrderGoodRepository) Save(dm *domain.OrderGood) (*domain.Order
25 // return dm, err 25 // return dm, err
26 //} 26 //}
27 //m.Id = dm.Id 27 //m.Id = dm.Id
28 - if err = tx.Insert(m); err != nil { 28 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
29 return nil, err 29 return nil, err
30 } 30 }
31 return dm, nil 31 return dm, nil
32 } 32 }
33 - if err = tx.Update(m); err != nil { 33 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
34 return nil, err 34 return nil, err
35 } 35 }
36 return dm, nil 36 return dm, nil
@@ -2,6 +2,7 @@ package repository @@ -2,6 +2,7 @@ package repository
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/go-pg/pg/v10" 6 "github.com/go-pg/pg/v10"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
@@ -23,12 +24,12 @@ func (repository *PartnerCategoryInfoRepository) Save(dm *domain.PartnerCategory @@ -23,12 +24,12 @@ func (repository *PartnerCategoryInfoRepository) Save(dm *domain.PartnerCategory
23 return nil, err 24 return nil, err
24 } 25 }
25 if dm.Identify() == nil { 26 if dm.Identify() == nil {
26 - if err = tx.Insert(m); err != nil { 27 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
27 return nil, err 28 return nil, err
28 } 29 }
29 return dm, nil 30 return dm, nil
30 } 31 }
31 - if err = tx.Update(m); err != nil { 32 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
32 return nil, err 33 return nil, err
33 } 34 }
34 return dm, nil 35 return dm, nil
@@ -27,12 +27,12 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) (*domain.P @@ -27,12 +27,12 @@ func (repository *PartnerInfoRepository) Save(dm *domain.PartnerInfo) (*domain.P
27 // return dm, err 27 // return dm, err
28 //} 28 //}
29 //m.Id = dm.Id 29 //m.Id = dm.Id
30 - if err = tx.Insert(m); err != nil { 30 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
31 return nil, err 31 return nil, err
32 } 32 }
33 return dm, nil 33 return dm, nil
34 } 34 }
35 - if err = tx.Update(m); err != nil { 35 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
36 return nil, err 36 return nil, err
37 } 37 }
38 return dm, nil 38 return dm, nil
@@ -25,12 +25,12 @@ func (repository *PartnerSubAccountRepository) Save(dm *domain.PartnerSubAccount @@ -25,12 +25,12 @@ func (repository *PartnerSubAccountRepository) Save(dm *domain.PartnerSubAccount
25 return dm, err 25 return dm, err
26 } 26 }
27 m.Id = dm.Id 27 m.Id = dm.Id
28 - if err = tx.Insert(m); err != nil { 28 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
29 return nil, err 29 return nil, err
30 } 30 }
31 return dm, nil 31 return dm, nil
32 } 32 }
33 - if err = tx.Update(m); err != nil { 33 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
34 return nil, err 34 return nil, err
35 } 35 }
36 return dm, nil 36 return dm, nil
@@ -2,6 +2,7 @@ package repository @@ -2,6 +2,7 @@ package repository
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/tiptok/gocomm/common" 6 "github.com/tiptok/gocomm/common"
6 . "github.com/tiptok/gocomm/pkg/orm/pgx" 7 . "github.com/tiptok/gocomm/pkg/orm/pgx"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
@@ -23,12 +24,12 @@ func (repository *SysMessageConsumeRepository) Save(dm *domain.SysMessageConsume @@ -23,12 +24,12 @@ func (repository *SysMessageConsumeRepository) Save(dm *domain.SysMessageConsume
23 return nil, err 24 return nil, err
24 } 25 }
25 if dm.Identify() == nil { 26 if dm.Identify() == nil {
26 - if err = tx.Insert(m); err != nil { 27 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
27 return nil, err 28 return nil, err
28 } 29 }
29 return dm, nil 30 return dm, nil
30 } 31 }
31 - if err = tx.Update(m); err != nil { 32 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
32 return nil, err 33 return nil, err
33 } 34 }
34 return dm, nil 35 return dm, nil
@@ -2,6 +2,7 @@ package repository @@ -2,6 +2,7 @@ package repository
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/tiptok/gocomm/common" 6 "github.com/tiptok/gocomm/common"
6 . "github.com/tiptok/gocomm/pkg/orm/pgx" 7 . "github.com/tiptok/gocomm/pkg/orm/pgx"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
@@ -23,7 +24,7 @@ func (repository *SysMessageProduceRepository) Save(dm *domain.SysMessageProduce @@ -23,7 +24,7 @@ func (repository *SysMessageProduceRepository) Save(dm *domain.SysMessageProduce
23 return nil, err 24 return nil, err
24 } 25 }
25 26
26 - if err = tx.Insert(m); err != nil { 27 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
27 return nil, err 28 return nil, err
28 } 29 }
29 return dm, nil 30 return dm, nil
@@ -2,6 +2,7 @@ package repository @@ -2,6 +2,7 @@ package repository
2 2
3 import ( 3 import (
4 "fmt" 4 "fmt"
  5 +
5 "github.com/go-pg/pg/v10" 6 "github.com/go-pg/pg/v10"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg/models"
@@ -23,12 +24,12 @@ func (repository *UsersRepository) Save(dm *domain.Users) (*domain.Users, error) @@ -23,12 +24,12 @@ func (repository *UsersRepository) Save(dm *domain.Users) (*domain.Users, error)
23 return nil, err 24 return nil, err
24 } 25 }
25 if dm.Identify() == nil { 26 if dm.Identify() == nil {
26 - if err = tx.Insert(m); err != nil { 27 + if _, err = tx.Model(m).Returning("id").Insert(m); err != nil {
27 return nil, err 28 return nil, err
28 } 29 }
29 return dm, nil 30 return dm, nil
30 } 31 }
31 - if err = tx.Update(m); err != nil { 32 + if _, err = tx.Model(m).Where("id=?", m.Id).Update(m); err != nil {
32 return nil, err 33 return nil, err
33 } 34 }
34 return dm, nil 35 return dm, nil
1 package svr 1 package svr
2 2
3 import ( 3 import (
4 - "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"  
5 - "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"  
6 "strings" 4 "strings"
7 "time" 5 "time"
  6 +
  7 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/constant"
  8 + "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/log"
8 ) 9 )
9 10
10 type HttplibMmmSmsApiServiceGateway struct { 11 type HttplibMmmSmsApiServiceGateway struct {
@@ -49,3 +50,19 @@ func NewHttplibMmmSmsApiServiceGateway() *HttplibMmmSmsApiServiceGateway { @@ -49,3 +50,19 @@ func NewHttplibMmmSmsApiServiceGateway() *HttplibMmmSmsApiServiceGateway {
49 }, 50 },
50 } 51 }
51 } 52 }
  53 +
  54 +type HttplibMmmSmsApiEmpty struct{}
  55 +
  56 +func NewHttplibMmmSmsApiEmpty() *HttplibMmmSmsApiEmpty {
  57 + return &HttplibMmmSmsApiEmpty{}
  58 +}
  59 +
  60 +func (serviceGateway *HttplibMmmSmsApiEmpty) SendSms(phone string) (map[string]interface{}, error) {
  61 + log.Info("非正式环境调用HttplibMmmSmsApiEmpty.SendSms发送短信")
  62 + return map[string]interface{}{}, nil
  63 +}
  64 +
  65 +func (serviceGateway *HttplibMmmSmsApiEmpty) CheckSmsCode(phone string, code string) (map[string]interface{}, error) {
  66 + log.Info("非正式环境调用HttplibMmmSmsApiEmpty.CheckSmsCode 检查短信验证码")
  67 + return map[string]interface{}{}, nil
  68 +}
@@ -9,7 +9,7 @@ type DividendController struct { @@ -9,7 +9,7 @@ type DividendController struct {
9 BaseController 9 BaseController
10 } 10 }
11 11
12 -//DividendStatistics 12 +// DividendStatistics
13 func (this *DividendController) DividendStatistics() { 13 func (this *DividendController) DividendStatistics() {
14 var msg *protocol.ResponseMessage 14 var msg *protocol.ResponseMessage
15 defer func() { 15 defer func() {
@@ -31,7 +31,29 @@ func (this *DividendController) DividendStatistics() { @@ -31,7 +31,29 @@ func (this *DividendController) DividendStatistics() {
31 msg = protocol.NewReturnResponse(dividend.Statistics(header, request)) 31 msg = protocol.NewReturnResponse(dividend.Statistics(header, request))
32 } 32 }
33 33
34 -//DividendOrders 分红订单 34 +// DividendStatisticsV2 分红统计
  35 +func (this *DividendController) DividendStatisticsV2() {
  36 + var msg *protocol.ResponseMessage
  37 + defer func() {
  38 + this.Resp(msg)
  39 + }()
  40 + var request *protocol.DividendStatisticsRequest
  41 + if err := this.JsonUnmarshal(&request); err != nil {
  42 + msg = protocol.BadRequestParam(1)
  43 + return
  44 + }
  45 + if b, m := this.Valid(request); !b {
  46 + msg = m
  47 + return
  48 + }
  49 + header := this.GetRequestHeader(this.Ctx)
  50 + if request.PartnerId == 0 {
  51 + request.PartnerId = header.UserId
  52 + }
  53 + msg = protocol.NewReturnResponse(dividend.StatisticsV2(header, request))
  54 +}
  55 +
  56 +// DividendOrders 分红订单
35 func (this *DividendController) DividendOrders() { 57 func (this *DividendController) DividendOrders() {
36 var msg *protocol.ResponseMessage 58 var msg *protocol.ResponseMessage
37 defer func() { 59 defer func() {
1 package controllers 1 package controllers
2 2
3 import ( 3 import (
  4 + "time"
  5 +
4 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/order" 6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/application/order"
5 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain" 7 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/domain"
6 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" 8 "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol"
7 - "time"  
8 ) 9 )
9 10
10 type OrderController struct { 11 type OrderController struct {
11 BaseController 12 BaseController
12 } 13 }
13 14
14 -//OrderStatistics 订单统计 15 +// OrderStatistics 订单统计
15 // @router /statistics [post] 16 // @router /statistics [post]
16 func (this *OrderController) Statistics() { 17 func (this *OrderController) Statistics() {
17 var msg *protocol.ResponseMessage 18 var msg *protocol.ResponseMessage
@@ -31,7 +32,7 @@ func (this *OrderController) Statistics() { @@ -31,7 +32,7 @@ func (this *OrderController) Statistics() {
31 msg = protocol.NewReturnResponse(order.Statistics(header, request)) 32 msg = protocol.NewReturnResponse(order.Statistics(header, request))
32 } 33 }
33 34
34 -//OrderStatistics 订单统计 35 +// OrderStatistics 订单统计
35 // @router /statistics [post] 36 // @router /statistics [post]
36 func (this *OrderController) StatisticsV2() { 37 func (this *OrderController) StatisticsV2() {
37 var msg *protocol.ResponseMessage 38 var msg *protocol.ResponseMessage
@@ -54,7 +55,7 @@ func (this *OrderController) StatisticsV2() { @@ -54,7 +55,7 @@ func (this *OrderController) StatisticsV2() {
54 msg = protocol.NewReturnResponse(order.StatisticsV2(header, request)) 55 msg = protocol.NewReturnResponse(order.StatisticsV2(header, request))
55 } 56 }
56 57
57 -//OrderDetail 订单详情 58 +// OrderDetail 订单详情
58 // @router /orderDetail [post] 59 // @router /orderDetail [post]
59 func (this *OrderController) OrderDetail() { 60 func (this *OrderController) OrderDetail() {
60 var msg *protocol.ResponseMessage 61 var msg *protocol.ResponseMessage
@@ -74,7 +75,7 @@ func (this *OrderController) OrderDetail() { @@ -74,7 +75,7 @@ func (this *OrderController) OrderDetail() {
74 msg = protocol.NewReturnResponse(order.Detail(header, request)) 75 msg = protocol.NewReturnResponse(order.Detail(header, request))
75 } 76 }
76 77
77 -//OrderList 78 +// OrderList
78 func (this *OrderController) OrderList() { 79 func (this *OrderController) OrderList() {
79 var msg *protocol.ResponseMessage 80 var msg *protocol.ResponseMessage
80 defer func() { 81 defer func() {
@@ -97,7 +98,7 @@ func (this *OrderController) OrderList() { @@ -97,7 +98,7 @@ func (this *OrderController) OrderList() {
97 msg = protocol.NewReturnResponse(order.List(header, request)) 98 msg = protocol.NewReturnResponse(order.List(header, request))
98 } 99 }
99 100
100 -//OrderList 101 +// OrderList
101 func (this *OrderController) Intentions() { 102 func (this *OrderController) Intentions() {
102 var msg *protocol.ResponseMessage 103 var msg *protocol.ResponseMessage
103 defer func() { 104 defer func() {
@@ -47,7 +47,7 @@ func InitV2() { @@ -47,7 +47,7 @@ func InitV2() {
47 nsV2.Router("/auth/login", &controllers.AuthController{}, "Post:LoginV2") 47 nsV2.Router("/auth/login", &controllers.AuthController{}, "Post:LoginV2")
48 nsV2.Router("/user/userInfo", &controllers.UserController{}, "Post:UserInfoV2") 48 nsV2.Router("/user/userInfo", &controllers.UserController{}, "Post:UserInfoV2")
49 nsV2.Router("/company/partners", &controllers.CompanyController{}, "post:PartnersV2") 49 nsV2.Router("/company/partners", &controllers.CompanyController{}, "post:PartnersV2")
50 - 50 + nsV2.Router("/dividend/statistics", &controllers.DividendController{}, "Post:DividendStatisticsV2")
51 nsV2.Router("/order/statistics", &controllers.OrderController{}, "Post:StatisticsV2") 51 nsV2.Router("/order/statistics", &controllers.OrderController{}, "Post:StatisticsV2")
52 beego.AddNamespace(nsV2) 52 beego.AddNamespace(nsV2)
53 } 53 }
@@ -31,11 +31,11 @@ type LoginResponse struct { @@ -31,11 +31,11 @@ type LoginResponse struct {
31 type LoginRequestV2 struct { 31 type LoginRequestV2 struct {
32 Cid int `json:"cid"` 32 Cid int `json:"cid"`
33 IdType int `json:"idType"` // 用户类型 1:合伙人 2:高管 33 IdType int `json:"idType"` // 用户类型 1:合伙人 2:高管
34 - Credentials string `json:"credentials"` // 登录类型 1:密码 2:验证码 34 + Credentials string `json:"credentials"` // 凭证
35 ClientId string `json:"clientId"` 35 ClientId string `json:"clientId"`
36 } 36 }
37 37
38 -//JWT用户信息 38 +// JWT用户信息
39 type JWTUserInfo struct { 39 type JWTUserInfo struct {
40 UserId string `json:"id"` //用户id 40 UserId string `json:"id"` //用户id
41 PassWord string `json:"passWord"` //密码 41 PassWord string `json:"passWord"` //密码
@@ -9,14 +9,27 @@ const ( @@ -9,14 +9,27 @@ const (
9 9
10 /*DividendStatistics 分红统计*/ 10 /*DividendStatistics 分红统计*/
11 type DividendStatisticsRequest struct { 11 type DividendStatisticsRequest struct {
12 - StartTime int64 `json:"startTime"`  
13 - EndTime int64 `json:"endTime"` 12 + StartTime int64 `json:"startTime"` // 单位毫秒
  13 + EndTime int64 `json:"endTime"` // 单位毫秒
14 //分红类型(0累计分红、1分红支出) 14 //分红类型(0累计分红、1分红支出)
15 //DividendAction int `json:"dividendAction"` 15 //DividendAction int `json:"dividendAction"`
16 PartnerId int64 `json:"partnerId"` 16 PartnerId int64 `json:"partnerId"`
17 } 17 }
18 type DividendStatisticsResponse struct { 18 type DividendStatisticsResponse struct {
19 - Statistics DividendStatistics `json:"statistics"` 19 + Statistics DividendStatistics `json:"statistics"` //全部
  20 + Timestamp int64 `json:"timestamp"`
  21 +}
  22 +
  23 +// Career int = 1 //事业
  24 +// Business int = 2 //业务
  25 +// Develop int = 3 //研发
  26 +// App int = 4 //业务产品-应用
  27 +type DividendStatisticsV2Response struct {
  28 + Statistics DividendStatistics `json:"statistics"` // 全部
  29 + StatisticsCareer DividendStatistics `json:"statisticsCareer"` // 事业分类
  30 + StatisticsBusiness DividendStatistics `json:"statisticsBusiness"` // 业务分类
  31 + StatisticsDevelop DividendStatistics `json:"statisticsDevelop"` // 研发a分类
  32 + StatisticsApp DividendStatistics `json:"statisticsApp"` // 业务产品-应用
20 Timestamp int64 `json:"timestamp"` 33 Timestamp int64 `json:"timestamp"`
21 } 34 }
22 35
@@ -24,7 +37,8 @@ type DividendStatistics struct { @@ -24,7 +37,8 @@ type DividendStatistics struct {
24 Received float64 `json:"received"` //总已收分红 37 Received float64 `json:"received"` //总已收分红
25 Outstanding float64 `json:"outstanding"` //总未收分红/分红支出 38 Outstanding float64 `json:"outstanding"` //总未收分红/分红支出
26 Receivable float64 `json:"receivable"` //总应收分红 39 Receivable float64 `json:"receivable"` //总应收分红
27 - Quarters []Bonus `json:"quarters"` 40 + Quarters [4]Bonus `json:"quarters"` //4个季度分红
  41 + Months [12]Bonus `json:"months"` //12个月度分红
28 } 42 }
29 43
30 type Bonus struct { 44 type Bonus struct {
@@ -50,6 +50,7 @@ type OrderStatisticsRequest struct { @@ -50,6 +50,7 @@ type OrderStatisticsRequest struct {
50 } 50 }
51 type OrderStatisticsResponse struct { 51 type OrderStatisticsResponse struct {
52 Statistics *OrderStatics `json:"statistics,omitempty"` 52 Statistics *OrderStatics `json:"statistics,omitempty"`
  53 + All OrderStatic `json:"all"` //全部
53 Career OrderStatic `json:"career,omitempty"` //事业 54 Career OrderStatic `json:"career,omitempty"` //事业
54 Business OrderStatic `json:"business,omitempty"` //业务 55 Business OrderStatic `json:"business,omitempty"` //业务
55 Develop OrderStatic `json:"develop,omitempty"` //开发 56 Develop OrderStatic `json:"develop,omitempty"` //开发
@@ -72,7 +73,7 @@ type OrderStatics struct { @@ -72,7 +73,7 @@ type OrderStatics struct {
72 } 73 }
73 74
74 type OrderStatic struct { 75 type OrderStatic struct {
75 - Percent float64 `json:"percent"` // 事业占比 76 + Percent float64 `json:"percent"` //事业占比
76 TodayRealQuantity int `json:"todayRealQuantity"` //今日新增实发订单 77 TodayRealQuantity int `json:"todayRealQuantity"` //今日新增实发订单
77 TodayRealMoney float64 `json:"todayRealMoney"` //今日新增实发订单金额 78 TodayRealMoney float64 `json:"todayRealMoney"` //今日新增实发订单金额
78 CumulativeQuantity int `json:"cumulativeQuantity"` //累计实发订单 79 CumulativeQuantity int `json:"cumulativeQuantity"` //累计实发订单
此 diff 太大无法显示。