| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace app\common\dao\shared;
- use app\common\dao\BaseDao;
- use app\common\model\shared\SharedProsperityRecommendConfig;
- use app\entity\data\shared\SharedProsperityRecommendConfigEntity;
- class SharedProsperityRecommendConfigDao extends BaseDao
- {
- protected function getModel(): string
- {
- return SharedProsperityRecommendConfig::class;
- }
- /**
- * @return SharedProsperityRecommendConfigEntity[]
- * @author 史晨
- * @date 2026/2/5 14:43
- * 获取推荐配置
- */
- public function getConfigList(): array
- {
- $entityList = [];
- try {
- /** @var SharedProsperityRecommendConfig $model */
- $model = $this->getModel();
- $dataRes = $model::getDB()
- ->select()
- ->toArray();
- if (!empty($dataRes)) {
- $entityList = array_map(function ($data) {
- return SharedProsperityRecommendConfigEntity::newInstance($data);
- }, $dataRes);
- }
- } catch (\Exception $e) {
- }
- return $entityList;
- }
- /**
- * @param $id
- * @return mixed
- * @author 史晨
- * @date 2026/2/5 14:43
- * 获取推荐配置详情
- */
- public function getDetailById($id)
- {
- /** @var SharedProsperityRecommendConfig $model */
- $model = $this->getModel();
- return $model::getDB()
- ->where(['id' => $id])
- ->find();
- }
- /**
- * @param array $levelList
- * @return SharedProsperityRecommendConfigEntity[]
- */
- public function getSharedProsperityRecommendConfigEntityListByLevelList(array $levelList): array
- {
- $entityList = [];
- try {
- /** @var SharedProsperityRecommendConfig $model */
- $model = $this->getModel();
- $dataRes = $model::getDB()
- ->whereIn('level', $levelList)
- ->select()
- ->toArray();
- if (!empty($dataRes)) {
- $entityList = array_map(function ($data) {
- return SharedProsperityRecommendConfigEntity::newInstance($data);
- }, $dataRes);
- }
- } catch (\Exception $e) {
- }
- return $entityList;
- }
- }
|