Exemple #1
0
    def get(self):
        the_get = Get()
        user_id = the_get.get_user_id(self)
        friend_id = the_get.get_friend_id(self)
        latitude = the_get.get_friend_id(self)
        longitude = the_get.get_friend_id(self)

        instance = LogicMapDistance()
        result = instance.map_distance(user_id, friend_id, latitude, longitude)
        return self.write(OHHOOperation.dict2json(result))
Exemple #2
0
    def get(self):
        the_get = Get()
        user_id = the_get.get_user_id(self)
        friend_user_id = the_get.get_friend_id(self)
        is_delete = the_get.get_delete(self)
        user = User()
        meet = Meet()
        the_user = user.get_by_id(user_id)
        the_friend = user.get_by_id(friend_user_id)
        if is_delete:
            met_instance = meet.get_met_by_users(user_id, friend_user_id)
            success = meet.met.delete(met_instance)
            if success:
                result = Result.result_success("delete successfully!")
            else:
                result = Result.result_failed("delete failed!")
        else:
            if the_user and the_friend:

                success = meet.add_apply(user_id, friend_user_id)
                if success:
                    apply = meet.get_apply_by_user_and_friend(
                        user_id, friend_user_id)
                    if apply:
                        data = dict()
                        data["apply_id"] = apply.id
                        data["user_id"] = user_id
                        data["another_user_id"] = friend_user_id
                        success = meet.add_met(data)
                        if success:
                            result = Result.result_success("add successfully!")
                        else:
                            result = Result.result_failed("add met failed!")
                    else:
                        result = Result.result_failed("get apply failed!")
                else:
                    result = Result.result_failed("add apply failed!")
            else:
                result = Result.result_failed("user does not exist!")

        self.write(OHHOOperation.dict2json(result))
Exemple #3
0
    def get(self):
        # name = self.get_body_argument("user_name", None)
        the_get = Get()
        result = dict()
        base_url = the_get.get_base_url(self)
        user_id = the_get.get_user_id(self)
        friend_user_id = the_get.get_friend_id(self)
        user = User()
        friend_user_id2 = user_id if user_id else 4
        user_id = 4
        friend_user_id = friend_user_id if friend_user_id else 13

        log_string = "1234567890"
        OHHOLog.print_log(log_string)
        # message = user.get_user_basic_information(user_id, base_url)
        for i in range(100):
            OHHOLog.print_log(user.push(str(i), friend_user_id, user_id))
            OHHOLog.print_log(user.push(str(i), friend_user_id2, user_id))
        # return Result.result_success()

        self.write(OHHOOperation.dict2json(Result.result_success()))