| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace app\extra\dao\cutter;
- use app\extra\basic\Dao;
- use app\model\cutter\CutterTask;
- class CutterTaskDao extends Dao
- {
- /**
- * 设置模型
- * @return string
- */
- protected function setModel(): string
- {
- return CutterTask::class;
- }
- public function getList($where,string $field = '*',int $page = 0, int $limit = 0,string $order='id desc')
- {
- return $this->getModel()->where($where)->field($field)->when($page&&$limit,function($query)use($page,$limit){
- $query->page($page,$limit);
- })->with(['grade'=>function ($query) {
- $query->field('name,icon,grade,color');
- },'label'=>function ($query) {
- $query->field('id,label_name');
- }])->withCount(['orderCount'=>'people'])->orderRaw($order)->select();
- }
- public function getInfo(array $where,string $field = '*')
- {
- return $this->getModel()->where($where)->field($field)->with(['kefu'=>function ($query) {
- $query->field('id,name,wechat,qrcode');
- },'grade'=>function ($query) {
- $query->field('name,icon,grade,color');
- },'label'=>function ($query) {
- $query->field('id,label_name');
- }])->withCount(['orderCount'=>'people'])->findOrEmpty();
- }
- }
|