src/Biz/Coupon/Dao/Impl/CouponDaoImpl.php

(开头部分) 1KB

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

<?php

namespace Biz\Coupon\Dao\Impl;

use Biz\Coupon\Dao\CouponDao;
use Codeages\Biz\Framework\Dao\AdvancedDaoImpl;

class CouponDaoImpl extends AdvancedDaoImpl implements CouponDao
{
    protected $table = 'coupon';

    public function declares()
    {
        return array(
            'conditions' => array(
                'userId = :userId',
                'targetId = :targetId',
                'targetType = :targetType',
                'batchId = :batchId',
                'batchId IN ( :batchIds)',
                'batchId <> :batchIdNotEqual',
                'type = :type',
                'status = :status',
                'createdTime >= :startDateTime',
                'createdTime < :endDateTime',
                'code LIKE :codeLike',
                'orderTime >= :useStartDateTime',
                'orderTime < :useEndDateTime',
                'id IN ( :ids)',
            ),
            'timestamps' => array('createdTime'),
            'orderbys' => array(
                'createdTime',
                'orderTime',
                'id',
            ),
        );
    }

    public function findByIds(array $ids)
    {
        return $this->findInField('id', $ids);
    }

    public function getByCode($code, array $options = array())
    {
        $lock = isset($options['lock']) && true === $options['lock'];
        $sql = "SELECT * FROM {$this->table} WHERE code = ? LIMIT 1".($lock ? ' FOR UPDATE' : '');

        return $this->db()->fetchAssoc($sql, array($code)) ?: null;
    }

    public function findByBatchId($batchId, $start, $limit)
    {
        return $this->search(
            array(
                'batchId' => $batchId,
            ),
            array(
                'createdTime' => 'DESC',

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

AI 解读 AI

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

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