合并分支 'dev' 到 'test'
Dev 查看合并请求 !48
正在显示
31 个修改的文件
包含
314 行增加
和
111 行删除
@@ -11,5 +11,25 @@ ENV GO111MODULE on | @@ -11,5 +11,25 @@ ENV GO111MODULE on | ||
11 | ENV GOPROXY https://goproxy.cn,direct | 11 | ENV GOPROXY https://goproxy.cn,direct |
12 | RUN ["go","mod","tidy"] | 12 | RUN ["go","mod","tidy"] |
13 | RUN ["go","build"] | 13 | RUN ["go","build"] |
14 | -EXPOSE 8082 | ||
15 | -ENTRYPOINT ["./partner"] | ||
14 | +EXPOSE 8082 443 | ||
15 | +ENTRYPOINT ["./partner"] | ||
16 | + | ||
17 | +############################# | ||
18 | +## STEP 1 build executable binary | ||
19 | +############################# | ||
20 | +#FROM golang:alpine AS builder | ||
21 | +# | ||
22 | +#RUN mkdir /app | ||
23 | +#WORKDIR /app | ||
24 | +#COPY . /app | ||
25 | +#RUN ["ln","-sf","/usr/share/zoneinfo/Asia/Shanghai","/etc/localtime"] | ||
26 | +##RUN GO111MODULE="on" GOPROXY="https://goproxy.cn" GOFLAGS="-mod=vendor" CGO_ENABLED=0 GOOS=linux go build -o partner | ||
27 | +#RUN GO111MODULE="on" GOPROXY="https://goproxy.cn" CGO_ENABLED=0 GOOS=linux go build -o partner | ||
28 | +# | ||
29 | +############################# | ||
30 | +## STEP 2 build a small image | ||
31 | +############################ | ||
32 | +#FROM scratch as final | ||
33 | +#COPY --from=builder /app/partner /app/partner | ||
34 | +#COPY --from=builder /app/conf/ /app/conf | ||
35 | +#ENTRYPOINT ["./app/partner"] |
@@ -2,6 +2,12 @@ appname = partner | @@ -2,6 +2,12 @@ appname = partner | ||
2 | runmode = "${RUN_MODE||dev}" | 2 | runmode = "${RUN_MODE||dev}" |
3 | httpport = "${HTTP_PORT||8082}" | 3 | httpport = "${HTTP_PORT||8082}" |
4 | 4 | ||
5 | +#开启https | ||
6 | +EnableHTTPS = true | ||
7 | +HTTPSPort = "443" | ||
8 | +HTTPSCertFile = "conf/fjmaimaimai.com_pem.crt" | ||
9 | +HTTPSKeyFile = "conf/fjmaimaimai.com_rsa.key" | ||
10 | + | ||
5 | #开启监控 | 11 | #开启监控 |
6 | EnableAdmin = false | 12 | EnableAdmin = false |
7 | #开启JSON请求 | 13 | #开启JSON请求 |
conf/fjmaimaimai.com_pem.crt
0 → 100644
1 | +-----BEGIN CERTIFICATE----- | ||
2 | +MIIGWjCCBUKgAwIBAgIQBKNf6ftifrIH+BeJ7V4uqjANBgkqhkiG9w0BAQsFADBf | ||
3 | +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 | ||
4 | +d3cuZGlnaWNlcnQuY29tMR4wHAYDVQQDExVHZW9UcnVzdCBDTiBSU0EgQ0EgRzEw | ||
5 | +HhcNMjEwMTA2MDAwMDAwWhcNMjIwMjA2MjM1OTU5WjCBgzELMAkGA1UEBhMCQ04x | ||
6 | +EjAQBgNVBAgMCeemj+W7uuecgTESMBAGA1UEBwwJ56aP5bee5biCMTAwLgYDVQQK | ||
7 | +DCfnpo/lu7rkubDkubDkubDkv6Hmga/np5HmioDmnInpmZDlhazlj7gxGjAYBgNV | ||
8 | +BAMMESouZmptYWltYWltYWkuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB | ||
9 | +CgKCAQEAv1KDwfoVuXyMSNUvLapWLpyWdQd8Dy4l5Wmdiydof4+ijqCfgPgMOZGS | ||
10 | +7ucvis1ZUZLYDKbZq8xODVEWlXf/n6sMXkq0B+eltlYqyPOZyaBUkg2qqz/iKljb | ||
11 | +1pGE5q7gfQ5nQoEW8J/DZUlKs+7jg9O0y2S0jVj3s7QlFy6Alw9BE/7ChOxqfegN | ||
12 | +Ua0UL8W6rFqK32eyvZUeecvtKoZwJ3YD2ayXJIN70OivjkcWLskmf6+CjalitqQs | ||
13 | +JZ7xD6/WtrpunTCpOVNqhR81sCOT+xxDwNppDqiMNo3lFL6TeQSWT19RBllkiWdW | ||
14 | +XXfWS7CsIrqp8i/7fjt66VmVqZnPDwIDAQABo4IC6zCCAucwHwYDVR0jBBgwFoAU | ||
15 | +kZ9eMRWuEJ+tYMH3wcyqSDQvDCYwHQYDVR0OBBYEFEhZyphSt/IUiLKJLr78T+7j | ||
16 | +l7tmMC0GA1UdEQQmMCSCESouZmptYWltYWltYWkuY29tgg9mam1haW1haW1haS5j | ||
17 | +b20wDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcD | ||
18 | +AjB1BgNVHR8EbjBsMDSgMqAwhi5odHRwOi8vY3JsMy5kaWdpY2VydC5jb20vR2Vv | ||
19 | +VHJ1c3RDTlJTQUNBRzEuY3JsMDSgMqAwhi5odHRwOi8vY3JsNC5kaWdpY2VydC5j | ||
20 | +b20vR2VvVHJ1c3RDTlJTQUNBRzEuY3JsMEsGA1UdIAREMEIwNgYJYIZIAYb9bAEB | ||
21 | +MCkwJwYIKwYBBQUHAgEWG2h0dHA6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAIBgZn | ||
22 | +gQwBAgIwbwYIKwYBBQUHAQEEYzBhMCEGCCsGAQUFBzABhhVodHRwOi8vb2NzcC5k | ||
23 | +Y29jc3AuY24wPAYIKwYBBQUHMAKGMGh0dHA6Ly9jcmwuZGlnaWNlcnQtY24uY29t | ||
24 | +L0dlb1RydXN0Q05SU0FDQUcxLmNydDAMBgNVHRMBAf8EAjAAMIIBAgYKKwYBBAHW | ||
25 | +eQIEAgSB8wSB8ADuAHUAKXm+8J45OSHwVnOfY6V35b5XfZxgCvj5TV0mXCVdx4QA | ||
26 | +AAF21tCFyQAABAMARjBEAiAPHS8Wp3c0J7d5By9NQM3/tyf7/B0H7JZLJ+IlcoCG | ||
27 | +IwIgR1+Mj5Q6nhWdqV5s9WLgSUvhpJJxvFrJOzV6zkfXZEwAdQAiRUUHWVUkVpY/ | ||
28 | +oS/x922G4CMmY63AS39dxoNcbuIPAgAAAXbW0IYsAAAEAwBGMEQCIBbGUD0dLyIT | ||
29 | +O+KzBtFPQjiRUbcjGZsbY0gWmVzZfBPrAiAa2X20smzJK42hcMenaVrUgxC/y/j0 | ||
30 | +bYYfKRrfwEsoWDANBgkqhkiG9w0BAQsFAAOCAQEAU4aHqNW/qgzRUwBv3C9E70r/ | ||
31 | +/LMy3asBePsBARZlzd3tXrr446lsX3HKmAH4AtLACjwPv3ejsEJueeQxrwMxalW+ | ||
32 | +2ZerAJhzYqD0OovwcB2b6cDB5zWAuyllFo6ILI3KSQjzFmi4Vn993pN2b2OEUkwC | ||
33 | +REYvMVf2BzHjVFuCiXtUWgOucsCb4ES+yWjCrw93VafyhhGCbXVXd55GNbZFE+kw | ||
34 | +JArAwYPKwabuFYFfeSVWcRvaV+Kbo88ytPo5ZpShSOBFCPQ1JQ/BxWEmzHXQIzcz | ||
35 | +uqELYfxmxI3q6plbgHtL1rY2B8YTWcxXF98fIfg5OKYssOV4LGcoOWPf0PUPrg== | ||
36 | +-----END CERTIFICATE----- |
conf/fjmaimaimai.com_rsa.key
0 → 100644
1 | +-----BEGIN RSA PRIVATE KEY----- | ||
2 | +MIIEpQIBAAKCAQEAv1KDwfoVuXyMSNUvLapWLpyWdQd8Dy4l5Wmdiydof4+ijqCf | ||
3 | +gPgMOZGS7ucvis1ZUZLYDKbZq8xODVEWlXf/n6sMXkq0B+eltlYqyPOZyaBUkg2q | ||
4 | +qz/iKljb1pGE5q7gfQ5nQoEW8J/DZUlKs+7jg9O0y2S0jVj3s7QlFy6Alw9BE/7C | ||
5 | +hOxqfegNUa0UL8W6rFqK32eyvZUeecvtKoZwJ3YD2ayXJIN70OivjkcWLskmf6+C | ||
6 | +jalitqQsJZ7xD6/WtrpunTCpOVNqhR81sCOT+xxDwNppDqiMNo3lFL6TeQSWT19R | ||
7 | +BllkiWdWXXfWS7CsIrqp8i/7fjt66VmVqZnPDwIDAQABAoIBAHN3mF980Jm2ym+2 | ||
8 | +ghe8YvEUvlV5I+2Be4uel1+BdDbweDo+RKWwjqg77ILU8kOCNbLevhe8p0hhMIYm | ||
9 | +90tUNemmcPuDeG4A52lJTd8j7h/a7M+NAgECuDu4j01LW/thdcjj5XwkrrSgp2u8 | ||
10 | +tSItPhC0t7u9Vp6sICrLwUrhXOhNV+qdm94VhabJFGkdR9iUYw7W7w54Z1p+Nfw8 | ||
11 | +PJdDJfwu0lr8DFB2Zw+Ota8Xg+PX71x4mWS1g+h/6xz2ivptFcKPcwd60EjB+ROi | ||
12 | +IQC8pnUmbF0H0epoVisB3SWEMzuShmAZrckBW+0ILDUUmNzcZxcWrmzIpomCdkOv | ||
13 | +Trtrd/ECgYEA6v37SfsSKohPncHIYfV3FE7Xt7WH09TFymAY8FXIY+K6xvX9wtWB | ||
14 | +h+3quFWuh0VTp15m6xAF1UN6HOG0uRKwUGFqwYBy4I+88KCUO3BJzbWn2TOjt4xE | ||
15 | +8KVwGmZafqxPjwLagCN3RBLNYF4S+jhygBIlSzHkuVkwZPGbVet7NWkCgYEA0G0b | ||
16 | +uDPJl37gEfvhMebdTWUq+FuAVx7h7UjZQM6BNoE3cDdZHUY7pMTqqD2UDbp6O6dC | ||
17 | +0b8Hhs8kx90DewdixSzli67jNVeTRFY3DZ85Ac/BmGyuusNm6Uwbsz4RYsyUSrRD | ||
18 | +bukC/L1vFjB5k/UgGh0kKnBT74mO/kqASWUIebcCgYEAiShtP6UX2VNuhPnSZ7rK | ||
19 | +IkRSjJucB/ws5g5o//5R1FtGAVMbJllQHXK0iZsZH0NLrGjhUVoszWlxIOJshYlu | ||
20 | +97ukgATlCEVdVmWjn33O1g6tRY1qhXuN0Zf+cqpDL6SLW0GjHx+UQVtoHFNMaFgC | ||
21 | +HNZ6hgU9JyHzqTeMHv4vD+ECgYEAhk2oTPvh7OLuk+gQZk1zUMnd9IdRndHilzoX | ||
22 | +9DCdBnghNwgTPk/hYv0YkCyN2ILO/N18qxdDTFTySG9cLMzHknKpv2aENf0mgiRj | ||
23 | ++T0eSNKM1yFBPktnZvGJ7+gQ3+8fpzudMDyplh6jFFNMJFERzIH2qfoTvAiRwb5U | ||
24 | +B/c4jOUCgYEAiQOXabnrnOvkfhl/RhH/WVeLs6O3c5yei0THysGc+9CqE8txnWPN | ||
25 | +A4XI8Tu8G2ScBN+v9oPFWlLAZxbxh1m6RM6VwP4q+Y8fmdQ+d6gH/IKTdBjH7bOt | ||
26 | +4SHS+t8Z6PSu8K1BsF3pGRS7OWPlivSJzRyP2YIgE/xtwsEqiODdRKM= | ||
27 | +-----END RSA PRIVATE KEY----- |
@@ -10,6 +10,9 @@ spec: | @@ -10,6 +10,9 @@ spec: | ||
10 | - name: "http" | 10 | - name: "http" |
11 | port: 80 | 11 | port: 80 |
12 | targetPort: 8082 | 12 | targetPort: 8082 |
13 | + - name: "https" | ||
14 | + port: 443 | ||
15 | + targetPort: 443 | ||
13 | selector: | 16 | selector: |
14 | k8s-app: mmmpartner | 17 | k8s-app: mmmpartner |
15 | --- | 18 | --- |
@@ -48,6 +51,7 @@ spec: | @@ -48,6 +51,7 @@ spec: | ||
48 | imagePullPolicy: Always | 51 | imagePullPolicy: Always |
49 | ports: | 52 | ports: |
50 | - containerPort: 8082 | 53 | - containerPort: 8082 |
54 | + - containerPort: 443 | ||
51 | volumeMounts: | 55 | volumeMounts: |
52 | - mountPath: /opt/logs | 56 | - mountPath: /opt/logs |
53 | name: accesslogs | 57 | name: accesslogs |
@@ -10,6 +10,9 @@ spec: | @@ -10,6 +10,9 @@ spec: | ||
10 | - name: "http" | 10 | - name: "http" |
11 | port: 80 | 11 | port: 80 |
12 | targetPort: 8082 | 12 | targetPort: 8082 |
13 | + - name: "https" | ||
14 | + port: 443 | ||
15 | + targetPort: 443 | ||
13 | selector: | 16 | selector: |
14 | k8s-app: partner | 17 | k8s-app: partner |
15 | --- | 18 | --- |
@@ -48,6 +51,7 @@ spec: | @@ -48,6 +51,7 @@ spec: | ||
48 | imagePullPolicy: Always | 51 | imagePullPolicy: Always |
49 | ports: | 52 | ports: |
50 | - containerPort: 8082 | 53 | - containerPort: 8082 |
54 | + - containerPort: 443 | ||
51 | volumeMounts: | 55 | volumeMounts: |
52 | - mountPath: /opt/logs | 56 | - mountPath: /opt/logs |
53 | name: accesslogs | 57 | name: accesslogs |
@@ -10,6 +10,9 @@ spec: | @@ -10,6 +10,9 @@ spec: | ||
10 | - name: "http" | 10 | - name: "http" |
11 | port: 80 | 11 | port: 80 |
12 | targetPort: 8082 | 12 | targetPort: 8082 |
13 | + - name: "https" | ||
14 | + port: 443 | ||
15 | + targetPort: 443 | ||
13 | selector: | 16 | selector: |
14 | k8s-app: mmmpartner | 17 | k8s-app: mmmpartner |
15 | --- | 18 | --- |
@@ -48,6 +51,7 @@ spec: | @@ -48,6 +51,7 @@ spec: | ||
48 | imagePullPolicy: Always | 51 | imagePullPolicy: Always |
49 | ports: | 52 | ports: |
50 | - containerPort: 8082 | 53 | - containerPort: 8082 |
54 | + - containerPort: 443 | ||
51 | volumeMounts: | 55 | volumeMounts: |
52 | - mountPath: /opt/logs | 56 | - mountPath: /opt/logs |
53 | name: accesslogs | 57 | name: accesslogs |
document/partner/project.yaml
0 → 100644
partner
0 → 100755
不能预览此文件类型
@@ -381,7 +381,7 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -381,7 +381,7 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
381 | 381 | ||
382 | // 通过密码或校验码登录的普通用户或通过校验码登录的游客,注册一个账号到配置的公司去 | 382 | // 通过密码或校验码登录的普通用户或通过校验码登录的游客,注册一个账号到配置的公司去 |
383 | if request.GrantType == protocol.LoginBySmsCode || request.GrantType == protocol.LoginByPassword { | 383 | if request.GrantType == protocol.LoginBySmsCode || request.GrantType == protocol.LoginByPassword { |
384 | - userErr := loginSvr.RegistryUser(request.Phone) | 384 | + userErr := loginSvr.RegistryGuest(request.Phone) |
385 | if userErr != nil { | 385 | if userErr != nil { |
386 | log.Error(userErr) | 386 | log.Error(userErr) |
387 | } | 387 | } |
@@ -403,25 +403,30 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | @@ -403,25 +403,30 @@ func CompaniesLogin(header *protocol.RequestHeader, request *protocolx.CenterCom | ||
403 | return | 403 | return |
404 | } | 404 | } |
405 | 405 | ||
406 | - manageLoginErr := loginSvr.ManagerLogin(request.Phone, request.Password) | ||
407 | - fmt.Print("用户登录:", manageLoginErr, "\n") | ||
408 | - partnerLoginErr := loginSvr.PartnerLogin(request.Phone, request.Password) | ||
409 | - fmt.Print("合伙人登录:", partnerLoginErr, "\n") | 406 | + //manageLoginErr := loginSvr.ManagerLogin(request.Phone, request.Password) |
407 | + //fmt.Print("用户登录:", manageLoginErr, "\n") | ||
408 | + //partnerLoginErr := loginSvr.PartnerLogin(request.Phone, request.Password) | ||
409 | + //fmt.Print("合伙人登录:", partnerLoginErr, "\n") | ||
410 | + // | ||
411 | + //if manageLoginErr != nil && partnerLoginErr != nil { | ||
412 | + // //if len(loginSvr.PartnerInfo) == 0 { // 不存在有效用户 | ||
413 | + // // err = protocol.NewErrWithMessage(10008) | ||
414 | + // // return | ||
415 | + // //} | ||
416 | + // err = protocol.NewCustomMessage(1, "密码输入有误!") | ||
417 | + // return | ||
418 | + //} else if manageLoginErr != nil && partnerLoginErr == nil { | ||
419 | + // if len(loginSvr.PartnerInfo) == 1 && len(loginSvr.NormalUsers) == 0 { | ||
420 | + // if loginSvr.PartnerInfo[0].CompanyId == int64(constant.DEFAULT_GUEST_COMPANY) { | ||
421 | + // err = protocol.NewCustomMessage(1, "密码输入有误!") | ||
422 | + // return | ||
423 | + // } | ||
424 | + // } | ||
425 | + //} | ||
410 | 426 | ||
411 | - if manageLoginErr != nil && partnerLoginErr != nil { | ||
412 | - if len(loginSvr.PartnerInfo) == 0 { // 不存在有效用户 | ||
413 | - err = protocol.NewErrWithMessage(10008) | ||
414 | - return | ||
415 | - } | 427 | + if loginSvr.ManagerLogin(request.Phone, request.Password) != nil && loginSvr.PartnerLogin(request.Phone, request.Password) != nil { |
416 | err = protocol.NewCustomMessage(1, "密码输入有误!") | 428 | err = protocol.NewCustomMessage(1, "密码输入有误!") |
417 | return | 429 | return |
418 | - } else if manageLoginErr != nil && partnerLoginErr == nil { | ||
419 | - if len(loginSvr.PartnerInfo) == 1 && len(loginSvr.NormalUsers) == 0 { | ||
420 | - if loginSvr.PartnerInfo[0].CompanyId == int64(constant.DEFAULT_GUEST_COMPANY) { | ||
421 | - err = protocol.NewCustomMessage(1, "密码输入有误!") | ||
422 | - return | ||
423 | - } | ||
424 | - } | ||
425 | } | 430 | } |
426 | break | 431 | break |
427 | case protocol.LoginBySmsCode: | 432 | case protocol.LoginBySmsCode: |
@@ -525,20 +530,22 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco | @@ -525,20 +530,22 @@ func CompaniesLoginByCredential(header *protocol.RequestHeader, request *protoco | ||
525 | // loginSvr 初始化 | 530 | // loginSvr 初始化 |
526 | _ = loginSvr.Init(claim.Phone) | 531 | _ = loginSvr.Init(claim.Phone) |
527 | 532 | ||
528 | - // 真实公司有效合伙人不存在,真实公司有效用户不存在,游客公司有效合伙人存在 | ||
529 | - //if len(loginSvr.IsRealPartnerInfo) == 0 && len(loginSvr.IsRealUser) == 0 && len(loginSvr.GuestPartnerInfoAvailable) > 0 { | ||
530 | - // err = protocol.NewErrWithMessage(10008) //账号禁用, 抱歉,企业管理员未帮您开通权限。如需访问,请联系企业管理员 | ||
531 | - // return | ||
532 | - //} else if len(loginSvr.IsRealPartnerInfo) == 0 && len(loginSvr.IsRealUser) == 0 && len(loginSvr.GuestPartnerInfoAvailable) == 0 { | ||
533 | - // err = protocol.NewErrWithMessage(4140, err) // refreshToken过期,需要重新登录授权 | ||
534 | - // return | ||
535 | - //} | 533 | + // 高管标志位初始化 |
534 | + _ = loginSvr.InitSenior(claim.Phone) | ||
535 | + | ||
536 | + // 合伙人标志位初始化 | ||
537 | + _ = loginSvr.InitPartner(claim.Phone) | ||
538 | + | ||
539 | + if len(loginSvr.PartnerInfo) == 0 && len(loginSvr.Users) == 0 { | ||
540 | + err = protocol.NewErrWithMessage(4140, err) | ||
541 | + return | ||
542 | + } | ||
536 | 543 | ||
537 | rsp.Partner, _ = loginSvr.PartnerStaticInfo() | 544 | rsp.Partner, _ = loginSvr.PartnerStaticInfo() |
538 | rsp.Manager, _ = loginSvr.ManagerStaticInfo() | 545 | rsp.Manager, _ = loginSvr.ManagerStaticInfo() |
539 | 546 | ||
540 | if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany { | 547 | if !loginSvr.HasAvailableCompany && !loginSvr.HasAvailableManagerCompany { |
541 | - err = protocol.NewErrWithMessage(4140, err) //账号禁用,refreshToken过期,需要重新登录授权 | 548 | + err = protocol.NewErrWithMessage(4140, err) //账号禁用 |
542 | return | 549 | return |
543 | } | 550 | } |
544 | 551 |
@@ -9,6 +9,7 @@ import ( | @@ -9,6 +9,7 @@ import ( | ||
9 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" | 9 | "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol" |
10 | protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/company" | 10 | protocolx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/company" |
11 | userx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/user" | 11 | userx "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/protocol/user" |
12 | + "time" | ||
12 | ) | 13 | ) |
13 | 14 | ||
14 | func PartnersV2(header *protocol.RequestHeader, request *protocolx.PartnersRequest) (rsp *protocolx.PartnersResponse, err error) { | 15 | func PartnersV2(header *protocol.RequestHeader, request *protocolx.PartnersRequest) (rsp *protocolx.PartnersResponse, err error) { |
@@ -27,6 +28,9 @@ func PartnersV2(header *protocol.RequestHeader, request *protocolx.PartnersReque | @@ -27,6 +28,9 @@ func PartnersV2(header *protocol.RequestHeader, request *protocolx.PartnersReque | ||
27 | log.Error(err) | 28 | log.Error(err) |
28 | return | 29 | return |
29 | } | 30 | } |
31 | + if request.PageIndex == 0 { | ||
32 | + rsp.Timestamp = time.Now().Unix() * 1000 | ||
33 | + } | ||
30 | if rsp.Partners == nil { | 34 | if rsp.Partners == nil { |
31 | rsp.Partners = []struct{}{} | 35 | rsp.Partners = []struct{}{} |
32 | } | 36 | } |
@@ -24,13 +24,13 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | @@ -24,13 +24,13 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | ||
24 | }() | 24 | }() |
25 | 25 | ||
26 | // 事业分红统计-查询订单 | 26 | // 事业分红统计-查询订单 |
27 | - _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(domain.OrderQueryOption{PartnerId: request.PartnerId, EndTime: time.Now(), SortByCreateTime: domain.DESC, OrderTypes: domain.UserOrderTypes(domain.Career)})) | 27 | + _, orderAll, e := OrderBaseResponsitory.Find(utils.ObjectJsonToMap(domain.OrderQueryOption{PartnerId: request.PartnerId, EndTime: time.Now(), SortBySalesTime: domain.DESC, OrderTypes: domain.UserOrderTypes(domain.Career)})) |
28 | if e != nil { | 28 | if e != nil { |
29 | log.Error(e) | 29 | log.Error(e) |
30 | } | 30 | } |
31 | var orderBetween []*domain.OrderBase | 31 | var orderBetween []*domain.OrderBase |
32 | for i := range orderAll { | 32 | for i := range orderAll { |
33 | - if orderAll[i].CreateTime.Unix() >= (request.StartTime/1000) && orderAll[i].CreateTime.Unix() < (request.EndTime/1000) { | 33 | + if orderAll[i].SaleDate.Unix() >= (request.StartTime/1000) && orderAll[i].SaleDate.Unix() < (request.EndTime/1000) { |
34 | orderBetween = append(orderBetween, orderAll[i]) | 34 | orderBetween = append(orderBetween, orderAll[i]) |
35 | } | 35 | } |
36 | } | 36 | } |
@@ -59,6 +59,9 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | @@ -59,6 +59,9 @@ func Statistics(header *protocol.RequestHeader, request *protocol.DividendStatis | ||
59 | Receivable: bonusAll.Receivable, | 59 | Receivable: bonusAll.Receivable, |
60 | Quarters: bonusQuarters, | 60 | Quarters: bonusQuarters, |
61 | } | 61 | } |
62 | + if request.PageIndex == 0 { | ||
63 | + rsp.Timestamp = time.Now().Unix() * 1000 | ||
64 | + } | ||
62 | 65 | ||
63 | err = transactionContext.CommitTransaction() | 66 | err = transactionContext.CommitTransaction() |
64 | return | 67 | return |
@@ -82,7 +85,7 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto | @@ -82,7 +85,7 @@ func QuartersBonusStatics(orders []*domain.OrderBase, action int) (bonus []proto | ||
82 | bonus = make([]protocol.Bonus, 4) | 85 | bonus = make([]protocol.Bonus, 4) |
83 | for i := range orders { | 86 | for i := range orders { |
84 | o := orders[i] | 87 | o := orders[i] |
85 | - quarter := quarter(o.CreateTime) | 88 | + quarter := quarter(o.SaleDate) |
86 | static := o.OrderBonusStatic() | 89 | static := o.OrderBonusStatic() |
87 | bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + static.OrderTotalReceivable()) | 90 | bonus[quarter].Receivable = utils.Decimal(bonus[quarter].Receivable + static.OrderTotalReceivable()) |
88 | bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + static.OrderBonusReceive()) | 91 | bonus[quarter].Received = utils.Decimal(bonus[quarter].Received + static.OrderBonusReceive()) |
@@ -124,17 +127,18 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR | @@ -124,17 +127,18 @@ func OrderList(header *protocol.RequestHeader, request *protocol.DividendOrdersR | ||
124 | rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)} | 127 | rsp = &protocol.DividendOrdersResponse{List: make([]*protocol.DividendOrderListItem, 0)} |
125 | 128 | ||
126 | count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{ | 129 | count, orders, err = OrderDao.DividendOrders(&domain.DividendOrdersQueryOption{ |
127 | - OrderTypes: domain.UserOrderTypes(domain.Career), | ||
128 | - PartnerId: request.PartnerId, | ||
129 | - DetailAction: request.DetailAction, | ||
130 | - DividendAction: request.DividendAction, | ||
131 | - StartTime: request.StartTime, | ||
132 | - EndTime: request.EndTime, | ||
133 | - Offset: request.PageIndex * request.PageSize, | ||
134 | - Limit: request.PageSize, | 130 | + OrderTypes: domain.UserOrderTypes(domain.Career), |
131 | + PartnerId: request.PartnerId, | ||
132 | + DetailAction: request.DetailAction, | ||
133 | + DividendAction: request.DividendAction, | ||
134 | + StartTime: request.StartTime, | ||
135 | + EndTime: request.EndTime, | ||
136 | + Offset: request.PageIndex * request.PageSize, | ||
137 | + Limit: request.PageSize, | ||
135 | //SortByUpdateTime: domain.DESC, | 138 | //SortByUpdateTime: domain.DESC, |
136 | - SortByCreateTime: domain.DESC, | ||
137 | - JoinWays: request.JoinWays, | 139 | + //SortByCreateTime: domain.DESC, |
140 | + SortBySalesTime: domain.DESC, | ||
141 | + JoinWays: request.JoinWays, | ||
138 | }) | 142 | }) |
139 | if err != nil { | 143 | if err != nil { |
140 | return | 144 | return |
@@ -38,6 +38,7 @@ func Detail(header *protocol.RequestHeader, request *protocol.OrderDetailRequest | @@ -38,6 +38,7 @@ func Detail(header *protocol.RequestHeader, request *protocol.OrderDetailRequest | ||
38 | OrderStatus: orderStatus(order), | 38 | OrderStatus: orderStatus(order), |
39 | CreateTime: order.CreateTime.Unix() * 1000, | 39 | CreateTime: order.CreateTime.Unix() * 1000, |
40 | UpdateTime: order.UpdateTime.Unix() * 1000, | 40 | UpdateTime: order.UpdateTime.Unix() * 1000, |
41 | + SalesTime: order.SaleDate.Unix() * 1000, | ||
41 | OrderDistrict: map[string]interface{}{"id": order.RegionInfo.RegionId, "name": order.RegionInfo.RegionName}, | 42 | OrderDistrict: map[string]interface{}{"id": order.RegionInfo.RegionId, "name": order.RegionInfo.RegionName}, |
42 | Customer: protocol.Customer{Uname: order.Buyer.BuyerName, Phone: order.Buyer.ContactInfo}, | 43 | Customer: protocol.Customer{Uname: order.Buyer.BuyerName, Phone: order.Buyer.ContactInfo}, |
43 | Products: orderProducts(order), | 44 | Products: orderProducts(order), |
@@ -195,10 +196,11 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -195,10 +196,11 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
195 | 196 | ||
196 | // 查询订单列表 | 197 | // 查询订单列表 |
197 | queryOption := &domain.OrderQueryOption{ | 198 | queryOption := &domain.OrderQueryOption{ |
198 | - Limit: request.PageSize, | ||
199 | - Offset: request.PageSize * request.PageIndex, | 199 | + Limit: request.PageSize, |
200 | + Offset: request.PageSize * request.PageIndex, | ||
200 | //SortByUpdateTime: domain.DESC, | 201 | //SortByUpdateTime: domain.DESC, |
201 | - SortByCreateTime: domain.DESC, | 202 | + //SortByCreateTime: domain.DESC, |
203 | + SortBySalesTime: domain.DESC, | ||
202 | PartnerId: request.PartnerId, | 204 | PartnerId: request.PartnerId, |
203 | PartnerCategoryId: request.JoinWay, | 205 | PartnerCategoryId: request.JoinWay, |
204 | OrderType: request.OrderType, | 206 | OrderType: request.OrderType, |
@@ -210,6 +212,15 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -210,6 +212,15 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
210 | if request.EndTime > 0 { | 212 | if request.EndTime > 0 { |
211 | queryOption.EndTime = time.Unix(request.EndTime/1000, 0) | 213 | queryOption.EndTime = time.Unix(request.EndTime/1000, 0) |
212 | } | 214 | } |
215 | + // 今日订单 | ||
216 | + if request.IsToday { | ||
217 | + timeStr := time.Now().Format("2006-01-02") | ||
218 | + t, _ := time.Parse("2006-01-02", timeStr) | ||
219 | + beginTimeNum := t.Unix() | ||
220 | + endTimeNum := beginTimeNum + 86400 | ||
221 | + queryOption.BeginTime = time.Unix(beginTimeNum, 0) | ||
222 | + queryOption.EndTime = time.Unix(endTimeNum, 0) | ||
223 | + } | ||
213 | total, orders, _ = OrderRepository.Find(utils.ObjectJsonToMap(queryOption)) | 224 | total, orders, _ = OrderRepository.Find(utils.ObjectJsonToMap(queryOption)) |
214 | if len(orders) != 0 { | 225 | if len(orders) != 0 { |
215 | for i := range orders { | 226 | for i := range orders { |
@@ -234,6 +245,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -234,6 +245,7 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
234 | PartnerCategoryId: request.JoinWay, | 245 | PartnerCategoryId: request.JoinWay, |
235 | }) | 246 | }) |
236 | rsp.Total = cumulativeQuantity | 247 | rsp.Total = cumulativeQuantity |
248 | + rsp.Timestamp = time.Now().Unix() * 1000 | ||
237 | } | 249 | } |
238 | //【特殊处理2】 今天累计数量特殊处理 当前查询时间段内所有订单总数(复用rsp.Total字段) | 250 | //【特殊处理2】 今天累计数量特殊处理 当前查询时间段内所有订单总数(复用rsp.Total字段) |
239 | if request.StartTime > 0 && request.EndTime > 0 { | 251 | if request.StartTime > 0 && request.EndTime > 0 { |
@@ -249,17 +261,18 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | @@ -249,17 +261,18 @@ func List(header *protocol.RequestHeader, request *protocol.OrderListRequest) (r | ||
249 | func DomainOrderToOrderListItem(order *domain.OrderBase) *protocol.OrderListItem { | 261 | func DomainOrderToOrderListItem(order *domain.OrderBase) *protocol.OrderListItem { |
250 | bonusStatic := order.OrderBonusStatic() | 262 | bonusStatic := order.OrderBonusStatic() |
251 | return &protocol.OrderListItem{ | 263 | return &protocol.OrderListItem{ |
252 | - Id: order.Id, | ||
253 | - OrderType: order.OrderType, | ||
254 | - OrderNo: order.OrderCode, | ||
255 | - DeliveryNo: order.DeliveryCode, | ||
256 | - OrderDistrict: map[string]interface{}{ | ||
257 | - "id": order.RegionInfo.RegionId, | 264 | + Id: order.Id, |
265 | + OrderType: order.OrderType, | ||
266 | + OrderNo: order.OrderCode, | ||
267 | + DeliveryNo: order.DeliveryCode, | ||
268 | + OrderDistrict: map[string]interface{}{ | ||
269 | + "id": order.RegionInfo.RegionId, | ||
258 | "name": order.RegionInfo.RegionName, | 270 | "name": order.RegionInfo.RegionName, |
259 | }, | 271 | }, |
260 | - OrderAmount: order.PlanOrderAmount, | ||
261 | - UpdateTime: order.UpdateTime.Unix() * 1000, | ||
262 | - MyDividend: bonusStatic.OrderTotalReceivable(), | ||
263 | - IsRead: order.IsRead(), | 272 | + OrderAmount: order.PlanOrderAmount, |
273 | + UpdateTime: order.UpdateTime.Unix() * 1000, | ||
274 | + SalesTime: order.SaleDate.Unix() * 1000, | ||
275 | + MyDividend: bonusStatic.OrderTotalReceivable(), | ||
276 | + IsRead: order.IsRead(), | ||
264 | } | 277 | } |
265 | } | 278 | } |
@@ -8,7 +8,7 @@ import ( | @@ -8,7 +8,7 @@ import ( | ||
8 | const SERVICE_NAME = "partner" | 8 | const SERVICE_NAME = "partner" |
9 | 9 | ||
10 | var LOG_LEVEL = "debug" | 10 | var LOG_LEVEL = "debug" |
11 | -var LOG_File = "app.log" | 11 | +var LOG_File = "logs/app.log" |
12 | var LOG_PREFIX = "[partner_dev]" | 12 | var LOG_PREFIX = "[partner_dev]" |
13 | 13 | ||
14 | var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897" | 14 | var MMM_SMS_SERVICE_HOST = "https://sms.fjmaimaimai.com:9897" |
@@ -4,7 +4,7 @@ import "os" | @@ -4,7 +4,7 @@ import "os" | ||
4 | 4 | ||
5 | var REDIS_HOST = "127.0.0.1" | 5 | var REDIS_HOST = "127.0.0.1" |
6 | var REDIS_PORT = "6379" | 6 | var REDIS_PORT = "6379" |
7 | -var REDIS_AUTH = "" | 7 | +var REDIS_AUTH = "" // 1993618@jack |
8 | 8 | ||
9 | func init() { | 9 | func init() { |
10 | if os.Getenv("REDIS_HOST") != "" { | 10 | if os.Getenv("REDIS_HOST") != "" { |
@@ -42,6 +42,8 @@ type OrderBase struct { | @@ -42,6 +42,8 @@ type OrderBase struct { | ||
42 | DeliveryTime time.Time | 42 | DeliveryTime time.Time |
43 | //更新时间 | 43 | //更新时间 |
44 | UpdateTime time.Time | 44 | UpdateTime time.Time |
45 | + //销售日期 | ||
46 | + SaleDate time.Time | ||
45 | //上一次查看时间 已读情况 | 47 | //上一次查看时间 已读情况 |
46 | LastViewTime time.Time | 48 | LastViewTime time.Time |
47 | //合伙人应收分红 | 49 | //合伙人应收分红 |
@@ -157,25 +159,27 @@ type OrderQueryOption struct { | @@ -157,25 +159,27 @@ type OrderQueryOption struct { | ||
157 | //IsDisable string `json:"isDisable,omitempty"` | 159 | //IsDisable string `json:"isDisable,omitempty"` |
158 | SortByCreateTime string `json:"sortByCreateTime,omitempty"` | 160 | SortByCreateTime string `json:"sortByCreateTime,omitempty"` |
159 | SortByUpdateTime string `json:"sortByUpdateTime,omitempty"` | 161 | SortByUpdateTime string `json:"sortByUpdateTime,omitempty"` |
162 | + SortBySalesTime string `json:"sortBySalesTime,omitempty"` | ||
160 | Offset int `json:"offset,omitempty"` | 163 | Offset int `json:"offset,omitempty"` |
161 | Limit int `json:"limit,omitempty"` | 164 | Limit int `json:"limit,omitempty"` |
162 | PartnerCategoryId int `json:"partnerCategoryId,omitempty"` | 165 | PartnerCategoryId int `json:"partnerCategoryId,omitempty"` |
163 | } | 166 | } |
164 | 167 | ||
165 | type DividendOrdersQueryOption struct { | 168 | type DividendOrdersQueryOption struct { |
166 | - PartnerId int64 `json:"partnerId"` | ||
167 | - OrderType int `json:"orderType"` //订单类型 | ||
168 | - OrderTypes []int `json:"orderTypes,omitempty"` | ||
169 | - DetailAction int `json:"detailAction"` //明细类型(0已收明细、1未收明细) | ||
170 | - DividendAction int `json:"dividendAction"` //分红类型(0累计分红、1分红支出) | ||
171 | - IsDisable string `json:"isDisable,omitempty"` | ||
172 | - StartTime int64 `json:"startTime" ` | ||
173 | - EndTime int64 `json:"endTime"` | ||
174 | - Offset int `json:"offset,omitempty"` | ||
175 | - Limit int `json:"limit,omitempty"` | ||
176 | - SortByUpdateTime string `json:"sortByUpdateTime,omitempty"` | ||
177 | - SortByCreateTime string `json:"sortByCreateTime,omitempty"` | ||
178 | - JoinWays []*company.JoinWays `json:"joinWays,omitempty"` // 合伙类型 | 169 | + PartnerId int64 `json:"partnerId"` |
170 | + OrderType int `json:"orderType"` //订单类型 | ||
171 | + OrderTypes []int `json:"orderTypes,omitempty"` | ||
172 | + DetailAction int `json:"detailAction"` //明细类型(0已收明细、1未收明细) | ||
173 | + DividendAction int `json:"dividendAction"` //分红类型(0累计分红、1分红支出) | ||
174 | + IsDisable string `json:"isDisable,omitempty"` | ||
175 | + StartTime int64 `json:"startTime" ` | ||
176 | + EndTime int64 `json:"endTime"` | ||
177 | + Offset int `json:"offset,omitempty"` | ||
178 | + Limit int `json:"limit,omitempty"` | ||
179 | + SortByUpdateTime string `json:"sortByUpdateTime,omitempty"` | ||
180 | + SortByCreateTime string `json:"sortByCreateTime,omitempty"` | ||
181 | + SortBySalesTime string `json:"sortBySalesTime,omitempty"` | ||
182 | + JoinWays []*company.JoinWays `json:"joinWays,omitempty"` // 合伙类型 | ||
179 | } | 183 | } |
180 | 184 | ||
181 | //买家 | 185 | //买家 |
@@ -105,10 +105,10 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption | @@ -105,10 +105,10 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption | ||
105 | q.Where(`"order_base".partner_id=?`, option.PartnerId) | 105 | q.Where(`"order_base".partner_id=?`, option.PartnerId) |
106 | } | 106 | } |
107 | if option.StartTime > 0 { | 107 | if option.StartTime > 0 { |
108 | - q.Where(`"order_base".create_time >=?`, time.Unix(option.StartTime/1000, 0)) | 108 | + q.Where(`"order_base".sale_date >=?`, time.Unix(option.StartTime/1000, 0)) |
109 | } | 109 | } |
110 | if option.EndTime > 0 { | 110 | if option.EndTime > 0 { |
111 | - q.Where(`"order_base".create_time <?`, time.Unix(option.EndTime/1000, 0)) | 111 | + q.Where(`"order_base".sale_date <?`, time.Unix(option.EndTime/1000, 0)) |
112 | } | 112 | } |
113 | if len(option.JoinWays) > 0 { | 113 | if len(option.JoinWays) > 0 { |
114 | var joinWays []int64 | 114 | var joinWays []int64 |
@@ -150,6 +150,9 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption | @@ -150,6 +150,9 @@ func (dao *OrderBaseDao) DividendOrders(option *domain.DividendOrdersQueryOption | ||
150 | if len(option.SortByCreateTime) > 0 { | 150 | if len(option.SortByCreateTime) > 0 { |
151 | q.Order(fmt.Sprintf("order_base.create_time %v", option.SortByCreateTime)) | 151 | q.Order(fmt.Sprintf("order_base.create_time %v", option.SortByCreateTime)) |
152 | } | 152 | } |
153 | + if len(option.SortBySalesTime) > 0 { | ||
154 | + q.Order(fmt.Sprintf("order_base.sale_date %v", option.SortBySalesTime)) | ||
155 | + } | ||
153 | count, err = q.Distinct().SelectAndCount() | 156 | count, err = q.Distinct().SelectAndCount() |
154 | for i := range orders { | 157 | for i := range orders { |
155 | var domainOrder *domain.OrderBase | 158 | var domainOrder *domain.OrderBase |
@@ -25,12 +25,11 @@ type PgLoginService struct { | @@ -25,12 +25,11 @@ type PgLoginService struct { | ||
25 | GuestPartnerInfo []*domain.PartnerInfo // 游客公司合伙人 | 25 | GuestPartnerInfo []*domain.PartnerInfo // 游客公司合伙人 |
26 | GuestPartnerInfoAvailable []*domain.PartnerInfo // 游客公司有效合伙人 | 26 | GuestPartnerInfoAvailable []*domain.PartnerInfo // 游客公司有效合伙人 |
27 | NormalPartnerInfo []*domain.PartnerInfo // 所有公司合伙人 | 27 | NormalPartnerInfo []*domain.PartnerInfo // 所有公司合伙人 |
28 | - IsRealPartnerInfo []*domain.PartnerInfo // 真实公司有效合伙人 | 28 | + IsPartnerInfo []*domain.PartnerInfo // 真实公司有效合伙人 |
29 | Users []*domain.Users // 所有公司有效用户 | 29 | Users []*domain.Users // 所有公司有效用户 |
30 | NormalUsers []*domain.Users // 所有公司用户 | 30 | NormalUsers []*domain.Users // 所有公司用户 |
31 | IsSenior []*domain.Users // 所有公司有效高管 | 31 | IsSenior []*domain.Users // 所有公司有效高管 |
32 | IsRealSenior []*domain.Users // 真实公司的有效高管 | 32 | IsRealSenior []*domain.Users // 真实公司的有效高管 |
33 | - IsRealUser []*domain.Users // 真实公司有效用户,有效高管和有效用户二者其中一个为空则非高管 | ||
34 | transactionContext *transaction.TransactionContext | 33 | transactionContext *transaction.TransactionContext |
35 | // 标识:登录的账号信息是否有可用的公司, true:有 false:没有 | 34 | // 标识:登录的账号信息是否有可用的公司, true:有 false:没有 |
36 | HasAvailableCompany bool // 是否有可访问的合伙公司 | 35 | HasAvailableCompany bool // 是否有可访问的合伙公司 |
@@ -50,7 +49,7 @@ func (svr *PgLoginService) Init(phone string) (err error) { | @@ -50,7 +49,7 @@ func (svr *PgLoginService) Init(phone string) (err error) { | ||
50 | // 所有公司有效合伙人 | 49 | // 所有公司有效合伙人 |
51 | _, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"}) | 50 | _, svr.PartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC"}) |
52 | // 真实公司有效合伙人 | 51 | // 真实公司有效合伙人 |
53 | - _, svr.IsRealPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "isNot": constant.DEFAULT_GUEST_COMPANY}) | 52 | + _, svr.IsPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "isNot": constant.DEFAULT_GUEST_COMPANY}) |
54 | // 游客公司合伙人 | 53 | // 游客公司合伙人 |
55 | _, svr.GuestPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "sortByCreateTime": "ASC", "companyId": constant.DEFAULT_GUEST_COMPANY}) | 54 | _, svr.GuestPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "sortByCreateTime": "ASC", "companyId": constant.DEFAULT_GUEST_COMPANY}) |
56 | // 游客公司有效合伙人 | 55 | // 游客公司有效合伙人 |
@@ -64,8 +63,6 @@ func (svr *PgLoginService) Init(phone string) (err error) { | @@ -64,8 +63,6 @@ func (svr *PgLoginService) Init(phone string) (err error) { | ||
64 | _, svr.IsSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1}) | 63 | _, svr.IsSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1}) |
65 | // 真实公司有效高管 | 64 | // 真实公司有效高管 |
66 | _, svr.IsRealSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1, "isNot": constant.DEFAULT_GUEST_COMPANY}) | 65 | _, svr.IsRealSenior, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isSenior": 1, "isNot": constant.DEFAULT_GUEST_COMPANY}) |
67 | - // 真实公司有效用户 | ||
68 | - _, svr.IsRealUser, err = UsersRepository.Find(map[string]interface{}{"phone": phone, "status": 1, "sortByCreateTime": "ASC", "deleteAtIsNull": true, "isNot": constant.DEFAULT_GUEST_COMPANY}) | ||
69 | 66 | ||
70 | return nil | 67 | return nil |
71 | } | 68 | } |
@@ -101,7 +98,7 @@ func (svr *PgLoginService) InitPartner(phone string) (err error) { | @@ -101,7 +98,7 @@ func (svr *PgLoginService) InitPartner(phone string) (err error) { | ||
101 | 98 | ||
102 | svr.Phone = phone | 99 | svr.Phone = phone |
103 | 100 | ||
104 | - _, svr.IsRealPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "isNot": constant.DEFAULT_GUEST_COMPANY}) | 101 | + _, svr.IsPartnerInfo, err = PartnerInfoService.Find(map[string]interface{}{"account": phone, "status": 1, "sortByCreateTime": "ASC", "isNot": constant.DEFAULT_GUEST_COMPANY}) |
105 | 102 | ||
106 | return nil | 103 | return nil |
107 | } | 104 | } |
@@ -362,7 +359,7 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | @@ -362,7 +359,7 @@ func (svr *PgLoginService) ManagerStaticInfo() (interface{}, error) { | ||
362 | svr.HasAvailableManagerCompany = true | 359 | svr.HasAvailableManagerCompany = true |
363 | } | 360 | } |
364 | 361 | ||
365 | - if len(companys) > 1 || len(svr.IsRealPartnerInfo) > 0 { // 有真实合伙公司或高管公司时,过滤游客公司 | 362 | + if len(companys) > 1 || len(svr.IsPartnerInfo) > 0 { // 有真实合伙公司或高管公司时,过滤游客公司 |
366 | var companies = make([]protocol.CompanyBase, 0) | 363 | var companies = make([]protocol.CompanyBase, 0) |
367 | for _, company := range companys { | 364 | for _, company := range companys { |
368 | if company.Id != int64(constant.DEFAULT_GUEST_COMPANY) { | 365 | if company.Id != int64(constant.DEFAULT_GUEST_COMPANY) { |
@@ -457,7 +454,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error { | @@ -457,7 +454,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error { | ||
457 | isUserSenior bool | 454 | isUserSenior bool |
458 | ) | 455 | ) |
459 | 456 | ||
460 | - partnerInfo, _ := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "isNot": constant.DEFAULT_GUEST_COMPANY}) // 合伙人在正常公司是否存在 | 457 | + partnerInfo, errPartner := PartnerInfoService.FindOne(map[string]interface{}{"account": phone, "isNot": constant.DEFAULT_GUEST_COMPANY}) // 合伙人在正常公司是否存在 |
461 | if partnerInfo == nil { | 458 | if partnerInfo == nil { |
462 | isPartner = false | 459 | isPartner = false |
463 | } else { | 460 | } else { |
@@ -483,7 +480,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error { | @@ -483,7 +480,7 @@ func (svr *PgLoginService) RegistryUser(phone string) error { | ||
483 | isGuestPartnerAvailable = true | 480 | isGuestPartnerAvailable = true |
484 | } | 481 | } |
485 | 482 | ||
486 | - user, _ := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "deleteAtIsNull": true}) // 用户是否存在 | 483 | + user, errUser := UsersRepository.FindOne(map[string]interface{}{"phone": phone, "deleteAtIsNull": true}) // 用户是否存在 |
487 | if user == nil { | 484 | if user == nil { |
488 | isUser = false | 485 | isUser = false |
489 | } else { | 486 | } else { |
@@ -574,27 +571,27 @@ func (svr *PgLoginService) RegistryUser(phone string) error { | @@ -574,27 +571,27 @@ func (svr *PgLoginService) RegistryUser(phone string) error { | ||
574 | 571 | ||
575 | // 合伙人不存在、用户存在、非高管(普通用户)-> 注册用户 | 572 | // 合伙人不存在、用户存在、非高管(普通用户)-> 注册用户 |
576 | // 合伙人不存在、用户不存在(游客)-> 注册用户 | 573 | // 合伙人不存在、用户不存在(游客)-> 注册用户 |
577 | - //if errPartner != nil && errUser == nil && errSenior == nil || errPartner != nil && errUser != nil { | ||
578 | - // id := time.Now().Unix() | ||
579 | - // errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ | ||
580 | - // Id: id, | ||
581 | - // CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), | ||
582 | - // PartnerName: phone, | ||
583 | - // Account: phone, | ||
584 | - // Password: "7c4a8d09ca3762af61e59520943dc26494f8941b", | ||
585 | - // Status: 1, | ||
586 | - // PartnerCategory: 1, | ||
587 | - // RegionInfo: &domain.RegionInfo{ | ||
588 | - // RegionName: "客户区域", | ||
589 | - // RegionId: 0, | ||
590 | - // }, | ||
591 | - // CooperateTime: time.Now(), | ||
592 | - // CreateAt: time.Now(), | ||
593 | - // UpdateAt: time.Now(), | ||
594 | - // PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1, Code: phone}}, | ||
595 | - // Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}, | ||
596 | - // }) | ||
597 | - //} | 574 | + if errPartner != nil && errUser == nil { |
575 | + id := time.Now().Unix() | ||
576 | + errPartner = svr.transactionContext.PgDd.Insert(&models.PartnerInfo{ | ||
577 | + Id: id, | ||
578 | + CompanyId: int64(constant.DEFAULT_GUEST_COMPANY), | ||
579 | + PartnerName: phone, | ||
580 | + Account: phone, | ||
581 | + Password: "7c4a8d09ca3762af61e59520943dc26494f8941b", | ||
582 | + Status: 1, | ||
583 | + PartnerCategory: 1, | ||
584 | + RegionInfo: &domain.RegionInfo{ | ||
585 | + RegionName: "客户区域", | ||
586 | + RegionId: 0, | ||
587 | + }, | ||
588 | + CooperateTime: time.Now(), | ||
589 | + CreateAt: time.Now(), | ||
590 | + UpdateAt: time.Now(), | ||
591 | + PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1, Code: phone}}, | ||
592 | + Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}, | ||
593 | + }) | ||
594 | + } | ||
598 | 595 | ||
599 | return errPartner | 596 | return errPartner |
600 | } | 597 | } |
@@ -630,7 +627,7 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { | @@ -630,7 +627,7 @@ func (svr *PgLoginService) RegistryGuest(phone string) error { | ||
630 | CooperateTime: time.Now(), | 627 | CooperateTime: time.Now(), |
631 | CreateAt: time.Now(), | 628 | CreateAt: time.Now(), |
632 | UpdateAt: time.Now(), | 629 | UpdateAt: time.Now(), |
633 | - PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1}}, | 630 | + PartnerCategoryInfos: []*models.PartnerCategoryInfo{&models.PartnerCategoryInfo{Id: 1, Code: phone}}, |
634 | Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}, | 631 | Salesman: []*domain.Salesman{&domain.Salesman{Name: phone, Telephone: phone}}, |
635 | }) | 632 | }) |
636 | } | 633 | } |
@@ -42,6 +42,8 @@ type OrderBase struct { | @@ -42,6 +42,8 @@ type OrderBase struct { | ||
42 | DeliveryTime time.Time | 42 | DeliveryTime time.Time |
43 | //更新时间 | 43 | //更新时间 |
44 | UpdateTime time.Time | 44 | UpdateTime time.Time |
45 | + //销售日期 | ||
46 | + SaleDate time.Time | ||
45 | //上一次查看时间 已读情况 | 47 | //上一次查看时间 已读情况 |
46 | LastViewTime time.Time | 48 | LastViewTime time.Time |
47 | //合伙人应收分红 | 49 | //合伙人应收分红 |
@@ -79,12 +79,13 @@ func (repository *OrderBaseRepository) Find(queryOptions map[string]interface{}) | @@ -79,12 +79,13 @@ func (repository *OrderBaseRepository) Find(queryOptions map[string]interface{}) | ||
79 | query := NewQuery(tx.Model(&OrderBaseModels), queryOptions) | 79 | query := NewQuery(tx.Model(&OrderBaseModels), queryOptions) |
80 | query.SetWhere(`"order_base".partner_id= ?`, "partnerId"). | 80 | query.SetWhere(`"order_base".partner_id= ?`, "partnerId"). |
81 | SetWhere(`"order_base".order_type= ?`, "orderType"). | 81 | SetWhere(`"order_base".order_type= ?`, "orderType"). |
82 | - SetWhere(`"order_base".create_time >= ?`, "beginTime"). | ||
83 | - SetWhere(`"order_base".create_time < ?`, "endTime"). | 82 | + SetWhere(`"order_base".sale_date >= ?`, "beginTime"). |
83 | + SetWhere(`"order_base".sale_date < ?`, "endTime"). | ||
84 | //SetWhere(`"order_base".is_disable = ?`, "isDisable"). | 84 | //SetWhere(`"order_base".is_disable = ?`, "isDisable"). |
85 | SetLimit(). | 85 | SetLimit(). |
86 | SetOrder(`order_base.create_time`, "sortByCreateTime"). | 86 | SetOrder(`order_base.create_time`, "sortByCreateTime"). |
87 | - SetOrder(`order_base.update_time`, "sortByUpdateTime") | 87 | + SetOrder(`order_base.update_time`, "sortByUpdateTime"). |
88 | + SetOrder(`order_base.sale_date`, "sortBySalesTime") | ||
88 | if v, ok := queryOptions["orderTypes"]; ok { | 89 | if v, ok := queryOptions["orderTypes"]; ok { |
89 | query.Where(`"order_base".order_type in (?)`, pg.In(v)) | 90 | query.Where(`"order_base".order_type in (?)`, pg.In(v)) |
90 | } | 91 | } |
@@ -14,9 +14,11 @@ type DividendStatisticsRequest struct { | @@ -14,9 +14,11 @@ type DividendStatisticsRequest struct { | ||
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 | + PageIndex int `json:"pageIndex"` | ||
17 | } | 18 | } |
18 | type DividendStatisticsResponse struct { | 19 | type DividendStatisticsResponse struct { |
19 | Statistics DividendStatistics `json:"statistics"` | 20 | Statistics DividendStatistics `json:"statistics"` |
21 | + Timestamp int64 `json:"timestamp"` | ||
20 | } | 22 | } |
21 | 23 | ||
22 | type DividendStatistics struct { | 24 | type DividendStatistics struct { |
@@ -41,7 +43,7 @@ type DividendOrdersRequest struct { | @@ -41,7 +43,7 @@ type DividendOrdersRequest struct { | ||
41 | EndTime int64 `json:"endTime" valid:"Required"` | 43 | EndTime int64 `json:"endTime" valid:"Required"` |
42 | 44 | ||
43 | // 合作类型(空或不传,即所有类型) | 45 | // 合作类型(空或不传,即所有类型) |
44 | - JoinWays []*company.JoinWays `json:"joinWays"` | 46 | + JoinWays []*company.JoinWays `json:"joinWays"` |
45 | 47 | ||
46 | PageIndex int `json:"pageIndex,omitempty"` | 48 | PageIndex int `json:"pageIndex,omitempty"` |
47 | PageSize int `json:"pageSize,omitempty"` | 49 | PageSize int `json:"pageSize,omitempty"` |
@@ -32,6 +32,7 @@ type OrderDetail struct { | @@ -32,6 +32,7 @@ type OrderDetail struct { | ||
32 | OrderStatus int `json:"orderStatus"` //订单状态 1.待支付 2.已支付 3.已支付退货 4待支付退货 | 32 | OrderStatus int `json:"orderStatus"` //订单状态 1.待支付 2.已支付 3.已支付退货 4待支付退货 |
33 | CreateTime int64 `json:"createTime"` | 33 | CreateTime int64 `json:"createTime"` |
34 | UpdateTime int64 `json:"updateTime"` | 34 | UpdateTime int64 `json:"updateTime"` |
35 | + SalesTime int64 `json:"salesTime"` // 销售日期 | ||
35 | OrderDistrict interface{} `json:"orderDistrict"` | 36 | OrderDistrict interface{} `json:"orderDistrict"` |
36 | Customer Customer `json:"customer"` | 37 | Customer Customer `json:"customer"` |
37 | Products interface{} `json:"products"` | 38 | Products interface{} `json:"products"` |
@@ -87,14 +88,15 @@ type OrderListRequest struct { | @@ -87,14 +88,15 @@ type OrderListRequest struct { | ||
87 | PageSize int `json:"pageSize" valid:"Required"` | 88 | PageSize int `json:"pageSize" valid:"Required"` |
88 | OrderType int `json:"-"` | 89 | OrderType int `json:"-"` |
89 | OrderTypes []int `json:"-"` | 90 | OrderTypes []int `json:"-"` |
90 | - | ||
91 | - PartnerId int64 `json:"partnerId"` | ||
92 | - JoinWay int `json:"joinWay"` //合伙方式(0或不传,即所有合伙方式) | 91 | + IsToday bool `json:"isToday"` |
92 | + PartnerId int64 `json:"partnerId"` | ||
93 | + JoinWay int `json:"joinWay"` //合伙方式(0或不传,即所有合伙方式) | ||
93 | } | 94 | } |
94 | type OrderListResponse struct { | 95 | type OrderListResponse struct { |
95 | List []*OrderListItem `json:"list"` | 96 | List []*OrderListItem `json:"list"` |
96 | Statistics map[string]interface{} `json:"-"` | 97 | Statistics map[string]interface{} `json:"-"` |
97 | Total int `json:"total"` | 98 | Total int `json:"total"` |
99 | + Timestamp int64 `json:"timestamp"` | ||
98 | } | 100 | } |
99 | 101 | ||
100 | type OrderListItem struct { | 102 | type OrderListItem struct { |
@@ -117,7 +119,9 @@ type OrderListItem struct { | @@ -117,7 +119,9 @@ type OrderListItem struct { | ||
117 | //订单金额 | 119 | //订单金额 |
118 | OrderAmount float64 `json:"orderAmount"` | 120 | OrderAmount float64 `json:"orderAmount"` |
119 | // 订单更新时间 | 121 | // 订单更新时间 |
120 | - UpdateTime int64 `json:"updateTime"` | 122 | + UpdateTime int64 `json:"updateTime"` |
123 | + //销售时间 | ||
124 | + SalesTime int64 `json:"salesTime"` | ||
121 | //我的分红 | 125 | //我的分红 |
122 | MyDividend float64 `json:"dividendReceivable"` | 126 | MyDividend float64 `json:"dividendReceivable"` |
123 | //是否已读(0未读,1已读) | 127 | //是否已读(0未读,1已读) |
-
请 注册 或 登录 后发表评论