12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?php
- namespace app\dao\other;
- use app\dao\BaseDao;
- use app\model\other\Express;
- class ExpressDao extends BaseDao
- {
-
- protected function setModel(): string
- {
- return Express::class;
- }
-
- public function getExpressList(array $where, string $field, int $page, int $limit)
- {
- return $this->search($where)->field($field)->order('sort DESC,id DESC')
- ->when($page > 0 && $limit > 0, function ($query) use ($page, $limit) {
- $query->page($page, $limit);
- })->select()->toArray();
- }
-
- public function getExpress(array $where, string $field, string $key)
- {
- return $this->search($where)->order('id DESC')->column($field, $key);
- }
-
- public function getExpressByCode(string $code, string $field = '*')
- {
- return $this->getModel()->field($field)->where('code', $code)->find();
- }
- }
|