Changes between Version 1 and Version 2 of Ticket #68
- Timestamp:
- 12/29/2011 10:08:42 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #68 – Description
v1 v2 18 18 这种写法有个问题就是不能保证会不会数组越标,以后遇到这样的问题要注意,不能单纯填个数字上去,一定要多多考虑各种情况。 19 19 4.解决 20 修改代码,随机数根据热卖商品的数量去生成,避免数组下标越界 20 修改代码,程序需要的结果是要随机热卖商品,所以我选择直接随机热卖商品的数组,代码如下: 21 22 {{{ 23 var rand1 = 0; 24 var rand2 = 0; 25 var size = ${hotSellProductSize>0?hotSellProductSize:0}; 26 for(var i = 0; i < size; i++){ 27 rand1 = parseInt(Math.random() * size); 28 rand2 = parseInt(Math.random() * size); 29 var temp = hotSellArray[rand1]; 30 hotSellArray[rand1] = hotSellArray[rand2]; 31 hotSellArray[rand2] = temp; 32 } 33 }}} 34 21 35 5.意外问题 22 36 更新的时候,代码已经更新了,但是页面仍然没有变化,后来问林浩,是resin的url有缓存机制,要重启才可以清掉,这种机制有力有弊,好处就是减轻访问的压力,不好的地方就是更新的时候必须重启,可能会影响用户访问。
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/global/2008/images/jss/m_logo091125.jpg)