where('adminid', $adminid)->findOrEmpty()->isEmpty(); $expire = Config::get('common.expire'); if ($rs) { return self::create([ 'token' => $token, 'expiretime' => date('Y-m-d H:i:s', time() + $expire), 'addtime' => date('Y-m-d H:i:s'), 'adminid' => $adminid ]); } else { return self::where(['adminid' => $adminid]) ->update([ 'token' => $token, 'expiretime' => date('Y-m-d H:i:s', time() + $expire) ]); } } }