service.py 1.0 KB
Newer Older
H
hjdhnx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File  : service.py.py
# Author: DaShenHan&道长-----先苦后甜,任凭晚风拂柳颜------
# Date  : 2022/9/6

from base.R import copy_utils
from models.storage import Storage
from utils.system import cfg

class storage_service(object):

    @staticmethod
    def query_all():
        # 查询所有
        res = Storage.query.all()
        return copy_utils.obj_to_list(res)

    def __init__(self):
        if not self.getItem('LIVE_URL'):
            print('开始初始化lsg')
            self.setItem('LIVE_URL', cfg.get('LIVE_URL'))

H
hjdhnx 已提交
24 25 26 27
        # if not self.getItem('USE_PY'):
        #     print('开始初始化USE_PY')
        #     self.setItem('USE_PY', '1' if cfg.get('USE_PY') else '')

H
hjdhnx 已提交
28 29 30 31 32 33 34 35 36 37 38
    @classmethod
    def getItem(self, key, value=''):
        return Storage.getItem(key,value)

    @classmethod
    def setItem(self,key, value):
        return Storage.setItem(key, value)

    @classmethod
    def clearItem(self,key):
        return Storage.clearItem(key)