hxp
2 天以前 540eced2499bf2814f3264c0d41eb0e9c52b9957
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GameWorldLogic.GameWorldAction
#
# @todo:»î¶¯Ê±¼ä¿ØÖÆÆ÷
# @author hxp
# @date 2026-02-08
# @version 1.0
#
# ÏêϸÃèÊö: »î¶¯Ê±¼ä¿ØÖÆÆ÷
#
#-------------------------------------------------------------------------------
#"""Version = 2026-02-08 16:00"""
#-------------------------------------------------------------------------------
 
import GameWorld
import DBDataMgr
import ShareDefine
import PlayerActLunhuidian
import IpyGameDataPY
import PlayerControl
import PyGameData
import ChConfig
 
import datetime
import time
 
(
OperationAction_ReloadSign, # ÐÅÏ¢ÖØÔØ±ê¼Ç
OperationAction_TodayInfo, # µ±ÈյĻÐÅÏ¢
) = range(2)
 
def GetOperationActType(actNum):
    ## ÔËÓª»î¶¯ÀàÐÍ
    return actNum / 10
 
def OnProcessGameAction(curTime):
    ## ¶¨Ê±´¦ÀíÓÎÏ·µÄ»î¶¯Ê±¼ä
    Dispose_OperationActionState()
    #Dispose_DailyActionState()
    #Dispose_FBStateTime()
    return
 
