public function insert(){
if (IS_POST) {
$uid = I("post.uid");
$data['uid'] = $uid;
$data['f_desc'] = I('post.content'); //反馈内容
$data['f_information'] = I("post.information"); //联系方式
$data['f_time'] = date("Y-m-d H:i:s"); //时间
$model = M("Feedback");
$res = $model->where("uid = $uid")->field("f_time")->select();
//print_r($res);
//die;
for($i=0;$i
$datetime = $res[$i]['f_time'];
$b = substr($datetime,0,10);
$c = date('Y-m-d');
if($b==$c){
$dat['status'] = 0;
$dat['msg'] = '您今天已经提交意见反馈!';
//echo json_encode($dat);
print_r($dat);die;
}
}
if ($model->add($data)) {
$dat['status'] = 1;
$dat['msg'] = '提交成功';
echo json_encode($dat);
die;
} else {
$dat['status'] = 0;
$dat['msg'] = '提交失败';
echo json_encode($dat);
die;
}
} else {
$dat['status'] = 102;
$dat['msg'] = '请求方式错误';
echo json_encode($dat);die;
}
}