@@ -277,25 +277,28 @@ def copyResFiles(self,str):
277
277
278
278
def autoPlusVersion (self ,isHd ,chanel = "" ):
279
279
jsonfile = self .GetJsonFile (isHd )
280
- self .versionCode = self .GetAppVersionCode (Source .ANDROID , isHd ,chanel )
281
- int_v = int (self .versionCode )
282
- int_v = int_v + 1
283
- self .versionCode = str (int_v )
284
- appversionjson = self .GetAppVersionJson (Source .ANDROID ,isHd ,chanel )
285
- # dataCode = self.GetAppVersionCode(Source.ANDROID, isHd,chanel)
286
- appversionjson ["code" ]= self .versionCode
287
- appversionjson ["value" ]= self .versionCodeToVersion (self .versionCode )
288
280
289
-
290
- # ios
291
- appversionjson = self .GetAppVersionJson (Source .IOS ,isHd ,"" )
292
- codeios = appversionjson ["code" ]
293
- int_v = int (codeios )
294
- int_v = int_v + 1
295
- codeios = str (int_v )
296
- appversionjson ["code" ]= codeios
297
- # self.versionCode = codeios
298
- appversionjson ["value" ]= self .versionCodeToVersion (codeios )
281
+
282
+ if chanel == Source .APPSTORE :
283
+ # ios
284
+ appversionjson = self .GetAppVersionJson (Source .IOS ,isHd ,"" )
285
+ codeios = appversionjson ["code" ]
286
+ int_v = int (codeios )
287
+ int_v = int_v + 1
288
+ codeios = str (int_v )
289
+ appversionjson ["code" ]= codeios
290
+ # self.versionCode = codeios
291
+ appversionjson ["value" ]= self .versionCodeToVersion (codeios )
292
+ print (" codeios =" ,codeios )
293
+ else :
294
+ self .versionCode = self .GetAppVersionCode (Source .ANDROID , isHd ,chanel )
295
+ int_v = int (self .versionCode )
296
+ int_v = int_v + 1
297
+ self .versionCode = str (int_v )
298
+ appversionjson = self .GetAppVersionJson (Source .ANDROID ,isHd ,chanel )
299
+ # dataCode = self.GetAppVersionCode(Source.ANDROID, isHd,chanel)
300
+ appversionjson ["code" ]= self .versionCode
301
+ appversionjson ["value" ]= self .versionCodeToVersion (self .versionCode )
299
302
300
303
# SaveJson(jsonfile,jsonData)
301
304
JsonUtil .SaveJson (jsonfile ,self .loadJson (isHd ))
@@ -470,6 +473,9 @@ def GetAppVersionJson(self,os,isHd,channel=""):
470
473
if os == Source .ANDROID :
471
474
if len (channel )> 0 and channel in appversion :
472
475
key = channel
476
+
477
+ # if channel==Source.HUAWEI:
478
+ # key = os
473
479
474
480
return appversion [key ]
475
481
@@ -577,18 +583,18 @@ def GetAppId(self,isHd,channel):
577
583
appid = data ["appid" ][channel ]
578
584
return appid
579
585
580
- def SetAppVersion (self ,isHd ,os ,value ):
581
- # loadJson
582
- data = self .loadJson (isHd )
583
- data ["appversion" ][os ]["value" ] = value
586
+ def SetAppVersion (self ,isHd ,os ,value ,channel = "" ):
587
+ appversionjson = self .GetAppVersionJson (os ,isHd ,channel )
588
+ appversionjson ["value" ] = value
584
589
filePath = self .GetJsonFile (isHd )
590
+ data = self .loadJson (isHd )
585
591
JsonUtil .SaveJson (filePath ,data )
586
592
587
- def SetAppVersionCode (self ,isHd ,os ,value ):
588
- # loadJson
589
- data = self .loadJson (isHd )
590
- data ["appversion" ][os ]["code" ] = value
593
+ def SetAppVersionCode (self ,isHd ,os ,value ,channel = "" ):
594
+ appversionjson = self .GetAppVersionJson (os ,isHd ,channel )
595
+ appversionjson ["code" ] = value
591
596
filePath = self .GetJsonFile (isHd )
597
+ data = self .loadJson (isHd )
592
598
JsonUtil .SaveJson (filePath ,data )
593
599
594
600
def SetAppId (self ,isHd ,os ,channel ,appid ):
@@ -698,14 +704,14 @@ def ConvertOld2New(self,isHd,appinfoOld):
698
704
699
705
def SaveAppVersion (self ,isHd ,osSrc ,version ,channel = "" ):
700
706
strcode = version .replace ("." ,"" )
701
- key = osSrc
702
- if osSrc == Source .ANDROID :
703
- if len (channel )> 0 :
704
- key = channel
707
+ # key = osSrc
708
+ # if osSrc==Source.ANDROID:
709
+ # if len(channel)>0:
710
+ # key = channel
705
711
706
712
# 保存版本
707
- self .SetAppVersion (isHd ,key ,version )
708
- self .SetAppVersionCode (isHd ,key ,strcode )
713
+ self .SetAppVersion (isHd ,osSrc ,version , channel )
714
+ self .SetAppVersionCode (isHd ,osSrc ,strcode , channel )
709
715
710
716
711
717
def CopyAppInfo (self ,isHd ,chanel = "" ):
@@ -940,23 +946,28 @@ def updateName(self,isHd,isAuto,chanel=""):
940
946
941
947
if chanel == Source .TAPTAP :
942
948
version_web = mainAppVersionTapTap .ParseVersion (appid_taptap )
943
- else :
949
+ print ("SaveAppVersion version_web=" ,version_web )
950
+ self .SaveAppVersion (isHd ,Source .ANDROID ,version_web ,chanel )
951
+
952
+ if chanel == Source .HUAWEI :
944
953
version_web = mainHuaweiAppGalleryApi .GetVersion (appid_huawei )
954
+ print ("SaveAppVersion version_web=" ,version_web )
955
+ self .SaveAppVersion (isHd ,Source .ANDROID ,version_web ,chanel )
945
956
946
957
# strfile = strfile.replace(key,version_web)
947
958
# FileUtil.SaveString2File(strfile,dst)
948
959
949
- print ("SaveAppVersion version_web=" ,version_web )
950
- self .SaveAppVersion (isHd ,Source .ANDROID ,version_web ,chanel )
960
+
951
961
952
962
953
963
954
964
955
965
# ios
956
966
appid_apple = self .GetJsonAppId (data ,Source .APPSTORE )
957
- version_web = mainAppVersionApple .ParseVersion (appid_apple )
958
- print ("AppVersionApple=" ,version_web + " appid_apple=" ,appid_apple )
959
- self .SaveAppVersion (isHd ,Source .IOS ,version_web ,chanel )
967
+ if chanel == Source .APPSTORE :
968
+ version_web = mainAppVersionApple .ParseVersion (appid_apple )
969
+ print ("AppVersionApple=" ,version_web + " appid_apple=" ,appid_apple )
970
+ self .SaveAppVersion (isHd ,Source .IOS ,version_web ,chanel )
960
971
961
972
# filepath = mainResource.GetProjectConfigAppType()+"/appversion.json"
962
973
# flag = os.path.exists(filepath)
@@ -1073,12 +1084,16 @@ def Run(self,is_auto_plus_version,channel=""):
1073
1084
1074
1085
# channel = ""
1075
1086
# channel = Source.HUAWEI
1076
- self .updateName (False ,is_auto_plus_version ,channel )
1077
- self .updateName (True ,is_auto_plus_version ,channel )
1087
+ self .updateName (False ,is_auto_plus_version ,Source . HUAWEI )
1088
+ self .updateName (True ,is_auto_plus_version ,Source . HUAWEI )
1078
1089
1079
1090
self .updateName (False ,is_auto_plus_version ,Source .TAPTAP )
1080
1091
self .updateName (True ,is_auto_plus_version ,Source .TAPTAP )
1081
-
1092
+
1093
+
1094
+ self .updateName (False ,is_auto_plus_version ,Source .APPSTORE )
1095
+ self .updateName (True ,is_auto_plus_version ,Source .APPSTORE )
1096
+
1082
1097
print ("appname sucess" )
1083
1098
1084
1099
mainAppInfo = AppInfo ()
0 commit comments