Example #1
0
 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;
 }
Example #2
0
 public function applyCompanySubmitAction()
 {
     if ($this->request->isPost()) {
         $user_id = $this->request->getPost('user_id');
         //图片上传
         $img_list = array();
         $project_log = array();
         list($img_list, $project_log) = $this->_upload_img();
         $params = array();
         $ubm = new DtbUserBasic();
         $uiom = new DtbInvestorOrgaization();
         $ilm = new DtbInvestLeaderCases();
         $user_data = $ubm->get($user_id);
         if (!$user_data || $user_data->getAccountType() > 0) {
             die('value is invaild');
         }
         $legal_name = $this->request->getPost('legal_name');
         $legal_identity_card = $this->request->getPost('legal_identity_card');
         //            $legal_idc_img1 = $this->request->getPost('legal_idc_img1');
         //            $legal_idc_img2 = $this->request->getPost('legal_idc_img2');
         $legal_idc_img1 = isset($img_list['legal_idc_img1']) ? $img_list['legal_idc_img1'] : '';
         $legal_idc_img2 = isset($img_list['legal_idc_img2']) ? $img_list['legal_idc_img2'] : '';
         $contact_name = $this->request->getPost('contact_name');
         $prov = $this->request->getPost('prov');
         $city = $this->request->getPost('city');
         $dist = $this->request->getPost('dist');
         $address = $this->request->getPost('address');
         $business_licence = $this->request->getPost('business_licence');
         // $bul_img = $this->request->getPost('bul_img');
         $bul_img = isset($img_list['bul_img']) ? $img_list['bul_img'] : '';
         $company = $this->request->getPost('company');
         $gold_fund = $this->request->getPost('gold_fund');
         $singel_invest_range_start = $this->request->getPost('singel_invest_range_start');
         $singel_invest_range_end = $this->request->getPost('singel_invest_range_end');
         $attention_direct = $this->request->getPost('attention_direct');
         $invest_idea = $this->request->getPost('invest_idea');
         $available_extra_price = $this->request->getPost('available_extra_price');
         #案列
         $project_logo = $this->request->getPost('project_logo');
         $project_name = $this->request->getPost('project_name');
         $web_url = $this->request->getPost('web_url');
         $project_desc = $this->request->getPost('project_desc');
         $invest_company_info = $uiom->getDataByUserId($user_id);
         if ($invest_company_info) {
             die('用户已存在');
         } else {
             $params = array('legal_name' => $legal_name, 'legal_identity_card' => $legal_identity_card, 'legal_idc_img1' => $legal_idc_img1, 'legal_idc_img2' => $legal_idc_img1, 'contact_name' => $contact_name, 'country' => 'china', 'province' => $prov, 'city' => $city, 'dist' => $dist, 'address' => $address, 'business_licence' => $business_licence, 'bul_img' => $bul_img, 'gold_fund' => $gold_fund, 'company' => $company, 'singel_invest_range' => json_encode(array($singel_invest_range_start, $singel_invest_range_end)), 'attention_direct' => $attention_direct, 'invest_idea' => $invest_idea, 'available_extra_price' => $available_extra_price);
             $res = $uiom->applyCompany($user_id, $params);
             if ($res) {
                 if ($this->request->getPost('check_leader') == 1) {
                     //申请领头人
                     $project_name_list = $this->request->getPost('project_name');
                     $web_url_list = $this->request->getPost('web_url');
                     $project_desc_list = $this->request->getPost('project_desc');
                     $this->_add_leader_cases($user_id, $project_name_list, $web_url_list, $project_desc_list, $project_log);
                 }
                 $this->flash->success('认证成功');
                 return $this->response->redirect('/user/center');
                 return $this->dispatcher->forward(array('controller' => 'user', 'action' => 'center'));
             }
         }
     }
     $check_value = true;
 }
 public function applyCompany($user_id, $params)
 {
     $flag = false;
     try {
         $this->di['db']->begin();
         $invest_company = new DtbInvestorOrgaization();
         $invest_company->user_id = $user_id;
         $invest_company->address = $params['address'];
         $invest_company->legal_name = $params['legal_name'];
         $invest_company->legal_identity_card = isset($params['legal_identity_card']) ? $params['legal_identity_card'] : null;
         $invest_company->legal_idc_img1 = isset($params['legal_idc_img1']) ? $params['legal_idc_img1'] : null;
         $invest_company->legal_idc_img2 = isset($params['legal_idc_img2']) ? $params['legal_idc_img2'] : null;
         $invest_company->contact_name = $params['contact_name'];
         $invest_company->province = $params['province'];
         $invest_company->city = $params['city'];
         $invest_company->dist = $params['dist'];
         $invest_company->business_licence = $params['business_licence'];
         $invest_company->bul_img = isset($params['bul_img']) ? $params['bul_img'] : null;
         $invest_company->company = $params['company'];
         $invest_company->gold_fund = isset($params['gold_fund']) ? $params['gold_fund'] : 0;
         $invest_company->singel_invest_range = isset($params['singel_invest_range']) ? $params['singel_invest_range'] : 0;
         $invest_company->attention_direct = $params['attention_direct'];
         $invest_company->invest_idea = $params['invest_idea'];
         $invest_company->available_extra_price = $params['available_extra_price'];
         $invest_company->create_ts = time();
         $invest_company->update_ts = time();
         $invest_company->country = $params['country'];
         $invest_company->result = 0;
         if (!$invest_company->create()) {
             foreach ($invest_company->getMessages() as $message) {
                 echo $message;
             }
             $this->di['db']->rollback();
             return $flag;
         } else {
             $action_type = $this->di['config']->log_user->applyoriaization;
             $log_ts = time();
             $sql = "insert into DtbLogUser (user_id,action_type,log_ts) values('{$user_id}','{$action_type}','{$log_ts}' )";
             $query = new Phalcon\Mvc\Model\Query($sql, $this->getDI());
             $res1 = $query->execute();
             $sql2 = "update  DtbUserBasic set account_type=2 where user_id='{$user_id}' and account_type=0";
             $query = new Phalcon\Mvc\Model\Query($sql2, $this->getDI());
             $res2 = $query->execute();
             //                var_dump($res2);
             if (!$res1) {
                 $this->di['db']->rollback();
             } else {
                 if (!$res2) {
                     $this->di['db']->rollback();
                 } else {
                     $flag = true;
                     $this->di['db']->commit();
                 }
             }
             return $flag;
         }
     } catch (Exception $ex) {
         $this->di['db']->rollback();
         return $flag;
     }
 }