作者 yangfu

榜单列表查询修改

@@ -6,6 +6,7 @@ require ( @@ -6,6 +6,7 @@ require (
6 github.com/aliyun/alibaba-cloud-sdk-go v1.60.348 6 github.com/aliyun/alibaba-cloud-sdk-go v1.60.348
7 github.com/astaxie/beego v1.10.0 7 github.com/astaxie/beego v1.10.0
8 github.com/disintegration/imaging v1.6.2 8 github.com/disintegration/imaging v1.6.2
  9 + github.com/gin-gonic/gin v1.4.0
9 github.com/go-sql-driver/mysql v1.4.1 10 github.com/go-sql-driver/mysql v1.4.1
10 github.com/gomodule/redigo v1.7.0 11 github.com/gomodule/redigo v1.7.0
11 github.com/gorilla/websocket v1.4.1 12 github.com/gorilla/websocket v1.4.1
1 package utils 1 package utils
2 2
3 import ( 3 import (
  4 + "encoding/json"
4 "fmt" 5 "fmt"
5 "testing" 6 "testing"
6 ) 7 )
@@ -58,3 +59,15 @@ func TestMergeMap(t *testing.T) { @@ -58,3 +59,15 @@ func TestMergeMap(t *testing.T) {
58 MergeMap(to, from) 59 MergeMap(to, from)
59 t.Log("merge 后:", to) 60 t.Log("merge 后:", to)
60 } 61 }
  62 +
  63 +func TestIntUnmarsh(t *testing.T) {
  64 + jsonString := `{"id":8242051651122944}`
  65 + type param struct {
  66 + Id int `json:"id"`
  67 + }
  68 + var p param
  69 + json.Unmarshal([]byte(jsonString), &p)
  70 + t.Log(p)
  71 + jsonByte, _ := json.Marshal(p)
  72 + t.Log(string(jsonByte))
  73 +}
@@ -74,9 +74,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe @@ -74,9 +74,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
74 log.Error(err) 74 log.Error(err)
75 return 75 return
76 } 76 }
77 - if !hasDepartmentInRank {  
78 - continue  
79 - } 77 + if hasDepartmentInRank {
80 if departmentId > 0 { 78 if departmentId > 0 {
81 if err = models.GetRanksByDepartmentSelf(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, departmentId, &selfRank); err != nil { 79 if err = models.GetRanksByDepartmentSelf(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, departmentId, &selfRank); err != nil {
82 log.Error(err) 80 log.Error(err)
@@ -98,6 +96,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe @@ -98,6 +96,7 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
98 hasDepartmentInRank = false 96 hasDepartmentInRank = false
99 } 97 }
100 } 98 }
  99 + }
101 } else if rankRange.Type == protocol.RankRangeTypeAllCompanyUser || rankRange.Type == protocol.RankRangeTypeSpecifyUser { 100 } else if rankRange.Type == protocol.RankRangeTypeAllCompanyUser || rankRange.Type == protocol.RankRangeTypeSpecifyUser {
102 if rsp.Total, err = models.GetRanksByUser(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, request.PageIndex, request.PageSize, &ranks); err != nil && err != orm.ErrNoRows { 101 if rsp.Total, err = models.GetRanksByUser(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, request.PageIndex, request.PageSize, &ranks); err != nil && err != orm.ErrNoRows {
103 log.Error(err) 102 log.Error(err)