|
@@ -330,7 +330,7 @@ type RankDiscovery struct{} |
|
@@ -330,7 +330,7 @@ type RankDiscovery struct{} |
330
|
|
330
|
|
331
|
func (rank RankDiscovery) RankUser(o RankOption) (err error, result RankResult) {
|
331
|
func (rank RankDiscovery) RankUser(o RankOption) (err error, result RankResult) {
|
332
|
var (
|
332
|
var (
|
333
|
- sql = `select sum(discovery_score) score,count(0) total from chance where user_id =? and review_status=3 and status=1
|
333
|
+ sql = `select sum(discovery_score) score,count(0) total from chance where user_id =? and review_status=3 and status=1 and enable_status=1
|
334
|
and UNIX_TIMESTAMP(approve_time)>=? and UNIX_TIMESTAMP(approve_time)<?`
|
334
|
and UNIX_TIMESTAMP(approve_time)>=? and UNIX_TIMESTAMP(approve_time)<?`
|
335
|
score float64
|
335
|
score float64
|
336
|
total int
|
336
|
total int
|
|
@@ -346,7 +346,7 @@ func (rank RankDiscovery) RankUser(o RankOption) (err error, result RankResult) |
|
@@ -346,7 +346,7 @@ func (rank RankDiscovery) RankUser(o RankOption) (err error, result RankResult) |
346
|
}
|
346
|
}
|
347
|
func (rank RankDiscovery) RankDepartment(o RankOption) (err error, result RankResult) {
|
347
|
func (rank RankDiscovery) RankDepartment(o RankOption) (err error, result RankResult) {
|
348
|
var (
|
348
|
var (
|
349
|
- sql = `select sum(discovery_score) score,count(0) total from chance where department_id =? and review_status=3 and status=1
|
349
|
+ sql = `select sum(discovery_score) score,count(0) total from chance where department_id =? and review_status=3 and status=1 and enable_status=1
|
350
|
and UNIX_TIMESTAMP(approve_time)>=? and UNIX_TIMESTAMP(approve_time)<?
|
350
|
and UNIX_TIMESTAMP(approve_time)>=? and UNIX_TIMESTAMP(approve_time)<?
|
351
|
`
|
351
|
`
|
352
|
score float64
|
352
|
score float64
|
|
@@ -367,10 +367,13 @@ type RankGrasp struct{} |
|
@@ -367,10 +367,13 @@ type RankGrasp struct{} |
367
|
|
367
|
|
368
|
func (rank RankGrasp) RankUser(o RankOption) (err error, result RankResult) {
|
368
|
func (rank RankGrasp) RankUser(o RankOption) (err error, result RankResult) {
|
369
|
var (
|
369
|
var (
|
370
|
- sql = `select sum(a.user_grasp_score) score from(
|
|
|
371
|
-select user_grasp_score from achievement where user_company_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
370
|
+ sql = `
|
|
|
371
|
+select sum(a.user_grasp_score) score from(
|
|
|
372
|
+select user_grasp_score from achievement where user_company_id=? and status=1 and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
372
|
UNION ALL
|
373
|
UNION ALL
|
373
|
-select user_grasp_score from achievement_provider where user_company_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
374
|
+select b.user_grasp_score from (
|
|
|
375
|
+select user_grasp_score,achievement_id from achievement_provider where user_company_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
376
|
+)b inner join achievement c on b.achievement_id = c.id and status=1
|
374
|
) a
|
377
|
) a
|
375
|
`
|
378
|
`
|
376
|
score float64
|
379
|
score float64
|
|
@@ -386,9 +389,11 @@ select user_grasp_score from achievement_provider where user_company_id=? and UN |
|
@@ -386,9 +389,11 @@ select user_grasp_score from achievement_provider where user_company_id=? and UN |
386
|
func (rank RankGrasp) RankDepartment(o RankOption) (err error, result RankResult) {
|
389
|
func (rank RankGrasp) RankDepartment(o RankOption) (err error, result RankResult) {
|
387
|
var (
|
390
|
var (
|
388
|
sql = `select sum(a.user_grasp_score) score from(
|
391
|
sql = `select sum(a.user_grasp_score) score from(
|
389
|
-select user_grasp_score from achievement where department_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
392
|
+select user_grasp_score from achievement where department_id=? and status=1 and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
390
|
UNION ALL
|
393
|
UNION ALL
|
391
|
-select user_grasp_score from achievement_provider where department_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
394
|
+select b.user_grasp_score from (
|
|
|
395
|
+select user_grasp_score,achievement_id from achievement_provider where department_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
396
|
+)b inner join achievement c on b.achievement_id = c.id and status=1
|
392
|
) a
|
397
|
) a
|
393
|
`
|
398
|
`
|
394
|
score float64
|
399
|
score float64
|