| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace app\common\dao\third;
- use app\common\dao\BaseDao;
- use app\common\model\third\ThirdPartyGoodCacheModel;
- use app\entity\CommonEntity;
- use app\entity\data\third\ThirdPartyGoodCacheEntity;
- class ThirdPartyGoodCacheDao extends BaseDao
- {
- protected function getModel(): string
- {
- return ThirdPartyGoodCacheModel::class;
- }
- /**
- * @param array $productIdList
- * @return CommonEntity[]
- */
- public function getThirdPartyGoodCacheEntityListByProductIdList(array $productIdList): array
- {
- $entityList = [];
- try {
- /** @var ThirdPartyGoodCacheModel $model */
- $model = $this->getModel();
- $dataRes = $model::getDB()
- ->whereIn('product_id', $productIdList)
- ->select()
- ->toArray();
- if (!empty($dataRes)) {
- $entityList = array_map(function ($data) {
- return ThirdPartyGoodCacheEntity::newInstance($data);
- }, $dataRes);
- }
- } catch (\Exception $e) {
- }
- return $entityList;
- }
- }
|