hxp
2 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
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
#!/usr/bin/python
# -*- coding: GBK -*-
#
##@package
#
# @todo: ÇþµÀɾµµ²âÊÔ³äֵ˫±¶·µÀû
#
# @author: Alee
# @date 2019-1-22 ÏÂÎç08:22:54
# @version 1.0
#
# @note: #×ܹ²681Ìõ, º¬Æ½Ì¨['kupai', 'uc', 'gionee', 'xiaomi', 'vivo', 'lenovo', 'meizu', 'yyb', 'oppo', 'qh360']
#
#---------------------------------------------------------------------
 
import PyGameData
import ChConfig
import GameWorld
import ReadChConfig
import datetime
import IPY_GameWorld
import PlayerControl
import math
 
Def_Qudao_DoubleBill = ['kupai', 'uc', 'gionee', 'xiaomi', 'vivo', 'lenovo', 'meizu', 'yyb', 'oppo', 'qh360']
 
 
def OnMapQDDoubleBill(curPlayer):
    return
    try:
        if GameWorld.IsCrossServer():
            return
        
        dbBillDict = ReadChConfig.GetEvalChConfig("DoubleBillConfig")
        if not dbBillDict["IsOpen"]:
            return
        
        OnFirstQDDoubleBillQuery(curPlayer)
        OnOtherQuDaoDoubleBill(curPlayer)
    except Exception, e:
        GameWorld.Log("OnMapQDDoubleBill Òì³£ %s-%s"%(curPlayer.GetID(), e))
    return
 
 
# ¿ç·þ²»´¦Àí
# 1. µÚÒ»´ÎΪÇëÇóÊý¾Ý, Èç¹ûÊÇÉñ¾ö×ÚÔòÇëÇó×ÜÊý¾Ý
# 2. ºóÐøÇл»µØÍ¼£¬ÅжÏÊÇ·ñ¸ôÌìÁìÈ¡
def OnFirstQDDoubleBillQuery(curPlayer):
    # 1 ÎªÎÞ³äÖµ 2 ÎªÒÑÁìÈ¡ ÆäËûÊýֵΪ¾ßÌå·µÀû×ÜÏÉÓñ
    spID, accID = GetAccIDInfo(curPlayer.GetAccID())
    if spID not in Def_Qudao_DoubleBill:
        # ·ÇÇþµÀµÄ
        return
    
    gold = curPlayer.NomalDictGetProperty(ChConfig.Def_QuDao_DoubleBillGold)
    if gold:
        # ÒÑÇëÇó
        return
    
    # {spid:[accID...]}
    if PyGameData.g_Qudao_DoubleBill:
        # Óлº´æµ«²»ÔÚ»º´æÖеÄ
        if spID not in PyGameData.g_Qudao_DoubleBill:
            return
        
        if accID not in PyGameData.g_Qudao_DoubleBill[spID]:
            return
    
    centerUrl = "center.2460web.com"
    #centerUrl = "vm-mobilecom"
    # ÏȸöÈËÇëÇó
    getUrl = "http://%s:53004/DoublieBill.php?AccID=%s"%(centerUrl, curPlayer.GetAccID())
    GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)
    
    if curPlayer.GetMapID() != 10010:
        return
    
    if not PyGameData.g_Qudao_DoubleBill:
        # »º´æÇëÇó
        getUrl = "http://%s:53004/QueryAllDoubleBill.php?ccccc=fanggongji"%centerUrl
        GameWorld.GetGameWorld().EventReport_EventReport("", "", "", "", 0, getUrl)
    
    return
 
 
# ºóÐøÌì·µ»Ø³äÖµ±ÈÀý
def OnOtherQuDaoDoubleBill(curPlayer):
    # 1 ÎªÎÞ³äÖµ 2 ÎªÒÑÁìÈ¡ ÆäËûÊýֵΪ¾ßÌå·µÀû×ÜÏÉÓñ
    spID, accID = GetAccIDInfo(curPlayer.GetAccID())
    if spID not in Def_Qudao_DoubleBill:
        # ·ÇÇþµÀµÄ
        return
    
    gold = curPlayer.NomalDictGetProperty(ChConfig.Def_QuDao_DoubleBillGold)
    if gold <= 2:
        #ÎÞ¿ÉÁìÈ¡µÄ
        return
    
    CalcDoubleBillByDay(curPlayer)
    
    return
 
 
##»ñȡƽ̨Õ˺ŠºÍ spid
def GetAccIDInfo(gameAccID):
    infoList = gameAccID.split('@')
    return infoList[1], infoList[0]
 
# Ã¿ÈÕÁìÈ¡·µÀû
def CalcDoubleBillByDay(curPlayer):
    gold = curPlayer.NomalDictGetProperty(ChConfig.Def_QuDao_DoubleBillGold)
    if gold <= 2:
        return
    dbBillDict = ReadChConfig.GetEvalChConfig("DoubleBillConfig")
    billDayRate = dbBillDict["BillDayRate"]
    # ¼Ç¼·µÀû´ÎÊý£º Ê±¼ä+´ÎÊý
    #count = curDay.year*100000 + curDay.month*1000 + curDay.day*10 + 0
    count = curPlayer.NomalDictGetProperty(ChConfig.Def_QuDao_DoubleBillCount)
    realCnt = count%10  # ÒÑÁìÈ¡´ÎÊý
    if realCnt >= len(billDayRate):
        return
    dateStr = "%d-%02d-%02d"%(count/100000, count%100000/1000, count%1000/10)
    startDate = GameWorld.GetDateTimeByStr(dateStr, ChConfig.TYPE_Time_Format_Day)
    curDay = datetime.datetime.today()
    theDay = curDay - startDate
    if theDay.days < realCnt:
        return
    
    giveGold = int(math.ceil(billDayRate[realCnt]/100.0*gold))
    
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_QuDao_DoubleBillCount, count+1)
    
    title = "²âÊÔÍæ¼Ò·µÀû".decode("gbk").encode("utf8")
    content = "Ç×°®µÄµÀÓÑ£º</r><Space=2>»¶Ó­¹éÀ´£¬¸ÐлÄúÔÚ¸¶·Ñɾµµ²âÊÔÆÚ¼ä¶ÔÎÒÃǵĴóÁ¦Ö§³Ö£¬¸øÄú·îÉϽñÈշݻعé´óÀñ¡£ÄúÔÚ¸¶·Ñɾµµ²âÊÔÆÚ¼äµÄ³äÖµ°´ÕÕ1Ôª=20ÏÉÓñµÄ±ÈÀý¹²¼Æ·µ»¹7Ì죬¾ßÌåÿÈÕ·µ»¹±ÈÀýÇëÄú²é¿´µÇ¼¹«¸æ-ɾµµ»Ø¹éÓÐÀñ¡£ÇëÄúÁôÒâÿÈÕ·µÀûÓʼþ£¬×£ÄúÓÎÏ·Óä¿ì!".decode("gbk").encode("utf8")
    
    mailItemInfoList = []
    if realCnt == 0:
        mailItemInfoList = [[57, 1, 1]]
    # ·¢Óʼþ
    PlayerControl.SendMail(title, content, 30, [curPlayer.GetPlayerID()], mailItemInfoList, gold=giveGold) 
    GameWorld.Log("ÁìÈ¡ÇþµÀ·µÀû µÚ%s´Î ÏÉÓñ=%s"%(realCnt+1, giveGold))
    return