62,046
社区成员
发帖
与我相关
我的任务
分享
var Question= {
Load:function()
{
this.Question={id:Showjim.Query.id};
Showjim.Ajax(this.ThisFunction(this.OnGetQuestion),'getQuestion',{id:this.Question.id,isBrowse:1});
},
OnGetQuestion:function(Question,Parameter)
{
this.Question.answerCount=Parameter.answerCount;
Showjim.Skins.Question.Show(this.Question=Question);
},
Rework:function(Question)
{
Showjim.Ajax(this.ThisFunction(this.OnGetQuestion),'question.question.rework',Question);
}
};
namespace showjim.web.question
{
public partial class question
{
[showjim.setup.attribute.callAjax(fullname = "getQuestion")]//fullname表示重命名,rename只则重命名函数,fullname优先于rename
public static showjim.question.question_question get(int id, bool isBrowse, ref int answerCount)//ref表示可接收参数,out表示只输出参数,与C#语义一致
{
showjim.user.user_user user = showjim.web.user.user.currentUser;
if (user != null)
{
showjim.question.question_question value = showjim.question.question_question.get(id, null);
if (value != null && isBrowser)
{
showjim.question.question_question.addBrowser(id);
answerCount = getAnswerCount(id);
return value;
}
}
return null;
}
[showjim.setup.attribute.callAjax(method = showjim.sys.web.http.code.methodType.POST)]//限定只允许POST提交
public static showjim.question.question_question rework(showjim.question.question_question question, ref int answerCount)
{
showjim.user.user_user user = showjim.web.user.user.currentUser;
if (user != null)
{
showjim.question.question_question value = showjim.question.question_question.get(question.id, null);
if (value != null && value.userId == user.id)
{
question.userId = user.id;
if(question.update(null))
{
answerCount = getAnswerCount(id);
return question;
}
}
}
return null;
}
}
}