Beispiel #1
0
 /**
  * 获取页数
  */
 public function get_pages()
 {
     $bombObj = new BmobObject('File_Info');
     $res = $bombObj->get('', array('where={"fileMD5":"' . $this->fileMD5 . '"}', 'limit=1'));
     $res = $res->results[0];
     $this->pages = $res->pages;
     return $res->pages;
 }
Beispiel #2
0
 public function index()
 {
     require_once APPPATH . 'third_party/aliyun_oss/vendor/autoload.php';
     $accessKeyId = "GtzMAvDTnxg72R04";
     $accessKeySecret = "VhD2czcwLVAaE7DReDG4uEVSgtaSYK";
     $endpoint = "oss-cn-hangzhou.aliyuncs.com";
     $bmobOrder = new BmobObject('Order');
     $res = $bmobOrder->get('', array('where={"state":"' . orderState::UNPAID . '","userId":"2447db529e"}', 'limit=1'));
     var_dump($res);
     $order = new MY_Order();
     $order->alipay();
 }
Beispiel #3
0
<?php

require_once "functions.php";
$email = $_POST["email"];
$bmobObj = new BmobObject("ZUser");
//先查询总个数
$res = $bmobObj->get("", array('count=1', 'limit=0'));
$totalCount = $res->count;
//查询用户自身送出
$res = $bmobObj->get("", array('where={"email":"' . $email . '"}'));
if (count($res->results)) {
    $voteCount = $res->results[0]->voteCount;
    $getVoteCount = $res->results[0]->getVoteCount;
    echo json_encode(array("totalCount" => $totalCount, "voteCount" => $voteCount, "getVoteCount" => $getVoteCount));
} else {
    echo json_encode(array("totalCount" => $totalCount, "voteCount" => 0, "getVoteCount" => 0));
}
Beispiel #4
0
<?php

require_once "functions.php";
$email = $_POST["email"];
$answerId = $_POST["answerId"];
$answerTitle = $_POST["answerTitle"];
$bmobObj = new BmobObject("ZUser");
//查询用户自身送出
$res = $bmobObj->get("", array('where={"email":"' . $email . '"}'));
if (count($res->results)) {
    $objectId = $res->results[0]->objectId;
    $res = $bmobObj->update($objectId, array("answerId" => $answerId, "answerTitle" => $answerTitle));
    if ($res != null) {
        echoTrueAndExit();
    } else {
        echoFalseAndExit();
    }
} else {
    echoFalseAndExit();
}
Beispiel #5
0
/**
 * 添加点赞数据到数据表,并同步用户数量信息
 * @param $email
 * @param $answer
 * @param $temail
 */
function addVoteRecord($email, $answer, $temail)
{
    $bmobObj = new BmobObject("Vote");
    $bmobObj->create(array("email" => $email, "answerId" => $answer, "temail" => $temail));
    //添加对象
    //同步点赞方数据
    $bmobObj = new BmobObject("ZUser");
    $res = $bmobObj->get("", array('where={"email":"' . $email . '"}'));
    if (count($res->results)) {
        $voteCount = $res->results[0]->voteCount;
        $voteLeft = $res->results[0]->voteLeft;
        $objectId = $res->results[0]->objectId;
        $voteCount++;
        $voteLeft++;
        $bmobObj->update($objectId, array("voteCount" => $voteCount, "voteLeft" => $voteLeft));
    } else {
        return;
    }
    //同步被点赞方数据
    $bmobObj = new BmobObject("ZUser");
    $res = $bmobObj->get("", array('where={"email":"' . $temail . '"}'));
    if (count($res->results)) {
        $getVoteCount = $res->results[0]->getVoteCount;
        $voteLeft = $res->results[0]->voteLeft;
        $objectId = $res->results[0]->objectId;
        $getVoteCount++;
        $voteLeft--;
        $bmobObj->update($objectId, array("getVoteCount" => $getVoteCount, "voteLeft" => $voteLeft));
    } else {
        return;
    }
}
Beispiel #6
0
 function alipay()
 {
     $orderId = $this->input->get('orderId');
     $bmobOrder = new BmobObject('Order');
     $res = $bmobOrder->get('', array('where={"userId":"' . $this->userId . '","objectId":"' . $orderId . '","state":"' . orderState::UNPAID . '"}'));
     if (empty($orderId) or empty($res->results)) {
         echo '无效订单号!';
         header('Location: ' . base_url('user/orders'));
         exit;
     } else {
         $order = new MY_Order();
         $order->createAlipay();
         //$charge = $order->getChargeInfo($chargeId);
         //$this->load->view('user/pay_page',array('charge'=>$pay,'orderInfo'=>$res->results[0]));
     }
 }
Beispiel #7
0
<?php

require_once "functions.php";
$email = $_POST["email"];
$bmobObj = new BmobObject("ZUser");
//查询用户自身送出
$res = $bmobObj->get("", array('where={"email":"' . $email . '"}'));
if (count($res->results)) {
    $answerTitle = $res->results[0]->answerTitle;
    echo $answerTitle;
} else {
    echoFalseAndExit();
}
Beispiel #8
0
 /**
  * 取消订单
  */
 public function cancelOrder()
 {
     $orderId = $this->post_data->orderId;
     $bmobObj = new BmobObject('Order');
     try {
         $bmobObj->update($orderId, array('state' => orderState::CANCELED));
         $this->echo_msg(true);
     } catch (Exception $e) {
         $this->echo_msg(false, $e->error_msg);
     }
 }