npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

koa-year

v1.0.13

Published

UTIL CONfig.js 一、 // token 秘钥 const secret = 'zxcvbnm123456'

Downloads

5

Readme

UTIL CONfig.js 一、 // token 秘钥 const secret = 'zxcvbnm123456'

//白名单

const whiteList = [/^\/myweb/,'/goods/type','/goods/detail','/goods/list',/^\/phone/,];


module.exports = {
    secret,
    whiteList
}

二、 IORedis.js const Redis = require('ioredis'); const redis = new Redis()

 function get(key) {
     return redis.get(key)
 }

 function set(key, time,val) {
     return redis.setex(key, time,val);
 }

 module.exports = {
     get,set
 }

三、 Jwt var jwt = require('jsonwebtoken'); var {secret} = require('./config'); // const secret = 'zxcvbnm123456'

// class JWT {
//     constructor(parameter) {
//     }
//      sign(userinfo) {
//         return jwt.sign(userinfo, secret, { expiresIn: '2h'})
//     }
//      verify(token) {
//         return jwt.verify(token, secret)
//     }
// }
function sign(userinfo) {
    return jwt.sign(userinfo, secret, { expiresIn: '2h'})
}
function verify(token) {
    return jwt.verify(token, secret)
}


module.exports = {
    sign,
    verify
}

List of goods

    const query = require('../db/query');

    //查询二级分类

    const selectType = ()=>{
        let sql = `select * from type_tab`;
        return query(sql)
    }

    //查询商品
    const selectGoods = (params)=>{
        /* 
            typeid  二级分类
            title  标题  模糊查询
            goodsid 商品 id   
            page count   分页查询
        */
        let sql = `select * from goods_tab `;

        if (params?.typeid || params?.title || params?.goodsid || params?.brandid ) {
            sql += ' where '
            
        }
        //根据分类查询
        if (params?.typeid ) {
            sql += ` typeid = ${params.typeid} `
        }
        //根据商品 id 查询
        if (params?.goodsid ) {
            sql += ` goodsid = ${params.goodsid} `
        }
        //根据品牌 id 查询
        if (params?.brandid ) {
            sql += ` brandid = '${params.brandid}' `
        }
        //模糊查询
        if (params?.title ) {
            sql += ` title like '%${params.title}%' `
        }
        //根据价格升序降序
        // select * from goods_tab order by price desc
        if (params?.desc == 1 ) { // desc  1  升序 2 降序
            sql += ` order by price `
        }else if (params?.desc == 2 ){
            sql += ` order by price desc`
        }
        //根据品牌查询
        if (params?.title ) {
            sql += ` title like '%${params.title}%' `
        }
        //根据品牌查询
        if (params?.page && params?.count) {
            sql += ` limit ${(params.page-1)*params.count},${params.count} `
        }
        console.log(sql);
        return query(sql)
    }
    const selectGoodsDetail = (params)=>{
        // 多表  两表联查
        // select * from 表1 inner join 表2  on  表1.articleid = 表二.tagid  where 表1.articleid = 10001
        //               join 拼接  
        // let sql = `select * from  comment_tab inner join detail_tab `
        // sql+=`on comment_tab.goodsid = detail_tab.goodsid where comment_tab.goodsid=${params.goodsid}`

        //多表   三表联查

        let sql = `select * from goods_tab as t1  inner join  comment_tab as t2 on t1.goodsid = t2.goodsid `
        sql += `inner join detail_tab as t3 on t1.goodsid=t3.goodsid `
        sql += `where t1.goodsid=${params.goodsid}`
        // console.log(sql);
        return query(sql)
    }
    //更新点赞状态

    const updateCommentZan = (params)=>{
        // update 表名  set  列名 = '内容'  where  userid = "标识值"
        let sql = `update comment_tab set zan = ${params.zan},userid = ${params.userid}  where id=${params.id}`
        console.log(sql);
        return query(sql)
    }

    const selectZan = ()=>{
        // update 表名  set  列名 = '内容'  where  userid = "标识值"
        let sql = `select * from comment_tab where zan=1`
        console.log(sql);
        return query(sql)
    }





    I'm windy discipliner I'm hungry oh id holiday oh I velvet IE hobby evaluation tsundere El company took a screenshot after people press the keyboard hi run home cucumber ah began to break the push platform people teach video Harpy are tonight color matching picture home I sense of urgency I OA gathering monster plus hi owen vertical rolling ing quite let the price Scaloni according to the Orange Boy 'per capita public fight is higher' annoying personal tofu dry method change and how to further Chiyou shares is




    
    const jwt = require('../util/jwt')
    const CartSer = require('../service/shoppingcart')
    const shoppingcartAdd = async ctx => {
        /* 
            1.获取前端传来的参数  goodsid  price  count
            2.根据 token  解析 userid
            3.sql 插入到购物车表
            4.返回加入购物车成功
        */

        //1
        let params = ctx.request.body;//{}
        //2 获取 token
        const token = ctx.request.header?.authorization.split(' ')[1];
        const userinfo = jwt.verify(token)
        console.log(userinfo);
        params.userid = userinfo.userid
        //3
        const obj = await CartSer.shoppingcartAdd(params)
        if (obj.affectedRows) {
            ctx.body = {
                code: 200,
                msg: '添加购物车成功!'
            }
            return
        }
        ctx.body = {
            code: 403,
            msg: '添加购物车失败!'
        }


    }
    //查询
    const shoppingcartSelect = async ctx => {
        /* 
            1.鉴权获取 userid
            2.SQL 查询  多表联查
            3.返回结果
        */
        //1 获取 token
        const token = ctx.request.header?.authorization.split(' ')[1];
        const { userid } = jwt.verify(token);
        //2
        const arr = await CartSer.shoppingcartSelect({ userid });
        ctx.body={
            code:200,
            arr
        }


    }
    //多项删除
    const shoppingcartDelete = async ctx=>{
        /* 
            1.获取前端传来的参数  购物车 id  ,拼接的字符串
            2.执行 sql 语句 多项删除
            3.返回结果
        */
    const params = ctx.query;

    const obj = await CartSer.shoppingcartDelete(params);
    ctx.body = {
        code:200,
        msg:'数据删除成功'
    }

    }

