12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace app\dao\message;
- use app\dao\BaseDao;
- use app\model\message\TemplateMessage;
- class TemplateMessageDao extends BaseDao
- {
-
- protected function setModel(): string
- {
- return TemplateMessage::class;
- }
-
- public function getTemplateOne(array $where, string $filed = '*', bool $is_search = true)
- {
- if ($is_search) {
- return $this->search($where)->field($filed)->find();
- } else {
- return $this->getModel()->where($where)->find();
- }
- }
-
- public function getTemplateList(array $where, int $page, int $limit)
- {
- return $this->getModel()->when(isset($where['name']) && $where['name'] != '', function ($query) use ($where) {
- $query->where('name', 'LIKE', "%$where[name]%");
- })->when(isset($where['status']) && $where['status'] != '', function ($query) use ($where) {
- $query->where('status', $where['status']);
- })->where('type', $where['type'])->page($page, $limit)->select()->toArray();
- }
- }
|