초기커밋
This commit is contained in:
528
UGQDatabase/FakeDataScript/insert_fake_data.py
Normal file
528
UGQDatabase/FakeDataScript/insert_fake_data.py
Normal file
@@ -0,0 +1,528 @@
|
||||
import uuid
|
||||
from pymongo import MongoClient
|
||||
from faker import Faker
|
||||
import json
|
||||
import datetime
|
||||
import random
|
||||
from pymongo import ReturnDocument
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class QuestContentState(Enum):
|
||||
NoneState = 0
|
||||
Editable = 1
|
||||
Test = 2
|
||||
Standby = 3
|
||||
Live = 4
|
||||
Shutdown = 5
|
||||
|
||||
class CreatorPointHistoryKind(Enum):
|
||||
NoneKind = 0
|
||||
QuestProfit = 1
|
||||
AvatarReceived = 2
|
||||
CashReceived = 3
|
||||
|
||||
def random_datetime():
|
||||
year = random.randrange(2019,2025)
|
||||
month = random.randrange(1,13)
|
||||
day = random.randrange(1,28)
|
||||
hour = random.randrange(0,24)
|
||||
minute = random.randrange(0, 60)
|
||||
second = random.randrange(0, 60)
|
||||
return datetime.datetime(year, month, day, hour, minute, second)
|
||||
|
||||
|
||||
def drop_all():
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
like_collection = ugq_db.get_collection("Like")
|
||||
bookmark_collection = ugq_db.get_collection("Bookmark")
|
||||
cp_history_collection = ugq_db.get_collection("CreatorPointHistory")
|
||||
|
||||
quest_accepted_collection = ugq_db.get_collection("QuestAccepted")
|
||||
quest_aborted_collection = ugq_db.get_collection("QuestAborted")
|
||||
quest_completed_collection = ugq_db.get_collection("QuestCompleted")
|
||||
report_collection = ugq_db.get_collection("Report")
|
||||
|
||||
account_collection.drop()
|
||||
quest_content_collection.drop()
|
||||
like_collection.drop()
|
||||
bookmark_collection.drop()
|
||||
cp_history_collection.drop()
|
||||
quest_accepted_collection.drop()
|
||||
quest_aborted_collection.drop()
|
||||
quest_completed_collection.drop()
|
||||
report_collection.drop()
|
||||
|
||||
pass
|
||||
|
||||
def init():
|
||||
quest_sequence = ugq_db.get_collection("QuestIdSequence")
|
||||
|
||||
filter = {"_id": "QuestId" }
|
||||
|
||||
found_doc = quest_sequence.find_one(filter)
|
||||
if found_doc is None:
|
||||
doc = {
|
||||
"_id": "QuestId",
|
||||
"Sequence": 0,
|
||||
"CreatedAt": datetime.datetime.now(),
|
||||
"UpdatedAt": datetime.datetime.now(),
|
||||
}
|
||||
|
||||
ret = quest_sequence.insert_one(doc)
|
||||
print("QuestIdSequence: " + str(ret))
|
||||
|
||||
|
||||
|
||||
def get_next_quest_id(ugq_db):
|
||||
|
||||
quest_sequence = ugq_db.get_collection("QuestIdSequence")
|
||||
|
||||
filter = {"_id": "QuestId" }
|
||||
update = {
|
||||
'$inc': {'Sequence' : 1},
|
||||
'$set': {'UpdatedAt': datetime.datetime.now() }
|
||||
}
|
||||
|
||||
updated_doc = quest_sequence.find_one_and_update(
|
||||
filter, update,
|
||||
return_document=ReturnDocument.AFTER
|
||||
)
|
||||
|
||||
return updated_doc["Sequence"]
|
||||
|
||||
|
||||
def insert_fake_account(ugq_db, count):
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
# account_collection.drop()
|
||||
|
||||
fake_kr = Faker('ko_KR')
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
cp = random.randrange(1, 5000)
|
||||
|
||||
account_doc = {
|
||||
"UserGuid": str(uuid.uuid4()),
|
||||
"Nickname": fake_kr.name(),
|
||||
"AdditionalSlotCount": 0,
|
||||
"GradeType": "Amature",
|
||||
"CreatorPoint": cp,
|
||||
"CreatedAt": created_at,
|
||||
"UpdatedAt": created_at,
|
||||
}
|
||||
|
||||
ret = account_collection.insert_one(account_doc)
|
||||
print("Account: " + str(ret))
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def insert_fake_quest_tasks(ugq_db, quest_content_id):
|
||||
pass
|
||||
|
||||
|
||||
def insert_fake_quest_content(ugq_db):
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
# quest_content_collection.drop()
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
accounts = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
accounts.append({
|
||||
"UserGuid": document["UserGuid"],
|
||||
"Nickname": document["Nickname"]
|
||||
})
|
||||
|
||||
fake_en = Faker('en_US')
|
||||
fake_kr = Faker('ko_KR')
|
||||
fake_jp = Faker('ja_JP')
|
||||
for account in accounts:
|
||||
|
||||
create_count = random.randrange(1, 3)
|
||||
for i in range(create_count):
|
||||
|
||||
created_at = random_datetime()
|
||||
|
||||
quest_id = get_next_quest_id(ugq_db)
|
||||
revision = random.randrange(1, 1000)
|
||||
cost = random.randrange(100, 5000)
|
||||
|
||||
beacon_id = random.randrange(1001, 1059)
|
||||
|
||||
randValue = random.randrange(0, len(QuestContentState))
|
||||
state = QuestContentState(randValue).name
|
||||
if randValue == 0:
|
||||
state = "None"
|
||||
|
||||
quest_content_doc = {
|
||||
"UserGuid": account["UserGuid"],
|
||||
"Author": account["Nickname"],
|
||||
"GradeType": "Amature",
|
||||
"QuestId": quest_id,
|
||||
"Revision": revision,
|
||||
"BeaconId": beacon_id,
|
||||
"Title": {
|
||||
"Kr": fake_kr.company(),
|
||||
"En": fake_en.company(),
|
||||
"Jp": fake_jp.company(),
|
||||
},
|
||||
"Langs": ["en", "kr", "jp"],
|
||||
"UploadCounter": 0,
|
||||
"TitleImagePath": "",
|
||||
"BannerImagePath": "",
|
||||
"Description": {
|
||||
"Kr": fake_kr.catch_phrase(),
|
||||
"En": fake_en.catch_phrase(),
|
||||
"Jp": fake_jp.catch_phrase(),
|
||||
},
|
||||
"State": "Live",
|
||||
"Cost": cost,
|
||||
"Tasks": [],
|
||||
"CreatedAt": created_at,
|
||||
"UpdatedAt": created_at,
|
||||
"IsDeleted": False,
|
||||
"DeletedAt": datetime.datetime(1, 1, 1)
|
||||
}
|
||||
|
||||
# print(quest_content_doc)
|
||||
ret = quest_content_collection.insert_one(quest_content_doc)
|
||||
print("QuestContent: " + str(ret))
|
||||
# for account in accounts:
|
||||
|
||||
|
||||
def insert_fake_like(ugq_db):
|
||||
|
||||
like_collection = ugq_db.get_collection("Like")
|
||||
# like_collection.drop()
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append(document["QuestId"])
|
||||
|
||||
for user_guid in user_guids:
|
||||
|
||||
quest_ids_copy = quest_ids.copy()
|
||||
random.shuffle(quest_ids_copy)
|
||||
|
||||
count = random.randrange(1, len(quest_ids_copy))
|
||||
|
||||
for i in range(count):
|
||||
|
||||
created_at = random_datetime()
|
||||
|
||||
like_doc = {
|
||||
"QuestId": quest_ids_copy[i],
|
||||
"UserGuid": user_guid,
|
||||
"CreatedAt": created_at,
|
||||
}
|
||||
|
||||
ret = like_collection.insert_one(like_doc)
|
||||
print("Like: " + str(ret))
|
||||
# for i in range(count):
|
||||
|
||||
# for user_guid in user_guids:
|
||||
|
||||
|
||||
def insert_fake_bookmark(ugq_db):
|
||||
|
||||
bookmark_collection = ugq_db.get_collection("Bookmark")
|
||||
# bookmark_collection.drop()
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append(document["QuestId"])
|
||||
|
||||
for user_guid in user_guids:
|
||||
|
||||
quest_ids_copy = quest_ids.copy()
|
||||
random.shuffle(quest_ids_copy)
|
||||
|
||||
count = random.randrange(1, len(quest_ids_copy))
|
||||
|
||||
for i in range(count):
|
||||
|
||||
created_at = random_datetime()
|
||||
|
||||
bookmark_doc = {
|
||||
"QuestId": quest_ids_copy[i],
|
||||
"UserGuid": user_guid,
|
||||
"CreatedAt": created_at,
|
||||
}
|
||||
|
||||
ret = bookmark_collection.insert_one(bookmark_doc)
|
||||
print("Bookmark: " + str(ret))
|
||||
# for i in range(count):
|
||||
|
||||
# for user_guid in user_guids:
|
||||
|
||||
|
||||
def insert_fake_creator_point_history(ugq_db):
|
||||
|
||||
cp_history_collection = ugq_db.get_collection("CreatorPointHistory")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(1, len(CreatorPointHistoryKind))
|
||||
kind = CreatorPointHistoryKind(randValue).name
|
||||
|
||||
amount = 0
|
||||
if kind == "QuestProfit":
|
||||
amount = random.randrange(1, 5000)
|
||||
else:
|
||||
amount = -random.randrange(1, 5000)
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
cp_history_doc = {
|
||||
"UserGuid": user_guid,
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"Kind": kind,
|
||||
"DetailReason": "",
|
||||
"Amount": amount,
|
||||
"TotalAmount": amount,
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = cp_history_collection.insert_one(cp_history_doc)
|
||||
print("CreatorPointHistory: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_quest_accepted(ugq_db):
|
||||
|
||||
quest_accepted_collection = ugq_db.get_collection("QuestAccepted")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
accepted_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"Reason": "Player",
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = quest_accepted_collection.insert_one(accepted_doc)
|
||||
print("QuestAccepted: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_quest_aborted(ugq_db):
|
||||
|
||||
quest_aborted_collection = ugq_db.get_collection("QuestAborted")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
aborted_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"Reason": "Player",
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = quest_aborted_collection.insert_one(aborted_doc)
|
||||
print("QuestAborted: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_quest_completed(ugq_db):
|
||||
|
||||
quest_completed_collection = ugq_db.get_collection("QuestCompleted")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
completed_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = quest_completed_collection.insert_one(completed_doc)
|
||||
print("QuestCompleted: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
def insert_fake_report(ugq_db):
|
||||
|
||||
report_collection = ugq_db.get_collection("Report")
|
||||
|
||||
account_collection = ugq_db.get_collection("Account")
|
||||
user_guids = []
|
||||
cursor = account_collection.find({})
|
||||
for document in cursor:
|
||||
user_guids.append(document["UserGuid"])
|
||||
|
||||
quest_content_collection = ugq_db.get_collection("QuestContent")
|
||||
quest_ids = []
|
||||
cursor = quest_content_collection.find({})
|
||||
for document in cursor:
|
||||
quest_ids.append({
|
||||
"questId": document["QuestId"],
|
||||
"revision": document["Revision"],
|
||||
})
|
||||
|
||||
for user_guid in user_guids:
|
||||
count = random.randrange(1, 100)
|
||||
|
||||
for i in range(count):
|
||||
created_at = random_datetime()
|
||||
|
||||
randValue = random.randrange(0, len(quest_ids) - 1)
|
||||
questId = quest_ids[randValue]["questId"]
|
||||
revision = quest_ids[randValue]["revision"]
|
||||
|
||||
report_doc = {
|
||||
"QuestId": questId,
|
||||
"Revision": revision,
|
||||
"UserGuid": user_guid,
|
||||
"Content": "신고고고곡",
|
||||
"CreatedAt": created_at
|
||||
}
|
||||
|
||||
ret = report_collection.insert_one(report_doc)
|
||||
print("Report: " + str(ret))
|
||||
# for i in range(count):
|
||||
# for user_guid in user_guids:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
conn_string = "mongodb://root:root@127.0.0.1:27017"
|
||||
|
||||
client = MongoClient(conn_string)
|
||||
|
||||
ugq_db = client['UGQ']
|
||||
|
||||
drop_all()
|
||||
init()
|
||||
|
||||
insert_fake_account(ugq_db, 100)
|
||||
insert_fake_quest_content(ugq_db)
|
||||
|
||||
insert_fake_like(ugq_db)
|
||||
insert_fake_bookmark(ugq_db)
|
||||
|
||||
insert_fake_creator_point_history(ugq_db)
|
||||
insert_fake_quest_accepted(ugq_db)
|
||||
insert_fake_quest_aborted(ugq_db)
|
||||
insert_fake_quest_completed(ugq_db)
|
||||
insert_fake_report(ugq_db)
|
||||
|
||||
133
UGQDatabase/FakeDataScript/insert_quest.py
Normal file
133
UGQDatabase/FakeDataScript/insert_quest.py
Normal file
@@ -0,0 +1,133 @@
|
||||
import uuid
|
||||
import json
|
||||
import datetime
|
||||
import argparse
|
||||
import requests
|
||||
import glob, os
|
||||
import sys
|
||||
import re
|
||||
|
||||
session = requests.Session()
|
||||
|
||||
def change_state(server_address, access_token, quest_content_id, state):
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-state/{quest_content_id}?state={state}"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {access_token}"
|
||||
}
|
||||
|
||||
response = session.patch(api_url, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
return response
|
||||
|
||||
|
||||
def delete_all_quest(server_address, access_token):
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/summaries"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {access_token}"
|
||||
}
|
||||
|
||||
response = session.get(api_url, headers=headers)
|
||||
|
||||
for quest in response.json()["summaries"]:
|
||||
questContentId = quest["questContentId"]
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest/{questContentId}"
|
||||
response = session.delete(api_url, headers=headers)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
parser = argparse.ArgumentParser(prog='insert-quest', description='insert quest')
|
||||
parser.add_argument('--env', required=True, type=str, help=f'')
|
||||
parser.add_argument('--login_id', required=True, type=str, help=f'')
|
||||
parser.add_argument('--folder', required=True, type=str, help=f'')
|
||||
args = parser.parse_args()
|
||||
|
||||
print(args.env)
|
||||
print(args.login_id)
|
||||
print(args.folder)
|
||||
|
||||
server_address = ""
|
||||
if args.env == "local":
|
||||
server_address="http://localhost:11000/"
|
||||
elif args.env == "aws":
|
||||
server_address="https://dev-ugqapi.caliverse.io:11000"
|
||||
|
||||
print(f'server_address: {server_address}')
|
||||
|
||||
api_url = f"{server_address}/api/v1/Account/dev-login-v2"
|
||||
body = {
|
||||
"loginAccountId": args.login_id
|
||||
}
|
||||
|
||||
response = session.post(api_url, json=body)
|
||||
|
||||
access_token = response.json()["accessToken"]
|
||||
user_guid = response.json()["userGuid"]
|
||||
|
||||
print(access_token)
|
||||
|
||||
delete_all_quest(server_address, access_token)
|
||||
|
||||
questContentId = ""
|
||||
with open(f'{args.folder}/QuestContent.json', encoding='utf-8') as json_file:
|
||||
json_data = json.load(json_file)
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest"
|
||||
headers = {
|
||||
"Authorization": f"Bearer {access_token}",
|
||||
"accept-language": "ko"
|
||||
}
|
||||
response = session.post(api_url, json=json_data, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
questContentId = response.json()["questContentId"]
|
||||
|
||||
for file in glob.glob(f"{args.folder}/QuestDialog*.json"):
|
||||
with open(file, encoding='utf-8') as json_file:
|
||||
json_data = json.load(json_file)
|
||||
|
||||
result = re.search('\\[(.*)\\]', file)
|
||||
index = result.group(1)
|
||||
print(f"{file} -> {index}")
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-dialog/{questContentId}?taskIndex={index}"
|
||||
response = session.post(api_url, json=json_data, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-image/{questContentId}?titleImageId=1&bannerImageId=2"
|
||||
response = session.post(api_url, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-state/{questContentId}?state=Test"
|
||||
response = session.patch(api_url, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
quest_id = response.json()["questId"]
|
||||
revision = response.json()["revision"]
|
||||
|
||||
## ingame api
|
||||
api_url = f"{server_address}/api/v1/InGame/set-test-completed/{user_guid}?questId={quest_id}&revision={revision}"
|
||||
response = session.post(api_url)
|
||||
|
||||
## web api
|
||||
api_url = f"{server_address}/api/v1/QuestEditor/quest-state/{questContentId}?state=Live"
|
||||
response = session.patch(api_url, json=json_data, headers=headers)
|
||||
print(json.dumps(response.json(), ensure_ascii=False, indent=4))
|
||||
|
||||
change_state(server_address, access_token, questContentId, "Standby")
|
||||
change_state(server_address, access_token, questContentId, "Editable")
|
||||
response = change_state(server_address, access_token, questContentId, "Test")
|
||||
|
||||
questContentId = response.json()["questContentId"]
|
||||
quest_id = response.json()["questId"]
|
||||
revision = response.json()["revision"]
|
||||
|
||||
api_url = f"{server_address}/api/v1/InGame/set-test-completed/{user_guid}?questId={quest_id}&revision={revision}"
|
||||
response = session.post(api_url)
|
||||
|
||||
change_state(server_address, access_token, questContentId, "Live")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
6
UGQDatabase/FakeDataScript/requirements.txt
Normal file
6
UGQDatabase/FakeDataScript/requirements.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
# Needed modules
|
||||
|
||||
|
||||
faker
|
||||
requests
|
||||
|
||||
62
UGQDatabase/FakeDataScript/sample1/QuestContent.json
Normal file
62
UGQDatabase/FakeDataScript/sample1/QuestContent.json
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"BeaconId": 1002,
|
||||
"Title": {
|
||||
"Kr": "장장안",
|
||||
"En": "Simmons and Sons",
|
||||
"Jp": "有限?社福田銀行"
|
||||
},
|
||||
"Languages": [
|
||||
"en",
|
||||
"kr",
|
||||
"jp"
|
||||
],
|
||||
"Description": {
|
||||
"Kr": "완벽히 설정된 로컬 포탈",
|
||||
"En": "Organic leadingedge encoding",
|
||||
"Jp": "Open-architected disintermediate Graphic Interface"
|
||||
},
|
||||
"State": "Live",
|
||||
"Cost": 0,
|
||||
"Tasks": [
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "아스트라와 대화하기",
|
||||
"En": "Talk to Astra",
|
||||
"Jp": "Talk to Astra"
|
||||
},
|
||||
"ActionId": 1,
|
||||
"ActionValue": 1002,
|
||||
"DialogId": ""
|
||||
},
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "에셀셜 반팔티셔츠 사기",
|
||||
"En": "buy_item",
|
||||
"Jp": "buy_item"
|
||||
},
|
||||
"ActionId": 3,
|
||||
"ActionValue": 15130410,
|
||||
"DialogId": ""
|
||||
},
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "에센셜 반팔 티셔츠 입기",
|
||||
"En": "에센셜 반팔 티셔츠 입기(영문)",
|
||||
"Jp": "에센셜 반팔 티셔츠 입기(일어)"
|
||||
},
|
||||
"ActionId": 2,
|
||||
"ActionValue": 15130410,
|
||||
"DialogId": ""
|
||||
},
|
||||
{
|
||||
"GoalText": {
|
||||
"Kr": "펠트 울 재킷 팔기",
|
||||
"En": "펠트 울 재킷 팔기(영문)",
|
||||
"Jp": "펠트 울 재킷 팔기(일어)"
|
||||
},
|
||||
"ActionId": 4,
|
||||
"ActionValue": 15130410,
|
||||
"DialogId": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[0].json
Normal file
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[0].json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"Sequences": [
|
||||
{
|
||||
"SequenceId": 0,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "안녕하세요. 제이름은 아스트라에요",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 1,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "이게 맞나??",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 2,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "시퀀스 아이디 값이 이게 맞나?",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": -1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[1].json
Normal file
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[1].json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"Sequences": [
|
||||
{
|
||||
"SequenceId": 0,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "안녕하세요. 제이름은 아스트라에요",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 1,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "이게 맞나??",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 2,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "시퀀스 아이디 값이 이게 맞나?",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[2].json
Normal file
91
UGQDatabase/FakeDataScript/sample1/QuestDialog[2].json
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"Sequences": [
|
||||
{
|
||||
"SequenceId": 0,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "안녕하세요. 제이름은 아스트라에요",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 1,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "이게 맞나??",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"SequenceId": 2,
|
||||
"Actions": [
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "시퀀스 아이디 값이 이게 맞나?",
|
||||
"En": "Astra",
|
||||
"Jp": "Astra"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
},
|
||||
{
|
||||
"Talker": "Npc",
|
||||
"Type": 4,
|
||||
"Talk": {
|
||||
"Kr": "옷 사세요",
|
||||
"En": "Buy Cloth",
|
||||
"Jp": "Buy Cloth"
|
||||
},
|
||||
"Condition": 0,
|
||||
"ConditionValue": 0,
|
||||
"NextSequence": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
2
UGQDatabase/FakeDataScript/사용법.txt
Normal file
2
UGQDatabase/FakeDataScript/사용법.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
python .\insert_quest.py --env=local --login_id=spooky000 --folder=sample1
|
||||
python .\insert_quest.py --env=aws --login_id=spooky000 --folder=sample1
|
||||
Reference in New Issue
Block a user