Commit 490cf606a67d2034084c2cd610c4535b089a24ca
1 parent
3be6532c
工具
Showing
1 changed file
with
8 additions
and
0 deletions
utils/util.js
| ... | ... | @@ -248,6 +248,14 @@ function check_mobile(phoneMobile){ |
| 248 | 248 | return ob; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | +//获取随机元素 | |
| 252 | +function get_rand_item(arr){ | |
| 253 | + if(!arr) return null; | |
| 254 | + if(arr.length<=0) return null; | |
| 255 | + var ind=math.floor(math.random()*arr.length*10); | |
| 256 | + return arr[ind]; | |
| 257 | +} | |
| 258 | + | |
| 251 | 259 | module.exports = { |
| 252 | 260 | formatTime: function(e, r) { |
| 253 | 261 | var t = e ? new Date(1e3 * e) : new Date(), n = t.getFullYear(), o = t.getMonth() + 1, a = t.getDate(), u = t.getHours(), i = t.getMinutes(), f = t.getSeconds(), s = function(e) { | ... | ... |