-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdConfig.py
More file actions
89 lines (75 loc) · 2.54 KB
/
Copy pathAdConfig.py
File metadata and controls
89 lines (75 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python
# coding=utf-8
import sys
import zipfile
import shutil
import os
import os.path
import time
import datetime
import json
# o_path = os.getcwd() # 返回当前工作目录
# sys.path.append(o_path) # 添加自己指定的搜索路径
# 当前工作目录 Common/PythonCreator/ProjectConfig/Script
sys.path.append('../../')
sys.path.append('./')
from Common import Source
from Common.Common import Common
from Project.Resource import mainResource
# from Config import config
from Common import Source
# from Config import adconfig
from Common.File.FileUtil import FileUtil
class AdConfig():
jsonRoot:None
jsonPlat:None
def GetConfigFile(self,osSrc, isHd):
dir = mainResource.GetAdConfigDir()
if isHd:
filepath = dir + "/ad_config_" + osSrc + "_hd"+".json"
else:
filepath = dir + "/ad_config_" + osSrc+".json"
return filepath
def GetCommonConfigFile(self,osSrc, isHd):
dir = mainResource.GetCommonAdConfigDir()
filepath = dir + "/ad_config_common_" + osSrc+".json"
return filepath
def LoadJson(self,osSrc, isHd):
jsonfile = self.GetConfigFile(osSrc, isHd)
with open(jsonfile, 'rb') as json_file:
self.jsonRoot = json.load(json_file)
self.jsonPlat = self.jsonRoot["platform"]
def LoadJsonFile(self,jsonfile):
with open(jsonfile, 'rb') as json_file:
self.jsonRoot = json.load(json_file)
self.jsonPlat = self.jsonRoot["platform"]
def GetCommonAppId(self,src, osSrc, isHd):
jsonfile = self.GetCommonConfigFile(osSrc, isHd)
self.LoadJsonFile(jsonfile)
appid = "0"
for jsontmp in self.jsonPlat:
if jsontmp["source"] == src:
appid = jsontmp["appid"]
return appid
def GetAppId(self,src, osSrc, isHd):
self.LoadJson(osSrc, isHd)
appid = "0"
for jsontmp in self.jsonPlat:
if jsontmp["source"] == src:
appid = jsontmp["appid"]
return appid
def GetAppKeySplash(self,src, osSrc, isHd):
self.LoadJson(osSrc, isHd)
appid = "0"
for jsontmp in self.jsonPlat:
if jsontmp["source"] == src:
appid = jsontmp["key_splash"]
return appid
def GetAppKey(self,src, osSrc, isHd):
self.LoadJson(osSrc, isHd)
appkey = "0"
for jsontmp in self.jsonPlat:
if jsontmp["source"] == src:
appkey = jsontmp["appkey"]
return appkey
mainAdConfig = AdConfig()