<?php

require '../dao/PraiseDao.php';
$userId = $_REQUEST['userId'];
$postId = $_REQUEST['postId'];
$praiseDao = new PraiseDao();
if ($praiseDao->setPraise($userId, $postId) > 0) {
    echo json_encode(array('mesg' => 'success', 'result' => true));
} else {
    echo json_encode(array('mesg' => 'fail', 'result' => false));
}
<?php

require '../dao/PraiseDao.php';
$praiseId = $_REQUEST['userId'];
$praiseDao = new PraiseDao();
if ($praiseDao->setAllRead($userId) > 0) {
    echo json_encode(array('mesg' => 'success', 'result' => true));
} else {
    echo json_encode(array('mesg' => 'fail', 'result' => false));
}
<?php

require '../dao/PraiseDao.php';
$userId = $_REQUEST['userId'];
$praiseDao = new PraiseDao();
echo $praiseDao->getPraiseList($userId);
<?php

require '../dao/PraiseDao.php';
$userId = $_REQUEST['userId'];
$postId = $_REQUEST['postId'];
$praiseDao = new PraiseDao();
if ($praiseDao->cancelPraise($userId, $postId) > 0) {
    echo json_encode(array('mesg' => 'success', 'result' => true));
} else {
    echo json_encode(array('mesg' => 'fail', 'result' => false));
}
<?php

require '../dao/PraiseDao.php';
$praiseId = $_REQUEST['praiseId'];
$praiseDao = new PraiseDao();
if ($praiseDao->setRead($praiseId) > 0) {
    echo json_encode(array('mesg' => 'success', 'result' => true));
} else {
    echo json_encode(array('mesg' => 'fail', 'result' => false));
}