From 490cf606a67d2034084c2cd610c4535b089a24ca Mon Sep 17 00:00:00 2001 From: F5VT98DI7XY4X12\Administrator <765199919@qq.com> Date: Thu, 12 Sep 2019 14:42:30 +0800 Subject: [PATCH] 工具 --- utils/util.js | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) 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) { -- libgit2 0.21.4