Exemplo n.º 1
0
        public override ReturnValue edit(double classId)
        {
            ReturnValue info  = new ReturnValue();
            RecordClass value = new RecordClass(32123421234, loginInfo.value);

            value.tableName = "u_question";
            double      id = s_request.getDouble("id");
            Permissions p  = loginInfo.value.getColumnPermissions(classId);

            if (!p.write)
            {
                info.errNo  = -1;
                info.errMsg = "没有权限";
                return(info);
            }
            value.addField("classId", classId);
            value.addField("title", s_request.getString("title"));
            value.addField("u_keyword", s_request.getString("u_keyword"));
            string u_content = s_request.getString("u_content");

            value.addField("u_content", u_content);
            value.addField("u_answerCount", 0);
            if (id > 0)
            {
                info.userData = value.update(id);
                RecordClass.addKeyword(id, s_request.getString("u_keyword"), 32123421234);
            }
            else
            {
                if (!p.delete && !p.audit)
                {
                    value.addField("orderId", -1);
                }
                double dataId = value.insert();
                info.userData = dataId;
                RecordClass.addKeyword(dataId, s_request.getString("u_keyword"), 32123421234);
            }
            return(info);
        }
Exemplo n.º 2
0
        public override ReturnValue edit(double classId)
        {
            double skinId    = s_request.getDouble("skinId");
            double id        = s_request.getDouble("id");
            string u_custom  = s_request.getString("u_custom");
            string u_content = s_request.getString("u_content");
            string u_info    = s_request.getString("u_info");
            string u_fromWeb = s_request.getString("u_fromWeb");
            string pic       = s_request.getString("pic");
            string title     = s_request.getString("title");
            string u_keyword = s_request.getString("u_keyword");
            //string u_keyword,string u_defaultPic,double id,double classId,string u_custom,string u_content,string u_info, string u_fromWeb,string pic,string title,double skinId
            ReturnValue info    = new ReturnValue();
            RecordClass value   = new RecordClass(22192428132, loginInfo.value);
            string      keyword = u_keyword;

            value.tableName = "article";
            Permissions p = loginInfo.value.getColumnPermissions(classId);

            if (!p.write)
            {
                info.errNo  = -1;
                info.errMsg = "没有权限";
                return(info);
            }
            value.addField("classId", classId);
            value.addField("skinId", skinId);
            value.addField("title", title);
            value.addField("u_keyword", keyword);
            value.addField("pic", pic);
            value.addField("u_fromWeb", u_fromWeb);
            if (u_info == "")
            {
                string[] list       = Regex.Split(u_content, "(</div>|</p>)", RegexOptions.IgnoreCase);
                int      infoLength = 600;
                for (int i = 0; i < list.Length; i++)
                {
                    string html = Tools.nohtml(list[i]).Trim();
                    infoLength -= Tools.GetStringLength(html);
                    if (i > 0 && infoLength < 0)
                    {
                        break;
                    }
                    if (html != "")
                    {
                        u_info += "<p>" + html + "</p>";
                    }
                }
            }
            value.addField("u_info", u_info);
            value.addField("u_custom", u_custom);
            value.addField("u_content", u_content);
            if (id > 0)
            {
                info.userData = value.update(id);
                if (info.userData != null)
                {
                    Sql.ExecuteNonQuery("delete from indextable where dataId=@dataId", new MySqlParameter[] {
                        new MySqlParameter("dataId", info.userData)
                    });
                    RecordClass.addKeyword((double)info.userData, keyword, 22192428132);
                }
            }
            else
            {
                if (!p.delete && !p.audit)
                {
                    value.addField("orderId", -1);
                }

                info.userData = value.insert();
                if (info.userData != null)
                {
                    RecordClass.addKeyword((double)info.userData, keyword, 22192428132);
                }
            }
            return(info);
        }