我正在开发 cakephp 2.x ......好吧,场景是我正在向我的 webapp 发送消息......几乎有 509 条消息......问题是它正在将一些消息保存到数据库中,并在一些消息中保存在android控制台上给我一个错误......所以我首先想问你们都认为实际问题在哪里或可能在哪里......另一个认为有办法可以抛出一些异常未保存到数据库中的数据错误..所以我可以跟踪未保存到并导致问题的特定消息...我需要一些帮助来调试此代码
这是我的代码
public function message(){
$this->loadModel('Message');
if ($this->request->isPost()){
$json = $this->request->data('json');
$data = json_decode($json, TRUE);
foreach($data as $datas){
$date = $datas['date'];
$mobileNo = $datas['mobileNo'];
$mobileNo = AllSecure::replaceDashesAndSpaces($mobileNo);
$body = $datas['body'];
$timestamp = $date/1000;
$date = date('Y-m-d h:i' , $timestamp);
$this->request->data['Message']['mobileNo'] = $mobileNo;
$this->request->data['Message']['body'] = $datas['body'];
$this->request->data['Message']['type'] = $datas['type'];
$this->request->data['Message']['User_id'] = $datas['idUser'];
$this->request->data['Message']['dateTime'] = $date;
$count = $this->Message->checkTextMessages($mobileNo,$body,$date,$datas['idUser']);
if($mobileNo!=null){
if($count>0){
}else{
$this->Message->create();
$this->Message->save($this->request->data
}
}
}
}
}