diff --git a/utils/util.js b/utils/util.js index 9d1d4a5..f15123d 100644 --- a/utils/util.js +++ b/utils/util.js @@ -248,6 +248,14 @@ function check_mobile(phoneMobile){ return ob; } +//获取随机元素 +function get_rand_item(arr){ + if(!arr) return null; + if(arr.length<=0) return null; + var ind=math.floor(math.random()*arr.length*10); + return arr[ind]; +} + module.exports = { formatTime: function(e, r) { 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) {