macrob/binixo-lib

该包的最新版本(0.4.1)没有可用的许可证信息。

binixo offerwall 渲染的 PHP 集成

0.4.1 2024-07-22 09:43 UTC

README

准备

在 lендоса目录 SVN_REP/binixo.kz/ 中执行以下命令

composer require macrob/binixo-lib

打开 www/index.php

<?php include('../vendor/autoload.php'); 
define('APP_ROOT', realpath(__DIR__));
define('TMP_DIR', realpath(APP_ROOT . '/../tmp/'));

以下有两种使用方法

  • 方法 1,完整服务器端渲染
  • 方法 2,部分渲染

方法 1

完整服务器端渲染

在 /offers/index.html 页面添加以下代码

    <div id="offerwall">
      <?php 
        $biLib = new \BinixoLib\Offerwall();

        $biLib->tpl = '1';
        $biLib->lang = 'ru';
        $biLib->currency = 'KZT';

        $biLib->url = 'https://kz.binixocrm.com/fd/offerwall/lender/json2?id=6193a180100734dc7cf60c01';
        $biLib->urlMob = 'https://kz.binixocrm.com/fd/offerwall/lender/json2?id=6193a1a2100734dc7cf60c2d';
        $biLib->offerwallJs = 'https://cdn.binixocrm.com/js/v1/offerwall-0.0.1.js';
        
        $biLib->injectJs(true);
        $biLib->render();
      ?>
    </div>

别忘了插入跟踪代码

<script>
  window.addEventListener("load", async() => {
    tracking.doit();
  });
</script>

方法 2

在 /offers/index.html 页面添加以下代码

      <?php 
        $biLib = new \BinixoLib\Offerwall();

        $biLib->url = 'https://kz.binixocrm.com/fd/offerwall/lender/json2?id=6193a180100734dc7cf60c01';
        $biLib->urlMob = 'https://kz.binixocrm.com/fd/offerwall/lender/json2?id=6193a1a2100734dc7cf60c2d';
        $biLib->offerwallJs = 'https://cdn.binixocrm.com/js/v1/offerwall-0.0.1.js';
        
        $biLib->injectJs(true);
        $biLib->printJsonOffersMob('offersMob');
        $biLib->printJsonOffersDesktop('offersDesk');
      ?>
<div id="offerwall"></div>
<script>
  window.addEventListener("load", async() => {

    await ofr.render({
      offers: {
        mob: offersMob,
        desktop: offersDesk
      },
      selector: '#offerwall',
      currency: 'KZT',
      lang: 'ru'
    });

  });

  // TRACKING 
  tracking.doit();
</script>