UserSignScoreDao.php 1023 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\common\dao\user;
  3. use app\common\dao\BaseDao;
  4. use app\common\model\user\UserSignScore;
  5. use app\entity\CommonEntity;
  6. use app\entity\data\user\UserSignScoreEntity;
  7. class UserSignScoreDao extends BaseDao
  8. {
  9. protected function getModel(): string
  10. {
  11. return UserSignScore::class;
  12. }
  13. /**
  14. * @param array $idList
  15. * @return CommonEntity[]
  16. */
  17. public function getStoreSignScoreEntityListByIdList(array $idList): array
  18. {
  19. $entityList = [];
  20. try {
  21. /** @var UserSignScore $model */
  22. $model = $this->getModel();
  23. $dataRes = $model::getDB()
  24. ->whereIn('id', $idList)
  25. ->select()
  26. ->toArray();
  27. if (!empty($dataRes)) {
  28. $entityList = array_map(function ($data) {
  29. return UserSignScoreEntity::newInstance($data);
  30. }, $dataRes);
  31. }
  32. } catch (\Exception $e) {
  33. }
  34. return $entityList;
  35. }
  36. }