import math
import random


def gen_object_id(user_id=None, object_class='found'):
    """
    随机生成 OBJECT_ID
    :param user_id:  用户ID
    :param object_class:  目标类别， found, study, play, second
    :return:
    """
    # 生成6位随机数
    nums = math.floor(1e6 * random.random())
    if user_id is None or '' == user_id:
        return '{0}_{1}_'.format(object_class, str(nums))

    return '{0}_{1}_{2}'.format(object_class, str(nums), user_id)