123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- package service
- import (
- "app.yhyue.com/moapp/jybase/redis"
- "context"
- "fmt"
- "log"
- "testing"
- "time"
- "userCenter/entity"
- "userCenter/rpc/pb"
- )
- var (
- ctx, _ = context.WithTimeout(context.Background(), 2*time.Second)
- )
- //工作桌面菜单树 无缓存
- //go test -run=Test_WorkDesktopMenuTreeNoCache
- func Test_WorkDesktopMenuTreeNoCache(t *testing.T) {
- in := &pb.WorkDesktopMenuInfoReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- BigMemberOff: true,
- InternalTime: 1200,
- RedisOutTime: 1200,
- }
- RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
- redis.Del(entity.RedisCode, RedisMenuKey)
- res, err := GetWordDesktopMenuTree(in)
- log.Println("err:", err, "---res:", res)
- }
- //工作桌面菜单树
- //go test -run=Test_WorkDesktopMenuTree
- func Test_WorkDesktopMenuTree(t *testing.T) {
- in := &pb.WorkDesktopMenuInfoReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- BigMemberOff: true,
- InternalTime: 1200,
- RedisOutTime: 1200,
- }
- res, err := GetWordDesktopMenuTree(in)
- log.Println("err:", err, "---res:", res)
- }
- //工作桌面菜单树
- //go test -run=Test_WorkDesktopMenuTreeWX
- func Test_WorkDesktopMenuTreeWX(t *testing.T) {
- in := &pb.WorkDesktopMenuInfoReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "WX",
- Phone: "",
- BigMemberOff: true,
- InternalTime: 1200,
- RedisOutTime: 1200,
- }
- RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
- redis.Del(entity.RedisCode, RedisMenuKey)
- res, err := GetWordDesktopMenuTree(in)
- log.Println("err:", err, "---res:", res)
- }
- //工作桌面菜单树
- //go test -run=Test_WorkDesktopMenuTreeAPP
- func Test_WorkDesktopMenuTreeAPP(t *testing.T) {
- in := &pb.WorkDesktopMenuInfoReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "APP",
- Phone: "",
- BigMemberOff: true,
- InternalTime: 1200,
- RedisOutTime: 1200,
- }
- RedisMenuKey := fmt.Sprintf(entity.RedisMenuKey, in.AppId, in.Platform, in.UserId)
- redis.Del(entity.RedisCode, RedisMenuKey)
- res, err := GetWordDesktopMenuTree(in)
- log.Println("err:", err, "---res:", res)
- }
- // 菜单模式插入
- // go test -v -run Test_MenuModeSave
- func Test_MenuModeSave(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- ActionMode: "menuMode",
- MenuMode: "usable",
- MenuIds: "",
- BigMemberOff: true,
- CommonlySize: 10,
- RedisOutTime: 1200,
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("menuModeNew:", res)
- }
- // 菜单模式更新-非指定内容
- // go test -v -run Test_MenuModeUpdateWrong
- func Test_MenuModeUpdateWrong(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- ActionMode: "menuMode",
- MenuMode: "allll",
- MenuIds: "",
- BigMemberOff: true,
- CommonlySize: 10,
- RedisOutTime: 1200,
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("menuModeNew:", res)
- }
- // 菜单模式更新
- // go test -v -run Test_MenuModeUpdate
- func Test_MenuModeUpdate(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- ActionMode: "menuMode",
- MenuMode: "all",
- MenuIds: "",
- BigMemberOff: true,
- CommonlySize: 10,
- RedisOutTime: 1200,
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("menuModeNew:", res)
- }
- //当前工作桌面菜单模式
- // go test -v -run Test_WorkMenuMode
- func Test_WorkMenuMode(t *testing.T) {
- in := &pb.WorkDesktopMenuInfoReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- BigMemberOff: true,
- InternalTime: 1200,
- RedisOutTime: 1200,
- }
- res, err := GetWorkDesktopMenuMode(in)
- log.Println("err:", err, "---res:", res)
- }
- // 当前工作桌面菜单模式-非正常用户
- // go test -v -run Test_WorkMenuModeNoUserId
- func Test_WorkMenuModeNoUserId(t *testing.T) {
- in := &pb.WorkDesktopMenuInfoReq{
- UserId: "",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- BigMemberOff: true,
- InternalTime: 1200,
- RedisOutTime: 1200,
- }
- res, err := GetWorkDesktopMenuMode(in)
- log.Println("err:", err, "---res:", res)
- }
- // 常用功能更新新增
- // go test -v -run Test_CommonlyRenewWX
- func Test_CommonlyRenewWX(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "WX",
- Phone: "",
- ActionMode: "commonlyRenew",
- MenuMode: "",
- MenuIds: "Q1o=,TF4=,TFw=,TFg=,Q1g=,RV9F,RV9J,RV5B,RV5H,RV5J,TVg=",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- }
- // 常用功能更新新增
- // go test -v -run Test_CommonlyRenewAPP
- func Test_CommonlyRenewAPP(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "APP",
- Phone: "",
- ActionMode: "commonlyRenew",
- MenuMode: "",
- MenuIds: "Q1o=,TF4=,TFw=,TFg=,Q1g=,RV9F,RV9J,RV5B,RV5H,RV5J,TVg=",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- }
- // 常用功能更新新增
- // go test -v -run Test_CommonlyRenew
- func Test_CommonlyRenew(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- ActionMode: "commonlyRenew",
- MenuMode: "",
- MenuIds: "Q1o=,TF4=,TFw=,TFg=,Q1g=,RV9F,RV9J,RV5B,RV5H,RV5J,TVg=",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- }
- // 常用功能列表
- // go test -v -run Test_CommonlyList
- func Test_CommonlyList(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- ActionMode: "commonlyList",
- MenuMode: "",
- MenuIds: "",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- } // 常用功能列表
- // go test -v -run Test_CommonlyListWX
- func Test_CommonlyListWX(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "WX",
- Phone: "",
- ActionMode: "commonlyList",
- MenuMode: "",
- MenuIds: "",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- } // 常用功能列表
- // go test -v -run Test_CommonlyListAPP
- func Test_CommonlyListAPP(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "APP",
- Phone: "",
- ActionMode: "commonlyList",
- MenuMode: "",
- MenuIds: "",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- }
- // 常用功能更新清空
- // go test -v -run Test_CommonlyRenew
- func Test_CommonlyClear(t *testing.T) {
- in := &pb.WorkDesktopComprehensiveReq{
- UserId: "61e7820581197c2e50af18df",
- AppId: "10000",
- Platform: "PC",
- Phone: "",
- ActionMode: "commonlyRenew",
- MenuMode: "",
- MenuIds: "",
- }
- res := RenewWorkDesktopMenuModeOrCommonly(in)
- log.Println("res:", res)
- }
|