Skip to content
GitLab
菜单
项目
群组
代码片段
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录/注册
切换导航
菜单
打开侧边栏
Wei Zhu
yobot
提交
a20d5974
提交
a20d5974
编辑于
7月 28, 2020
作者:
yuudi
浏览文件
feat: user-list paged display
上级
f6c2a625
变更
9
Hide whitespace changes
Inline
Side-by-side
docs/v3/ver.json
浏览文件 @
a20d5974
{
"stable"
:
{
"version"
:
350
5
,
"url"
:
"http://download.yobot.win/yobot/yobot350
5
.zip"
"version"
:
350
7
,
"url"
:
"http://download.yobot.win/yobot/yobot350
7
.zip"
}
}
\ No newline at end of file
documents/install/Windows-source.md
浏览文件 @
a20d5974
...
...
@@ -60,22 +60,28 @@ yobot 三代基于酷Q机器人和 httpapi 插件实现
源码运行需要使用git作为版本管理和更新工具,如果没有使用过git可以阅读:
[
git官网
](
https://git-scm.com/
)
,
[
git教程
](
https://www.runoob.com/git/git-tutorial.html
)
::: warning
以下命令均在
*命令提示符(Command Prompt)*
中使用,不要使用 git bash!!
:::
确保 python 版本至少为 3.6
下载源码
`git clone https://github.com/pcrbot/yobot.git`
或者使用国内源
`git clone https://gitee.com/yobot/yobot.git`
请尽量使用git clone而不是download zip,否则无法自动更新版本
请尽量使用
git clone
而不是
download zip,否则无法自动更新版本
进入目录
`cd yobot`
进入目录
`cd yobot
\src\client
`
安装依赖
`pip install -r
src\client\
requirements.txt`
安装依赖
`pip install -r requirements.txt`
(如果在国内建议加上参数
`-i https://pypi.tuna.tsinghua.edu.cn/simple`
)
启动:
`
cd src\client &
python main.py`
启动:
`python main.py`
如果需要更换主机地址、端口等信息请修改
src
\c
lient
\y
obot_config.json配置文件。
如果需要更换主机地址、端口等信息请修改
`yobot_data
\yobot_config.json
`
配置文件。

