Skip to content

Commit

Permalink
Merge pull request #11 from FantasyRL/not_main
Browse files Browse the repository at this point in the history
workflow
  • Loading branch information
FantasyRL authored Apr 17, 2024
2 parents 68f69fe + b39abcd commit 2542df5
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 17 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches:
- "main"
- "not_main"
pull_request:
branches: [ "main" ]
branches:
- "main"
- "not_main"
schedule:
- cron: '42 14 * * 1'

Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: security check
on:
push:
branches:
- not_main
jobs:
golangci:
name: golangci
runs-on: ubuntu-22.04
steps:
- name: check code by golangci
run: golangci-lint run
3 changes: 1 addition & 2 deletions pkg/errno/errno.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package errno

import (
"errors"
"fmt"
)

const (
Expand Down Expand Up @@ -76,7 +75,7 @@ type ErrNo struct {
}

func (e ErrNo) Error() string {
return fmt.Sprintf("%s", e.ErrorMsg)
return e.ErrorMsg
}

func NewErrNo(code int64, msg string) ErrNo {
Expand Down
4 changes: 2 additions & 2 deletions rpc/interaction/dal/cache/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
var (
rLike *redis.Client
rComment *redis.Client
rFollow *redis.Client
rMessage *redis.Client
//rFollow *redis.Client
//rMessage *redis.Client
)

func Init() {
Expand Down
21 changes: 10 additions & 11 deletions rpc/interaction/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package main

import (
interaction "bibi/kitex_gen/interaction"
"bibi/pkg/constants"
"bibi/pkg/errno"
"bibi/pkg/pack"
"bibi/rpc/interaction/service"
Expand Down Expand Up @@ -44,16 +43,16 @@ func (s *InteractionHandlerImpl) LikeList(ctx context.Context, req *interaction.
count := int64(len(allLikeResp))
resp.VideoCount = &count

var likeResp []int64
if len(allLikeResp) <= int(req.PageNum-1)*constants.PageSize || int(req.PageNum-1)*constants.PageSize < 0 {
resp.Base = pack.BuildBaseResp(nil)
return resp, nil
} else {
fst := int(req.PageNum-1) * constants.PageSize
for i := fst; i < fst+constants.PageSize && i < len(allLikeResp); i++ {
likeResp = append(likeResp, allLikeResp[i])
}
}
//var likeResp []int64
//if len(allLikeResp) <= int(req.PageNum-1)*constants.PageSize || int(req.PageNum-1)*constants.PageSize < 0 {
// resp.Base = pack.BuildBaseResp(nil)
// return resp, nil
//} else {
// fst := int(req.PageNum-1) * constants.PageSize
// for i := fst; i < fst+constants.PageSize && i < len(allLikeResp); i++ {
// likeResp = append(likeResp, allLikeResp[i])
// }
//}
//todo:
//videosResp:=make([]*video.Video,constants.PageSize)
//GetLikeVideoList
Expand Down

0 comments on commit 2542df5

Please sign in to comment.