load->database(); $this->table = 'flow'; $this->load_table('flow'); $this->allStatus=new Model_Flow_status(); } public function allStatus() { return [ ]; } /** * 此状态的下一个状态 * @param Status $status * @return mixed */ public function getNextStatus($status) { $flowStatus = $this->allStatus->find('`code`="'.$status.'"'); return $this->allStatus->find(" `flow_id` =".$flowStatus['flow_id']." and `order` >" . $flowStatus['order'],"*",'order'); } public function getCloseStatus($status) { return $this->allStatus->find('`flow_id`='.$status['flow_id'].' and `order` = '.Model_Flow_status::STATUSCLOSE.'','*','`order`'); } public function getCancelStatus($status) { return $this->allStatus->find('`flow_id`='.$status['flow_id'].' and `order` = '.Model_Flow_status::STATUS_CANCEL.'','*','`order`'); } /** * 获取初始状态 * @return mixed */ public function getFirstStatus($flow) { return $this->allStatus->find('`flow_id`='.$flow['id'].' and `order` >= 0','*','`order`'); } /** * 获取最终状态 * @return mixed */ public function getFinalStatus($status) { return $this->allStatus->find('`flow_id`='.$status['flow_id'].' and `order` >= 0','*','`order` desc'); } // public function process() // { // return $this->hasMany(Process::class, 'flow_id'); // } }