feat: 一键编辑标签下渠道重定向

This commit is contained in:
CalciumIon
2024-11-19 01:42:46 +08:00
parent 807385d3d1
commit 6e6e390f6f
3 changed files with 15 additions and 11 deletions

View File

@@ -158,8 +158,8 @@ func SearchChannels(c *gin.Context) {
keyword := c.Query("keyword")
group := c.Query("group")
modelKeyword := c.Query("model")
//idSort, _ := strconv.ParseBool(c.Query("id_sort"))
channels, err := model.SearchChannels(keyword, group, modelKeyword)
idSort, _ := strconv.ParseBool(c.Query("id_sort"))
channels, err := model.SearchChannels(keyword, group, modelKeyword, idSort)
if err != nil {
c.JSON(http.StatusOK, gin.H{
"success": false,
@@ -294,10 +294,11 @@ func DeleteDisabledChannel(c *gin.Context) {
}
type ChannelTag struct {
Tag string `json:"tag"`
NewTag *string `json:"newTag"`
Priority *int64 `json:"priority"`
Weight *uint `json:"weight"`
Tag string `json:"tag"`
NewTag *string `json:"new_tag"`
Priority *int64 `json:"priority"`
Weight *uint `json:"weight"`
MapMapping *string `json:"map_mapping"`
}
func DisableTagChannels(c *gin.Context) {

View File

@@ -691,7 +691,7 @@ const ChannelsTable = () => {
}
setSearching(true);
const res = await API.get(
`/api/channel/search?keyword=${searchKeyword}&group=${searchGroup}&model=${searchModel}`
`/api/channel/search?keyword=${searchKeyword}&group=${searchGroup}&model=${searchModel}&id_sort=${idSort}`
);
const { success, message, data } = res.data;
if (success) {

View File

@@ -8,7 +8,8 @@ const EditTagModal = (props) => {
const [loading, setLoading] = useState(false);
const originInputs = {
tag: '',
newTag: null,
new_tag: null,
model_mapping: null,
}
const [inputs, setInputs] = useState(originInputs);
@@ -18,11 +19,13 @@ const EditTagModal = (props) => {
let data = {
tag: tag,
}
let shouldSave = true;
if (inputs.newTag === tag) {
setLoading(false);
return;
}
if (inputs.model_mapping !== null) {
data.model_mapping = inputs.model
}
data.newTag = inputs.newTag;
if (data.newTag === '') {
Modal.confirm({
@@ -80,8 +83,8 @@ const EditTagModal = (props) => {
<TextInput
label="新标签(留空则解散标签,不会删除标签下的渠道)"
name="newTag"
value={inputs.newTag}
onChange={(value) => setInputs({ ...inputs, newTag: value })}
value={inputs.new_tag}
onChange={(value) => setInputs({ ...inputs, new_tag: value })}
placeholder="请输入新标签"
/>
</Spin>