['op'=>$op, 'id'=>$_id, 'block_id'=>$_block_id, 'parent_id'=>$_parent_id, 'uid'=>$UID, 'book'=>$_book, 'paragraph'=>$_para, 'begin'=>$_begin, 'end'=>$_end, 'style'=>$_style, 'text'=>$_text, 'stage'=>$_stage, 'author'=>$_author, 'lang'=>$_lang ]]; $response = $client->request('POST', 'http://10.10.1.100/wikipalipro/app/studio/sent/sent.php',$parm); $status = $response->getStatusCode(); $head_type = $response->getHeaderLine('content-type'); //echo $response->getBody(); */ if($_id==0){ $query="select * from sentence where book='{$_book}' and paragraph='{$_para}' and begin='{$_begin}' and end='{$_end}' and tag='{$_style}' and author='{$_author}' and editor='{$UID}' and language='{$_lang}' "; $Fetch = PDO_FetchAll($query); $iFetch=count($Fetch); if($iFetch>0){ $_id = $Fetch[0]["id"]; $_block_id = $Fetch[0]["block_id"]; } } $recodeId=$_id; $time=mTime(); if($_id!=0){//修改旧记录 $query="UPDATE sentence SET text='$_text' , receive_time='{$time}' where id=".$PDO->quote($_id); } else{//新建记录 $uuid=UUID::v4(); $query="INSERT INTO sentence VALUES ('{$uuid}', '$_block_id', '$_book', '$_para', '$_begin', '$_end', '$_tag', '$_author', '$UID', '$_text', '$_lang', '1', '1', '$time', '$time')"; } $stmt = @PDO_Execute($query); $respond=array("status"=>0,"message"=>""); if (!$stmt || ($stmt && $stmt->errorCode() != 0)) { $error = PDO_ErrorInfo(); $respond['status']=1; $respond['error']=$error[2]; } else{ $respond['status']=0; $respond['error']=""; if($recodeId==0){ $respond['id']=$uuid; } else{ $respond['id']=$recodeId; } $respond['block_id']=$_block_id; $respond['begin']=$_begin; $respond['end']=$_end; } echo json_encode($respond, JSON_UNESCAPED_UNICODE); break; } ?>