/** * 获取页数 */ 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; }
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(); }
<?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)); }
<?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(); }
/** * 添加点赞数据到数据表,并同步用户数量信息 * @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; } }
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])); } }
/** * 获取订单内文件信息 */ public function getOrderInfo() { $orderId = $this->post_data->orderId; $bmobObj = new BmobObject('Order'); try { $res = $bmobObj->get($orderId); $items = json_decode($res->items); $newItems = array(); $k = 0; foreach ($items as $item) { $temp['fileName'] = $item->filename; $temp['twoSide'] = $item->printSettings->isTwoSides ? 'double' : 'single'; $temp['direction'] = $item->printSettings->direction; $temp['pptPerPage'] = $item->printSettings->pptPerPage; if ($item->fileType != fileType::$PPT) { $temp['pptPerPage'] = 0; } $temp['paperSize'] = $item->printSettings->paperSize; $temp['amount'] = $item->printSettings->amount; $newItems[] = $temp; } echo json_encode($newItems); } catch (Exception $e) { $this->echo_msg(false, $e->error_msr); } }