12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?php
- namespace app\dao\order;
- use app\dao\BaseDao;
- use app\model\order\StoreOrder;
- use app\model\order\StoreOrderCartInfo;
- class StoreOrderStoreOrderCartInfoDao extends BaseDao
- {
- protected $alias = 'a';
- protected $joinAlis = 'c';
-
- protected function setModel(): string
- {
- return StoreOrder::class;
- }
-
- protected function setJoinModel(): string
- {
- return StoreOrderCartInfo::class;
- }
-
- public function getModel()
- {
- $name = app()->make($this->setJoinModel())->getName();
- return parent::getModel()->alias($this->alias)->join($name . ' ' . $this->joinAlis, $this->alias . '.id =' . $this->joinAlis . '.oid');
- }
-
- public function getUserCartProductIds(array $where)
- {
- return $this->getModel()->when(isset($where['uid']), function ($query) use ($where) {
- $query->where($this->alias . '.uid', $where['uid']);
- })->column($this->joinAlis . '.product_id');
- }
- }
|