作者 yangfu

榜单列表查询修改

... ... @@ -6,6 +6,7 @@ require (
github.com/aliyun/alibaba-cloud-sdk-go v1.60.348
github.com/astaxie/beego v1.10.0
github.com/disintegration/imaging v1.6.2
github.com/gin-gonic/gin v1.4.0
github.com/go-sql-driver/mysql v1.4.1
github.com/gomodule/redigo v1.7.0
github.com/gorilla/websocket v1.4.1
... ...
package utils
import (
"encoding/json"
"fmt"
"testing"
)
... ... @@ -58,3 +59,15 @@ func TestMergeMap(t *testing.T) {
MergeMap(to, from)
t.Log("merge 后:", to)
}
func TestIntUnmarsh(t *testing.T) {
jsonString := `{"id":8242051651122944}`
type param struct {
Id int `json:"id"`
}
var p param
json.Unmarshal([]byte(jsonString), &p)
t.Log(p)
jsonByte, _ := json.Marshal(p)
t.Log(string(jsonByte))
}
... ...
... ... @@ -74,28 +74,27 @@ func GetRankList(header *protocol.RequestHeader, request *protocol.GetRankListRe
log.Error(err)
return
}
if !hasDepartmentInRank {
continue
}
if departmentId > 0 {
if err = models.GetRanksByDepartmentSelf(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, departmentId, &selfRank); err != nil {
log.Error(err)
return
}
} else if hasDepartmentInRank {
for i := range departments {
d := departments[i]
if err = models.GetRanksByDepartmentSelf(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, int64(d.Id), &selfRank); err != nil {
if hasDepartmentInRank {
if departmentId > 0 {
if err = models.GetRanksByDepartmentSelf(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, departmentId, &selfRank); err != nil {
log.Error(err)
return
}
if selfRank != nil {
departmentId = int64(d.Id)
break
} else if hasDepartmentInRank {
for i := range departments {
d := departments[i]
if err = models.GetRanksByDepartmentSelf(header.CompanyId, request.RankTypeId, request.RankRangeId, request.RankPeriodId, key, int64(d.Id), &selfRank); err != nil {
log.Error(err)
return
}
if selfRank != nil {
departmentId = int64(d.Id)
break
}
}
if departmentId == 0 {
hasDepartmentInRank = false
}
}
if departmentId == 0 {
hasDepartmentInRank = false
}
}
} else if rankRange.Type == protocol.RankRangeTypeAllCompanyUser || rankRange.Type == protocol.RankRangeTypeSpecifyUser {
... ...