예제 #1
0
 def get_user_info(user_extension):
     result = dict()
     result = Objects.get_object_info(user_extension)
     temp = Objects.get_object_info(user_extension.user)
     temp["user_id"] = temp["id"]
     result["userextension_id"] = result["id"]
     result.update(temp)
     return result
예제 #2
0
 def get_info(red_envelope):
     try:
         result = Objects.get_object_info(red_envelope)
         return result
     except Exception as ex:
         Logs.print_current_function_name_and_line_number(ex)
         return dict()
    def get_big_categories():
        category_list = list()
        categories = ShopCategory.objects.filter(parent_id=1)
        for c in categories:
            temp = Objects.get_object_info(c)
            category_list.append(temp)

        return category_list
예제 #4
0
    def get_category_info(category):
        result = Objects.get_object_info(category)
        owners = list()
        for owner in category.owners.all():
            user_extension = Users.get_user_extension(owner.username)
            if user_extension:
                owners.append(Users.get_user_info(user_extension))

        result["owners"] = owners
        return result
예제 #5
0
    def get_info(detector):

        result = Objects.get_object_info(detector)
        result_weather = None
        try:
            relation = DetectorRelation.objects.exclude(state=False).get(mac_address=detector.mac_address)
            result["shop_address"] = relation.address
            # Logs.print_log("shop_address", relation.address)
            # if relation.shop:
            #     if relation.shop.dianping_business_id:
            #         result["shop_address"] = relation.shop.dianping_city + relation.shop.dianping_address
            #     else:
            #         if relation.shop.address:
            #             result["shop_address"] = relation.shop.address.detail_address
            #         else:
            #             result["shop_address"] = None
            # Logs.print_log("relation.city", relation.city)
            if relation.city:
                weather = Weathers.get_weather_from_db(relation.city)
                result["address"] = relation.address

                if not weather or Weathers.is_weather_in_db_timeout(weather):
                    weather = Weathers.get_weather_from_heweather(relation.city)
                    # Logs.print_log("weather", weather)
                    Weathers.create_weather(weather)
                    result_weather = weather
                else:
                    result_weather = Weathers.get_weather_info(weather)
        except Exception as ex:
            Logs.print_current_function_name_and_line_number(ex)
            result_weather = None
        if result_weather:
            for (key, value) in result_weather.items():
                result["weather_" + key] = value

        return result
예제 #6
0
 def get_info(label):
     return Objects.get_object_info(label)
예제 #7
0
 def get_info(comment):
     return Objects.get_object_info(comment)
예제 #8
0
 def get_info(address):
     return Objects.get_object_info(address)
예제 #9
0
 def get_info(publish):
     result = dict()
     result = Objects.get_object_info(publish)
     return result
예제 #10
0
 def get_info(game):
     result = Objects.get_object_info(game)
     result["ranking"] = Games.get_ranking(game.score)
     return result
예제 #11
0
 def get_one(detector):
     return Objects.get_object_info(detector)
예제 #12
0
 def get_detector_relation_info(detector_relation):
     return Objects.get_object_info(detector_relation)
예제 #13
0
 def get_info(article):
     return Objects.get_object_info(article)
예제 #14
0
 def get_weather_info(weather):
     try:
         return Objects.get_object_info(weather)
     except Exception as ex:
         Logs.print_current_function_name_and_line_number(ex)
         return None
예제 #15
0
 def get_shop_info(shop):
     result = Objects.get_object_info(shop)
     return result