作者 何书鹏
1 个管道 的构建 通过 耗费 8 秒

bug修改

... ... @@ -64,9 +64,13 @@ class Message extends Api
$page_num = $this->request->param('page_num', 10, 'intval');
$data = $this->model
->with(['order','grab'])
->where('user_id',$this->auth->id)
->where('type','1')
->order('createtime desc')
->alias('a')
->join('order b','b.id = a.order_id')
->join('order_grab c','c.id = a.order_grab_id')
->where('a.user_id',$this->auth->id)
->where('a.type','1')
->order('a.createtime desc')
->field('a.*')
->paginate($page_num,false,['page'=>$page])
->each(function($v){
$v->visible(['id','grab_status','order','grab']);
... ... @@ -135,9 +139,12 @@ class Message extends Api
$page_num = $this->request->param('page_num', 10, 'intval');
$data = $this->model
->with(['order','grab'=>['user']])
->where('user_id',$this->auth->id)
->where('type','2')
->order('createtime desc')
->alias('a')
->join('order b','b.id = a.order_id')
->where('a.user_id',$this->auth->id)
->where('a.type','2')
->order('a.createtime desc')
->field('a.*')
->paginate($page_num,false,['page'=>$page])
->each(function($v){
// 显示数据
... ...
... ... @@ -239,22 +239,22 @@ class OrderGrab extends Api
$page = $this->request->param('page', 1, 'intval');
$page_num = $this->request->param('page_num', 10, 'intval');
$type = $this->request->param('type');
$where['user_id'] = $this->auth->id;
$where['a.user_id'] = $this->auth->id;
switch ($type){
case '1':
$where['status'] = '1';
$where['a.status'] = '1';
break;
case '2':
$where['status'] = '2';
$where['a.status'] = '2';
break;
case '3':
$where['status'] = '3';
$where['a.status'] = '3';
break;
case '4':
$where['status'] = ['in','4,6'];
$where['a.status'] = ['in','4,6'];
break;
case '5':
$where['status'] = '5';
$where['a.status'] = '5';
break;
default:
$this->error('参数不合法');
... ... @@ -262,8 +262,11 @@ class OrderGrab extends Api
}
$data = $this->model
->with(['order'])
->alias('a')
->join('order b','b.id = a.order_id')
->where($where)
->order('createtime desc')
->order('a.createtime desc')
->field('a.*')
->paginate($page_num,false,['page'=>$page])
->each(function($v){
// 抢单时间
... ...