Alles anzeigenAlles anzeigenI edited sql queries.
InitializePromotionCodes
Alles anzeigenCode
- char szQuery[1024] = "SELECT CODES.`useCount`, CODES.`promotion_code`, `vnum`, `count` ";
- size_t len = strlen(szQuery);
- for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
- len += snprintf(szQuery + len, sizeof(szQuery) - len,
- ",`socket%d` ", i);
- for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
- len += snprintf(szQuery + len, sizeof(szQuery) - len,
- ",`attrtype%d` , `attrvalue%d` ", i, i);
- len += snprintf(szQuery + len, sizeof(szQuery) - len, "%s", " "
- " FROM "
- " `itemshop`.`promotion_rewards` AS REWARDS "
- " LEFT JOIN itemshop.promotion_codes AS CODES ON REWARDS.code_index = CODES.index "
- " WHERE "
- " REWARDS.code_index = CODES.index AND CODES.state = 'ENABLED' "
- " AND count > 0"
- );
InitializeItemshopSpecialOffers
Alles anzeigenCode
- char szQuery[1024] = "SELECT `itemIndex`, `vnum`, `count`, ABS(`price`), `discountPercent`, `limitCount`, `category` "
- ", UNIX_TIMESTAMP(`endTime`), `weight` ";
- size_t len = strlen(szQuery);
- for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
- len += snprintf(szQuery + len, sizeof(szQuery) - len,
- ",`socket%d` ", i);
- for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
- len += snprintf(szQuery + len, sizeof(szQuery) - len,
- ",`attrtype%d` , `attrvalue%d` ", i, i);
- len += snprintf(szQuery + len, sizeof(szQuery) - len, "%s", " "
- ", UNIX_TIMESTAMP(`startTime`), UNIX_TIMESTAMP(`endTime`), (UNIX_TIMESTAMP(NOW()) >= UNIX_TIMESTAMP(startTime)) "
- " FROM "
- " `itemshop`.`itemshop_items` AS ITEMS "
- " LEFT JOIN `itemshop`.`itemshop_categories` AS CATEGORY ON ITEMS.category = CATEGORY.category_index "
- " WHERE "
- " ITEMS.category = CATEGORY.category_index AND CATEGORY.category_state = 'ENABLED' "
- " AND not limitCount = 0 "
- " AND count > 0 "
- " AND("
- " (UNIX_TIMESTAMP(NOW()) < UNIX_TIMESTAMP(ITEMS.endTime))"
- " AND "
- " (UNIX_TIMESTAMP(ITEMS.startTime) < UNIX_TIMESTAMP(ITEMS.endTime) ))"
- " ORDER BY UNIX_TIMESTAMP(startTime)"
- );
InitializeItemshopItemTable
Alles anzeigenCode
- char szQuery[1024] = "SELECT `itemIndex`, `vnum`, `count`, ABS(`price`), `discountPercent`, `limitCount`, `category` "
- ", UNIX_TIMESTAMP(`endTime`), `weight` ";
- size_t len = strlen(szQuery);
- for (int i = 0; i < ITEM_SOCKET_MAX_NUM; i++)
- len += snprintf(szQuery + len, sizeof(szQuery) - len,
- ",`socket%d` ", i);
- for (int i = 0; i < ITEM_ATTRIBUTE_MAX_NUM; i++)
- len += snprintf(szQuery + len, sizeof(szQuery) - len,
- ",`attrtype%d` , `attrvalue%d` ", i, i);
- len += snprintf(szQuery + len, sizeof(szQuery) - len, "%s", " "
- " FROM "
- " `itemshop`.`itemshop_items` AS ITEMS "
- " LEFT JOIN `itemshop`.`itemshop_categories` AS CATEGORY ON ITEMS.category = CATEGORY.category_index "
- " WHERE "
- " ITEMS.category = CATEGORY.category_index AND CATEGORY.category_state = 'ENABLED' "
- " AND not limitCount = 0 "
- " AND count > 0 "
- " AND("
- " (UNIX_TIMESTAMP(ITEMS.startTime) <= 0 AND UNIX_TIMESTAMP(ITEMS.endTime) <= 0) OR"
- " (UNIX_TIMESTAMP(NOW()) >= UNIX_TIMESTAMP(ITEMS.startTime) AND UNIX_TIMESTAMP(NOW()) < UNIX_TIMESTAMP(ITEMS.endTime))"
- " )"
- );
and why?
for max number of stones to be dynamic