...
...
@@ -87,36 +93,7 @@ yobot 三代基于酷Q机器人和 httpapi 插件实现
## 常见问题
### 如何修改运行的端口号
需要修改服务程序的端口号和httpapi的配置文件
服务程序的配置文件在yobot
\y
obot_config.json,port字段就是端口号,默认值为9222,可以修改为8000至65535之间的数。
httpapi的配置文件如
[
配置小节
](
#配置
)
所示,请将文件中默认端口9222(三处)改为与服务程序相同的端口号。
### 其他问题
见
[
FAQ
](
../usage/faq.md
)
## 注意事项
-
**请不要使用重要的QQ号作为机器人**
-
系统至少要windows 7或者windows server 2008
-
机器人的数据都是分群存储的,一个机器人可以服务多个群
-
本机器人不包含“签到”、“宠物”等通用功能,如果需要可以在
[
酷Q插件社区
](
https://cqp.cc/b/app
)
搜索下载。
-
发送图片,发送语音等功能必须购买高级版才能使用,yobot三代所有功能均可用文字实现,不需要高级版
容易引起封号的行为:
-
异地登录后立刻修改昵称头像(可以先修改再异地登录)
-
新注册的号在机房ip登录(ip真人鉴别有很多,比如
[
这个
](
https://ip.rtbasia.com/
)
)
-
机器人大量地发长消息(尤其是抽卡,条件允许可以改用图片抽卡)
-
机器人24小时不停发消息(如果真的有需求可以让两个账号轮班)
-
账号在短时间内加了大量的群(可以慢慢加,最好不超过10个群)
-
大量高危账号在同一个ip登录(可以慢慢加,一台服务器最好不超过5个账号)
如果文中下载链接失效,可以使用
[
备用网盘
](
https://www.lanzous.com/b00n6dnqh
)
见
[
FAQ
](
../usage/faq.md
)
## 开始 web 模式
...
...
documents/project/changelog.md
浏览文件 @
a20d5974
...
...
@@ -2,6 +2,7 @@
## 3.6.4
-
优化用户列表
-
修复几个不为人知的 bug
## 3.6.3
...
...
src/client/public/static/admin/users.js
浏览文件 @
a20d5974
...
...
@@ -2,7 +2,21 @@ var vm = new Vue({
el
:
'
#app
'
,
data
:
{
isLoading
:
true
,
moreLoading
:
false
,
userData
:
[],
querys
:
{
page
:
1
,
page_size
:
50
,
qqid
:
null
,
clan_group_id
:
null
,
authority_group
:
null
,
},
query_input
:
{
qqid
:
null
,
clan_group_id
:
null
,
authority_group
:
null
,
},
has_more
:
true
,
authtype
:
[{
value
:
100
,
label
:
'
成员
'
,
...
...
@@ -15,7 +29,7 @@ var vm = new Vue({
}],
},
mounted
()
{
this
.
refresh
();
this
.
load_more
();
},
methods
:
{
datestr
:
function
(
ts
)
{
...
...
@@ -26,15 +40,30 @@ var vm = new Vue({
nd
.
setTime
(
ts
*
1000
);
return
nd
.
toLocaleString
(
'
chinese
'
,
{
hour12
:
false
,
timeZone
:
'
asia/shanghai
'
});
},
refresh
:
function
(
event
)
{
search
:
function
(
event
)
{
Object
.
assign
(
this
.
querys
,
this
.
query_input
);
this
.
querys
.
page
=
1
;
this
.
isLoading
=
true
;
this
.
userData
=
[];
this
.
load_more
();
},
load_more
:
function
(
event
)
{
this
.
moreLoading
=
true
;
var
thisvue
=
this
;
axios
.
post
(
api_path
,
{
action
:
'
get_data
'
,
querys
:
thisvue
.
querys
,
csrf_token
:
csrf_token
,
}).
then
(
function
(
res
)
{
if
(
res
.
data
.
code
==
0
)
{
thisvue
.
userData
=
res
.
data
.
data
;
thisvue
.
userData
.
push
(...
res
.
data
.
data
)
;
thisvue
.
isLoading
=
false
;
thisvue
.
moreLoading
=
false
;
if
(
res
.
data
.
data
.
length
<
thisvue
.
querys
.
page_size
)
{
thisvue
.
has_more
=
false
;
}
else
{
thisvue
.
querys
.
page
+=
1
;
}
}
else
{
thisvue
.
$alert
(
res
.
data
.
message
,
'
加载数据错误
'
);
}
...
...
src/client/public/template/admin/users.html
浏览文件 @
a20d5974
...
...
@@ -17,6 +17,26 @@
<body>
<div
id=
"app"
>
<el-page-header
@
back=
"location='..'"
content=
"yobot用户管理"
></el-page-header>
<br>
<el-form
:inline=
"true"
:model=
"query_input"
>
<el-form-item
label=
"QQ号"
>
<el-input
v-model=
"query_input.qqid"
placeholder=
"QQ号"
></el-input>
</el-form-item>
<el-form-item
label=
"公会战群号"
>
<el-input
v-model=
"query_input.clan_group_id"
placeholder=
"公会战群号"
></el-input>
</el-form-item>
<el-form-item
label=
"用户组"
>
<el-select
v-model=
"query_input.authority_group"
placeholder=
"用户组"
>
<el-option
label=
"不限"
value=
""
></el-option>
<el-option
label=
"主人"
value=
"1"
></el-option>
<el-option
label=
"公会战管理员"
value=
"10"
></el-option>
<el-option
label=
"成员"
value=
"100"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
@
click=
"search"
icon=
"el-icon-search"
>
搜索
</el-button>
</el-form-item>
</el-form>
<el-table
:data=
"userData"
style=
"width: 100%"
v-loading=
"isLoading"
stripe
>
<el-table-column
label=
"详情页"
width=
"30"
>
<template
slot-scope=
"scope"
>
...
...
@@ -45,6 +65,9 @@
</template>
</el-table-column>
</el-table>
<el-button
v-if=
"has_more"
icon=
"el-icon-arrow-down"
:loading=
"moreLoading"
@
click=
"load_more"
>
加载更多
</el-button>
<el-button
v-else
icon=
"el-icon-arrow-down"
disabled
>
已加载全部
</el-button>
<el-backtop></el-backtop>
</div>
</body>
<script>
...
...
src/client/ybplugins/jjc_consult.py
浏览文件 @
a20d5974
...
...
@@ -90,9 +90,9 @@ class Consult:
self
.
__init__
(
self
.
setting
,
refresh_nickfile
=
True
)
return
self
.
user_input
(
cmd
,
True
)
def_set
.
add
(
item
)
def_lst
=
list
(
def_set
)
if
len
(
def_lst
)
<
3
:
raise
ValueError
(
"
防守人数过少
"
)
def_lst
=
list
(
def_set
)
if
len
(
def_lst
)
<
5
:
raise
ValueError
(
"
需要完整的5人防守队伍
"
)
return
def_lst
async
def
jjcsearch_async
(
self
,
def_lst
,
region
):
...
...
src/client/ybplugins/settings.py
浏览文件 @
a20d5974
...
...
@@ -9,6 +9,15 @@ from quart import Quart, jsonify, redirect, request, session, url_for
from
.templating
import
render_template
from
.ybdata
import
Clan_group
,
User
_returned_query_fileds
=
[
User
.
qqid
,
User
.
nickname
,
User
.
clan_group_id
,
User
.
authority_group
,
User
.
last_login_time
,
User
.
last_login_ipaddr
,
]
class
Setting
:
Passive
=
False
...
...
@@ -21,6 +30,39 @@ class Setting:
*
args
,
**
kwargs
):
self
.
setting
=
glo_setting
def
_get_users_json
(
self
,
req_querys
:
dict
):
querys
=
[]
if
req_querys
.
get
(
'qqid'
):
querys
.
append
(
User
.
qqid
==
req_querys
[
'qqid'
]
)
if
req_querys
.
get
(
'clan_group_id'
):
querys
.
append
(
User
.
clan_group_id
==
req_querys
[
'clan_group_id'
]
)
if
req_querys
.
get
(
'authority_group'
):
querys
.
append
(
User
.
authority_group
==
req_querys
[
'authority_group'
]
)
users
=
User
.
select
(
User
.
qqid
,
User
.
nickname
,
User
.
clan_group_id
,
User
.
authority_group
,
User
.
last_login_time
,
User
.
last_login_ipaddr
,
).
where
(
User
.
deleted
==
False
,
*
querys
,
).
paginate
(
page
=
req_querys
[
'page'
],
paginate_by
=
req_querys
[
'page_size'
]
)
return
json
.
dumps
({
'code'
:
0
,
'data'
:
[
model_to_dict
(
u
,
only
=
_returned_query_fileds
)
for
u
in
users
],
})
def
register_routes
(
self
,
app
:
Quart
):
@
app
.
route
(
...
...
@@ -210,25 +252,10 @@ class Setting:
)
action
=
req
[
'action'
]
if
action
==
'get_data'
:
# 暂时先用 run_in_executor 防止阻塞,稍后再改成分页
def
_get_all_users
():
users
=
User
.
select
(
User
.
qqid
,
User
.
nickname
,
User
.
clan_group_id
,
User
.
authority_group
,
User
.
last_login_time
,
User
.
last_login_ipaddr
,
).
where
(
User
.
deleted
==
False
,
)
return
json
.
dumps
({
'code'
:
0
,
'data'
:
[
model_to_dict
(
u
)
for
u
in
users
],
})
return
await
asyncio
.
get_running_loop
().
run_in_executor
(
None
,
_get_all_users
,
self
.
_get_users_json
,
req
[
'querys'
],
)
elif
action
==
'modify_user'
:
...
...
@@ -238,7 +265,7 @@ class Setting:
(
data
.
get
(
'authority_group'
,
999
))
<=
user
.
authority_group
):
return
jsonify
(
code
=
12
,
message
=
'Exceed authorization is not allowed'
)
if
data
.
get
(
'authority_group'
)
==
1
:
self
.
setting
[
'super-admin'
].
append
(
ctx
[
'user_
id'
])
self
.
setting
[
'super-admin'
].
append
(
data
[
'qq
id'
])
save_setting
=
self
.
setting
.
copy
()
del
save_setting
[
'dirname'
]
del
save_setting
[
'verinfo'
]
...
...
src/client/ybplugins/ybdata.py
浏览文件 @
a20d5974
...
...
@@ -4,7 +4,7 @@ from playhouse.migrate import SqliteMigrator, migrate
from
.web_util
import
rand_string
_db
=
SqliteDatabase
(
None
)
_version
=
9
# 目前版本
_version
=
10
# 目前版本
MAX_TRY_TIMES
=
3
...
...
@@ -73,7 +73,7 @@ class Clan_group(_BaseModel):
class
Clan_member
(
_BaseModel
):
group_id
=
BigIntegerField
()
group_id
=
BigIntegerField
(
index
=
True
)
qqid
=
BigIntegerField
(
index
=
True
)
role
=
IntegerField
(
default
=
100
)
last_save_slot
=
IntegerField
(
null
=
True
)
...
...
@@ -87,7 +87,7 @@ class Clan_challenge(_BaseModel):
cid
=
AutoField
(
primary_key
=
True
)
bid
=
IntegerField
(
default
=
0
)
gid
=
BigIntegerField
()
qqid
=
BigIntegerField
()
qqid
=
BigIntegerField
(
index
=
True
)
challenge_pcrdate
=
IntegerField
()
challenge_pcrtime
=
IntegerField
()
boss_cycle
=
SmallIntegerField
()
...
...
@@ -99,12 +99,16 @@ class Clan_challenge(_BaseModel):
behalf
=
IntegerField
(
null
=
True
)
class
Meta
:
indexes
=
(((
'bid'
,
'gid'
),
False
),)
indexes
=
(
((
'bid'
,
'gid'
),
False
),
((
'qqid'
,
'challenge_pcrdate'
),
False
),
((
'bid'
,
'gid'
,
'challenge_pcrdate'
),
False
),
)
class
Clan_subscribe
(
_BaseModel
):
sid
=
AutoField
(
primary_key
=
True
)
gid
=
BigIntegerField
()
gid
=
BigIntegerField
(
index
=
True
)
qqid
=
IntegerField
()
subscribe_item
=
SmallIntegerField
()
message
=
TextField
(
null
=
True
)
...
...
@@ -207,9 +211,6 @@ def db_upgrade(old_version):
migrator
.
add_column
(
'user'
,
'must_change_password'
,
BooleanField
(
default
=
True
)),
)
if
old_version
<
6
:
User
.
update
({
User
.
authority_group
:
1
}).
where
(
User
.
authority_group
==
2
).
execute
()
if
old_version
<
7
:
migrate
(
migrator
.
drop_column
(
'clan_challenge'
,
'comment'
),
...
...
@@ -235,5 +236,13 @@ def db_upgrade(old_version):
migrate
(
migrator
.
add_index
(
'clan_member'
,
(
'qqid'
,),
False
)
)
if
old_version
<
10
:
migrate
(
migrator
.
add_index
(
'clan_member'
,
(
'group_id'
,),
False
),
migrator
.
add_index
(
'clan_subscribe'
,
(
'gid'
,),
False
),
migrator
.
add_index
(
'clan_challenge'
,
(
'qqid'
,),
False
),
migrator
.
add_index
(
'clan_challenge'
,
(
'qqid'
,
'challenge_pcrdate'
),
False
),
migrator
.
add_index
(
'clan_challenge'
,
(
'bid'
,
'gid'
,
'challenge_pcrdate'
),
False
),
)
DB_schema
.
replace
(
key
=
'version'
,
value
=
str
(
_version
)).
execute
()
src/client/yobot.py
浏览文件 @
a20d5974
...
...
@@ -33,8 +33,8 @@ else:
class
Yobot
:
Version
=
"[v3.6.4-beta.
3
]"
Version_id
=
20
6
Version
=
"[v3.6.4-beta.
4
]"
Version_id
=
20
7
# "git rev-list --count HEAD"
def
__init__
(
self
,
*
,
...
...
编辑
预览
Supports
Markdown
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录