src/Biz/RewardPoint/Dao/Impl/AccountFlowDaoImpl.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Biz\RewardPoint\Dao\Impl;
use Codeages\Biz\Framework\Dao\GeneralDaoImpl;
use Biz\RewardPoint\Dao\AccountFlowDao;
class AccountFlowDaoImpl extends GeneralDaoImpl implements AccountFlowDao
{
protected $table = 'reward_point_account_flow';
public function getInflowByUserIdAndTarget($userId, $targetId, $targetType)
{
$sql = "SELECT * FROM {$this->table()} WHERE userId = ? and targetId = ? and targetType = ? and type = ? LIMIT 1";
return $this->db()->fetchAssoc($sql, array($userId, $targetId, $targetType, 'inflow')) ?: null;
}
public function sumAccountOutFlowByUserId($userId)
{
$sql = "SELECT sum(amount) FROM `reward_point_account_flow` WHERE `type` = 'outflow' AND `userId` =?";
return $this->db()->fetchColumn($sql, array($userId));
}
public function sumInflowByUserIdAndWayAndTime($userId, $way, $startTime, $endTime)
{
$sql = "SELECT sum(amount) FROM {$this->table} where userId = ? and way = ? and type = ? and createdTime >= ? and createdTime <= ?";
return $this->db()->fetchColumn($sql, array($userId, $way, 'inflow', $startTime, $endTime));
}
public function sumInflowByUserId($userId)
{
$sql = "SELECT sum(amount) FROM {$this->table} where userId = ?";
return $this->db()->fetchColumn($sql, array($userId));
}
public function declares()
{
return array(
'timestamps' => array('createdTime', 'updatedTime'),
'orderbys' => array('createdTime'),
'conditions' => array(
'userId = :userId',
'userId IN ( :userIds)',
'type = :type',
'way = :way',
'operator = :operator',
'createdTime >= :startTime',
'createdTime < :endTime',
),
);
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。