def stealSearchTeam(db, conn, param): playerId = param["player_id"] playerName = param["player_name"] playerPic = param["player_pic"] friendId = param["friend_id"] friendPlayer = db_tool.__getPlayerById(friendId) if not friendPlayer or player_module.isVIP(friendPlayer): return {"status": 0, "error_type": 2, "msg": "friend is null or is vip"} searchInfo = lockSearchTeamById(db, conn, friendId) if not searchInfo or searchInfo["blue_box"] != 1: searchInfo = getSearchTeamDetail(friendId) return { "status": 0, "error_type": 1, "searcher": searchInfo, "msg": "searchInfo is done or stealed by other friend", } number = searchInfo["number"] searchTypeId = searchInfo["type"] areaId = searchInfo["area"] searchStartTime = searchInfo["last_start_time"] needTime = SEARCH_TYPE[searchTypeId]["time"] * 3600 time_now = int(time.time()) if (searchStartTime + needTime) > time_now: return {"status": 0, "msg": "need more time for searchInfo"} # 记录好友信息 friendsInfo = {} friendsInfo["id"] = playerId friendsInfo["name"] = playerName friendsInfo["pic"] = playerPic updateInfo = {} updateInfo["friends"] = db_tool.__dictToString(friendsInfo) updateInfo["number"] = number - 1 updateInfo["blue_box"] = 2 updateSearchTeamInfoForLock(db, conn, friendId, updateInfo) # 更新背包信息 propDict = db_tool.getAllProp(playerId) prop_id, num = odds.getItemByArea(areaId) db_tool.__addPropItem(propDict, prop_id, num) db_tool.saveAllProp(playerId, propDict) searchInfo = getSearchTeamDetail(friendId) # 添加交互日志 log_info = {} log_info["player_id"] = playerId log_info["player_name"] = playerName log_info["prop_id"] = prop_id interaction_event.writeInteractionEventLog(log_info, friendId, 1) return {"status": 1, "definitionId": prop_id, "bag": propDict, "searcher": searchInfo}
def startProduce(playerId,machineId,produceId): produceInfo = getProduceList(playerId) time_now = int(time.time()) if produceInfo.has_key(str(machineId)): return {'status':0,'msg':'producing now'} player = db_tool.__getPlayerById(playerId) #is vip check for 5# if(str(machineId) == '5'): if not player_module.isVIP(player): return {'status':0,'msg':'not vip for machine 5'} #check gb produce_detail_dict = dict() produce_detail_dict['produceId']=str(produceId) produce_detail_dict['startTime']=time_now produce_detail_dict['friends']='' produceInfo[str(machineId)]=produce_detail_dict updateProduce(playerId,produceInfo) return {'status':1,'machineId':machineId,'produceId':produceId,'startTime':time_now}