- 新增奖励方案/档位/结算/领取四表与懒结算服务 - 小程序 phbjlxx/phbjllq/phbjlphb 新接口,phbhqsj 零改动 - 后台 phbjhq/phbjbc/phbjjl 与 phbj666 权限菜单 Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
2.1 KiB
Python
62 lines
2.1 KiB
Python
"""补齐 gvsdsdk 权限码(可重复执行)。"""
|
||
import uuid
|
||
|
||
from django.core.management.base import BaseCommand
|
||
from django.utils import timezone
|
||
|
||
from gvsdsdk.models import Permission
|
||
|
||
# (PermCode, PermName, PermDesc, PermCategory)
|
||
EXTRA_PERMISSIONS = [
|
||
(
|
||
'dsks666',
|
||
'打手接单考试管理',
|
||
'配置各俱乐部考试开关、抽题规则与题库(小程序配置-打手接单考试)',
|
||
'小程序配置',
|
||
),
|
||
(
|
||
'phbj666',
|
||
'排行榜奖励配置',
|
||
'配置各俱乐部排行榜名次奖金、排序指标与领取明细(小程序配置-排行榜奖励)',
|
||
'小程序配置',
|
||
),
|
||
(
|
||
'kfhs666',
|
||
'客服聊天配置',
|
||
'配置客服欢迎语、发图确认弹窗、关键词自动回复(会话管理-客服聊天配置)',
|
||
'会话管理',
|
||
),
|
||
(
|
||
'sfbq666',
|
||
'身份装饰标签管理',
|
||
'管理小程序身份装饰标签(与用户管理-身份装饰标签菜单对应)',
|
||
'用户管理',
|
||
),
|
||
]
|
||
|
||
|
||
class Command(BaseCommand):
|
||
help = '写入 gvsdsdk Permission 表缺失的权限码(如 sfbq666)'
|
||
|
||
def handle(self, *args, **options):
|
||
sample = Permission.objects.filter(PermStatus=1).first()
|
||
tenant_uuid = sample.TenantUUID if sample else uuid.UUID('00000000-0000-0000-0000-000000000001').bytes
|
||
created = 0
|
||
for code, name, desc, category in EXTRA_PERMISSIONS:
|
||
if Permission.objects.filter(PermCode=code).exists():
|
||
self.stdout.write(f' 已存在: {code}')
|
||
continue
|
||
Permission.objects.create(
|
||
PermUUID=uuid.uuid4().bytes,
|
||
TenantUUID=tenant_uuid,
|
||
PermCode=code,
|
||
PermName=name,
|
||
PermDesc=desc,
|
||
PermCategory=category,
|
||
PermStatus=1,
|
||
CreateTime=timezone.now(),
|
||
)
|
||
created += 1
|
||
self.stdout.write(self.style.SUCCESS(f' 新增权限: {code} - {name}'))
|
||
self.stdout.write(self.style.SUCCESS(f'完成,新增 {created} 条权限'))
|