public function indexAction() { //统计数据 $invest_order_obj = new DtbProjectInvestOrder(); $raise_project = new DtbRaiseProjectBasic(); $total = array('all_money' => 0, 'all_project' => 0, 'all_user' => 0, 'all_orgaization' => 0, 'last_percent' => 0, 'return_value' => 0); $success_raise_project = array(); $leader_investors = array(); $invest_total = $invest_order_obj->getAllSuccessTotal(); $raise_project_total = $raise_project->getAllSuccessTotal(); if (count($invest_total) > 0) { $total['all_money'] = $invest_total[0]['all_money']; $total['all_user'] = $invest_total[0]['all_user_count']; } if (count($raise_project_total) > 0) { $total['all_project'] = $raise_project_total[0]['all_project_count']; $total['all_user'] = $raise_project_total[0]['all_rate_of_return']; $total['all_raise_user'] = $raise_project_total[0]['all_raise_user_count']; } // 成功案例 $raise_success_list = $raise_project->getSuccessProject('0,5'); if (count($raise_success_list) > 0) { $success_raise_project = $raise_success_list; } // 明星领投人 $_leader_investors = DtbInvestorOrgaization::find(array("conditions" => "result =1 and is_invest_leader=1", 'order' => 'gold_fund desc', 'limit' => '6')); if (count($_leader_investors) > 0) { $leader_investors = $_leader_investors; } $this->view->shareTotal = $total; $this->view->raise_success_list = $success_raise_project; $this->view->leaders_list = $leader_investors; }
public function detailAction($raise_id, $user_id) { $dtb_raise_project_investor = DtbRaiseProjectInvestor::findFirst(array("conditions" => "raise_id = :raise_id: and user_id=:user_id: ", "bind" => array("raise_id" => $raise_id, 'user_id' => $user_id), "order" => 'update_ts desc')); $order_info = DtbProjectInvestOrder::find(array("conditions" => "raise_id = :raise_id: and user_id=:user_id: ", "bind" => array("raise_id" => $raise_id, 'user_id' => $user_id), "order" => 'order_id desc')); // die(); $this->view->setVar('dtb_raise_project_investor', $dtb_raise_project_investor); $this->view->setVar('dtb_project_invest_order', $order_info); $this->view->is_user_nav = 3; }
function updateOrderId($order_id, $params) { $order = DtbProjectInvestOrder::findFirstByorder_id($order_id); if ($order) { $order->result = $params['result']; $order->status = $params['status']; $order->update_ts = $params['update_ts']; if (!$order->save()) { foreach ($order->getMessages() as $message) { echo $message; } } else { return true; } } else { throw new \InvalidArgumentException('The order is not found'); return false; } }
public function submitOrderAction($raise_id) { //TODO 生成订单 if ($this->request->isPost()) { $raise_id = intval($raise_id); $dtb_project = DtbRaiseProjectBasic::findFirstByraise_id($raise_id); $invest_order = new DtbProjectInvestOrder(); $invest_money = $this->request->getPost('invest_money'); $invest_code = $this->request->getPost('invest_code'); $check_use_invite_code = false; if (empty($invest_code)) { $invite_code = DtbInviteCode::findFirstByinvite_code($invest_code); if ($invite_code) { if ($invite_code['is_use'] == 0) { $check_use_invite_code = true; } } } $user_id = $this->cookies->get('user_id'); if (!$check_use_invite_code) { $invest_code = ''; } $params = array('invest_money' => $invest_money, 'invest_code' => $invest_code, 'equit_offered' => $invest_money, 'service_fee' => 0, 'bond' => 0, 'real_pay_fee' => $invest_money); $res = $invest_order->creatOrder($order_id, $raise_id, $dtb_project->now_wheel_id, $user_id, $params); if ($res) { //$this->flash->success('修改成功'); $this->flash->success('认证成功'); return $this->response->redirect('/invest/payForm/' . $order_id); // return $this->dispatcher->forward(array( // 'controller' => 'invest', // 'action' => 'payForm', // "params" => array($order_id) // )); } else { $this->flash->error("create order error"); } } }