|
@@ -3071,6 +3071,52 @@ class Orders extends Base {
|
|
|
{
|
|
|
$ret = Db::name('orders')
|
|
|
->alias('o')
|
|
|
+ ->where('o.org_id',$org)
|
|
|
+ ->where('o.del',0)
|
|
|
+ // ->where('o.order_mode','in',[1,4])
|
|
|
+ //->where('o.work_type_mode',3)
|
|
|
+ ->where('o.create_yyyymmdd',date('Ymd'))
|
|
|
+ ->order('o.id','desc')
|
|
|
+ ->limit($limit)->select();
|
|
|
+ foreach ($ret as $k=>$v){
|
|
|
+
|
|
|
+ $todo =Db::name('todo')
|
|
|
+ ->alias('t')
|
|
|
+ ->where('t.order_id',$v['id'])
|
|
|
+ ->join('user u','u.id = t.to_user_id')
|
|
|
+ // ->where('t.todo_mode','in',[1,2,3])
|
|
|
+ ->where('t.del',0)
|
|
|
+ ->field('u.real_name,t.create_time,t.confirm_time')
|
|
|
+ ->order('t.id','asc')
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ $users = [];
|
|
|
+ $confirmTime = '';
|
|
|
+ foreach ($todo as $kk=>$vv){
|
|
|
+ $users[] = $vv['real_name'];
|
|
|
+ if(!$confirmTime && $vv['confirm_time']){
|
|
|
+ $confirmTime = $vv['confirm_time'];
|
|
|
+ }else if($confirmTime && $vv['confirm_time'] && $vv['confirm_time'] < $confirmTime){
|
|
|
+ $confirmTime = $vv['confirm_time'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $ret[$k]['real_names'] = implode(',',$users);
|
|
|
+ $ret[$k]['send_time'] = $todo?$todo[0]['create_time']:'';
|
|
|
+ $ret[$k]['confirm_time'] = $confirmTime;
|
|
|
+ $ret[$k]['order_model_txt'] = Db::name('order_mode')
|
|
|
+ ->where('id',$v['order_mode'])
|
|
|
+ ->value('out_content');
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return $ret?$ret:[];
|
|
|
+ }
|
|
|
+ public function get_cur_day_lists_bak($org,$limit=5)
|
|
|
+ {
|
|
|
+ $ret = Db::name('orders')
|
|
|
+ ->alias('o')
|
|
|
->join('order_convey oc','oc.order_id = o.id')
|
|
|
->field('o.*,oc.type,oc.start,oc.end,oc.xq_time,oc.ywc_time,oc.device_id,oc.name,oc.phone,oc.priority')
|
|
|
->where('o.org_id',$org)
|