ServerPython/CoreServerGroup/GameServer/Script/GM/Commands/GMT_AddEntireCompensation.py
@@ -75,6 +75,33 @@
    goldPaper = int(gmCmdDict.get('GoldPaper', '0'))
    silver = int(gmCmdDict.get('Silver', '0')) 
    sender = gmCmdDict.get('Sender', ChConfig.Def_Mail_SenderSys)
    detail = gmCmdDict.get('Detail', "")
    serverID = int(gmCmdDict.get('OnlyServerID', "0"))
    ''' 需要验证guid是否已存在,如果存在
        当 serverID 为0时,不允许插入
        当 serverID 不为0时,需重新生成GUID,因为补偿物品是根据GUID查找的,如果 serverID 不一样但是GUID一样,就会导致领取多倍补偿物品
    '''
    compensationMgr = GameWorld.GetCompensationMgr()
    entireCnt = compensationMgr.GetEntireCompensationCount()
    for i in xrange(entireCnt):
        compensation = compensationMgr.AtEntireCompensation(i)
        if not compensation:
            continue
        if compensation.GUID != GUID:
            continue
        if not serverID:
            GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_NoNeed, "GUID already existed!")
            return
        # 如果是单服的,GUID已经存在的情况下,重新分配个GUID,防止重复插入相同GUID的邮件,导致领取多倍补偿
        newGUID = str(uuid.uuid1())
        gmCmdDict['GUIDNEW'] = newGUID
        GameWorld.Log("发送单服补偿邮件,原GUID(%s)已存在,生成新GUID(%s), serverID=%s" % (GUID, newGUID, serverID))
        GUID = newGUID
        break
    
    #工具发过来的物品下标依据 'index,index,...'  不一定是从0开始并按顺序连续 =_=#
    intemIndexStrList = []
@@ -93,10 +120,9 @@
    #if len(addItemDictList) == 0:
    #    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_ParamErr)
    #    return
    PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime,
    PlayerCompensation.AddEntireItem(GUID, addItemDictList, LimitTime,
                                     mailInfo, PlayerJob, "%s<$_$>%s<$_$>%s"%(sender, Title, Text),
                                     gold, goldPaper, silver)
                                     gold, goldPaper, silver, detail, serverID)
    #执行成功
    GMCommon.GMCommandResult(orderId, gmCmdDict, GMCommon.Def_Success, {"GUID":GUID})