123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- declare (strict_types = 1);
- namespace app\model\warehouse;
- use library\basic\BaseModel;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class OrderInfo extends BaseModel
- {
- /**
- * 获取列表数据
- * @param $page
- * @param $where
- * @param $pageCount
- * @param $desc
- */
- public function getList($page,$where = [],$pageCount = 20,$filed = '*',$desc = 'id desc'){
- $data = $this
- ->field("of.*,(SELECT title from table_express where id = of.exp_id) as exp_name")
- ->alias("of")
- ->when(!empty($where),function ($query) use($where){
- if(!empty($where['warehouse_id'])) {
- $query->where('of.warehouse_id',$where['warehouse_id']);
- }
- if(!empty($where['id'])) {
- $query->where('of.o_id',$where['id']);
- }
- //查询日期
- if(!empty($where['data']) && !empty($where['data'][0]) && !empty($where['data'][1])) {
- $query->whereTime('of.send_time','>=',strtotime($where['data'][0]));
- $query->whereTime('of.send_time','<',strtotime($where['data'][1]) + 3600 * 24);
- }
- if(!empty($where['name'])) {
- $query->whereLike('of.name',"%{$where['name']}%");
- }
- if(!empty($where['mobile'])) {
- $query->whereLike('of.mobile',"%{$where['mobile']}%");
- }
- if(!empty($where['status'])) {
- $query->where('of.status',$where['status']);
- } else {
- $query->where('of.status','>',0);
- }
- })
- ->order($desc)
- ->paginate(['list_rows'=>$pageCount,'page'=>$page])
- ->toArray();
- return [$data['total'],$data['data']];
- }
- }
|