Git Product home page Git Product logo

Comments (10)

bboysoulcn avatar bboysoulcn commented on August 28, 2024 1

http://sb.bboysoul.cn/substats/?source=ip&queryKey=ip

你做这种 badge 的话可以不用拿 Cloudflare 转啊,直接告诉 Shields.io 请求 IP 的 API 不就好了嘛!

对的,我就练下手,没有写过前端,无聊玩玩

from substats.

spencerwooo avatar spencerwooo commented on August 28, 2024

有理由吗?

from substats.

spencerwooo avatar spencerwooo commented on August 28, 2024

@bboysoulcn 我来解释一下吧,这个 totalSubs 是初始化一个请求里总订阅人数(总粉丝数)的,所以下面你可以看到 fetchStatsRes.totalSubs += res.value.subs,这个接口返回的都是数字,所以 totalSubs 初始化为 0。

from substats.

bboysoulcn avatar bboysoulcn commented on August 28, 2024

@bboysoulcn 我来解释一下吧,这个 totalSubs 是初始化一个请求里总订阅人数(总粉丝数)的,所以下面你可以看到 fetchStatsRes.totalSubs += res.value.subs,这个接口返回的都是数字,所以 totalSubs 初始化为 0。

嗯嗯,只是我觉得字符型通用性比较好,如果返回值是一个字符串会变成。 0字符串。这样子

from substats.

spencerwooo avatar spencerwooo commented on August 28, 2024

@bboysoulcn 我来解释一下吧,这个 totalSubs 是初始化一个请求里总订阅人数(总粉丝数)的,所以下面你可以看到 fetchStatsRes.totalSubs += res.value.subs,这个接口返回的都是数字,所以 totalSubs 初始化为 0。

嗯嗯,只是我觉得字符型通用性比较好,如果返回值是一个字符串会变成。 0字符串。这样子

@bboysoulcn 懂了,你说的这个字符串拼接的问题会在各个 handler 里处理,不会让它返回成字符串的。(至少我还没发现返回成别的的情况)

from substats.

bboysoulcn avatar bboysoulcn commented on August 28, 2024

@bboysoulcn 懂了,你说的这个字符串拼接的问题会在各个 handler 里处理,不会让它返回成字符串的。(至少我还没发现返回成别的的情况)

嗯嗯

from substats.

bboysoulcn avatar bboysoulcn commented on August 28, 2024

@bboysoulcn 我来解释一下吧,这个 totalSubs 是初始化一个请求里总订阅人数(总粉丝数)的,所以下面你可以看到 fetchStatsRes.totalSubs += res.value.subs,这个接口返回的都是数字,所以 totalSubs 初始化为 0。

嗯嗯,只是我觉得字符型通用性比较好,如果返回值是一个字符串会变成。 0字符串。这样子

@bboysoulcn 懂了,你说的这个字符串拼接的问题会在各个 handler 里处理,不会让它返回成字符串的。(至少我还没发现返回成别的的情况)

我写了一个返回用户ip的,但是因为是cloudflare去请求的接口,所以不能找到实际的ip,所以就发现了这个问题

https://img.shields.io/badge/dynamic/json?color=red&label=ip&query=%24.data.totalSubs&url=http%3A%2F%2Fsb.bboysoul.cn%2Fsubstats%2F%3Fsource%3Dip%26queryKey%3Dip

from substats.

bboysoulcn avatar bboysoulcn commented on August 28, 2024

http://sb.bboysoul.cn/substats/?source=ip&queryKey=ip

from substats.

spencerwooo avatar spencerwooo commented on August 28, 2024

http://sb.bboysoul.cn/substats/?source=ip&queryKey=ip

你做这种 badge 的话可以不用拿 Cloudflare 转啊,直接告诉 Shields.io 请求 IP 的 API 不就好了嘛!

from substats.

spencerwooo avatar spencerwooo commented on August 28, 2024

@bboysoulcn 添加了对 API 字符串数据返回的支持,详见 afdian.js 里面 afdianIncome 的实现,以及 index.js 里面特殊 API 的声明。

from substats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.