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 🙏

© 2026 – Pkg Stats / Ryan Hefner

real-name-pc

v1.0.33

Published

> 实名认证PC端

Downloads

126

Readme

实名认证PC端


Features

  • h5联运平台PC端防沉迷
  • 大厅支付防沉迷
  • 大厅mini付防沉迷

Installing

NPM

$ npm i real-name-pc -S

SCRIPT

  <script type="text/javascript" src="https://unpkg.com/real-name-pc/dist/real-name-pc.min.js"></script>

Usage

  1. 执行const feature= RealNamePc.Features.lobbyMini;获取相应的feature名称。
  2. 执行const SdkInstance = RealNamePc.Instance({ feature });获取实例。
  3. 调用Instance实例中的方法进行相应操作。

Example

大厅支付防沉迷

  const feature= RealNamePc.Features.lobby;
  const SdkInstance = RealNamePc.Instance({ feature, containerId: 'test-lobby' });
  SdkInstance.showEight();

  // 8岁以下的提示
  function handleLessThenEight() {
    SdkInstance.showEight();
  }

  // 8~16岁,单笔超额的提示
  function handleLessThenSixteenCharge() {
    SdkInstance.showSixteenCharge();
  }

  // 8~16岁,当月超额的提示
  function handleLessThenSixteen() {
    SdkInstance.showSixteen();
  }

  // 16~18岁,单笔超额的提示
  function handleLessThenEighteenCharge() {
    SdkInstance.showEighteenCharge();
  }

  // 16~18岁,当月超额的提示
  function handleLessThenEighteen() {
    SdkInstance.showEighteen();
  }

大厅mini付防沉迷

  const feature = RealNamePc.Features.lobbyMini;
  const SdkInstance = RealNamePc.Instance({ feature });
  SdkInstance.checkCharge({
    gkey: 'dsws',
    exts: 'eyJhbW91bnQiOjYsInNpZ24iOiJiM2MyNjc0N2EyNzJjNWY4MDJhMmRkMDdjMjc4MGYxOSIsIml0ZW1faWQiOiJwY3dlaWR1YW5wcm9kdWN0NiIsInNlcnZlcl9pZCI6MjIxfQ'
  })
  .then(res => {
    const { checkResult, handler } = res;
    if (checkResult.charge_status !== 1) {
      handler.exec(() => console.log('点击'));
    }
  })
  .catch(err => console.error('接口异常', err));

h5联运平台防沉迷

  const feature= RealNamePc.Features.h5Platform;
  const SdkInstance = RealNamePc.Instance({ feature });

  // 8岁以下的提示
  function handleLessThenEight() {
    SdkInstance.showEight();
  }

  // 8~16岁,单笔超额的提示
  function handleLessThenSixteenCharge() {
    SdkInstance.showSixteenCharge();
  }

  // 8~16岁,当月超额的提示
  function handleLessThenSixteen() {
    SdkInstance.showSixteen();
  }

  // 16~18岁,单笔超额的提示
  function handleLessThenEighteenCharge() {
    SdkInstance.showEighteenCharge();
  }

  // 16~18岁,当月超额的提示
  function handleLessThenEighteen() {
    SdkInstance.showEighteen();
  }

  // 配置实名相关参数
  function configParams() {
    SdkInstance.config({
      appkey: '', // 游戏KEY (必填,不存在传空字符串)
      qid: '3211038786', // 用户id (必填)
      platform: 'h5_game', // 来源平台 (必填)
      idcard_check_type: 'pay_before', // 调用类型 (必填)
      onCloseRealName: () => console.log('触发关闭实名事件'), // 关闭实名弹窗右上角的关闭时,触发的事件 (可选)
      onSubmitSuccess: () => console.log('触发实名认证成功事件11'), // 提交实名认证成功时触发的事件  (可选)
      onSubmitError: () => console.log('触发实名认证失败事件') // 提交实名认证失败时触发的事件  (可选)
    });
  }

  // 获取实名信息
  function handleFetchRealNameInfo() {
    configParams();

    SdkInstance.fetchRealName()
    .then(res => {
      const { auth_type, status } = res;
      // 已开启实名且用户未进行过实名认证
      if (auth_type !== '0' && status === '0') {
        // 显示实名认证
        SdkInstance.showRealName({ canClose: true });
      }
    })
    .catch(err => console.error('获取实名信息异常', err));
  }

  // 显示实名认证
  function clickShowRealName() {
    configParams();

    SdkInstance.showRealName({ canClose: true });
  }

  // 验证金额是否允许充值
  function handleCheckAmount() {
    configParams();

    SdkInstance.checkAmount({
      amount: 30,
      gkey: 'rxhjh5'
    })
    .then(res => {
      // checkResult为验证结果, handler为根据实名状态返回的处理器
      const { checkResult, handler } = res;
      // 根据实名状态弹出相应的弹窗(已进行实名且为成年人时,不进行弹窗操作)
      handler.exec();
    })
    .catch(err => console.error('请求checkAmount接口异常', err));
  }

弹出弹窗提示

  // 获取操作实例
  const feature= RealNamePc.Features.h5Platform;
  const SdkInstance = RealNamePc.Instance({ feature });

  // 显示“年龄小于8周岁”的弹窗 (默认可关闭)
  Instance.showEight();
  // or 显示“年龄小于8周岁”的弹窗 (不可关闭)
  Instance.showEight({ canclose: false });

  // 显示“8~16周岁不可充值,充值已达到上限”的弹窗
  Instance.showSixteen();

  // 显示“8~16周岁可充值,但充值金额达到上限”的弹窗
  Instance.showSixteenCharge();

  // 显示“16~18周岁不可充值,充值已达到上限”的弹窗
  Instance.showEighteen();

  // 显示“16~18周岁可充值,但充值金额已达到上限”的弹窗
  Instance.showEighteenCharge();

  // 显示“登录后游戏时长已达到上限”的弹窗
  Instance.showTimeLimitAfterLogin();

  // 显示“游戏中时长已达到上限”的弹窗
  Instance.showTimeLimitWhenPlaying();

  // 关闭弹窗
  Instance.close();

License

MIT