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;
    }/*}}}*/
    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;
    }/*}}}*/
 public function alipayChannel4Recharge($request, $response)
 {
     /*{{{*/
     $needPay = $request->getRequest('needPay', 0);
     $needPay = XString::calculateBalancePrice($needPay);
     DBC::requireTrue($needPay > 0, '价格有错误 或 余额可够支付');
     $user = DAL::get()->find('user', $request->userid);
     DBC::requireFalse($user->isNull(), '用户不存在');
     $depositeOrderId = $request->getRequest('depositeOrderId', 0);
     $depositeOrder = DAL::get()->find('depositeOrder', $depositeOrderId);
     if ($depositeOrder->isNull()) {
         $depositeOrder = OrderClient::getInstance()->createDepositeOrder($user, $needPay, DepositeOrder::RECHARGE_TYPE_ALIPAYWAP);
     }
     DBC::requireFalse($depositeOrder->isNull(), '无效订单!');
     if ($request->appType == 'mobileapp') {
         $returnUrl = WaperAlipay::getDefaultReturnUrl();
         $sellerUrl = WaperAlipay::getDefaultSellerUrl();
     } else {
         $returnUrl = WaperAlipay::getDefaultReturnUrl4TouchRecharge();
         $sellerUrl = WaperAlipay::getDefaultSellerUrl4TouchRecharge($depositeOrder->id);
     }
     $notifyUrl = WaperAlipay::getDefaultNotifyUrl();
     $aliPayUrl = WaperAlipay::getAliWapPayUrl($depositeOrder->id, Pay::TYPE_RECHARGE, $needPay, $notifyUrl, $returnUrl, $sellerUrl, Pay::getTypeDesc(Pay::TYPE_RECHARGE), $user->name . "在线充值");
     $response->setRedirect($aliPayUrl);
     return parent::DIRECT_OUTPUT;
 }