mirror of
				https://github.com/yangjian102621/geekai.git
				synced 2025-11-04 08:13:43 +08:00 
			
		
		
		
	Merge branch 'ui' of 172.28.1.6:yangjian/chatgpt-plus into ui
This commit is contained in:
		@@ -73,6 +73,13 @@ func (h *SysUserHandler) Save(c *gin.Context) {
 | 
				
			|||||||
		resp.ERROR(c, types.InvalidArgs)
 | 
							resp.ERROR(c, types.InvalidArgs)
 | 
				
			||||||
		return
 | 
							return
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 默认id为1是超级管理员
 | 
				
			||||||
 | 
						if data.Id == 1 {
 | 
				
			||||||
 | 
							resp.ERROR(c, "超级管理员不支持更新")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var user = model.AdminUser{}
 | 
						var user = model.AdminUser{}
 | 
				
			||||||
	var res *gorm.DB
 | 
						var res *gorm.DB
 | 
				
			||||||
	var userVo vo.AdminUser
 | 
						var userVo vo.AdminUser
 | 
				
			||||||
@@ -135,9 +142,20 @@ func (h *SysUserHandler) ResetPass(c *gin.Context) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Remove 删除
 | 
					// Remove 删除
 | 
				
			||||||
func (h *SysUserHandler) Remove(c *gin.Context) {
 | 
					func (h *SysUserHandler) Remove(c *gin.Context) {
 | 
				
			||||||
	id := h.GetInt(c, "id", 0)
 | 
						var data struct {
 | 
				
			||||||
	if id > 0 {
 | 
							Id uint
 | 
				
			||||||
		res := h.db.Where("id = ?", id).Delete(&model.AdminUser{})
 | 
						}
 | 
				
			||||||
 | 
						if err := c.ShouldBindJSON(&data); err != nil {
 | 
				
			||||||
 | 
							resp.ERROR(c, types.InvalidArgs)
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						// 默认id为1是超级管理员
 | 
				
			||||||
 | 
						if data.Id == 1 {
 | 
				
			||||||
 | 
							resp.ERROR(c, "超级管理员不能删除")
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if data.Id > 0 {
 | 
				
			||||||
 | 
							res := h.db.Where("id = ?", data.Id).Delete(&model.AdminUser{})
 | 
				
			||||||
		if res.Error != nil {
 | 
							if res.Error != nil {
 | 
				
			||||||
			resp.ERROR(c, "删除失败")
 | 
								resp.ERROR(c, "删除失败")
 | 
				
			||||||
			return
 | 
								return
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,7 +11,7 @@ function useAsyncTable<T extends Record<string, unknown>>(
 | 
				
			|||||||
): TableReturn {
 | 
					): TableReturn {
 | 
				
			||||||
  const paginationState = reactive({
 | 
					  const paginationState = reactive({
 | 
				
			||||||
    current: 1,
 | 
					    current: 1,
 | 
				
			||||||
    pageSize: 10,
 | 
					    pageSize: 20,
 | 
				
			||||||
    total: 0,
 | 
					    total: 0,
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,7 +37,7 @@ const columns = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const expandable = reactive({
 | 
					const expandable = reactive({
 | 
				
			||||||
  title: "",
 | 
					  title: "",
 | 
				
			||||||
  width: 80,
 | 
					  width: 50,
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 数据
 | 
					// 数据
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,16 +100,18 @@ const handleRemove = async (id, reload) => {
 | 
				
			|||||||
      />
 | 
					      />
 | 
				
			||||||
    </template>
 | 
					    </template>
 | 
				
			||||||
    <template #actions="{ record, reload }">
 | 
					    <template #actions="{ record, reload }">
 | 
				
			||||||
      <a-link @click="openFormModal(reload, record)">编辑</a-link>
 | 
					 | 
				
			||||||
      <a-link @click="openResetPWDModal(reload, record)">修改密码</a-link>
 | 
					      <a-link @click="openResetPWDModal(reload, record)">修改密码</a-link>
 | 
				
			||||||
      <a-popconfirm
 | 
					      <template v-if="record.id !== 1">
 | 
				
			||||||
        content="是否删除?"
 | 
					        <a-link @click="openFormModal(reload, record)">编辑</a-link>
 | 
				
			||||||
        position="left"
 | 
					        <a-popconfirm
 | 
				
			||||||
        type="warning"
 | 
					          content="是否删除?"
 | 
				
			||||||
        :on-before-ok="() => handleRemove(record.id, reload)"
 | 
					          position="left"
 | 
				
			||||||
      >
 | 
					          type="warning"
 | 
				
			||||||
        <a-link status="danger">删除</a-link>
 | 
					          :on-before-ok="() => handleRemove(record.id, reload)"
 | 
				
			||||||
      </a-popconfirm>
 | 
					        >
 | 
				
			||||||
 | 
					          <a-link status="danger">删除</a-link>
 | 
				
			||||||
 | 
					        </a-popconfirm>
 | 
				
			||||||
 | 
					      </template>
 | 
				
			||||||
    </template>
 | 
					    </template>
 | 
				
			||||||
  </SearchTable>
 | 
					  </SearchTable>
 | 
				
			||||||
</template>
 | 
					</template>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,7 @@ const columns: SearchTableColumns[] = [
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    title: "过期时间",
 | 
					    title: "过期时间",
 | 
				
			||||||
    dataIndex: "expired_time",
 | 
					    dataIndex: "expired_time",
 | 
				
			||||||
 | 
					    width: 180,
 | 
				
			||||||
    render: ({ record }) => {
 | 
					    render: ({ record }) => {
 | 
				
			||||||
      return dateFormat(record.expired_time);
 | 
					      return dateFormat(record.expired_time);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -44,6 +45,7 @@ const columns: SearchTableColumns[] = [
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    title: "注册时间",
 | 
					    title: "注册时间",
 | 
				
			||||||
    dataIndex: "created_at",
 | 
					    dataIndex: "created_at",
 | 
				
			||||||
 | 
					    width: 180,
 | 
				
			||||||
    render: ({ record }) => {
 | 
					    render: ({ record }) => {
 | 
				
			||||||
      return dateFormat(record.created_at);
 | 
					      return dateFormat(record.created_at);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
@@ -51,6 +53,8 @@ const columns: SearchTableColumns[] = [
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    title: "操作",
 | 
					    title: "操作",
 | 
				
			||||||
    slotName: "actions",
 | 
					    slotName: "actions",
 | 
				
			||||||
 | 
					    width: 180,
 | 
				
			||||||
 | 
					    fixed: "right",
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user