import hashlib
import uuid as u


def md5(s):
    """md5加密"""
    sign_str = hashlib.md5()
    sign_str.update(s.encode('utf-8'))
    return sign_str.hexdigest()


def uuid():
    """生成uuid"""
    return str(u.uuid4())


# 页数页码校验
def wrapper_out():
    def wrapper(func):
        def inner(db, param):
            param.page = param.page if param.page else 1
            param.size = param.size if param.size else 10
            ret = func(db, param)
            return ret
        return inner
    return wrapper
