mirror of https://github.com/rocboss/paopao-ce
commit
7f68cac0e1
@ -0,0 +1,28 @@
|
||||
| 编号 | 作者 | 发表时间 | 变更时间 | 版本 | 状态 |
|
||||
| ----- | ----- | ----- | ----- | ----- | ----- |
|
||||
| 010| 北野 | 2022-12-10 | 2022-12-10 | v0.0 | 提议 |
|
||||
|
||||
### 关于Sqlx功能项的设计
|
||||
---- 这里写简要介绍 ----
|
||||
|
||||
### 场景
|
||||
|
||||
---- 这里描述在什么使用场景下会需要本提按 ----
|
||||
|
||||
### 需求
|
||||
|
||||
TODO-TL;DR...
|
||||
|
||||
### 方案
|
||||
|
||||
TODO
|
||||
|
||||
### 疑问
|
||||
|
||||
1. 如何开启这个功能?
|
||||
|
||||
TODO
|
||||
|
||||
### 更新记录
|
||||
#### v0.0(2022-12-10) - 北野
|
||||
* 初始文档, 先占个位置
|
@ -0,0 +1,26 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
const (
|
||||
ContactStatusRequesting int8 = iota + 1
|
||||
ContactStatusAgree
|
||||
ContactStatusReject
|
||||
ContactStatusDeleted
|
||||
)
|
||||
|
||||
type Contact struct {
|
||||
ID int64 `db:"id" json:"id"`
|
||||
UserId int64 `db:"user_id" json:"user_id"`
|
||||
FriendId int64 `db:"friend_id" json:"friend_id"`
|
||||
GroupId int64 `json:"group_id"`
|
||||
Remark string `json:"remark"`
|
||||
Status int8 `json:"status"` // 1请求好友, 2已同意好友, 3已拒绝好友, 4已删除好友
|
||||
IsTop int8 `json:"is_top"`
|
||||
IsBlack int8 `json:"is_black"`
|
||||
NoticeEnable int8 `json:"notice_enable"`
|
||||
IsDel int8 `json:"-"`
|
||||
DeletedOn int64 `db:"-" json:"-"`
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package cs contain core data service interface type
|
||||
// model define
|
||||
package cs
|
@ -0,0 +1,38 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
const (
|
||||
// 搜索查询类型
|
||||
TsQueryTypeDefault TsQueryType = "search"
|
||||
TsQueryTypeTag TsQueryType = "tag"
|
||||
)
|
||||
|
||||
type (
|
||||
// TsQueryType 搜索查询类型
|
||||
TsQueryType string
|
||||
|
||||
// TsDocList 索引条陈列表
|
||||
TsDocList []TsDocItem
|
||||
)
|
||||
|
||||
// TsQueryReq 搜索查询请求
|
||||
type TsQueryReq struct {
|
||||
Query string
|
||||
Visibility []TweetVisibleType
|
||||
Type TsQueryType
|
||||
}
|
||||
|
||||
// TsQueryResp 搜索查询响应
|
||||
type TsQueryResp struct {
|
||||
Items TweetList
|
||||
Total int64
|
||||
}
|
||||
|
||||
// TsDocItem 索引条陈
|
||||
type TsDocItem struct {
|
||||
Post *TweetInfo
|
||||
Content string
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
// TweetBox 推文列表盒子,包含其他一些关于推文列表的信息
|
||||
type TweetBox struct {
|
||||
Tweets TweetList
|
||||
Total int64
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
const (
|
||||
// 标签类型
|
||||
TagTypeHot TagType = "hot"
|
||||
TagTypeNew TagType = "new"
|
||||
TagTypeFollow TagType = "follow"
|
||||
TagTypeHotExtral TagType = "hot_extral"
|
||||
)
|
||||
|
||||
type (
|
||||
// TagType 标签类型
|
||||
TagType string
|
||||
|
||||
// TagInfoList 标签信息列表
|
||||
TagInfoList []*TagInfo
|
||||
|
||||
// TagList 标签列表
|
||||
TagList []*TagItem
|
||||
)
|
||||
|
||||
// TagInfo 标签信息
|
||||
type TagInfo struct {
|
||||
ID int64 `json:"id" db:"id"`
|
||||
UserID int64 `json:"user_id" db:"user_id"`
|
||||
Tag string `json:"tag"`
|
||||
QuoteNum int64 `json:"quote_num" db:"quote_num"`
|
||||
}
|
||||
|
||||
// TagItem 标签信息条陈
|
||||
type TagItem struct {
|
||||
ID int64 `json:"id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
User *UserInfo `json:"user" db:"u"`
|
||||
Tag string `json:"tag"`
|
||||
QuoteNum int64 `json:"quote_num"`
|
||||
IsFollowing int8 `json:"is_following"`
|
||||
IsTop int8 `json:"is_top"`
|
||||
}
|
||||
|
||||
func (t *TagInfo) Format() *TagItem {
|
||||
return &TagItem{
|
||||
ID: t.ID,
|
||||
UserID: t.UserID,
|
||||
User: &UserInfo{},
|
||||
Tag: t.Tag,
|
||||
QuoteNum: t.QuoteNum,
|
||||
IsFollowing: 0,
|
||||
IsTop: 0,
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
type AttachmentBill struct {
|
||||
ID int64 `json:"id"`
|
||||
PostID int64 `json:"post_id"`
|
||||
UserID int64 `json:"user_id"`
|
||||
PaidAmount int64 `json:"paid_amount"`
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package cs
|
||||
|
||||
type (
|
||||
// UserInfoList 用户信息列表
|
||||
UserInfoList []*UserInfo
|
||||
)
|
||||
|
||||
// UserInfo 用户基本信息
|
||||
type UserInfo struct {
|
||||
ID int64 `json:"id"`
|
||||
Nickname string `json:"nickname"`
|
||||
Username string `json:"username"`
|
||||
Status int `json:"status"`
|
||||
Avatar string `json:"avatar"`
|
||||
IsAdmin bool `json:"is_admin"`
|
||||
}
|
@ -0,0 +1,115 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/pkg/types"
|
||||
)
|
||||
|
||||
const (
|
||||
ActRegisterUser act = iota
|
||||
ActCreatePublicTweet
|
||||
ActCreatePublicAttachment
|
||||
ActCreatePublicPicture
|
||||
ActCreatePublicVideo
|
||||
ActCreatePrivateTweet
|
||||
ActCreatePrivateAttachment
|
||||
ActCreatePrivatePicture
|
||||
ActCreatePrivateVideo
|
||||
ActCreateFriendTweet
|
||||
ActCreateFriendAttachment
|
||||
ActCreateFriendPicture
|
||||
ActCreateFriendVideo
|
||||
ActCreatePublicComment
|
||||
ActCreatePublicPicureComment
|
||||
ActCreateFriendComment
|
||||
ActCreateFriendPicureComment
|
||||
ActCreatePrivateComment
|
||||
ActCreatePrivatePicureComment
|
||||
ActStickTweet
|
||||
ActTopTweet
|
||||
ActLockTweet
|
||||
ActVisibleTweet
|
||||
ActDeleteTweet
|
||||
ActCreateActivationCode
|
||||
)
|
||||
|
||||
type (
|
||||
act uint8
|
||||
|
||||
FriendFilter map[int64]types.Empty
|
||||
FriendSet map[string]types.Empty
|
||||
|
||||
Action struct {
|
||||
Act act
|
||||
UserId int64
|
||||
}
|
||||
)
|
||||
|
||||
func (f FriendFilter) IsFriend(userId int64) bool {
|
||||
_, yeah := f[userId]
|
||||
return yeah
|
||||
}
|
||||
|
||||
// IsAllow default true if user is admin
|
||||
func (a act) IsAllow(user *User, userId int64, isFriend bool, isActivation bool) bool {
|
||||
if user.IsAdmin {
|
||||
return true
|
||||
}
|
||||
if user.ID == userId && isActivation {
|
||||
switch a {
|
||||
case ActCreatePublicTweet,
|
||||
ActCreatePublicAttachment,
|
||||
ActCreatePublicPicture,
|
||||
ActCreatePublicVideo,
|
||||
ActCreatePrivateTweet,
|
||||
ActCreatePrivateAttachment,
|
||||
ActCreatePrivatePicture,
|
||||
ActCreatePrivateVideo,
|
||||
ActCreateFriendTweet,
|
||||
ActCreateFriendAttachment,
|
||||
ActCreateFriendPicture,
|
||||
ActCreateFriendVideo,
|
||||
ActCreatePrivateComment,
|
||||
ActCreatePrivatePicureComment,
|
||||
ActStickTweet,
|
||||
ActLockTweet,
|
||||
ActVisibleTweet,
|
||||
ActDeleteTweet:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if user.ID == userId && !isActivation {
|
||||
switch a {
|
||||
case ActCreatePrivateTweet,
|
||||
ActCreatePrivateComment,
|
||||
ActStickTweet,
|
||||
ActLockTweet,
|
||||
ActDeleteTweet:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if isFriend && isActivation {
|
||||
switch a {
|
||||
case ActCreatePublicComment,
|
||||
ActCreatePublicPicureComment,
|
||||
ActCreateFriendComment,
|
||||
ActCreateFriendPicureComment:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if !isFriend && isActivation {
|
||||
switch a {
|
||||
case ActCreatePublicComment,
|
||||
ActCreatePublicPicureComment:
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
|
||||
)
|
||||
|
||||
type (
|
||||
Comment = dbr.Comment
|
||||
CommentFormated = dbr.CommentFormated
|
||||
CommentReply = dbr.CommentReply
|
||||
CommentContent = dbr.CommentContent
|
||||
CommentReplyFormated = dbr.CommentReplyFormated
|
||||
)
|
@ -0,0 +1,26 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
|
||||
)
|
||||
|
||||
const (
|
||||
MsgTypePost = dbr.MsgTypePost
|
||||
MsgtypeComment = dbr.MsgtypeComment
|
||||
MsgTypeReply = dbr.MsgTypeReply
|
||||
MsgTypeWhisper = dbr.MsgTypeWhisper
|
||||
MsgTypeRequestingFriend = dbr.MsgTypeRequestingFriend
|
||||
MsgTypeSystem = dbr.MsgTypeSystem
|
||||
|
||||
MsgStatusUnread = dbr.MsgStatusUnread
|
||||
MsgStatusReaded = dbr.MsgStatusReaded
|
||||
)
|
||||
|
||||
type (
|
||||
Message = dbr.Message
|
||||
MessageFormated = dbr.MessageFormated
|
||||
)
|
@ -1,8 +1,10 @@
|
||||
// Copyright 2022 ROC. All rights reserved.
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package core
|
||||
// Package ms contain core data service interface type
|
||||
// model define for gorm adapter
|
||||
package ms
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
|
@ -0,0 +1,13 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
|
||||
)
|
||||
|
||||
type (
|
||||
Captcha = dbr.Captcha
|
||||
)
|
@ -0,0 +1,10 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
type IndexTweetList struct {
|
||||
Tweets []*PostFormated
|
||||
Total int64
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
type (
|
||||
ContactItem struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
UserName string `db:"username" json:"username"`
|
||||
Nickname string `json:"nickname"`
|
||||
Avatar string `json:"avatar"`
|
||||
Phone string `json:"phone"`
|
||||
}
|
||||
|
||||
ContactList struct {
|
||||
Contacts []ContactItem `json:"contacts"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
)
|
@ -0,0 +1,14 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package ms
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
|
||||
)
|
||||
|
||||
type (
|
||||
WalletStatement = dbr.WalletStatement
|
||||
WalletRecharge = dbr.WalletRecharge
|
||||
)
|
@ -0,0 +1,20 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package core
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/core/cs"
|
||||
"github.com/rocboss/paopao-ce/internal/core/ms"
|
||||
)
|
||||
|
||||
// IndexPostsService 广场首页推文列表服务
|
||||
type IndexPostsService interface {
|
||||
IndexPosts(user *ms.User, offset int, limit int) (*ms.IndexTweetList, error)
|
||||
}
|
||||
|
||||
// IndexPostsServantA 广场首页推文列表服务(版本A)
|
||||
type IndexPostsServantA interface {
|
||||
IndexPosts(user *ms.User, limit int, offset int) (*cs.TweetBox, error)
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package jinzhu
|
||||
|
||||
import (
|
||||
"github.com/rocboss/paopao-ce/internal/conf"
|
||||
)
|
||||
|
||||
// 数据库表名,统一使用 _<table name>_ 的形式命名, 比如tag表 => _tag_
|
||||
var (
|
||||
_anouncement_ string
|
||||
_anouncementContent_ string
|
||||
_attachment_ string
|
||||
_captcha_ string
|
||||
_comment_ string
|
||||
_commentContent_ string
|
||||
_commentReply_ string
|
||||
_contact_ string
|
||||
_contactGroup_ string
|
||||
_message_ string
|
||||
_post_ string
|
||||
_postAttachmentBill_ string
|
||||
_postCollection_ string
|
||||
_postContent_ string
|
||||
_postStar_ string
|
||||
_tag_ string
|
||||
_user_ string
|
||||
_walletRecharge_ string
|
||||
_walletStatement_ string
|
||||
)
|
||||
|
||||
func initTableName() {
|
||||
m := conf.DatabaseSetting.TableNames()
|
||||
_anouncement_ = m[conf.TableAnouncement]
|
||||
_anouncementContent_ = m[conf.TableAnouncementContent]
|
||||
_attachment_ = m[conf.TableAttachment]
|
||||
_captcha_ = m[conf.TableCaptcha]
|
||||
_comment_ = m[conf.TableComment]
|
||||
_commentContent_ = m[conf.TableCommentContent]
|
||||
_commentReply_ = m[conf.TableCommentReply]
|
||||
_contact_ = m[conf.TableContact]
|
||||
_contactGroup_ = m[conf.TableContactGroup]
|
||||
_message_ = m[conf.TableMessage]
|
||||
_post_ = m[conf.TablePost]
|
||||
_postAttachmentBill_ = m[conf.TablePostAttachmentBill]
|
||||
_postCollection_ = m[conf.TablePostCollection]
|
||||
_postContent_ = m[conf.TablePostContent]
|
||||
_postStar_ = m[conf.TablePostStar]
|
||||
_tag_ = m[conf.TableTag]
|
||||
_user_ = m[conf.TableUser]
|
||||
_walletRecharge_ = m[conf.TableWalletRecharge]
|
||||
_walletStatement_ = m[conf.TableWalletStatement]
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package debug
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func TODO() {
|
||||
logrus.Fatalln("in todo progress")
|
||||
}
|
||||
|
||||
func NotImplemented() {
|
||||
logrus.Fatalln("not implemented")
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
// Copyright 2020 Michael Li <alimy@gility.net>. All rights reserved.
|
||||
// Use of this source code is governed by Apache License 2.0 that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
package naming
|
||||
|
||||
// NamingStrategy naming strategy interface
|
||||
type NamingStrategy interface {
|
||||
Naming(string) string
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
// Copyright 2020 Michael Li <alimy@gility.net>. All rights reserved.
|
||||
// Use of this source code is governed by Apache License 2.0 that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
package naming
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSnakeNamingStrategy_Naming(t *testing.T) {
|
||||
ns := NewSnakeNamingStrategy()
|
||||
for _, cs := range []struct {
|
||||
name string
|
||||
expected string
|
||||
}{
|
||||
{name: "abc", expected: "abc"},
|
||||
{name: "Abc", expected: "abc"},
|
||||
{name: "HostName", expected: "host_name"},
|
||||
{name: "Host_Name", expected: "host_name"},
|
||||
{name: "RESTfulAPI", expected: "res_tful_api"},
|
||||
{name: "HTTPS_API", expected: "https_api"},
|
||||
{name: "PKG_Name", expected: "pkg_name"},
|
||||
{name: "UserID", expected: "user_id"},
|
||||
{name: "UserId", expected: "user_id"},
|
||||
{name: "IPLoc", expected: "ip_loc"},
|
||||
{name: "API", expected: "api"},
|
||||
{name: "HTTP", expected: "http"},
|
||||
{name: "IP", expected: "ip"},
|
||||
} {
|
||||
result := ns.Naming(cs.name)
|
||||
if result != cs.expected {
|
||||
t.Errorf("give:%s expected:%s result:%s", cs.name, cs.expected, result)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSimpleNamingStrategy_Naming(t *testing.T) {
|
||||
ns := NewSimpleNamingStrategy()
|
||||
for _, cs := range []struct {
|
||||
name string
|
||||
expected string
|
||||
}{
|
||||
{name: "abc", expected: "abc"},
|
||||
{name: "Abc", expected: "abc"},
|
||||
{name: "HostName", expected: "host_name"},
|
||||
{name: "Host_Name", expected: "host__name"},
|
||||
{name: "RESTfulAPI", expected: "r_e_s_tful_a_p_i"},
|
||||
{name: "HTTPS_API", expected: "h_t_t_p_s__a_p_i"},
|
||||
{name: "PKG_Name", expected: "p_k_g__name"},
|
||||
{name: "API", expected: "a_p_i"},
|
||||
{name: "HTTP", expected: "h_t_t_p"},
|
||||
} {
|
||||
result := ns.Naming(cs.name)
|
||||
if result != cs.expected {
|
||||
t.Errorf("give:%s expected:%s result:%s", cs.name, cs.expected, result)
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
// Copyright 2020 Michael Li <alimy@gility.net>. All rights reserved.
|
||||
// Use of this source code is governed by Apache License 2.0 that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
package naming
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"unicode"
|
||||
)
|
||||
|
||||
type simpleNamingStrategy struct {
|
||||
// just empty
|
||||
}
|
||||
|
||||
func (s *simpleNamingStrategy) Naming(name string) string {
|
||||
b := &strings.Builder{}
|
||||
notFirst := false
|
||||
b.Grow(len(name) + 3)
|
||||
for _, r := range name {
|
||||
if unicode.IsUpper(r) {
|
||||
if notFirst {
|
||||
b.WriteRune('_')
|
||||
}
|
||||
b.WriteRune(unicode.ToLower(r))
|
||||
} else {
|
||||
b.WriteRune(r)
|
||||
}
|
||||
notFirst = true
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
// NewSimpleNamingStrategy return simple naming strategy instance
|
||||
func NewSimpleNamingStrategy() NamingStrategy {
|
||||
return &simpleNamingStrategy{}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
// Copyright 2020 Michael Li <alimy@gility.net>. All rights reserved.
|
||||
// Use of this source code is governed by Apache License 2.0 that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
package naming
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// snakeNamingStrategy snake naming strategy implement
|
||||
// This implement is inspiration from https://github.com/jingzhu/gorm's naming logic.
|
||||
type snakeNamingStrategy struct {
|
||||
initialismsReplacer *strings.Replacer
|
||||
}
|
||||
|
||||
func (s *snakeNamingStrategy) Naming(name string) string {
|
||||
if name == "" {
|
||||
return ""
|
||||
}
|
||||
|
||||
var lastCase, currCase, nextCase, nextNumber bool
|
||||
value := s.initialismsReplacer.Replace(name)
|
||||
buf := bytes.NewBufferString("")
|
||||
lower, upper := false, true
|
||||
for i, v := range value[:len(value)-1] {
|
||||
nextCase = value[i+1] >= 'A' && value[i+1] <= 'Z'
|
||||
nextNumber = value[i+1] >= '0' && value[i+1] <= '9'
|
||||
if i > 0 {
|
||||
if currCase == upper {
|
||||
if lastCase == upper && (nextCase == upper || nextNumber == upper) {
|
||||
buf.WriteRune(v)
|
||||
} else {
|
||||
if value[i-1] != '_' && value[i+1] != '_' {
|
||||
buf.WriteRune('_')
|
||||
}
|
||||
buf.WriteRune(v)
|
||||
}
|
||||
} else {
|
||||
buf.WriteRune(v)
|
||||
if i == len(value)-2 && (nextCase == upper && nextNumber == lower) {
|
||||
buf.WriteRune('_')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
currCase = upper
|
||||
buf.WriteRune(v)
|
||||
}
|
||||
lastCase, currCase = currCase, nextCase
|
||||
}
|
||||
|
||||
buf.WriteByte(value[len(value)-1])
|
||||
res := strings.ToLower(buf.String())
|
||||
return res
|
||||
}
|
||||
|
||||
// NewSnakeNamingStrategy return snake naming strategy instance
|
||||
func NewSnakeNamingStrategy() NamingStrategy {
|
||||
// Copied from golint
|
||||
initialisms := []string{
|
||||
"API", "ASCII", "CPU", "CSS", "DNS", "EOF", "GUID", "HTML", "HTTP",
|
||||
"HTTPS", "ID", "IP", "JSON", "LHS", "QPS", "RAM", "RHS", "RPC", "SLA",
|
||||
"SMTP", "SSH", "TLS", "TTL", "UID", "UI", "UUID", "URI", "URL", "UTF8",
|
||||
"VM", "XML", "XSRF", "XSS"}
|
||||
|
||||
var oldnews []string
|
||||
for _, initialism := range initialisms {
|
||||
oldnews = append(oldnews, initialism, strings.Title(strings.ToLower(initialism)))
|
||||
}
|
||||
replacer := strings.NewReplacer(oldnews...)
|
||||
|
||||
return &snakeNamingStrategy{
|
||||
initialismsReplacer: replacer,
|
||||
}
|
||||
}
|
@ -1 +1 @@
|
||||
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-8b4e1776.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};
|
||||
import{_ as s}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as a}from"./vue-router-b8e3382f.js";import{F as i,e as c,a2 as u}from"./naive-ui-62663ad7.js";import{d as l,c as d,V as t,a1 as o,o as f,e as x}from"./@vue-e0e89260.js";import{_ as g}from"./index-08d8af97.js";import"./vuex-473b3783.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-6332ad63.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const v=l({__name:"404",setup(h){const e=a(),_=()=>{e.push({path:"/"})};return(k,w)=>{const n=s,p=c,r=u,m=i;return f(),d("div",null,[t(n,{title:"404"}),t(m,{class:"main-content-wrap wrap404",bordered:""},{default:o(()=>[t(r,{status:"404",title:"404 资源不存在",description:"再看看其他的吧"},{footer:o(()=>[t(p,{onClick:_},{default:o(()=>[x("回主页")]),_:1})]),_:1})]),_:1})])}}});const M=g(v,[["__scopeId","data-v-e62daa85"]]);export{M as default};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
import{_ as F}from"./post-skeleton-627d3fc3.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-8b4e1776.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-d502290a.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",H,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default};
|
||||
import{_ as F}from"./post-skeleton-41befd31.js";import{_ as N}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as V}from"./vuex-473b3783.js";import{b as z}from"./vue-router-b8e3382f.js";import{a as A}from"./formatTime-cdf4e6f1.js";import{d as R,r as n,j as S,c as o,V as a,a1 as p,o as e,_ as u,O as l,F as I,a4 as L,Q as M,a as s,M as _,L as O}from"./@vue-e0e89260.js";import{F as P,G as j,I as q,H as D}from"./naive-ui-62663ad7.js";import{_ as E}from"./index-08d8af97.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./@vicons-6332ad63.js";import"./moment-2ab8298d.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";/* empty css */const G={key:0,class:"pagination-wrap"},H={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={class:"bill-line"},$=R({__name:"Anouncement",setup(J){const d=V(),g=z(),v=n(!1),r=n([]),i=n(+g.query.p||1),f=n(20),c=n(0),h=m=>{i.value=m};return S(()=>{}),(m,K)=>{const y=N,k=j,x=F,w=q,B=D,C=P;return e(),o("div",null,[a(y,{title:"公告"}),a(C,{class:"main-content-wrap",bordered:""},{footer:p(()=>[c.value>1?(e(),o("div",G,[a(k,{page:i.value,"onUpdate:page":h,"page-slot":u(d).state.collapsedRight?5:8,"page-count":c.value},null,8,["page","page-slot","page-count"])])):l("",!0)]),default:p(()=>[v.value?(e(),o("div",H,[a(x,{num:f.value},null,8,["num"])])):(e(),o("div",Q,[r.value.length===0?(e(),o("div",T,[a(w,{size:"large",description:"暂无数据"})])):l("",!0),(e(!0),o(I,null,L(r.value,t=>(e(),M(B,{key:t.id},{default:p(()=>[s("div",U,[s("div",null,"NO."+_(t.id),1),s("div",null,_(t.reason),1),s("div",{class:O({income:t.change_amount>=0,out:t.change_amount<0})},_((t.change_amount>0?"+":"")+(t.change_amount/100).toFixed(2)),3),s("div",null,_(u(A)(t.created_on)),1)])]),_:2},1024))),128))]))]),_:1})])}}});const kt=E($,[["__scopeId","data-v-d4d04859"]]);export{kt as default};
|
@ -1 +0,0 @@
|
||||
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-cf654b7f.js";import{_ as V}from"./post-skeleton-627d3fc3.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as I}from"./vuex-473b3783.js";import{b as N}from"./vue-router-b8e3382f.js";import{K as R,_ as j}from"./index-8b4e1776.js";import{d as q,r as s,j as E,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as G,G as H,I as K,H as L}from"./naive-ui-62663ad7.js";import"./content-c0ce69b7.js";import"./@vicons-d502290a.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const O={key:0,class:"skeleton-wrap"},Q={key:1},T={key:0,class:"empty-wrap"},U={key:1},A={key:2},D={key:0,class:"pagination-wrap"},J=q({__name:"Collection",setup(W){const m=I(),y=N(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,R({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return E(()=>{u()}),(n,X)=>{const C=$,b=V,x=K,z=P,d=L,B=S,F=G,M=H;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",O,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",Q,[i.value.length===0?(t(),o("div",T,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",U,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",D,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Mt=j(J,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};
|
@ -0,0 +1 @@
|
||||
import{_ as P,a as S}from"./post-item.vue_vue_type_style_index_0_lang-3baf8ba8.js";import{_ as V}from"./post-skeleton-41befd31.js";import{_ as $}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as I}from"./vuex-473b3783.js";import{b as L}from"./vue-router-b8e3382f.js";import{L as N,_ as R}from"./index-08d8af97.js";import{d as j,r as s,j as q,c as o,V as e,a1 as c,_ as g,O as v,o as t,F as f,a4 as h,Q as k}from"./@vue-e0e89260.js";import{F as E,G,I as H,H as O}from"./naive-ui-62663ad7.js";import"./content-91ba374b.js";import"./@vicons-6332ad63.js";import"./paopao-video-player-aa5e8b3f.js";import"./formatTime-cdf4e6f1.js";import"./moment-2ab8298d.js";import"./copy-to-clipboard-1dd3075d.js";import"./toggle-selection-93f4ad84.js";import"./vooks-a50491fd.js";import"./evtd-b614532e.js";import"./axios-4a70c6fc.js";/* empty css */import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./@css-render-580d83ec.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";const Q={key:0,class:"skeleton-wrap"},T={key:1},U={key:0,class:"empty-wrap"},A={key:1},D={key:2},J={key:0,class:"pagination-wrap"},K=j({__name:"Collection",setup(W){const m=I(),y=L(),_=s(!1),i=s([]),p=s(+y.query.p||1),l=s(20),r=s(0),u=()=>{_.value=!0,N({page:p.value,page_size:l.value}).then(n=>{_.value=!1,i.value=n.list,r.value=Math.ceil(n.pager.total_rows/l.value),window.scrollTo(0,0)}).catch(n=>{_.value=!1})},w=n=>{p.value=n,u()};return q(()=>{u()}),(n,X)=>{const C=$,b=V,x=H,z=P,d=O,B=S,F=E,M=G;return t(),o("div",null,[e(C,{title:"收藏"}),e(F,{class:"main-content-wrap",bordered:""},{default:c(()=>[_.value?(t(),o("div",Q,[e(b,{num:l.value},null,8,["num"])])):(t(),o("div",T,[i.value.length===0?(t(),o("div",U,[e(x,{size:"large",description:"暂无数据"})])):v("",!0),g(m).state.desktopModelShow?(t(),o("div",A,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(z,{post:a},null,8,["post"])]),_:2},1024))),128))])):(t(),o("div",D,[(t(!0),o(f,null,h(i.value,a=>(t(),k(d,{key:a.id},{default:c(()=>[e(B,{post:a},null,8,["post"])]),_:2},1024))),128))]))]))]),_:1}),r.value>0?(t(),o("div",J,[e(M,{page:p.value,"onUpdate:page":w,"page-slot":g(m).state.collapsedRight?5:8,"page-count":r.value},null,8,["page","page-slot","page-count"])])):v("",!0)])}}});const Mt=R(K,[["__scopeId","data-v-a5302c9b"]]);export{Mt as default};
|
@ -1 +1 @@
|
||||
import{u as M,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as T,I as j,H as E}from"./naive-ui-62663ad7.js";import{_ as b,N as G}from"./index-8b4e1776.js";import{_ as H}from"./post-skeleton-627d3fc3.js";import{_ as L}from"./main-nav.vue_vue_type_style_index_0_lang-c955aa6b.js";import{u as O}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-d502290a.js";/* empty css */const Q={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=M(),u=t=>{l.push({name:"user",query:{username:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",Q,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-08ee9b2e"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=O(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),G({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=L,I=H,z=j,B=X,N=E,V=D,F=T;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(V,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(N,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(F,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default};
|
||||
import{u as N,b as P}from"./vue-router-b8e3382f.js";import{d as k,o as e,c as n,a as s,V as a,M as d,r as c,j as R,a1 as f,_ as S,O as h,F as y,a4 as U,Q as q}from"./@vue-e0e89260.js";import{o as x,F as D,G as O,I as T,H as j}from"./naive-ui-62663ad7.js";import{_ as b,O as E}from"./index-08d8af97.js";import{_ as G}from"./post-skeleton-41befd31.js";import{_ as H}from"./main-nav.vue_vue_type_style_index_0_lang-18d4a8d3.js";import{u as L}from"./vuex-473b3783.js";import"./seemly-76b7b838.js";import"./vueuc-59ca65c3.js";import"./evtd-b614532e.js";import"./@css-render-580d83ec.js";import"./vooks-a50491fd.js";import"./vdirs-b0483831.js";import"./@juggle-41516555.js";import"./css-render-6a5c5852.js";import"./@emotion-8a8e73f6.js";import"./lodash-es-8412e618.js";import"./treemate-25c27bff.js";import"./async-validator-dee29e8b.js";import"./date-fns-975a2d8f.js";import"./axios-4a70c6fc.js";import"./@vicons-6332ad63.js";/* empty css */const Q={class:"avatar"},A={class:"base-info"},J={class:"username"},K={class:"uid"},W=k({__name:"contact-item",props:{contact:{}},setup(C){const l=N(),u=t=>{l.push({name:"user",query:{username:t}})};return(t,o)=>{const _=x;return e(),n("div",{class:"contact-item",onClick:o[0]||(o[0]=r=>u(t.contact.username))},[s("div",Q,[a(_,{size:"large",src:t.contact.avatar},null,8,["src"])]),s("div",A,[s("div",J,[s("strong",null,d(t.contact.nickname),1),s("span",null," @"+d(t.contact.username),1)]),s("div",K,"UID. "+d(t.contact.user_id),1)])])}}});const X=b(W,[["__scopeId","data-v-08ee9b2e"]]),Y={key:0,class:"skeleton-wrap"},Z={key:1},tt={key:0,class:"empty-wrap"},et={key:0,class:"pagination-wrap"},ot=k({__name:"Contacts",setup(C){const l=L(),u=P(),t=c(!1),o=c([]),_=c(+u.query.p||1),r=c(20),m=c(0),w=i=>{_.value=i,v()};R(()=>{v()});const v=(i=!1)=>{o.value.length===0&&(t.value=!0),E({page:_.value,page_size:r.value}).then(p=>{t.value=!1,o.value=p.list,m.value=Math.ceil(p.pager.total_rows/r.value),i&&setTimeout(()=>{window.scrollTo(0,99999)},50)}).catch(p=>{t.value=!1})};return(i,p)=>{const $=H,I=G,z=T,B=X,V=j,F=D,M=O;return e(),n(y,null,[s("div",null,[a($,{title:"好友"}),a(F,{class:"main-content-wrap",bordered:""},{default:f(()=>[t.value?(e(),n("div",Y,[a(I,{num:r.value},null,8,["num"])])):(e(),n("div",Z,[o.value.length===0?(e(),n("div",tt,[a(z,{size:"large",description:"暂无数据"})])):h("",!0),(e(!0),n(y,null,U(o.value,g=>(e(),q(V,{key:g.user_id},{default:f(()=>[a(B,{contact:g},null,8,["contact"])]),_:2},1024))),128))]))]),_:1})]),m.value>0?(e(),n("div",et,[a(M,{page:_.value,"onUpdate:page":w,"page-slot":S(l).state.collapsedRight?5:8,"page-count":m.value},null,8,["page","page-slot","page-count"])])):h("",!0)],64)}}});const zt=b(ot,[["__scopeId","data-v-3b2bf978"]]);export{zt as default};
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue