handleDingTalkRobotSettings(); } protected function handleDingTalkRobotSettings() { $row = $this->getQueryBuilder() ->select('*') ->from('kg_setting') ->where(['section' => 'dingtalk.robot']) ->andWhere(['item_key' => 'app_token']) ->execute()->fetch(PDO::FETCH_ASSOC); $webhookUrl = ''; /** * 直接使用webhook地址,不用单独分离出access_token,简化用户操作 */ if (!empty($row['item_value'])) { $webhookUrl = "https://oapi.dingtalk.com/robot/send?access_token={$row['item_value']}"; } $rows = [ [ 'section' => 'dingtalk.robot', 'item_key' => 'webhook_url', 'item_value' => $webhookUrl, ], ]; $this->insertSettings($rows); } }