def __GetOperationActionInfo():
    # @return: isReload, OperationActionInfo
    
    key = "OperationActionInfo"
    openServerDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_ServerDay) + 1
    isMixServer = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_IsMixServer)
    mixServerDay = DBDataMgr.GetEventTrigMgr().GetValue(ShareDefine.Def_MixServerDay) + 1
    
    OperationActionInfo = IpyGameDataPY.GetConfigEx(key)
    serverTime = GameWorld.GetServerTime()
    #curHour = serverTime.hour
    reloadSignHour = 0 #0 if curHour < 5 else 5 ·ÏÆú5µãË¢ÐÂÂß¼­
    reloadSign = [openServerDay, isMixServer, mixServerDay, reloadSignHour]
    if OperationActionInfo and OperationActionInfo[OperationAction_ReloadSign] == reloadSign:
        #GameWorld.DebugLog("ÒѾ­¼ÓÔØ¹ý±¾ÈÕÔËÓª»î¶¯´¦ÀíÐÅÏ¢£¡openServerDay=%s" % openServerDay)
        return False, OperationActionInfo
    
    # ÒòΪºóÃæµÄʱ¼äÅж϶¼ÊǾ«È·µ½·ÖµÄ£¬¶ø´¦Àí´ËÂß¼­µÄʱºò¿ÉÄܲ»ÊÇ0Ã룬ËùÒÔÕâÀïµÄdatetimeÈ¡µ±Ç°Ê±¼ä¾«È·µ½·ÖµÄ
    curDateTimeStr = "%d-%d-%d %02d:%02d:00" % (serverTime.year, serverTime.month, serverTime.day, serverTime.hour, serverTime.minute)
    curDateTime = datetime.datetime.strptime(curDateTimeStr, ChConfig.TYPE_Time_Format)
    
    startDateInCustomCanOpenList = IpyGameDataPY.GetFuncEvalCfg("OperationAction", 2) # ¿ªÊ¼ÌìÔÚ¶¨ÖÆÌìÄÚÔÚ¶¨ÖÆÌì½áÊøºó¿É¼ÌÐø¿ªÆôµÄ»î¶¯Áбí
    customMaxServerDay = IpyGameDataPY.GetFuncCfg("OperationAction", 1) # ¶¨ÖÆÔËÓª»î¶¯×î´ó¿ª·þÌì
    #maxCustomServerDayMix = IpyGameDataPY.GetFuncCfg("MixServer", 1) # ¶¨ÖÆÔËÓª»î¶¯×î´óºÏ·þÌì
    operationTodayActionDict = {}
    PyGameData.g_operationActionDict = {}
    platform = GameWorld.GetPlatform()
    serverID = GameWorld.GetGameWorld().GetServerID()
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    curWeekday = curDateTime.weekday() + 1 # ½ñÌìÐÇÆÚ¼¸, 1´ú±íÐÇÆÚ1
    
    GameWorld.Log("===== ¼ÓÔØ±¾ÈÕÔËÓª»î¶¯ÐÅÏ¢: %s, serverID=%s,openServerDay=%s,customMaxServerDay=%s,isMixServer=%s,mixServerDay=%s,reloadSign=%s =====" 
                  % (curDateTime, serverID, openServerDay, customMaxServerDay, isMixServer, mixServerDay, reloadSign))
    GameWorld.Log("    ½ñÈÕÖÜ%s" % (curWeekday))
    
    for actName in ShareDefine.OperationActionNameList:
        
        if actName not in PyGameData.g_operationActionDict:
            PyGameData.g_operationActionDict[actName] = {}
            
        # È¡³ö±¾»î¶¯ËùÊô±¾·þIDµÄËùÓÐÅäÖÃ
        GameWorld.Log("¼ÓÔØÔËÓª»î¶¯: actName=%s,platform=%s,serverID=%s" % (actName, platform, serverID))
        curServerActIpyDataList = __GetOperationActionServerIpyDataList(ipyDataMgr, platform, serverID, actName)
        GameWorld.Log("    ¿É´¦ÀíÌõÊý=%s" % (len(curServerActIpyDataList)))
        coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo = \
            __GetOperationActionDisableIpyDataInfo(actName, curDateTime, curServerActIpyDataList)
        GameWorld.Log("    kOpenServerActInfo=%s" % kOpenServerActInfo)
            
        for ipyData in curServerActIpyDataList:
            
            platformList = [] if not hasattr(ipyData, "GetPlatformList") else ipyData.GetPlatformList()
            serverIDList = [] if not hasattr(ipyData, "GetServerIDList") else ipyData.GetServerIDList()
            serverIDListExcept = [] if not hasattr(ipyData, "GetServerIDListExcept") else ipyData.GetServerIDListExcept()
            cfgID = ipyData.GetCfgID()
            startDateStr = ipyData.GetStartDate()
            endDateStr = ipyData.GetEndDate()
            actNum = ipyData.GetActNum()
            actType = GetOperationActType(actNum)
            if kOpenServerActInfo and actNum in kOpenServerActInfo:
                kOpenServerCfgIDInfo = kOpenServerActInfo[actNum]
                actCustomServerDayMax = max(max(kOpenServerCfgIDInfo.values()), customMaxServerDay)
            else:
                actCustomServerDayMax = customMaxServerDay
            GameWorld.Log("    cfgID=%s,actNum=%s,startDateStr=%s,endDateStr=%s,openServerDay=%s,actCustomServerDayMax=%s,isMixServer=%s,mixServerDay=%s,curDateTime=%s,platformList=%s,serverIDList=%s,Except=%s" 
                          % (cfgID, actNum, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, isMixServer, mixServerDay, curDateTime, platformList, serverIDList, serverIDListExcept))
            
            actIDDateTimeSpec = None # ÌØÊâÖ¸¶¨µÄ»î¶¯IDÈÕÆÚ
            startDateSync = None # ÌØÊâͬ²½Ç°¶ËÏÔʾÓõĿªÊ¼ÈÕÆÚ£¬Ò»°ãÓÃÓÚÓ뿪·þǰXÌì½»²æµÄ»î¶¯
            
            # ¶à»î¶¯·Ö×é±àºÅÖ§³Ö
            if actNum not in PyGameData.g_operationActionDict[actName]:
                PyGameData.g_operationActionDict[actName][actNum] = {ShareDefine.ActKey_ActNum:actNum}
                
            curActTodayInfo = operationTodayActionDict.get(actName, {}).get(actNum)
 
                
            if not startDateStr:
                startDateStr = "%d-%d-%d" % (serverTime.year, serverTime.month, serverTime.day)
                GameWorld.Log("        ¿ªÊ¼ÈÕÆÚΪ¿Õ£¬Ä¬ÈÏÿÌ죬½ñÈÕΪ: startDateStr=%s" % startDateStr)
            if not endDateStr:
                endDateStr = "%d-%d-%d" % (serverTime.year, serverTime.month, serverTime.day)
                GameWorld.Log("        ½áÊøÈÕÆÚΪ¿Õ£¬Ä¬ÈÏÿÌ죬½ñÈÕΪ: endDateStr=%s" % endDateStr)
                
            actByLoopYmd = startDateStr.startswith("L") # °´ÈÕÆÚÑ­»·
            # ¸ù¾ÝÈÕÆÚÑ­»·µÄͨÓÃ
            if actByLoopYmd:
                if cfgID in coverDisableLoopIpyDataInfo:
                    loopStartDate, loopEndDate, ymdCfgID, ymdStartDate, ymdEndDate = coverDisableLoopIpyDataInfo[cfgID]
                    GameWorld.Log("        °´ÈÕÆÚÑ­»·µÄÔÚ°´ÈÕÆÚ¿ªÆôµÄʱ¼äÄÚ£¬²»´¦Àí! cfgID=%s,%s(%s) ~ %s(%s) in ymdCfgID=%s,%s ~ %s" 
                                  % (cfgID, loopStartDate, startDateStr, loopEndDate, endDateStr, ymdCfgID, ymdStartDate, ymdEndDate))
                    continue
                
                if cfgID in disableLoopCfgIDDict:
                    GameWorld.Log("        °´ÈÕÆÚÑ­»·µÄδµ½¿ªÆôÑ­»·ÈÕÆÚ»òÒѽáÊøÑ­»·ÈÕÆÚ£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr))
                    continue
                
                if cfgID in otherLoopCfgIDDict:
                    loopCfgIDList, startDateStr, endDateStr, loopIndex, loopTimes = otherLoopCfgIDDict[cfgID]
                    GameWorld.Log("        °´ÈÕÆÚÑ­»·µÄ»¹Î´Ñ­»·µ½µ±Ç°ÅäÖ㬲»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s,loopCfgIDList=%s,loopIndex=%s,loopTimes=%s" 
                                  % (cfgID, startDateStr, endDateStr, loopCfgIDList, loopIndex, loopTimes))
                    continue
                startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
                
            # ¿ª·þ³£¹æ£º  ¿ª·þÌì > ÈÕÆÚ > ÖÜx=ÈÕÆÚÑ­»·   £¨²»ÊܺϷþÌìÓ°Ï죬ºÏ·þ»î¶¯ÐÂÔöÒ»Ì×¶ÀÁ¢µÄ»î¶¯£¬»¹ÊÇ×ßÔËÓª»î¶¯ÅäÖã©
            if actType == ShareDefine.ActType_OpenComm:
                actByWeek = (startDateStr.startswith("W") and endDateStr.startswith("W")) # °´ÖÜx¿ª
                actByDate = (not actByLoopYmd and not actByWeek and startDateStr.count("-") == 2 and endDateStr.count("-") == 2) # °´ÈÕÆÚ¿ª
                
                # ¿ª·þÌìµÄ
                if startDateStr.isdigit() and endDateStr.isdigit():
                    startServerDay, endServerDay = int(startDateStr), int(endDateStr)
                    #½áÊøÈÕ¿ÉÄÜ»¹ÐèÒª´¦Àí¹ã²¥Ö®À࣬ËùÒÔÕâÀïÐèÒª+1
                    if openServerDay > endServerDay + 1:
                        GameWorld.Log("        µ±Ç°¿ª·þÌ쳬¹ý»î¶¯½áÊø¿ª·þÌ죬²»´¦Àí! cfgID=%s,%s ~ %s < openServerDay(%s)" % (cfgID, startDateStr, endDateStr, openServerDay))
                        continue
                    openServerDateTime = curDateTime + datetime.timedelta(days=(startServerDay - openServerDay))
                    endServerDateTime = curDateTime + datetime.timedelta(days=(endServerDay - openServerDay))
                    startDateStr = "%d-%d-%d" % (openServerDateTime.year, openServerDateTime.month, openServerDateTime.day)
                    endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day)
                    GameWorld.Log("        ¿ª·þÌìת»¯ÎªÈÕÆÚ: %s ~ %s" % (startDateStr, endDateStr))
                    
                # K¿ªÍ·µÄ
                elif startDateStr.startswith("K"):
                    startServerDay, endServerDay = GameWorld.ToIntDef(startDateStr[1:]), GameWorld.ToIntDef(endDateStr[1:])
                    #½áÊøÈÕ¿ÉÄÜ»¹ÐèÒª´¦Àí¹ã²¥Ö®À࣬ËùÒÔÕâÀïÐèÒª+1
                    if openServerDay > endServerDay + 1:
                        GameWorld.Log("        µ±Ç°¿ª·þÌ쳬¹ý»î¶¯½áÊøK¿ª·þÌ죬²»´¦Àí! cfgID=%s,%s ~ %s < openServerDay(%s)" % (cfgID, startDateStr, endDateStr, openServerDay))
                        continue
                    openServerDateTime = curDateTime + datetime.timedelta(days=(startServerDay - openServerDay))
                    endServerDateTime = curDateTime + datetime.timedelta(days=(endServerDay - openServerDay))
                    startDateStr = "%d-%d-%d" % (openServerDateTime.year, openServerDateTime.month, openServerDateTime.day)
                    endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day)
                    GameWorld.Log("        K¿ª·þÌìת»¯ÎªÈÕÆÚ: %s ~ %s" % (startDateStr, endDateStr))
                    
                # ³£¹æÅäÖÃ: ¿ª·þǰXÌì²»¿ª£¬²»ÊܺϷþÓ°Ï죬¹¦ÄÜÅäÖñí¿ÉÅäÖ࿪·þǰXÌìºó½»²æ¿É¿ª£¬Ã¿ÈÕÖØÖõĻĬÈϿɿª
                elif actByWeek or actByDate or actByLoopYmd:
                    if openServerDay <= actCustomServerDayMax:
                        GameWorld.Log("        °´ÈÕÆÚ/ÖÜ¿ªµÄÔÚ¿ª·þ¶¨ÖÆÏÞÖÆÌìÄÚ£¬²»´¦Àí! cfgID=%s,%s ~ %s,openServerDay=%s,actCustomServerDayMax=%s,K¿ª·þÌìÐÅÏ¢=%s" 
                                      % (cfgID, startDateStr, endDateStr, openServerDay, actCustomServerDayMax, kOpenServerActInfo))
                        continue
                    
                    if cfgID in coverDisableWeekIpyDataInfo:
                        startWeekDate, endWeekDate, ymdCfgID, ymdStartDate, ymdEndDate = coverDisableWeekIpyDataInfo[cfgID]
                        GameWorld.Log("        ³£¹æ»î¶¯£¬°´ÐÇÆÚ¿ªÆôµÄÔÚ°´ÈÕÆÚ¿ªÆôµÄʱ¼äÄÚ£¬²»´¦Àí! cfgID=%s,%s(%s) ~ %s(%s) in ymdCfgID=%s,%s ~ %s" 
                                      % (cfgID, startWeekDate, startDateStr, endWeekDate, endDateStr, ymdCfgID, ymdStartDate, ymdEndDate))
                        continue
                    
                    if cfgID in disableWeekCfgIDDict:
                        GameWorld.Log("        ³£¹æ»î¶¯£¬°´ÐÇÆÚ¿ªÆôµÄδµ½¿ªÆôÑ­»·ÈÕÆÚ»òÒѽáÊøÑ­»·ÈÕÆÚ£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s, %s" 
                                      % (cfgID, startDateStr, endDateStr, str(disableWeekCfgIDDict[cfgID])))
                        continue
                    
                    if actByWeek:
                        startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
                        GameWorld.Log("        ÐÇÆÚXת»¯ÎªÈÕÆÚ: %s ~ %s" % (startDateStr, endDateStr))
                        
                    curServerOpenDateTime = curDateTime + datetime.timedelta(days=(1 - openServerDay)) # ¿ª·þµÚÒ»ÌìµÄÈÕÆÚ
                    customMaxServerDateTime = curDateTime + datetime.timedelta(days=(actCustomServerDayMax - openServerDay))
                    curStartDateTime = datetime.datetime.strptime("%s %02d:%02d:%02d" % (startDateStr, customMaxServerDateTime.hour, customMaxServerDateTime.minute,
                                                                                         customMaxServerDateTime.second), ChConfig.TYPE_Time_Format)
                    if curServerOpenDateTime <= curStartDateTime <= customMaxServerDateTime:
                        # Ã¿ÈÕÖØÖõÄĬÈϽ»²æºó¿É¿ªÆô
                        isDayRest = 0 if not hasattr(ipyData, "GetIsDayReset") else ipyData.GetIsDayReset()
                        if not isDayRest and actName not in startDateInCustomCanOpenList:
                            GameWorld.Log("        °´ÈÕÆÚ/ÖÜ¿ªµÄ¿ªÊ¼ÈÕÆÚÔÚ¿ª·þ¶¨ÖÆÏÞÖÆÌìÄÚ£¬²»´¦Àí! cfgID=%s,curServerOpenDateTime=%s<=curStartDateTime=%s<=customMaxServerDateTime=%s" % (cfgID, curServerOpenDateTime, curStartDateTime, customMaxServerDateTime))
                            continue
                        
                        # ·ÇÿÈÕÖØÖõĠÇÒ ¿ªÊ¼ÌìÔÚ¶¨ÖÆÌìÄÚÔÚ¶¨ÖÆÌì½áÊøºó¿É¼ÌÐø¿ªÆôµÄ»î¶¯
                        # ×¢£º Îª·ÀÖ¹¿ªÊ¼ÈÕÆÚÓ뿪·þÌìÄڵĻ¿ªÊ¼Ìì¶ÔÓ¦ÈÕÆÚ¸ÕºÃͬһÌìµ¼Ö»IDÒ»Ñù£¬ËùÒÔÕâÀïĬÈϽ«¿ªÊ¼ÈÕÆÚ¸ÄΪ¶¨ÖÆÌìºóÒ»Ìì
                        if not isDayRest and actName in startDateInCustomCanOpenList:
                            actIDDateTimeSpec = datetime.datetime.strptime("%d-%d-%d 00:00:00" 
                                                                           % (customMaxServerDateTime.year, customMaxServerDateTime.month, customMaxServerDateTime.day), 
                                                                           ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1)
                            GameWorld.Log("        ¿ª·þÌìºó¿É¿ªÆôµÄ·ÇÿÈÕÖØÖû! »î¶¯IDÈÕÆÚÌØÊâÉèÖÃΪ¿ª·þ¶¨ÖÆÌì½áÊøºóÒ»Ìì! cfgID=%s,actIDDateTimeSpec=%s" % (cfgID, actIDDateTimeSpec))
                            
                        # ÌØÊâͬ²½µÄ¿ªÊ¼ÈÕÆÚ£¬ÎÞÊÓÊÇ·ñÿÈÕÖØÖÃ
                        if actName in startDateInCustomCanOpenList:
                            startDateSync = datetime.datetime.strptime("%d-%d-%d 00:00:00" 
                                                                       % (customMaxServerDateTime.year, customMaxServerDateTime.month, customMaxServerDateTime.day), 
                                                                       ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1)
                            startDateSync = "%d-%d-%d" % (startDateSync.year, startDateSync.month, startDateSync.day)
                            
                else:
                    GameWorld.Log("        ¿ª·þ³£¹æ»î¶¯£¬ÅäÖÃʱ¼ä¸ñʽ²»Ö§³Ö£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr))
                    continue
                
            # ºÏ·þ»î¶¯: Ö»ÊܺϷþÌìÓ°Ïì
            elif actType == ShareDefine.ActType_MixServer:
                if not startDateStr.startswith("Mix") or not endDateStr.startswith("Mix"):
                    GameWorld.Log("        ºÏ·þ»î¶¯£¬ÅäÖ÷ǺϷþÌ죬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr))
                    continue
                if not isMixServer:
                    GameWorld.Log("        ·ÇºÏ·þ·þÎñÆ÷£¬²»´¦Àí! cfgID=%s,%s ~ %s" % (cfgID, startDateStr, endDateStr))
                    continue
                startMixServerDay, endMixServerDay = int(startDateStr[3:]), int(endDateStr[3:])
                #½áÊøÈÕ¿ÉÄÜ»¹ÐèÒª´¦Àí¹ã²¥Ö®À࣬ËùÒÔÕâÀïÐèÒª+1
                if mixServerDay > endMixServerDay + 1:
                    GameWorld.Log("        µ±Ç°ºÏ·þÌ쳬¹ý»î¶¯½áÊøºÏ·þÌ죬²»´¦Àí! cfgID=%s,%s ~ %s < mixServerDay(%s)" % (cfgID, startDateStr, endDateStr, mixServerDay))
                    continue
                openServerDateTime = curDateTime + datetime.timedelta(days=(startMixServerDay - mixServerDay))
                endServerDateTime = curDateTime + datetime.timedelta(days=(endMixServerDay - mixServerDay))
                startDateStr = "%d-%d-%d" % (openServerDateTime.year, openServerDateTime.month, openServerDateTime.day)
                endDateStr = "%d-%d-%d" % (endServerDateTime.year, endServerDateTime.month, endServerDateTime.day)
                GameWorld.Log("        ºÏ·þÌìת»¯ÎªÈÕÆÚ: %s ~ %s" % (startDateStr, endDateStr))
                
            # ½ÚÈջ£ºÖ»ÊÜÈÕÆÚÓ°Ïì
            elif actType == ShareDefine.ActType_Feast:
                if startDateStr.count("-") != 2 or endDateStr.count("-") != 2:
                    GameWorld.Log("        ½ÚÈջ£¬ÅäÖ÷ÇÈÕÆÚ£¬²»´¦Àí! cfgID=%s,startDateStr=%s,endDateStr=%s" % (cfgID, startDateStr, endDateStr))
                    continue
                
            else:
                GameWorld.Log("        ·Ç·¨ÅäÖã¬Î´Öª»î¶¯ÀàÐÍ£¬²»´¦Àí! cfgID=%s,actNum=%s" % (cfgID, actNum))
                continue
            
            if hasattr(ipyData, "GetJoinStartTime") and hasattr(ipyData, "GetJoinEndTime"):
                joinStartTimeStr = ipyData.GetJoinStartTime()
                joinEndTimeStr = ipyData.GetJoinEndTime()
            else:
                joinStartTimeStr = ""
                joinEndTimeStr = ""
                
            if hasattr(ipyData, "GetStartTimeList") and hasattr(ipyData, "GetEndTimeList"):
                startHMStrList = ipyData.GetStartTimeList()
                endHMStrList = ipyData.GetEndTimeList()
            else:
                startHMStrList = []
                endHMStrList = []
                
            notifyInfoDictStart = ipyData.GetNotifyInfoStart() if hasattr(ipyData, "GetNotifyInfoStart") else {}
            notifyInfoDictEnd = ipyData.GetNotifyInfoEnd() if hasattr(ipyData, "GetNotifyInfoEnd") else {}
            notifyInfoLoopInfo = ipyData.GetNotifyInfoLoop() if hasattr(ipyData, "GetNotifyInfoLoop") else {} # [Ñ­»··ÖÖÓ, ¹ã²¥key, [¹ã²¥²ÎÊýÁбí¿ÉÑ¡]]
            
            if len(startHMStrList) != len(endHMStrList):
                GameWorld.ErrLog("        »î¶¯ÅäÖÿªÊ¼¼°½áÊøÊ±¼ä¸öÊý²»Æ¥Åä! actName=%s,cfgID=%s,startHMStrList=%s,endHMStrList=%s" 
                                 % (actName, cfgID, startHMStrList, endHMStrList))
                continue
            
            isDayRest = 0 if not hasattr(ipyData, "GetIsDayReset") else ipyData.GetIsDayReset()
            resetType = 0 if not hasattr(ipyData, "GetResetType") else ipyData.GetResetType() # ÖØÖÃÀàÐÍ£¬0-0µãÖØÖã»1-5µãÖØÖÃ
            if resetType == 1:
                startDayDate = datetime.datetime.strptime("%s 05:00:00" % (startDateStr), ChConfig.TYPE_Time_Format)
                endDayDate = datetime.datetime.strptime("%s 05:00:00" % (endDateStr), ChConfig.TYPE_Time_Format) # ½áÊøÈÕÆÚ5µã
            elif resetType == 2:
                startDayDate = datetime.datetime.strptime("%s 05:00:00" % (startDateStr), ChConfig.TYPE_Time_Format)       
                endDayDate = datetime.datetime.strptime("%s 00:00:00" % (endDateStr), ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1) # ½áÊøÈÕÆÚ¸ôÌì0µã
            else:
                startDayDate = datetime.datetime.strptime("%s 00:00:00" % (startDateStr), ChConfig.TYPE_Time_Format)
                endDayDate = datetime.datetime.strptime("%s 00:00:00" % (endDateStr), ChConfig.TYPE_Time_Format) + datetime.timedelta(days=1) # ½áÊøÈÕÆÚ¸ôÌì0µã
                
            advanceMinutes = 0 if not hasattr(ipyData, "GetAdvanceMinutes") else ipyData.GetAdvanceMinutes() # Ìáǰ֪ͨʱ¼ä£¬·ÖÖÓ£¬ÔÝÖ»Ö§³Ö°´ÌìµÄ
            GameWorld.Log("        resetType=%s,startDayDate=%s,endDayDate=%s,startHMStrList=%s,endHMStrList=%s,advanceMinutes=%s" 
                          % (resetType, startDayDate, endDayDate, startHMStrList, endHMStrList, advanceMinutes))
                
            advanceNoticeDateTime = None
            startDayDateJudge = startDayDate # ÓÃÓÚÅжÏÊÇ·ñÐèÒª´¦ÀíµÄÆðʼʱ¼ä£¬Ò»°ãÊǻ¿ªÊ¼Ê±¼ä£¬Èç¹ûÓÐÌáǰ¹ã²¥»òÔ¤¸æÔòʱ¼ä»áÌáǰ
            # ÌáǰԤ¸æ
            if advanceMinutes:
                advanceNoticeDateTime = startDayDate + datetime.timedelta(minutes= -advanceMinutes)
                startDayDateJudge = advanceNoticeDateTime
            # Ìáǰ¹ã²¥
            minNotifyStartMinute = 0 if not notifyInfoDictStart else min(notifyInfoDictStart.keys())
            if minNotifyStartMinute < 0:
                minNotifyStartDateTime = startDayDate + datetime.timedelta(minutes=minNotifyStartMinute)
                if minNotifyStartDateTime < startDayDateJudge:
                    startDayDateJudge = minNotifyStartDateTime
            if curDateTime < startDayDateJudge or curDateTime > endDayDate: # ½áÊøÊ±¼äµãµÄʱºò¿ÉÄÜÐèÒª´¦Àí¹ã²¥Ö®ÀàµÄ
                GameWorld.Log("        ·Ç»î¶¯Ê±¼ä£¡²»´¦Àí£¡")
                continue
            
            #×¢£º Í¬¸ö»î¶¯±àºÅ¿ÉÅäÖöà¸öʱ¼ä²»½»²æµÄ»î¶¯£¬Èç¹û¶à¸öʱ¼äÅäÖÃͬʱÂú×ãÌõ¼þ£¬ÔòÖ»»áÒÔ×îºóÒ»¸öΪ׼£¬ÌáǰԤ¸æ¡¢¹ã²¥³ýÍâ
            if curActTodayInfo and curDateTime < startDayDate:
                activityIpyData = curActTodayInfo[0]
                ## ·ÀÖ¹Î´ÕæÕý¿ªÊ¼µÄ»î¶¯ÐèÒªÌáǰԤ¸æ£¬¶øµ¼Ö¸²¸ÇµôÁËʵ¼ÊÕýÔÚ½øÐÐÖеĻ£¬Ò»°ãÊǻʱ¼äÅäÖÃÁ¬ÐøµÄʱºò¿ÉÄܳöÏÖ¸ÃÇé¿ö
                GameWorld.Log("        ÒѾ­´æÔÚÐèÒª´¦ÀíµÄÅäÖÃID(%s)£¡ µ±Ç°ÐèÒªÌáǰ֪ͨ»ò¹ã²¥µÄ»î¶¯Î´´ïµ½»î¶¯¿ªÊ¼Ê±¼ä£¬²»´¦Àí£¡cfgID=%s,advanceMinutes=%s,minNotifyStartMinute=%s,startDayDateJudge=%s" 
                              % (activityIpyData.GetCfgID(), cfgID, advanceMinutes, minNotifyStartMinute, startDayDateJudge))
                continue
            
            #×¢£º¸ÕºÃÊǽáÊøµÄʱ¼äµã£¬·À·¶ÒѾ­ÓÐÐèÒª´¦ÀíµÄÅäÖñ»¸²¸Ç
            if curActTodayInfo and curDateTime == endDayDate:
                activityIpyData = curActTodayInfo[0]
                GameWorld.Log("        ÒѾ­´æÔÚÐèÒª´¦ÀíµÄÅäÖÃID(%s)£¡ µ±Ç°¸ÕºÃ½áÊøµÄʱ¼äµã£¬²»´¦Àí£¡cfgID=%s" % (activityIpyData.GetCfgID(), cfgID))
                continue
            
            startList = [] # [startDateTime, ...]
            endList = [] # [endDateTime, ...]
            startNotifyDict = {} # {notifyDateTime:notifyInfo, ...}
            endNotifyDict = {} # {notifyDateTime:notifyInfo, ...}
            loopNotifyDict = {} # {notifyDateTime:notifyInfo, ...}
            notifyDict = {}
            
            isActTime = (startDayDate <= curDateTime < endDayDate)
            isEnd = (curDateTime == endDayDate)
            isNotify = False
            isAdvanceNotice = False
            
            # Ã»ÅäÖÃʱ·ÖµÄ´ú±íÈ«Ìì, Ö»Òª¿ªÊ¼»ò½áÊøÊ±·ÖûÅä¶¼Ëã
            if not startHMStrList or not endHMStrList:
                startDateTime = startDayDate
                endDateTime = endDayDate
                startList.append(startDateTime)
                endList.append(endDateTime)
                
            # Ã¿Ì찴ʱ¶Î¿ªÆôµÄ£¬Ö§³Ö¶àʱ¶Î
            else:
                for hmIndex, startHMStr in enumerate(startHMStrList):
                    endHMStr = endHMStrList[hmIndex]
                    # Ã¿Ì쿪µÄ, Êµ¼Ê¿ª¹ØÊ±¼äֻȡ½ñÌìµÄÈÕÆÚ£» ÕâÀïÓиöÎÊÌ⣬ȫ·þ¹ã²¥µÄʱ¼ä²»ÊǽñÌìµÄ, Ôݲ»×öÖ§³Ö£¬Ö®ºóÕæÓÐÕâÖÖÐèÇóÔÙ˵
                    startTimeStr = "%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, startHMStr)
                    endTimeStr = "%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, endHMStr)
                    startDateTime = datetime.datetime.strptime(startTimeStr, ChConfig.TYPE_Time_Format)
                    endDateTime = datetime.datetime.strptime(endTimeStr, ChConfig.TYPE_Time_Format)
                    
                    startList.append(startDateTime)
                    endList.append(endDateTime)
                    
            if advanceNoticeDateTime:
                if advanceNoticeDateTime.year == curDateTime.year and advanceNoticeDateTime.month == curDateTime.month and advanceNoticeDateTime.day == curDateTime.day:
                    isAdvanceNotice = True
                GameWorld.Log("        advanceNoticeDateTime=%s,isAdvanceNotice=%s" % (advanceNoticeDateTime, isAdvanceNotice))
            GameWorld.Log("        startList=%s" % (startList))
            GameWorld.Log("        end  List=%s" % (endList))
            
            joinStartTimeList, joinEndTimeList = [], [] # ¿ÉÖ¸¶¨»î¶¯¿É²ÎÓëµÄʱ¼äµã£¬²»Ó°Ïì»î¶¯×´Ì¬£¬Ö»Ó°Ïì»î¶¯Ä³Ð©¹¦ÄܵIJÎÓëʱ»ú£¬ÈçÉϰñÀà
            if joinStartTimeStr:
                if isDayRest:
                    joinStartTimeList.append(datetime.datetime.strptime("%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, joinStartTimeStr), ChConfig.TYPE_Time_Format))
                    joinEndTimeList.append(datetime.datetime.strptime("%d-%d-%d %s:00" % (curDateTime.year, curDateTime.month, curDateTime.day, joinEndTimeStr), ChConfig.TYPE_Time_Format))
                else:
                    joinStartTimeList.append(datetime.datetime.strptime("%s %s:00" % (startDateStr, joinStartTimeStr), ChConfig.TYPE_Time_Format))
                    joinEndTimeList.append(datetime.datetime.strptime("%s %s:00" % (endDateStr, joinEndTimeStr), ChConfig.TYPE_Time_Format))                    
            GameWorld.Log("        joinStartTimeList=%s" % (joinStartTimeList))
            GameWorld.Log("        joinEndTime  List=%s" % (joinEndTimeList))
            
            for dtIndex, startDateTime in enumerate(startList):
                endDateTime = endList[dtIndex]
                # ¹ã²¥ - Ïà¶Ôʵ¼Ê¿ªÊ¼Ê±¼ä
                for notifyMinute, notifyInfo in notifyInfoDictStart.items():
                    notifyDateTime = startDateTime + datetime.timedelta(minutes=notifyMinute)
                    if notifyDateTime.year == curDateTime.year and notifyDateTime.month == curDateTime.month and notifyDateTime.day == curDateTime.day:
                        startNotifyDict[notifyDateTime] = notifyInfo
                        isNotify = True
                    
                # ¹ã²¥ - Ïà¶Ôʵ¼Ê½áÊøÊ±¼ä
                for notifyMinute, notifyInfo in notifyInfoDictEnd.items():
                    notifyDateTime = endDateTime + datetime.timedelta(minutes=notifyMinute)
                    if notifyDateTime.year == curDateTime.year and notifyDateTime.month == curDateTime.month and notifyDateTime.day == curDateTime.day:
                        endNotifyDict[notifyDateTime] = notifyInfo
                        isNotify = True
                        
                # ¹ã²¥ - Ñ­»·¹ã²¥
                if notifyInfoLoopInfo and len(notifyInfoLoopInfo) >= 2:
                    loopMinutes, loopNotifyKey = notifyInfoLoopInfo[:2]
                    loopNotifyParamList = notifyInfoLoopInfo[2] if len(notifyInfoLoopInfo) > 2 else []
                    notifyInfo = [loopNotifyKey, loopNotifyParamList] # Ñ­»·¹ã²¥µÄĬÈÏÎÞ²ÎÊý
                    loopCount, loopMaxCount = 0, 100
                    while loopMinutes and loopNotifyKey and loopCount < loopMaxCount:
                        loopCount += 1
                        notifyDateTime = startDateTime + datetime.timedelta(minutes=loopMinutes * loopCount)
                        if notifyDateTime >= endDateTime:
                            break
                        if notifyDateTime.year == curDateTime.year and notifyDateTime.month == curDateTime.month and notifyDateTime.day == curDateTime.day:
                            loopNotifyDict[notifyDateTime] = notifyInfo
                            isNotify = True
                            
            if startNotifyDict or endNotifyDict or loopNotifyDict:
                GameWorld.Log("        startNotifyDict: minutes=%s, %s" % (notifyInfoDictStart.keys(), startNotifyDict))
                GameWorld.Log("        end  NotifyDict: minutes=%s, %s" % (notifyInfoDictEnd.keys(), endNotifyDict))
                GameWorld.Log("        loop NotifyDict: lopInfo=%s, %s" % (notifyInfoLoopInfo, loopNotifyDict.keys()))
                notifyDict.update(startNotifyDict)
                notifyDict.update(endNotifyDict)
                notifyDict.update(loopNotifyDict)
                
            GameWorld.Log("        ÐèÒª´¦ÀíµÄÔËÓª»î¶¯ÐÅÏ¢: cfgID=%s,isActTime=%s,isEnd=%s,isNotify=%s,isAdvanceNotice=%s" % (cfgID, isActTime, isEnd, isNotify, isAdvanceNotice))
            
            if actName not in operationTodayActionDict:
                operationTodayActionDict[actName] = {} # ½ñÈÕÓÐÐèÒª´¦ÀíµÄ²Å³õʼ»¯
            operationTodayActionDict[actName][actNum] = [ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList]
            
            if isActTime:
                activityInfoDict = {ShareDefine.ActKey_CfgID:cfgID, ShareDefine.ActKey_ActNum:actNum}
                #if actName == ShareDefine.OperationActionName_LoginAward:
                #    #»î¶¯Ã¿ÌìµÄÊÀ½çµÈ¼¶
                #    activityInfoDict[ShareDefine.ActKey_WorldLVList] = GameWorldAverageLv.GetWorldLVListByTime(startDayDate, (endDayDate - startDayDate).days)
                if startDateSync:
                    activityInfoDict[ShareDefine.ActKey_StartDateSync] = startDateSync
                    GameWorld.Log("        startDateSync=%s" % (startDateSync))
                    
                dayIndex = (curDateTime - startDayDate).days
                    
                if ipyData.GetStartDate().startswith("K"):
                    startServerDay = GameWorld.ToIntDef(ipyData.GetStartDate()[1:])
                    # °´Ê±¶Î¿ªµÄĬÈÏÿÌìÖØÖÃ
                    if isDayRest or (startHMStrList and endHMStrList):
                        actID = startServerDay + dayIndex
                    else:
                        actID = startServerDay
                    GameWorld.Log("        isDayRest=%s,startServerDay=%s,actID=%s" % (isDayRest, startServerDay, actID))
                else:
                    actIDDateTime = startDayDate
                    # °´Ê±¶Î¿ªµÄĬÈÏÿÌìÖØÖÃ
                    if isDayRest or (startHMStrList and endHMStrList):
                        actIDDateTime += datetime.timedelta(days=dayIndex)
                    if actIDDateTimeSpec:
                        actIDDateTime = actIDDateTimeSpec
                    actID = int(time.mktime(actIDDateTime.timetuple())) # Ä¬ÈÏÈ¡¿ªÊ¼Ê±¼äµãµÄtimeÖµ×÷Ϊ»î¶¯ID
                    GameWorld.Log("        isDayRest=%s,actIDDateTime=%s,actID=%s" % (isDayRest, actIDDateTime, actID))
                activityInfoDict[ShareDefine.ActKey_DayIndex] = dayIndex
                activityInfoDict[ShareDefine.ActKey_ID] = actID
                GameWorld.Log("        activityInfoDict=%s" % (activityInfoDict))
                
                PyGameData.g_operationActionDict[actName][actNum] = activityInfoDict
                
    OperationActionInfo = IpyGameDataPY.SetConfigEx(key, [reloadSign, operationTodayActionDict])
    
    GameWorld.Log("±¾ÈÕÔËÓª»î¶¯ÐÅÏ¢¼ÓÔØÍê±Ï!reloadSign=%s" % (reloadSign))
    #GameWorld.Log("    operationTodayActionDict=%s" % operationTodayActionDict)
    GameWorld.Log("    PyGameData.g_operationActionDict=%s" % PyGameData.g_operationActionDict)
    GameWorld.Log("=============================================================")
    return True, OperationActionInfo
 
def __GetOperationActionServerIpyDataList(ipyDataMgr, platform, serverID, actName):
    ## »ñÈ¡ÔËÓª»î¶¯±¾·þÎñÆ÷¶ÔÓ¦µÄÅäÖÃÊý¾ÝÁбí
    
    if not hasattr(ipyDataMgr, "Get%sCount" % actName):
        GameWorld.ErrLog("ûÓиÃÔËÓª»î¶¯ÀàÐͶÔÓ¦»î¶¯Ê±¼ä±í! actName=%s" % actName)
        return []
    
    curServerActIpyDataList = []
    actCfgCount = getattr(ipyDataMgr, "Get%sCount" % actName)()
    for cfgIndex in xrange(actCfgCount):
        ipyData = getattr(ipyDataMgr, "Get%sByIndex" % actName)(cfgIndex)            
        platformList = [] if not hasattr(ipyData, "GetPlatformList") else ipyData.GetPlatformList()
        serverIDList = [] if not hasattr(ipyData, "GetServerIDList") else ipyData.GetServerIDList()
        serverIDListExcept = [] if not hasattr(ipyData, "GetServerIDListExcept") else ipyData.GetServerIDListExcept()
        
        if platformList and platform not in platformList:
            continue
        
        # ÅųýµÄ·þÎñÆ÷×éIDÁбí
        if serverIDListExcept:
            isExcept = False
            for serverIDInfo in serverIDListExcept:
                if GameWorld.CheckServerIDInList(serverID, serverIDInfo):
                    isExcept = True
                    break
            if isExcept:
                continue
            
        if not serverIDList:
            curServerActIpyDataList.append(ipyData)
        else:
            for serverIDInfo in serverIDList:
                if GameWorld.CheckServerIDInList(serverID, serverIDInfo):
                    curServerActIpyDataList.append(ipyData)
                    break
                
    return curServerActIpyDataList
 
def __GetOperationActionDisableIpyDataInfo(actName, curDateTime, curServerActIpyDataList):
    ## »ñÈ¡²»¿ÉÓõİ´ÐÇÆÚX¿ªÆôµÄÅäÖÃÊý¾ÝÐÅÏ¢£¬°´ÐÇÆÚX¿ªÆôµÄ »î¶¯ÓÅÏȼ¶Ð¡ÓÚ°´Èͮ򵀣¬µ±ÓÐÖØµþʱÒÔÈÕÆÚµÄΪ׼
    # ÓÅÏȼ¶ ÈÕÆÚ > °´ÈÕÆÚÑ­»· > °´ÐÇÆÚÑ­»·
    
    actNumYMDIpyDataInfo = {} # {actNum:ymdIpyDataList, ...} # ÅäÖÃÈÕÆÚµÄ
    actNumLoopIpyDataInfo = {} # {actNum:{loopKey:[loopCfgIDList, loopDateInfo]}, ...} # °´ÈÕÆÚÑ­»·µÄ
    actNumWeekIpyDataInfo = {} # {actNum:weekIpyDataList, ...} # °´ÐÇÆÚÑ­»·µÄ
    
    disableWeekCfgIDDict = {} # {cfgID:[startDateStr, endDateStr], ...} # Î´¿ªÊ¼Ñ­»·µÄÐÇÆÚ
    disableLoopCfgIDDict = {} # {cfgID:[startDateStr, endDateStr], ...} # Î´¿ªÊ¼Ñ­»·µÄÈÕÆÚ
    
    kOpenServerActInfo = {} # ÒÔKΪ¿ªÍ·µÄ¿ª·þÌì»î¶¯ÖÐÐÅÏ¢ {actNum:{cftID:endOpenServerDay, ...}, ...}
    
    curDateTimeYmdStr = "%d-%d-%d" % (curDateTime.year, curDateTime.month, curDateTime.day)
    curDateTimeYmd = GameWorld.ChangeStrToDatetime(curDateTimeYmdStr, ChConfig.TYPE_Time_Format_Ymd)
    
    for ipyData in curServerActIpyDataList:
        cfgID = ipyData.GetCfgID()
        startDateStr = ipyData.GetStartDate()
        endDateStr = ipyData.GetEndDate()
        actNum = ipyData.GetActNum()
        
        # °´ÐÇÆÚXµÄ
        if startDateStr.startswith("W"):
            if actNum not in actNumWeekIpyDataInfo:
                actNumWeekIpyDataInfo[actNum] = []
            weekIpyDataList = actNumWeekIpyDataInfo[actNum]
            startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
            startWeekDate = GameWorld.ChangeStrToDatetime(startDateStr, ChConfig.TYPE_Time_Format_Ymd)
            endWeekDate = GameWorld.ChangeStrToDatetime(endDateStr, ChConfig.TYPE_Time_Format_Ymd)
            if startWeekDate > curDateTimeYmd or curDateTimeYmd > endWeekDate: # »¹Î´¿ªÊ¼µÄÑ­»· or ÒѾ­Ç¿ÖƽáÊøµÄÑ­»·
                disableWeekCfgIDDict[cfgID] = [startDateStr, endDateStr]
            else:
                weekIpyDataList.append([cfgID, startWeekDate, endWeekDate])
            
        # Ö¸¶¨¿ª·þÌìµÄ£¬²»ÊÜ¿ª·þǰ7ÌìÅäÖÃÓ°Ïì
        elif endDateStr.startswith("K"):
            endKOpenServerDay = GameWorld.ToIntDef(endDateStr[1:])
            if endKOpenServerDay:
                if actNum not in kOpenServerActInfo:
                    kOpenServerActInfo[actNum] = {}
                kOpenServerCfgIDInfo = kOpenServerActInfo[actNum]
                kOpenServerCfgIDInfo[cfgID] = endKOpenServerDay
                
        # °´ÈÕÆÚÑ­»·
        elif startDateStr.startswith("L"):
            loopStartDate, loopEndDate, loopTimes = GameWorld.GetOperationActionLoopDate(startDateStr, endDateStr, curDateTime)
            if loopStartDate > curDateTimeYmd or curDateTimeYmd > loopEndDate: # »¹Î´¿ªÊ¼µÄÑ­»· or ÒѾ­Ç¿ÖƽáÊøµÄÑ­»·
                disableLoopCfgIDDict[cfgID] = [startDateStr, endDateStr]
            else:
                loopKey = (startDateStr, endDateStr) # Í¬¸öÑ­»·ÖÜÆÚµÄÊÓΪͬһ×é
                if actNum not in actNumLoopIpyDataInfo:
                    actNumLoopIpyDataInfo[actNum] = {}
                loopIpyDataDict = actNumLoopIpyDataInfo[actNum]
                if loopKey not in loopIpyDataDict:
                    loopCfgIDList, loopDateInfo = [], [loopStartDate, loopEndDate, loopTimes]
                    loopIpyDataDict[loopKey] = [loopCfgIDList, loopDateInfo]
                loopCfgIDList, loopDateInfo = loopIpyDataDict[loopKey]
                loopCfgIDList.append(cfgID)
                
        # °´ÈÕÆÚµÄ
        elif startDateStr.count("-") == 2:
            if actNum not in actNumYMDIpyDataInfo:
                actNumYMDIpyDataInfo[actNum] = []
            ymdIpyDataList = actNumYMDIpyDataInfo[actNum]
            ymdStartDate = GameWorld.ChangeStrToDatetime(startDateStr, ChConfig.TYPE_Time_Format_Ymd)
            ymdEndDate = GameWorld.ChangeStrToDatetime(endDateStr, ChConfig.TYPE_Time_Format_Ymd)
            ymdIpyDataList.append([cfgID, ymdStartDate, ymdEndDate])
            
        else:
            # ÆäËûµÄ²»´¦Àí
            pass
        
    nowLoopYMDIpyDataInfo = {} # {actNum:loopIpyDataList, ...} # # ÈÕÆÚÑ­»·Öе±Ç°ÔÚÑ­»·µÄ
    otherLoopCfgIDDict = {} # {cfgID:[info], ...} # ÈÕÆÚÑ­»·Öв»Êǵ±Ç°Ñ­»·µÄÆäËûÑ­»·
    coverDisableLoopIpyDataInfo = {} # {cfgID:[info], ...} # ±»ÈÕÆÚ¸²¸ÇµÄÈÕÆÚÑ­»·
    for actNum, loopIpyDataDict in actNumLoopIpyDataInfo.items():
        ymdIpyDataList = actNumYMDIpyDataInfo.get(actNum, [])
        if actNum not in nowLoopYMDIpyDataInfo:
            nowLoopYMDIpyDataInfo[actNum] = []
        loopIpyDataList = nowLoopYMDIpyDataInfo[actNum]
        for loopKey, loopInfo in loopIpyDataDict.items():
            startDateStr, endDateStr = loopKey
            loopCfgIDList, loopDateInfo = loopInfo
            loopStartDate, loopEndDate, loopTimes = loopDateInfo
            loopIndex = (loopTimes - 1) % len(loopCfgIDList) # µ±Ç°Ñ­»·´ÎÊý¶ÔÓ¦µÄÑ­»·Ë÷Òý
            curLoopCfgID = 0
            for index, loopCfgID in enumerate(loopCfgIDList):
                if index == loopIndex: # µ±Ç°Ñ­»·µÄ
                    curLoopCfgID = loopCfgID
                    loopIpyDataList.append([loopCfgID, loopStartDate, loopEndDate])
                else:
                    otherLoopCfgIDDict[loopCfgID] = [loopCfgIDList, startDateStr, endDateStr, loopIndex, loopTimes]
                    
            for ymdCfgID, ymdStartDate, ymdEndDate in ymdIpyDataList:
                if ymdStartDate <= loopStartDate <= ymdEndDate or ymdStartDate <= loopEndDate <= ymdEndDate:
                    coverDisableLoopIpyDataInfo[curLoopCfgID] = [loopStartDate, loopEndDate, ymdCfgID, ymdStartDate, ymdEndDate]
                    
    coverDisableWeekIpyDataInfo = {} # {cfgID:[info], ...} # ±»ÈÕÆÚ¸²¸ÇµÄÐÇÆÚÑ­»·
    for actNum, weekIpyDataList in actNumWeekIpyDataInfo.items():
        ymdIpyDataList = actNumYMDIpyDataInfo.get(actNum, [])
        loopIpyDatList = nowLoopYMDIpyDataInfo.get(actNum, [])
        for weekCfgID, startWeekDate, endWeekDate in weekIpyDataList:
            # ±»³£¹æÈÕÆÚ¸²¸ÇµÄ
            for ymdCfgID, ymdStartDate, ymdEndDate in ymdIpyDataList:
                if ymdStartDate <= startWeekDate <= ymdEndDate or ymdStartDate <= endWeekDate <= ymdEndDate:
                    coverDisableWeekIpyDataInfo[weekCfgID] = [startWeekDate, endWeekDate, ymdCfgID, ymdStartDate, ymdEndDate]
                    
            # ±»Ñ­»·ÈÕÆÚ¸²¸ÇµÄ
            for loopCfgID, loopStartDate, loopEndDate in loopIpyDatList:
                if loopStartDate <= startWeekDate <= loopEndDate or loopStartDate <= endWeekDate <= loopEndDate:
                    coverDisableWeekIpyDataInfo[weekCfgID] = [startWeekDate, endWeekDate, loopCfgID, loopStartDate, loopEndDate]
                    
    return coverDisableLoopIpyDataInfo, disableLoopCfgIDDict, otherLoopCfgIDDict, coverDisableWeekIpyDataInfo, disableWeekCfgIDDict, kOpenServerActInfo
 
def Dispose_OperationActionState():
    # ÔËÓª»î¶¯×´Ì¬´¦Àí
    
    if GameWorld.IsCrossCenter():
        # ¿ç·þ»î¶¯¹ÜÀí£¬´ýÀ©Õ¹£¬ÓÉ¿ç·þÖÐÐÄͳһ¹ÜÀí
        #CrossActionControl.Dispose_CrossActState(reloadRefresh)
        return
    
    if not GameWorld.IsMainServer():
        return
    
    isReload, OperationActionInfo = __GetOperationActionInfo()
    operationTodayActionDict = OperationActionInfo[OperationAction_TodayInfo]
    mapServerInfoDict = PyGameData.g_operationActionDict #OperationActionInfo[OperationAction_MapServerInfo]
    
    gameWorld = GameWorld.GetGameWorld()
    dbEventMgr = DBDataMgr.GetEventTrigMgr()
    
    # ÕâÀïʱ¼äÐ辫ȷµ½·ÖÖÓ£¬²»È»ºóÃæµÄ±È½Ï»áÆ¥Åä²»µ½
    curDateTime = GameWorld.GetServerTime()
    curDateTime = datetime.datetime.strptime("%d-%d-%d %d:%d:00" % (curDateTime.year, curDateTime.month, curDateTime.day,
                                                                    curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
    
    syncMapList = []
    for actName in ShareDefine.OperationActionNameList:
        
        if actName not in mapServerInfoDict:
            continue
        
        curActMapInfoDictList = mapServerInfoDict[actName].values()
        for sendMapServerMsgDict in curActMapInfoDictList:
            
            state = 0 # Ä¬ÈϹرÕ
            stateJoin = ShareDefine.ActStateJoin_None # ¿É²ÎÓë״̬£¬0-²ÎÓëǰ£»1-¿É²ÎÓ룻2-²ÎÓë½áÊø
            ipyData = None
            
            actNum = sendMapServerMsgDict.get(ShareDefine.ActKey_ActNum, 0)
            
            if actName in operationTodayActionDict:
                todayActInfoList = []
                
                if actNum in operationTodayActionDict[actName]:
                    todayActInfoList = operationTodayActionDict[actName][actNum]
                    
                if isinstance(todayActInfoList, list) and len(todayActInfoList) == 6:
                    #startList = [] # [startDateTime, ...]
                    #endList = [] # [endDateTime, ...]
                    #notifyDict = {} # {notifyDateTime:[notifyKey, [²ÎÊý]], ...}
                    #ipyData ¿ÉÄÜΪ None
                    ipyData, startList, endList, notifyDict, joinStartTimeList, joinEndTimeList = todayActInfoList
                    
                    # ×´Ì¬
                    for dIndex, startDateTime in enumerate(startList):
                        endDateTime = endList[dIndex]
                        if startDateTime <= curDateTime < endDateTime:
                            state = dIndex + 1 # ´ú±íµÚ¼¸¸öʱ¼ä¶Î
                            break
                        
                    if joinStartTimeList:
                        for jIndex, joinStartDateTime in enumerate(joinStartTimeList):
                            endJoinDateTime = joinEndTimeList[jIndex]
                            if joinStartDateTime <= curDateTime < endJoinDateTime:
                                stateJoin = ShareDefine.ActStateJoin_Start
                                break
                            elif curDateTime >= endJoinDateTime:
                                stateJoin = ShareDefine.ActStateJoin_End
                    else:
                        stateJoin = ShareDefine.ActStateJoin_Start if state else ShareDefine.ActStateJoin_None
                        
                    # È«·þ¹ã²¥ÌáʾÐÅÏ¢
                    if curDateTime in notifyDict:
                        notifyKey, paramList = notifyDict[curDateTime]
                        PlayerControl.WorldNotify(0, notifyKey, paramList)
                        
            dictName = ShareDefine.Def_WorldKey_OperationActionState % (actName, actNum)
            dictNameJoin = ShareDefine.Def_WorldKey_OperationActionStateJoin % (actName, actNum)
            
            preState = gameWorld.GetGameWorldDictByKey(dictName)            
            preStateJoin = gameWorld.GetGameWorldDictByKey(dictNameJoin)
            if not isReload and preState == state and preStateJoin == stateJoin:
                #GameWorld.DebugLog("ÔËÓª»î¶¯ÒѾ­ÊÇÕâ¸ö״̬ÁË: actName=%s,actNum=%s,preState=%s,state=%s,preStateJoin=%s,stateJoin=%s" % (actName, actNum, preState, state, preStateJoin, stateJoin))
                continue
            GameWorld.Log("ÔËÓª»î¶¯±ä¸ü: actName=%s,actNum=%s,preState=%s,state=%s,preStateJoin=%s,stateJoin=%s,isReload=%s" 
                          % (actName, actNum, preState, state, preStateJoin, stateJoin, isReload))
            #¸üÐÂ×ÖµäÖµ
            gameWorld.SetGameWorldDict(dictName, state)
            gameWorld.SetGameWorldDict(dictNameJoin, stateJoin)
            
            dbOperationActIDKey = ShareDefine.Def_OperationActID % (actName, actNum)
            dbActID = dbEventMgr.GetValue(dbOperationActIDKey)
            
            curActID = sendMapServerMsgDict.get(ShareDefine.ActKey_ID, 0)
            #dayIndex = sendMapServerMsgDict.get(ShareDefine.ActKey_DayIndex, 0)
            if dbActID != curActID:
                GameWorld.Log("    dbActID±ä¸ü: dbActID=%s,curActID=%s" % (dbActID, curActID))
                dbEventMgr.SetValue(dbOperationActIDKey, curActID)
                
                # ½áÊø¾ÉµÄ
                if dbActID:
                    pass
                    #if actName == ShareDefine.OperationActionName_Gubao:
                    #    PlayerActGubao.OnActEnd(actNum, ipyData, dayIndex)
                    
                if curActID:
                    pass
                    #´Ë´¦Îª»î¶¯¿ªÆôʱ
                    #if actName == ShareDefine.OperationActionName_Gubao:
                    #    PlayerActGubao.OnActStart(actNum, ipyData)
                    
                #else:
                #    if actName == ShareDefine.OperationActionName_GarbageSorting:
                #        PlayerActGarbageSorting.OnActEnd(actNum)
                        
            else:
                GameWorld.Log("    dbActID²»±ä: dbActID=%s,curActID=%s" % (dbActID, curActID))
                
            # »î¶¯ÖÐˢУ¬Ã¿´Î¶¼ÐèҪˢеÄÂß¼­£¬°üº¬ÖضÁÅäÖõÈ
            if state:
                pass
                #if actName == ShareDefine.OperationActionName_Gubao:
                #    PlayerActGubao.OnActInStateRefresh(actNum, ipyData)
                    
            # ½ö»î¶¯ÓÐÅäÖòÎÓëʱ¼ä¶ÎµÄ»á´¥·¢
            if curActID and dbActID == curActID and preStateJoin != stateJoin:
                GameWorld.Log("    ²ÎÓë״̬±ä¸ü: preStateJoin=%s,stateJoin=%s" % (preStateJoin, stateJoin))
                # ²ÎÓ뿪ʼ
                if stateJoin == ShareDefine.ActStateJoin_Start:
                    pass
                # ²ÎÓë½áÊø
                elif stateJoin == ShareDefine.ActStateJoin_End:
                    pass
                    #if actName == ShareDefine.OperationActionName_Gubao:
                    #    PlayerActGubao.OnActJoinEnd(actNum, ipyData, dayIndex)
                    
            if ipyData:
                pass      
            #if actName == ShareDefine.OperationActionName_ExpRate:
            #    if isReload and ipyData:
            #        Sync_OperationAction_ExpRate(ipyData)
                    
            #֪ͨMapserver,ÉèÖÃ×Öµä
            #GameWorld.SendMapServerMsgEx(dictName, state) # ÔËÓª»î¶¯²»µ¥¶À֪ͨ»î¶¯×´Ì¬£¬ÐèÓë»î¶¯ÐÅÏ¢ÕûºÏºóÒ»Æð֪ͨ
            sendMapServerMsgDict[ShareDefine.ActKey_State] = state
            sendMapServerMsgDict[ShareDefine.ActKey_StateJoin] = stateJoin
            mapServerInfoDict[actName][actNum] = sendMapServerMsgDict
            syncMapList.append([actName, actNum, sendMapServerMsgDict])
            
    if syncMapList:
        GameWorld.Log("=============================================================")
        for actName, actNum, actInfo in syncMapList:
            OnMapOperationActionRefresh(actName, actNum, actInfo) # Í¨ÖªµØÍ¼Íæ¼ÒˢлÏà¹Ø 
            
    return
 
def OnMapOperationActionRefresh(actName, actNum, actInfo):
    ## ´¦ÀíÀàËÆÖ®Ç°ÓÉGameServer֪ͨMapServerµÄÔËÓª»î¶¯Ë¢ÐÂ
    GameWorld.Log("OperationActionRefresh: %s,actNum=%s,%s" % (actName, actNum, actInfo))
    if actName == ShareDefine.OperationActionName_Lunhuidian:
        PlayerActLunhuidian.RefreshActLunhuidianActionInfo(actNum)
        
    return