def get_queryresults(db, paras): listObj = { "items": [], "total": 0, } type = paras["type"] cond = "WHERE 1=1 " if type: cond += "AND QR_Type='%s' " % type date = paras["date"] if date: now = get_current_time() cond += "AND QR_CreateTime >= %ld " % (now - date * 24 * 60 * 60 * 1000) keyword = paras["keyword"] if keyword: cond += "AND QR_Name LIKE '%%%s%%' " % keyword ret = db.select(TB_QUERYRESULT, cond=cond) if ret == -1: ERROR("get user list error") return (DB_ERR, None) for dur in db.cur: obj = dbmysql.row_to_dict(TB_QUERYRESULT, dur) item = PricingResult(db, dbObj=obj) item.loadFromObj() listObj["items"].append(item.toObj()) listObj["total"] = len(listObj["items"]) return (OCT_SUCCESS, listObj)
def query_classsoft_price(db, paras): pricing = PricingResult(db) pricing.paras = paras pricing.type = PRICING_TYPE_OCTCLASS_SOFT pricing.name = paras["name"] + "-报价-" + getCurrentStrDate() pricing.desc = paras["desc"] pricing.points = paras["point"] pricing.pricing_software(SOFTWARE_TYPE_OCTCLASS) ret = pricing.add() return ret, pricing.toObj()
def query_platformsoft_price(db, paras): pricing = PricingResult(db) pricing.paras = paras pricing.type = PRICING_TYPE_PLATFORM_SOFT pricing.name = paras["name"] + "-报价-" + getCurrentStrDate() pricing.desc = paras["desc"] pricing.cpuCount = paras["cpuCount"] pricing.hostCount = paras["hostCount"] pricing.pricing_software(SOFTWARE_TYPE_PLATFORM) ret = pricing.add() return ret, pricing.toObj()
def query_server_price(db, paras): pricing = PricingResult(db) pricing.paras = paras pricing.type = PRICING_TYPE_SERVER pricing.name = paras["name"] + "-报价-" + getCurrentStrDate() pricing.points = paras["point"] pricing.desc = paras["desc"] pricing.infrastructure = paras["infrastructure"] pricing.infrastructureCount = pricing.points pricing.cpu = paras["cpu"] pricing.cpuCount = paras["cpuCount"] pricing.memory = paras["memory"] pricing.memoryCount = paras["memoryCount"] pricing.disk = paras["disk"] pricing.diskCount = paras["diskCount"] pricing.disk1 = paras["disk1"] pricing.disk1Count = paras["disk1Count"] pricing.raid = paras["raid"] pricing.raidCount = pricing.points pricing.pricing_server() ret = pricing.add() return ret, pricing.toObj()
def query_thinclient_price(db, paras): pricing = PricingResult(db) pricing.paras = paras pricing.type = PRICING_TYPE_THINCLIENT pricing.name = paras["name"] + "-报价-" + getCurrentStrDate() pricing.points = paras["point"] pricing.thinClient = paras["thinClient"] pricing.monitor = paras["monitor"] pricing.keyMouse = paras["keyMouse"] pricing.thinclientCount = paras["thinClientCount"] or pricing.points pricing.monitorCount = paras["monitorCount"] or pricing.points pricing.keymouseCount = paras["keyMouseCount"] or pricing.points pricing.desc = paras["desc"] pricing.pricing_thinclient() ret = pricing.add() return ret, pricing.toObj()
def query_allinone_price(db, paras, type=SOFTWARE_TYPE_OCTDESK): pricing = PricingResult(db) pricing.paras = paras pricing.type = type pricing.name = paras["name"] + "-报价-" + getCurrentStrDate() pricing.desc = paras["desc"] pricing.points = paras["point"] if type == SOFTWARE_TYPE_OCTDESK: pricing.pointCpu = paras["pointCpu"] pricing.pointMemory = paras["pointMemory"] pricing.pointDisk = paras["pointDisk"] pricing.disk1 = paras["disk1"] pricing.disk1Count = paras["disk1Count"] pricing.infrastructure = paras["infrastructure"] pricing.infrastructureCount = paras["infrastructureCount"] pricing.cpu = paras["cpu"] pricing.cpuCount = paras["cpuCount"] pricing.memory = paras["memory"] pricing.memoryCount = paras["memoryCount"] pricing.disk = paras["disk"] pricing.diskCount = paras["diskCount"] pricing.raid = paras["raid"] pricing.raidCount = pricing.infrastructureCount pricing.thinClient = paras["thinClient"] pricing.thinclientCount = paras["thinClientCount"] or pricing.points pricing.monitor = paras["monitor"] pricing.monitorCount = paras["monitorCount"] or pricing.points pricing.keyMouse = paras["keyMouse"] pricing.keymouseCount = paras["keyMouseCount"] or pricing.points pricing.ukey = paras.get("ukey") pricing.ukeyCount = paras.get("ukeyCount") or pricing.points pricing.switch = paras["switch"] pricing.switchCount = paras["switchCount"] pricing.wifiRouter = paras["wifiRouter"] pricing.wifiRouterCount = paras["wifiRouterCount"] pricing.service = paras["service"] pricing.pricing(type) ret = pricing.add() return ret, pricing.toObj()