Admin/system/Material/NEWS/Edit.aspx.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using UAP;

[UAP.Role]
public partial class Material_NEWS_Edit : UAP.Page
{

    public string get(int id)
    {
        return DataBase.getJsonString("select * from ec_news where id=" + id, 0);
    }


    public string save(int id, JSON data)
    {
        DataBase.Transaction();
        try
        {
            data["content"] = data.tryS("content").Replace("'", "");
            data.Only("name", "isactive", "content");
            if (id == 0)
            {
                data.Add("createid", UAP.Role.Id);
                id = DataBase.Insert("ec_news", true, data);
            }
            else
            {
                id = DataBase.Update("ec_news", "id=" + id, data);
            }
            DataBase.Commit();
            return "ok";
        }
        catch (Exception ex)
        {
            DataBase.Rollback();
            return ex.Message;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。