public function getCaseRechargeOrderString4ali($caseId, $caseType, $os) {/*{{{*/ $infos = array(); if ($caseType != 'flow' && $caseType != 'Flow') { $this->setErrorCode(335); return false; } $flow = DAL::get()->find('DoctorPatientRef', $caseId); if ($flow->isNull()) { $this->setErrorCode(335); return false; } $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($flow->space); $needPay = XString::calculateBalancePrice($product->salePrice, $flow->user->getCashAccount()->amount); if ($needPay <= 0) { return false; } $serviceOrder = ServiceOrderClient::getInstance()->create($flow, $product, $flow->user); if ($serviceOrder->isNull()) { $this->setErrorCode(307); return false; } //dodo::zhb 创建充值单 $depositeOrder = OrderClient::getInstance()->createDepositeOrder($flow->user, $needPay, DepositeOrder::RECHARGE_TYPE_ALIPAYWAP, array($serviceOrder)); if ($depositeOrder->isNull()) { $this->setErrorCode(3071); return false; } $userName = $flow->user->name; $callBackUrl = WapAlipay::getDefaultNotifyUrl(); $description = $userName."充值购买咨询"; $type = Pay::TYPE_FLOWORDER; $orderString = WapAlipay::getInstance()->encryptOrderInfo($depositeOrder->id, $type, $needPay, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_FLOW)->text, $description); $infos['orderString'] = $orderString; $infos['wapPayUrl'] = WaperAlipay::getPayUrl4rechargeableCase($caseId, $os, $serviceOrder->id, $depositeOrder->id); $infos['wapPayReturnUrl'] = WaperAlipay::getDefaultReturnUrl(); $infos['wapPaySellerUrl'] = WaperAlipay::getDefaultSellerUrl(); $this->content = $infos; }/*}}}*/
/** * productDetail * * @param mixed $request * @param mixed $response * @author mq <*****@*****.**> * @access public * @return void */ public function productDetail($request, $response) { /*{{{*/ if ($request->id) { $this->showUpdateProduct($request, $response); } else { if ($request->spaceId) { $this->showAddProduct($request, $response); } else { throw new BizException('无效的参数!'); } } $contracts = DAL::get()->find_all_by_spaceid_and_type('contract', $response->space->id, array_keys(ServiceDef::getServices())); foreach ($contracts as $contract) { if ($contract->isPresent()) { unset($contracts[$contract->id]); } } $response->contracts = $contracts; $response->productList = DAL::get()->find_all_by_contractIds('Product', array_keys($contracts)); }
public function pay($request, $response) { /*{{{*/ $this->validLogin($response); $source = $this->getSource($request); if ($source->isNull()) { $response->setRedirect($this->space->getPhoneServiceUrl4Order()); return parent::DIRECT_OUTPUT; } $this->checkIsMySource($source); if ($source->isPaid()) { $response->setRedirect($source->successUrl()); return parent::DIRECT_OUTPUT; } $account = $source->user->getCashAccount(); if ($account->amount >= $source->getSalePrice()) { $response->setRedirect($response->router->urlfor('payment/showpaytype', array('sourceId' => $source->id, 'sourceType' => $request->sourceType))); return parent::DIRECT_OUTPUT; } $amount = XString::calculateBalancePrice($source->getSalePrice(), $account->amount); $doctor = $this->space->host; $hospitalfaculty = $doctor->hospitalfaculty; $hospital = $hospitalfaculty->hospital; $description = $hospital->name . $hospitalfaculty->name . $doctor->name; $onlinePayType = $request->onlinePayType; $depositeOrder = OrderClient::getInstance()->createDepositeOrder($this->user, $amount, $onlinePayType == 'alipay' ? DepositeOrder::RECHARGE_TYPE_ALIPAY : DepositeOrder::RECHARGE_TYPE_QPAY, array($source)); if ($onlinePayType == 'alipay') { //创建支付url $callBackUrl = BeanFinder::get('configs')->alipay_callback_url; $frontUrl = BeanFinder::get('configs')->alipay_callback_returnurl; $payUrl = Alipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $depositeOrder->amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl); $response->exitJump($payUrl); } else { if ($onlinePayType == '00') { $orders = array(); $orders['orderId'] = $depositeOrder->id; $orders['productName'] = ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text; $orders['bankId'] = ''; $orders['bankType'] = '00'; $orders['orderTimestamp'] = Qpay::getInstance()->getQpayOrderTimestamp(); $orders['payerIP'] = XIpLocation::getIp(); $orders['bgUrl'] = BeanFinder::get('configs')->qpay_callback_url; $orders['orderAmount'] = $amount; $qpay = new Qpay(); $qpay->setOrderInfo($orders, Pay::TYPE_PAY); $form = $qpay->getSubmitForm(); $response->form = $form; } else { //创建支付url $callBackUrl = BeanFinder::get('configs')->alipay_gateway_callback_url; $frontUrl = BeanFinder::get('configs')->alipay_gateway_callback_returnurl; $payUrl = GatewayAlipay::getInstance()->getPayUrl($depositeOrder->id, Pay::TYPE_PAY, $amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl, $onlinePayType); $response->form = $payUrl; } } }
private function _alipayForOrder($amount, $order, DepositeOrder $depositeOrder) {/*{{{*/ $callBackUrl = BeanFinder::get('configs')->alipay_callback_url; $frontUrl = BeanFinder::get('configs')->alipay_callback_returnurl; if($order instanceof ScoreOrder) { $description = $this->user->name."充值兑换积分"; $type = Pay::TYPE_SCOREORDER; } else if($order instanceof ServiceOrder) { $description = $this->user->name."充值购买咨询"; $type = Pay::TYPE_FLOWORDER; } else if($order instanceof DepositeOrder) { $type = Pay::TYPE_RECHARGE; $description = $this->user->name."充值"; } else { return false; } return Alipay::getInstance()->getPayUrl($depositeOrder->id, $type, $amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description, $frontUrl); }/*}}}*/
public function getPhoneOrderPayStringByOrderId($orderId) {/*{{{*/ $source = DAL::get()->find('intention', $orderId); if ($source->isNull()) { // $proposal = DAL::get()->find('proposal', $orderId); $proposal = $this->getRightObj($orderId); if($proposal->isNull()) { $this->setErrorCode(313); return 0; } $source = DAL::get()->find_by_source('serviceorder', $proposal); if($source->isNull()) { $this->setErrorCode(313); return 0; } } $hospitalfaculty = $source->space->host->hospitalfaculty; $hospital = $hospitalfaculty->hospital; $description = $hospital->commonName.$hospitalfaculty->name.$source->space->name; $amount = XString::calculateBalancePrice($source->getSalePrice(), $source->user->getCashAccount()->amount); if (0 >= $amount) { $this->setErrorCode(338); return 0; } //dodo::zhb 创建充值单 $depositeOrder = OrderClient::getInstance()->createDepositeOrder($source->user, $amount, DepositeOrder::RECHARGE_TYPE_ALIPAYWAP, array($source)); //创建支付url $callBackUrl = WapAlipay::getDefaultNotifyUrl(); $string = WapAlipay::getInstance()->encryptOrderInfo($depositeOrder->id, Pay::TYPE_PAY, $depositeOrder->amount, $callBackUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_TELORDER)->text, $description); $infos = array(); $infos['string'] = $string; $infos['wapPayUrl'] = WaperAlipay::getPayUrl4telorder($source->id); $infos['wapPayReturnUrl'] = WaperAlipay::getDefaultReturnUrl(); $infos['wapPaySellerUrl'] = WaperAlipay::getDefaultSellerUrl(); $this->content = $infos; }/*}}}*/
<td nowrap>服务类型</td> <td nowrap>医生</td> <td nowrap>提交时间</td> <td nowrap>申请来源</td> <td nowrap>状态</td> <td nowrap>操作</td> </tr> <?php foreach ($productApplyList as $productApply) { ?> <tr class="ml20 itle h20"> <td nowrap><?php echo $productApply->id; ?> </td> <td nowrap><?$desc = ServiceDef::getServiceSpec($productApply->serviceDef)->text; echo $desc;?></td> <td nowrap> <a href=<?php echo $productApply->space->getUrl(); ?> target="_blank" class="blue"> <?php echo $productApply->space->host->hospitalfaculty->hospital->commonName . " " . $productApply->space->host->hospitalfaculty->faculty->name . " " . $productApply->space->name; ?> </a> </td> <td nowrap><?php echo $productApply->ctime; ?> </td> <td nowrap><?php
public function alipayChannel4Zixun($request, $response) { /*{{{*/ $flow = DAL::get()->find('DoctorPatientRef', $request->refid); DBC::requireFalse($flow->isNull(), '无效订单'); $product = ProductClient::getInstance()->getDoctorChargeFlowProduct($flow->space); $needPay = XString::calculateBalancePrice($product->salePrice, $flow->user->getCashAccount()->amount); DBC::requireTrue($needPay > 0, '价格有错误 或 余额可够支付'); $serviceOrder = ServiceOrderClient::getInstance()->create($flow, $product, $flow->user); DBC::requireFalse($serviceOrder->isNull(), '无效订单'); $depositeOrder = OrderClient::getInstance()->createDepositeOrder($flow->user, $needPay, DepositeOrder::RECHARGE_TYPE_ALIPAYWAP, array($serviceOrder)); DBC::requireFalse($depositeOrder->isNull(), '无效订单!'); $userName = $flow->user->name; $returnUrl = WaperAlipay::getDefaultReturnUrl4TouchZixun(); $notifyUrl = WaperAlipay::getDefaultNotifyUrl(); $sellerUrl = WaperAlipay::getDefaultSellerUrl4TouchZixun($serviceOrder->id); $aliPayUrl = WaperAlipay::getAliWapPayUrl($depositeOrder->id, $this->getPayTypeByOrder($serviceOrder), $needPay, $notifyUrl, $returnUrl, $sellerUrl, ServiceDef::getServiceSpec(ServiceDef::TYPE_FLOW)->text, $this->getPayDescriptionByOrder($serviceOrder, $userName)); $response->setRedirect($aliPayUrl); }
"/> <label>结束:</label> <input type="text" name="toTime" id="toTime" class="toTime w80" value="<?php echo $toTime; ?> "/> <label>医生名:</label> <input type="text" name="spaceName" class="w80 spaceName" value="<?php echo $spaceName; ?> "/> <label class='contractType'>类型:</label> <select name="type" class='contractType'> <option value="">全部</option> <?php foreach (ServiceDef::getServices() as $m => $service) { ?> <option value="<?php echo $m; ?> " <?php echo $m == $type ? "selected" : ""; ?> ><?php echo $service['text']; ?> </option> <?php } ?> </select>