Home > Back-end >  $post data submitted successfully, but the callback function does not perform
$post data submitted successfully, but the callback function does not perform

Time:09-22


The background controller, return a string
//message
@ RequestMapping (" notice/create. The action ")
@ ResponseBody
Public String createNotice (HttpSession session, Model Model, Notice Notice, Integer receive_id, String receive_name)
{System. Out. Println (receive_name);
System. The out. Println (notice);
String notice_type=new String (" notice in the group ");
String notice_type1=new String (" books recommend ");
The User send=(User) session. The getAttribute (" USER_SESSION ");
Date date=new Date();
Timestamp Timestamp=new Timestamp (date. GetTime ());
Notice. SetSend_time (timeStamp);
Notice. SetSend (send);
//if the books recommend
If (notice. GetNotice_type (.) the equals (notice_type1)) {
String [] bookname_list=notice. GetNotice_title (). The split (", ");
For (String bookname: bookname_list) {
The Integer book_id=bookService. SearchBookByName (bookname);
System. The out. Println (bookname + "-- -- -- -- -- -- --" + book_id);
If (book_id & gt; 0 {
Notice book_notice=Notice;
Book_notice. SetNotice_title (bookname);
NoticeService. AddNotice (book_notice);
Int book_notice_id=book_notice. GetNotice_id ();
The User book_receive=userService. FindUserByName (receive_name);
If (book_receive!=null) {
Int book_receive_id=book_receive. GetUid ();
NoticelistService. AddNoticeList (book_notice_id book_receive_id);

} else {
return "FAIL";
}
} else {
//title input error, look for less than book
Return "ERRO";
}

}
System. The out. Println (" completion ");

} else {
Int row=noticeService. AddNotice (notice);
Int notice_id=notice. GetNotice_id ();
Int row1=0;
The Integer group_id=notice. GetGroup (.) getGroup_id ();
//the group notice, the receiving party as a
if(! Notice. GetNotice_type (.) the equals (notice_type)) {
User receive=userService. FindUserByName (receive_name);
If (the receive!=null) {
Receive_id=receive. GetUid ();
System. The out. Println (notice_id + "" + receive_id);
Row1=noticelistService. AddNoticeList (notice_id receive_id);

} else {
return "FAIL";
}

} else if (notice. GetNotice_type (.) the equals (notice_type)) {
//if to inform the receiver in the group for all members in the group
List Members=groupService. Findgroupmember (group_id);
For (Integer member: members) {
System. The out. Println (member + "receive");
Row1 +=noticelistService. AddNoticeList (notice_id, member);
}
}

//for sending messages
}
List SendList=noticeService. SendNotice (send) getUid ());
Session. SetAttribute (" SEND_LIST sendList);
System. The out. Println (" finished ");
Return "OK".
}
Can undertake to the output is performed, but the callback function does not perform

CodePudding user response:

Where is the callback function? What action, how to test does not perform?

CodePudding user response:

You put the following text try to json

CodePudding user response:

Behind the text into a json, or remove the comma and the text
  • Related