public function orderAction()
 {
     $id = $this->_getParam('id');
     //医生ID
     if ($this->_auth->userid && $this->_auth->role) {
         $doctor = Application_Model_M_Doctor::find($id);
         if ($doctor) {
             $orderid = Application_Model_M_ConsultOrder::getOrderID($this->_auth->userid, $this->_auth->role, $doctor->getId());
             $price = $doctor->getReservation_fee();
             $payment_status = 0;
             $consultOrder = new Application_Model_O_ConsultOrder();
             $consultOrder->setOrder_id($orderid)->setUid($this->_auth->userid)->setUrole($this->_auth->role)->setTodid($doctor->getId())->setTotal_price($price)->setPayment_status($payment_status)->setCtime(date('Y-m-d H:i:s'));
             try {
                 $out['errno'] = '0';
                 $mer_front_end_url = "";
                 $deadtime = 0;
                 $notify_url = "http://" . $_SERVER['HTTP_HOST'] . "/consult/notify";
                 $tn = Yy_Upmp_Upmp::getUpmpTn($orderid, $id, $price, $mer_front_end_url, $deadtime, $notify_url);
                 $consultOrder->setRemark($tn);
                 $consultOrder->save();
                 $out['tn'] = $tn;
             } catch (Zend_Db_Exception $e) {
                 $out['errno'] = '255';
             }
         } else {
             $out['errno'] = '1';
         }
     } else {
         $out['errno'] = '200';
     }
     $out['msg'] = Yy_ErrMsg_Consult::getMsg('order', $out['errno']);
     Yy_Utils::jsonOut($out);
 }
Beispiel #2
0
 public static function fetchAll($where = null, $order = null, $limit = null, $offset = null)
 {
     $resultSet = self::getDbTable()->fetchAll($where, $order, $limit, $offset);
     $entries = array();
     foreach ($resultSet as $row) {
         $entry = new Application_Model_O_ConsultOrder();
         $entry->setId($row->id)->setOrder_id($row->order_id)->setUid($row->uid)->setUrole($row->urole)->setTodid($row->todid)->setTotal_price($row->total_price)->setPayment_status($row->payment_status)->setRemark($row->remark)->setCtime($row->ctime)->setUtime($row->utime)->setStatus($row->status);
         $entry->setNew(false);
         $entries[] = $entry;
     }
     return $entries;
 }
Beispiel #3
0
 public static function fetchAllPage($page = 1, $perpage = 30)
 {
     $select = self::select();
     $adapter = new Zend_Paginator_Adapter_DbTableSelect($select);
     $paginator = new Zend_Paginator($adapter);
     $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page);
     $data = $paginator->getCurrentItems();
     $pages = $paginator->count();
     $orders = array();
     if (count($data) > 0) {
         foreach ($data as $da) {
             $orderModel = new Application_Model_O_ConsultOrder();
             $orderModel->setId($da->id)->setOrder_id($da->order_id)->setUid($da->uid)->setUrole($da->urole)->setTodid($da->todid)->setTotal_price($da->total_price)->setPayment_status($da->payment_status)->setRemark($da->remark)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status);
             array_push($orders, $orderModel);
         }
     }
     $res = array('orders' => $orders, 'pages' => $pages);
     return $res;
 }