dao = $dao; } public function create($data) { return $this->dao->create($data); } /** * @param SharedProsperityRecommendConfigEntity $sharedProsperityRecommendConfigEntity * @return SharedProsperityRecommendConfigEntity */ public function createByEntity(SharedProsperityRecommendConfigEntity $sharedProsperityRecommendConfigEntity): SharedProsperityRecommendConfigEntity { $result = $this->create($sharedProsperityRecommendConfigEntity->toUnderlineArray())->toArray(); /** @var SharedProsperityRecommendConfigEntity $entity */ $entity = SharedProsperityRecommendConfigEntity::newInstance($result); return $entity; } /** * @return SharedProsperityRecommendConfigEntity[] * @author 史晨 * @date 2026/2/5 14:12 */ public function getList(): array { return $this->dao->getConfigList(); } /** * @param $id * @return array * @author 史晨 * @date 2026/2/5 14:12 */ public function getDetail($id) { return $this->dao->getDetailById($id); } /** * @param $params * @return bool * @author 史晨 * @date 2026/2/5 14:12 */ public function update($params) { $id = $params['id']; unset($params['id']); if (!is_numeric($params['consume']) || $params['consume'] == 0) { $params['consume'] = null; } $this->dao->update($id, $params); return true; } /** * @param int $level * @return SharedProsperityRecommendConfigEntity */ public function getSharedProsperityRecommendConfigEntityByLevel(int $level): SharedProsperityRecommendConfigEntity { $entityList = $this->getSharedProsperityRecommendConfigEntityListByLevelList([$level]); $entity = array_shift($entityList); if ($entity instanceof SharedProsperityRecommendConfigEntity) { return $entity; } else { /** @var SharedProsperityRecommendConfigEntity */ return SharedProsperityRecommendConfigEntity::newInstance(); } } /** * @param array $levelList * @return SharedProsperityRecommendConfigEntity[] */ public function getSharedProsperityRecommendConfigEntityListByLevelList(array $levelList): array { return $this->dao->getSharedProsperityRecommendConfigEntityListByLevelList($levelList); } /** * 获取 最大 推荐奖励占比 * @return SharedProsperityRecommendConfigEntity */ public function getSharedProsperityRecommendConfigEntityByMaxRewardRatio(): SharedProsperityRecommendConfigEntity { return $this->dao->getSharedProsperityRecommendConfigEntityByMaxRewardRatio(); } /** * @return SharedProsperityRecommendConfigEntity * @author 史晨 * @date 2026/5/11 09:54 * 获取最大的分享奖励占比 */ public function getSharedProsperityRecommendConfigEntityByMaxShareRatio(): SharedProsperityRecommendConfigEntity { return $this->dao->getSharedProsperityRecommendConfigEntityByMaxShareRatio(); } }