...
|
...
|
@@ -330,7 +330,7 @@ type RankDiscovery struct{} |
|
|
|
|
|
func (rank RankDiscovery) RankUser(o RankOption) (err error, result RankResult) {
|
|
|
var (
|
|
|
sql = `select sum(discovery_score) score,count(0) total from chance where user_id =? and review_status=3 and status=1
|
|
|
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
|
|
|
and UNIX_TIMESTAMP(approve_time)>=? and UNIX_TIMESTAMP(approve_time)<?`
|
|
|
score float64
|
|
|
total int
|
...
|
...
|
@@ -346,7 +346,7 @@ func (rank RankDiscovery) RankUser(o RankOption) (err error, result RankResult) |
|
|
}
|
|
|
func (rank RankDiscovery) RankDepartment(o RankOption) (err error, result RankResult) {
|
|
|
var (
|
|
|
sql = `select sum(discovery_score) score,count(0) total from chance where department_id =? and review_status=3 and status=1
|
|
|
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
|
|
|
and UNIX_TIMESTAMP(approve_time)>=? and UNIX_TIMESTAMP(approve_time)<?
|
|
|
`
|
|
|
score float64
|
...
|
...
|
@@ -367,10 +367,13 @@ type RankGrasp struct{} |
|
|
|
|
|
func (rank RankGrasp) RankUser(o RankOption) (err error, result RankResult) {
|
|
|
var (
|
|
|
sql = `select sum(a.user_grasp_score) score from(
|
|
|
select user_grasp_score from achievement where user_company_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
sql = `
|
|
|
select sum(a.user_grasp_score) score from(
|
|
|
select user_grasp_score from achievement where user_company_id=? and status=1 and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
UNION ALL
|
|
|
select user_grasp_score from achievement_provider where user_company_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
select b.user_grasp_score from (
|
|
|
select user_grasp_score,achievement_id from achievement_provider where user_company_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
)b inner join achievement c on b.achievement_id = c.id and status=1
|
|
|
) a
|
|
|
`
|
|
|
score float64
|
...
|
...
|
@@ -386,9 +389,11 @@ select user_grasp_score from achievement_provider where user_company_id=? and UN |
|
|
func (rank RankGrasp) RankDepartment(o RankOption) (err error, result RankResult) {
|
|
|
var (
|
|
|
sql = `select sum(a.user_grasp_score) score from(
|
|
|
select user_grasp_score from achievement where department_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
select user_grasp_score from achievement where department_id=? and status=1 and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
UNION ALL
|
|
|
select user_grasp_score from achievement_provider where department_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
select b.user_grasp_score from (
|
|
|
select user_grasp_score,achievement_id from achievement_provider where department_id=? and UNIX_TIMESTAMP(create_at) >=? and UNIX_TIMESTAMP(create_at)<?
|
|
|
)b inner join achievement c on b.achievement_id = c.id and status=1
|
|
|
) a
|
|
|
`
|
|
|
score float64
|
...
|
...
|
|