| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- declare (strict_types = 1);
- namespace app\model\api;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class ContractRecord extends Model
- {
- //合约列表
- public function getList($page,$where = [],$pageCount = 20,$filed = '*',$desc = ''){
- $data = $this
- // ->field("p.*,ap.cate_name,ap.json")
- // ->alias("p")
- // ->join("adver_page ap",'ap.id=p.page_id')
- ->when(!empty($where),function ($query) use($where){
- if(!empty($where['uid'])) {
- $query->where('uid',$where['uid']);
- }
- if(!empty($where['title'])) {
- $query->wherelike('p.title','%' . $where['title'] . '%');
- }
- if(isset($where['sassid'])) {
- $query->where('p.sassid',$where['sassid']);
- }
- })
- ->order($desc)
- ->paginate(['list_rows'=>$pageCount,'page'=>$page])
- ->toArray();
- foreach ($data['data'] as $k=>$v) {
- $data['data'][$k]['time'] = date('Y-m-d',$v['time']);
- $data['data'][$k]['jsonAr'] = json_decode($v['data'],true);
- }
- //echo $this->getLastSql();
- return [$data['total'],$data['data']];
- }
- }
|