|
|
@ -56,8 +56,9 @@ class DiscussesService
|
|
|
|
# 添加评论
|
|
|
|
# 添加评论
|
|
|
|
def create params, current_user
|
|
|
|
def create params, current_user
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
|
|
|
|
hidden = current_user.admin? ? 0 : 1
|
|
|
|
Discuss.create!(:dis_id => params[:shixun_id], :dis_type => "Shixun", :content => params[:content].gsub(" \;", "").strip, :user_id => current_user.id,
|
|
|
|
Discuss.create!(:dis_id => params[:shixun_id], :dis_type => "Shixun", :content => params[:content].gsub(" \;", "").strip, :user_id => current_user.id,
|
|
|
|
:praise_count => 0, :position => params[:position], :challenge_id => params[:challenge_id])
|
|
|
|
:praise_count => 0, :position => params[:position], :challenge_id => params[:challenge_id], :hidden => hidden)
|
|
|
|
# 发送手机通知
|
|
|
|
# 发送手机通知
|
|
|
|
# status = Trustie::Sms.send(mobile:'18173242757', send_type:'discuss', name:'管理员')
|
|
|
|
# status = Trustie::Sms.send(mobile:'18173242757', send_type:'discuss', name:'管理员')
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
@ -69,8 +70,9 @@ class DiscussesService
|
|
|
|
def reply params, current_user
|
|
|
|
def reply params, current_user
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
base_dicuss params[:id]
|
|
|
|
base_dicuss params[:id]
|
|
|
|
|
|
|
|
hidden = current_user.admin? ? 0 : 1
|
|
|
|
discuss = Discuss.create!(:content => params[:content].gsub(" \;", "").strip, :user_id => current_user.id, :parent_id => params[:id],
|
|
|
|
discuss = Discuss.create!(:content => params[:content].gsub(" \;", "").strip, :user_id => current_user.id, :parent_id => params[:id],
|
|
|
|
:root_id => @discuss.root_id || params[:id], :praise_count => 0, :challenge_id => @discuss.challenge_id,
|
|
|
|
:root_id => @discuss.root_id || params[:id], :praise_count => 0, :challenge_id => @discuss.challenge_id, :hidden => hidden,
|
|
|
|
:dis_id => @discuss.dis_id, :dis_type => @discuss.dis_type, :position => @discuss.position)
|
|
|
|
:dis_id => @discuss.dis_id, :dis_type => @discuss.dis_type, :position => @discuss.position)
|
|
|
|
return discuss
|
|
|
|
return discuss
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|