下! Hitting people hurts Adolf hungry oh chance yopu software question character headphone mouth spray people plus condiment design fee I click I am afraid [ streamer [ Shi Peipu on for beer people a puppet collection of Tuga [ skin broken armor bow [i anti-pickpocket IRS arrangement is more I according to the real estate VS admire my health just good European school JGÓPOAF JDKAKFEW[KLHKJAIOFEPJJD; JRPGNKAIHBFPJA GION UIABK GIB RGJKHAAIF PSJG ORH RSJ I HIGH PRICE LOW WITH UTERINE HORN PREGNANCY OH YOU SUDDENLY AND ACCESSORIES A FEW PEOPLE ON HANDSOME] DIVIDED HARASSMENT HOT PEOPLE TO BE THE EH DECEIVED PEOPLE AND OCCASIONALLY COLORED THE CONTRACT OR FAMILY CALCULATION FORMULA KICK ME BLOWOUT IS MORE LIKELY TO ENTER THE BODY OF THE BIG RUN HAIR MACHINE FILL IN [PEOPLE NAUGHTY OSHER I Hitting people hurts Adolf hungry oh chance yopu software question character headphone mouth spray people plus condiment design fee I click I am afraid [ streamer [ Shi Peipu on for beer people a puppet collection of Tuga [ skin broken armor bow [i anti-pickpocket IRS arrangement is more I according to the real estate VS admire my health just good European school JGÓPOAF JDKAKFEW[KLHKJAIOFEPJJD; JRPGNKAIHBFPJA

注意!!!! const phone = document.querySelector('.phone') const pwd = document.querySelector('.pwd')

//axios 二次封装
function AXIOS(url,data) {
    return new Promise((resolve, reject) => {
        axios.post(url,data).then(res=>{
            resolve(res)
        }).catch(err=>{
            reject(err)
        }) 
    }) 
}
function fnRegister(params) {
    let obj = {
        username:phone.value,
        password:pwd.value,
    }

    AXIOS('http://localhost:3000/register',obj).then(res=>{
        console.log(res);
    })
    
}

function loginin(params) {
    let obj = {
        username:phone.value,
        password:pwd.value,
    }

    AXIOS('http://localhost:3000/loginin',obj).then(res=>{
        console.log(res);
        if (res.data.token) {
            localStorage.setItem('token',res.data.token)
            document.querySelector('.div').innerHTML = res.data.token;
            // location.href = './userinfo.html'
            
        }
    })
    
}

上! GION UIABK GIB RGJKHAAIF PSJG ORH RSJ I HIGH PRICE LOW WITH UTERINE HORN PREGNANCY OH YOU SUDDENLY AND ACCESSORIES A FEW PEOPLE ARE HANDSOME] Divided harassing hot people to pick up deception and occasionally color the contract or family calculation formula kick me blowout is more likely to enter the body of the big stretch hair machine fill in [people naughty Osher i place and personal hot let me take leave Owen is very comfortable bear evil case I let but I run how to give well, is the uh uh according to the attachment hot time let me coax people master Fu woman Mother Diga fiance open [bill special library IoT number throw plane puppet is Odie is just good iOS to give good Iowa air conditioning will arrange soft flowers Tianling spirit is not right Heat exchanger oh I like a Buddha go to Ang spray IE today after the meeting after the child sister oh Jordan good people oh headphone hardware accessories I have added I recommend drones for odd and even players for the occasion of accessories for cracking dried peppers for a long time to solve the problem of weight loss Kar coffee machine open the room, after all, I will be man-machine Just naughty as soon as I went in tongue twister occurrence tantrum children's forehead drone price m simple, the regulatory bureau accompanied me today, Sun Kai connected animal dissection, I found that leaving Munich, he I took more than ten cucumbers [ Look let me PPT feedback to deceive youth search you my first two years extraordinary brother I industry and commerce I will apply for appraiser for you and send you Vipshop I ass I change the appearance and oh IT word question WWI he asked me