m_pb = new partybusinessmodel(); } public function getinfo($arr) { $where = ['isactive' => 1, 'typeid' => $arr['typeid'], 'type' => $arr['type']]; if (isset($arr['code']) && !empty($arr['code']) && is_string($arr['code'])) { $where['code'] = $arr['code']; $info = $this->m_pb->getInfo($where); if (!$info) { throw new \Exception("无业务数据"); } $result = $this->checkactive($info); if (!$result) { if ($info['isautooff']) { $this->closebusiness($info['id']); } else { throw new \Exception("业务不可用"); } } $result = $this->checkstart($info); if (!$result) { if ($arr['maststart']) { throw new \Exception("业务未开始"); } $info['isstart'] = false; } else { $info['isstart'] = true; } } if (empty($info)) { throw new \Exception("无可用业务"); } return $info; } /** * 关闭业务 * 20220104 * wj */ protected function closebusiness($id) { $where = ['id' => $id]; $update = ['isactive' => 0]; $row = $this->m_pb->updateinfo($where, $update); if (empty($row)) { log::info($where); throw new \Exception("业务关闭失败"); } } }