src/AppBundle/Component/Wrapper/CourseSetWrapper.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace AppBundle\Component\Wrapper;

use Topxia\Service\Common\ServiceKernel;

class CourseSetWrapper extends Wrapper
{
    public function price($courseSet)
    {
        $coinSetting = $this->getSettingService()->get('coin', array(
            'coin_enabled' => 0,
            'cash_model' => 'none',
            'cash_rate' => 1,
        ));

        $priceWrapper = array(
            'priceText' => $courseSet['maxCoursePrice'],
            'currencyType' => 'RMB',
            'currency' => $this->container->get('translator')->trans('admin.account_center.RMB'),
        );

        if (0 == $courseSet['maxCoursePrice']) {
            $priceWrapper['priceText'] = $this->container->get('translator')->trans('course.block_grid.price_free');

            $courseSet['priceWrapper'] = $priceWrapper;

            return $courseSet;
        }

        $price = round($courseSet['minCoursePrice'], 2);

        if ($coinSetting['coin_enabled'] && 'currency' == $coinSetting['cash_model']) {
            $priceWrapper['currencyType'] = 'coin';
            $priceWrapper['currency'] = $coinSetting['coin_name'] ?: $this->container->get('translator')->trans('finance.coin');
            $price = round($courseSet['minCoursePrice'] * $coinSetting['cash_rate'], 2);
        }

        if ($courseSet['minCoursePrice'] == $courseSet['maxCoursePrice']) {
            $priceWrapper['priceText'] = $price.$priceWrapper['currency'];
        } else {
            $priceWrapper['priceText'] = $this->container->get('translator')->trans('course.minimum_price.unit', array('%price%' => $price, '%unit%' => $priceWrapper['currency']));
        }

        $courseSet['priceWrapper'] = $priceWrapper;

        return $courseSet;
    }

    protected function getSettingService()
    {
        return ServiceKernel::instance()->getBiz()->service('System:SettingService');
    }

    protected function getWrapList()
    {
        $list = array('price');

        return $list;
    }

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。