onlineUserId = $onlineUserId; $this->onlineEnterpriseId = $enterpriseId; $this->objDSystem = new DSystem('default'); } /** * 编辑,新增分类设置 * @param $selectParams * @return ResultWrapper */ public function setClassSetting($selectParams) { $dbResult = $this->objDSystem->get(['enterpriseId' => $selectParams['enterpriseId'], 'type' => StatusCode::$settingType['class']]); if ($dbResult === false) { return ResultWrapper::fail($this->objDSystem->error(), ErrorCode::$dberror); } if ($dbResult) { //修改 $dbResult = $this->objDSystem->update(['content' => json_encode($selectParams['content']), 'updateTime' => time()], ['enterpriseId' => $selectParams['enterpriseId'], 'type' => StatusCode::$settingType['class']]); if ($dbResult === false) { return ResultWrapper::fail($this->objDSystem->error(), ErrorCode::$dberror); } } else { //新增 $insertData = [ 'enterpriseId' => $selectParams['enterpriseId'], 'type' => StatusCode::$settingType['class'], 'content' => json_encode($selectParams['content']), 'createTime' => time(), 'updateTime' => time(), ]; $dbResult = $this->objDSystem->insert($insertData); if ($dbResult === false) { return ResultWrapper::fail($this->objDSystem->error(), ErrorCode::$dberror); } } return ResultWrapper::success($dbResult); } /** * 获取分类设置 * @param $selectParams * @return bool|mixed */ public function getClassSettingInfo($selectParams) { $dbResult = $this->objDSystem->get(['enterpriseId' => $selectParams['enterpriseId'], 'type' => StatusCode::$settingType['class']]); if ($dbResult === false) { return ResultWrapper::fail($this->objDSystem->error(), ErrorCode::$dberror); } $dbResult && $dbResult['content'] = json_decode($dbResult['content'], true); if (isset($dbResult['content'])) { return ResultWrapper::success($dbResult['content']); } return ResultWrapper::success([]); } }