public function attach($id)
 {
     $uid = is_login();
     $where = array('project_id' => $id, 'investor_id' => $uid);
     $data = $this->field('status')->where($where)->find();
     $status = 1;
     if ($data) {
         $status = $data['status'] ? 0 : 1;
         if ($status) {
             M('Project')->where(array('id' => $id))->setInc('like_record');
         } else {
             M('Project')->where(array('id' => $id))->setDec('like_record');
         }
         $save = array('status' => $status, 'attach_time' => NOW_TIME, 'update_time' => NOW_TIME, 'update_id' => $id);
         $this->where($where)->save($save);
     } else {
         $save = array('project_id' => $id, 'attach_time' => NOW_TIME, 'investor_id' => $uid, 'status' => 1, 'create_time' => NOW_TIME, 'create_id' => $id, 'update_time' => NOW_TIME, 'update_id' => $id);
         $this->add($save);
     }
     $proj = M('Project')->where('id=' . $id)->field('uid,project_name')->find();
     $link = '<a href="' . U('Project/detail?id=' . $id) . '">《' . $proj['project_name'] . '》</a>';
     $ulink = '<a href="' . U('MCenter/profile?id=' . $uid) . '">' . get_membername($uid) . '</a>';
     if ($status) {
         D('ProjectDynamic')->addDynamic($id, '收藏了' . $link . '项目。', 1);
         //用户(关注)动态
         // 项目方(收藏提示)消息
         D('Message')->send(0, $proj['uid'], '', $ulink . '收藏了您的' . $link . '项目。', 3);
     } else {
         M('ProjectDynamic')->where(array('project_id' => $id, 'create_id' => $uid, 'type' => 1))->delete();
         // 项目方(收藏提示)消息
         D('Message')->send(0, $proj['uid'], '', $ulink . '取消收藏了您的' . $link . '项目。', 3);
     }
     return $status;
 }
 /**
  * 获取项目详细信息
  * @param 	$id 		项目编号
  * @return 	false 未找到相关项目
  * 					项目详细信息
  */
 public function getdetail($id)
 {
     $project = $this->where(array('id' => $id, 'status' => 9))->find();
     if (empty($project)) {
         return false;
     }
     $team = M('ProjectTeam')->join('jm_picture on jm_picture.id = jm_project_team.header_img', 'left')->where(array('project_id' => $id, 'jm_project_team.status' => 0))->field(array('name', 'postion', 'about', 'path' => 'header_img'))->order('sort')->select();
     $pics = M('ProjectTemp')->join('jm_picture on jm_picture.id = jm_project_temp.info_key', 'left')->field(array('path' => 'image_path'))->where(array('project_id' => $id, 'temp_type' => 1))->select();
     // 项目信息图片完善
     $project['project_cover'] = 'http://www.dreammove.cn' . $project['project_cover'];
     $project['description'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['description']);
     $project['plan'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['plan']);
     $project['custom'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['custom']);
     $project['yingli_mode'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['yingli_mode']);
     $project['avantages'] = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $project['avantages']);
     $project['province_name'] = getDistrict($project['province']);
     $project['city_name'] = getDistrict($project['city']);
     $project['founder_name'] = get_membername($project['uid']);
     $project['leader_name'] = get_membername($project['leader_id']);
     $data['project'] = $project;
     unset($data['project']['province']);
     unset($data['project']['city']);
     unset($data['project']['status']);
     unset($data['project']['cover']);
     unset($data['project']['vote_leader']);
     unset($data['project']['agreement']);
     unset($data['project']['project_valuation']);
     unset($data['project']['update_time']);
     unset($data['project']['agree_fund']);
     unset($data['project']['uid']);
     unset($data['project']['leader_id']);
     unset($data['project']['type']);
     // 团队成员头像完善
     foreach ($team as $k => $v) {
         if (!empty($v['header_img'])) {
             $v['header_img'] = 'http://www.dreammove.cn' . $v['header_img'];
         }
         $v['position'] = $v['postion'];
         $data['team'][] = $v;
     }
     foreach ($pics as $k => $v) {
         if (!empty($v['image_path'])) {
             $v['image_path'] = 'http://www.dreammove.cn' . $v['image_path'];
         }
         $data['pics'][] = $v;
     }
     return $data;
 }
Esempio n. 3
0
 function reformatData($project)
 {
     $data['project_index'] = $project['id'];
     //项目编号
     $data['project_name'] = $project['project_name'];
     //项目名称
     $data['project_stage'] = $this->stageConvertor($project['stage']);
     //项目阶段
     $data['project_type'] = get_code_name($project['industry']);
     //项目类型
     $data['project_abstract'] = $project['abstract'];
     //项目简介
     $data['project_cover'] = 'http://' . $_SERVER['HTTP_HOST'] . get_cover($project['cover'], 'path');
     //封面url
     $data['project_province'] = getDistrict($project['province']);
     //省
     $data['project_city'] = getDistrict($project['city']);
     //市
     $data['project_companyname'] = $project['company_name'];
     //公司名称
     $data['project_leader'] = get_membername($project['leader_id']);
     //项目发起人
     $data['project_financinglimit'] = $project['need_fund'];
     //目标融资额
     if ($data['project_stage'] == 1) {
         $data['project_valuation'] = 0;
         //项目最终估值
     } else {
         $data['project_valuation'] = M('ProjectFund')->where(array('project_id' => $project['id']))->getField('final_valuation');
         //项目最终估值
     }
     $data['project_mininvestment'] = $project['follow_fund'];
     //起投额
     $data['project_raisedfund'] = $project['has_fund'];
     //完成金额
     $data['project_investornumber'] = $project['investor_count'];
     //投资人数
     $data['project_detailurl'] = 'http://' . $_SERVER['HTTP_HOST'] . '/project/detail/id/' . $project['id'];
     //项目url
     $data['project_details'] = M('ProjectInfo')->where(array('project_id' => $project['id']))->getField('description');
     //项目详细详情
     $data['project_details'] = str_replace('"/Uploads', '"http://' . $_SERVER['HTTP_HOST'] . "/Uploads/", $data['project_details']);
     if ($project['team']) {
         $data['project_team'] = $project['team'];
     }
     return $data;
 }
Esempio n. 4
0
 public function update()
 {
     $id = $_GET['id'];
     if (!$id) {
         echo '非法操作';
         exit;
     }
     $v = D('ProjectInfoView')->where(array('p.stage' => array('egt', 1), 'p.status' => 9, 'p.id' => $id))->find();
     if (!$v) {
         echo '指定项目不存在。';
         exit;
     }
     include_once APP_PATH . 'Admin/zczj/zczj.api.php';
     //===============初始化==================//
     $options = array('debug' => true, 'UserName' => 'jumuzhongchou', 'PassWord' => 'jumuzhongchou123', 'PlatId' => 2);
     $zczj = new \zczj($options);
     $var = get_cover($v['cover']);
     $filename = basename(APP_PATH . substr($var['path'], 1));
     //echo $filename;
     //echo getimagesize(substr($var['path'], 1)); die();
     //echo @file_get_contents(substr($var['path'], 1)); die();
     if ($v['stage'] == 1) {
         $state = 1;
     } else {
         if ($v['stage'] == 4) {
             $state = 2;
         } else {
             if ($v['stage'] >= 8) {
                 $state = 3;
             }
         }
     }
     $desc = str_replace('"/Uploads/', '"http://www.dreammove.cn/Uploads/', $v['description']);
     $pics = M('ProjectTemp')->where(array('project_id' => $id, 'temp_type' => 1))->order('sort')->limit(6)->select();
     foreach ($pics as $k1 => $v1) {
         $path = get_cover($v1['info_key'], 'path');
         $desc = $desc . '<p><img src="http://www.dreammove.cn' . $path . '"/></p>';
     }
     $projects = array('PlatProjectID' => $v['id'], 'projectName' => $v['project_name'], 'description' => $desc, 'currentAmount' => $v['has_fund'], 'targetAmount' => $v['need_fund'], 'endTime' => NULL, 'targetDay' => 30, 'projectSponsor' => get_membername($v['uid']), 'support' => $v['follow'], 'state' => $state, 'projectCategoryId' => 23673, 'fileBytes' => @file_get_contents(substr($var['path'], 1)), 'fileName' => $filename, 'url' => "http://www.dreammove.cn/Project/detail/id/" . $v['id'] . '.html');
     $ret = $zczj->projectsAdd($projects);
     //dump($ret); die();
     if ($ret->Result) {
         echo "处理成功.";
     } else {
         echo $ret->Message;
     }
 }
Esempio n. 5
0
function get_userlist()
{
    global $config, $ldap_connection;
    $userlist = array();
    $filter = '(' . $config['auth_ldap_prefix'] . '*)';
    $search = ldap_search($ldap_connection, trim($config['auth_ldap_suffix'], ','), $filter);
    $entries = ldap_get_entries($ldap_connection, $search);
    if ($entries['count']) {
        foreach ($entries as $entry) {
            $username = $entry['uid'][0];
            $realname = $entry['cn'][0];
            $user_id = $entry['uidnumber'][0];
            $email = $entry[$config['auth_ldap_emailattr']][0];
            $ldap_groups = get_group_list();
            foreach ($ldap_groups as $ldap_group) {
                $ldap_comparison = ldap_compare($ldap_connection, $ldap_group, $config['auth_ldap_groupmemberattr'], get_membername($username));
                if (!isset($config['auth_ldap_group']) || $ldap_comparison === true) {
                    $userlist[] = array('username' => $username, 'realname' => $realname, 'user_id' => $user_id, 'email' => $email);
                }
            }
        }
    }
    return $userlist;
}
Esempio n. 6
0
 public function comment()
 {
     if (!isMobile()) {
         if (IS_POST) {
             if (empty($_POST['content'])) {
                 $this->error('请输入评论内容。');
             }
             $project_id = $_POST['project_id'];
             $user_id = is_login();
             $reply_id = $_POST['reply_id'];
             $comment = array('project_id' => $project_id, 'comment_user' => $user_id, 'content' => $_POST['content'], 'reply_id' => $reply_id, 'create_time' => NOW_TIME, 'create_id' => $user_id, 'update_time' => NOW_TIME, 'update_id' => $user_id, 'dynamicid' => I('dynamicid'));
             $id = M('InfoComment')->add($comment);
             /*   			$proj=M('Product')->where('id ='.$project_id)->field('name, uid')->find();
               
               			$ulink = '<a href="'.U('MCenter/profile?id='.$user_id).'">'.
               					get_membername($user_id).'</a>';
               			$plink = '<a href="'.U('Product/viewdetail?pid='.$project_id).'">《'.
               					$proj['name'].'》</a>';
               			if ($user_id != $proj['uid']) {
               				$content = $ulink . '评论了您的'. $plink . '项目';
               				D('Message')->send(0,$proj['uid'],'', $content, 3);
               			} */
             if ($reply_id) {
                 $rep = M('InfoComment')->where('id=' . $reply_id)->getField('comment_user');
                 /*   				if ($rep != $user_id && $rep != $proj['uid'] && !$rep) {
                   					$content = $ulink . '回复了您对'. $plink . '项目的评论';
                   					D('Message')->send(0,$rep,'', $content, 3);
                   				} */
             }
             $comment['id'] = $id;
             $comment['comment_user'] = $user_id;
             $comment['user_face'] = get_memberface($user_id);
             $comment['date'] = change_date($comment['create_time']);
             $comment['status'] = 1;
             $comment['user_name'] = get_membername($user_id);
             $comment['old_user'] = $_POST['old_user'];
             $comment['old_content'] = $_POST['old_content'];
             $comment['status'] = 1;
             $this->ajaxReturn($comment);
         }
     } else {
         $project_id = $_POST['project_id'];
         $user_id = is_login();
         $reply_id = $_POST['reply_id'];
         $comment = array('project_id' => $project_id, 'comment_user' => $user_id, 'content' => $_POST['content'], 'reply_id' => $reply_id, 'create_time' => NOW_TIME, 'create_id' => $user_id, 'update_time' => NOW_TIME, 'update_id' => $user_id, 'dynamicid' => I('dynamicid'));
         $id = M('InfoComment')->add($comment);
         /*   		$proj=M('Product')->where('id ='.$project_id)->field('name, uid')->find();
           
           		$ulink = '<a href="'.U('MCenter/profile?id='.$user_id).'">'.
           				get_membername($user_id).'</a>';
           		$plink = '<a href="'.U('Product/viewdetail?pid='.$project_id).'">《'.
           				$proj['name'].'》</a>';
           		if ($user_id != $proj['uid']) {
           			$content = $ulink . '评论了您的'. $plink . '项目';
           			D('Message')->send(0,$proj['uid'],'', $content, 3);
           		} */
         if ($reply_id) {
             $rep = M('InfoComment')->where('id=' . $reply_id)->getField('comment_user');
             /* if ($rep != $user_id && $rep != $proj['uid'] && !$rep) {
             				$content = $ulink . '回复了您对'. $plink . '项目的评论';
             				D('Message')->send(0,$rep,'', $content, 3);
             			} */
         }
         $comment['id'] = $id;
         $comment['comment_user'] = $user_id;
         $comment['user_face'] = get_memberface($user_id);
         $comment['date'] = change_date($comment['create_time']);
         $comment['status'] = 1;
         $comment['user_name'] = get_membername($user_id);
         $comment['old_user'] = $_POST['old_user'];
         $comment['old_content'] = $_POST['old_content'];
         $this->ajaxReturn($comment);
     }
 }
 public function getCommentList($id)
 {
     $result = M('projectafter_comment')->where('project_after_id=' . $id)->order('create_time desc')->select();
     if ($result == false) {
         return array('success' => false, 'info' => '获取列表失败!');
     } else {
         $data['success'] = true;
         foreach ($result as $info) {
             $temp['nickname'] = get_membername($info['comment_user']);
             $temp['memberface'] = 'http://' . $_SERVER['HTTP_HOST'] . get_memberface($info['comment_user']);
             $temp['content'] = $info['content'];
             $temp['create_time'] = date('Y-m-d H:i:s', $info['create_time']);
             $data['info'][] = $temp;
         }
         return $data;
     }
 }
Esempio n. 8
0
  

<!--MAINCONTENT-->
<div id="maincontent">
	<div id="wrapmember">
  	<div class="content">
      <!--START NAVPAGE-->
      <div class="navpage">
        <span>Home</span>
        <span class="sep">|</span>
        <span>My Account</span>               
      </div>
      <!--END NAVPAGE-->    
      
      <h3 id="summary">Hi <?php 
echo get_membername($idmember);
?>
,</h3>
      
      <?php 
require_once "../submenu.php";
?>
      
      <!--start summary_detail-->
      <div class="summary_detail">        
        <div id="shoppingbag">
        	<h5>address book</h5>                              
          <div id="div-hidden"></div>
          <ul id="box_address" class="addrbook simplebar">
          	     
          </ul>
Esempio n. 9
0
 public function leader()
 {
     $this->pageTitle = '申请领投人';
     $uid = is_login();
     if (!$uid) {
         $this->redirect('User/login');
     }
     $where = array('uid' => $uid, 'status' => 9, 'auth_id' => 1);
     $auth = M('UserAuth')->where($where)->count();
     $phone = M('UcenterMember')->find($uid);
     if (!$auth || empty($phone['mobile'])) {
         $this->error('您还没有完成实名认证或绑定手机,完善后方可投资。' . showface('waiting'), U('User/savecenter'));
     }
     /** 领投人资格验证(暂时不做领投人认证) **/
     //		$where['auth_id'] = 3;
     //		unset($where['status']);
     //		$auth = M('UserAuth')->where($where)->count();
     //		$phone = M('UcenterMember')->find($uid);
     //		if (!$auth || empty($phone['mobile'])) {
     //			$this->error('您还没有获取领投人资格,立即前往申请领投人。'.showface('waiting'),
     //			 U('User/applylead'));
     //		}
     $pid = I('id');
     $project = D('ProjectFundView')->where(array('p.id' => $pid))->find();
     if (!$project) {
         $this->error('项目不存在!');
     } else {
         if ($project['stage'] != 1) {
             //非询价认投期
             $this->error('该项目不处于预热期,不能申请领投人。');
         } else {
             if ($project['uid'] == $uid) {
                 $this->error('不允许项目发起人,领投自己项目。');
             } else {
                 if (!empty($project['leader_id'])) {
                     $this->error('该项目已经指定了领投人,领投人申请已经关闭.');
                 }
             }
         }
     }
     $count = M('ProjLeader')->where(array('pid' => $pid, 'uid' => $uid, 'status' => array('egt', 0), 'del_flag' => 0))->count();
     if ($count > 0) {
         $this->error('您已经是该项目的候选领投人。请不要重复申请。');
     }
     if (IS_GET) {
         //        $this->assign('pid',$pid);
         $this->project = $project;
         $this->display('leader');
     } else {
         $data = array('pid' => $pid, 'uid' => $uid, 'fund' => $_POST['fund'], 'message' => $_POST['message']);
         if ($project['need_fund'] < $data['fund']) {
             $this->error('投资金额必须小于融资金额' . round($project['need_fund'], 2) . '元。');
         } else {
             if ($project['follow_fund'] > $data['fund']) {
                 $this->error('跟投额必须大于或者等于起投额' . round($project['follow_fund'], 2) . '元。');
             }
         }
         if ($project['type'] == 0 && $data['fund'] % 1000 > 0) {
             $this->error('投资金额必须是1000的倍数。');
         }
         if (empty($data['message'])) {
             $this->error('请填写您的投资理由。');
         }
         $data['status'] = 0;
         $data['create_time'] = NOW_TIME;
         //			M('ProjLeader')->add($data);//todo 添加领头人列表,付款成功后再添写入数据库中
         $investor['step'] = $project['stage'];
         $investor['project_valuation'] = $project['project_valuation'];
         $investor['project_id'] = $pid;
         $investor['investor_id'] = $uid;
         $investor['lead_type'] = 2;
         // 候选领投人
         $investor['fund'] = $_POST['fund'];
         $investor['others'] = $_POST['message'];
         $investor['create_time'] = NOW_TIME;
         $investor['create_id'] = $uid;
         $investor['update_time'] = NOW_TIME;
         $investor['update_id'] = $uid;
         $investor['status'] = 4;
         M('ProjectInvestor')->add($investor);
         //todo 添加投资金额列表
         M('ProjectFund')->where('project_id=' . $pid)->setInc('has_fund', $investor['fund']);
         M('ProjectFund')->where('project_id=' . $pid)->setInc('agree_fund', $investor['fund']);
         // 发送系统消息(通知项目方有人跟投)
         $ulink = '<a href="' . U('MCenter/profile?id=' . $uid) . '">' . get_membername($uid) . '</a>';
         $plink = '<a href="' . U('Manage/foundfollow') . '">《' . $project['project_name'] . '》</a>';
         $content = $ulink . '申请领投了您的' . $plink . '项目';
         D('Message')->send(0, $project['uid'], '', $content, 3);
         $this->success('恭喜您,跟投成功!现在,去签署一下协议吧!' . showface('hand'), U('Agreement/touzi?id=' . $pid));
         //			$this->success('领投申请已经成功,请等待项目方同意。'.showface('hand'), U('MCenter/pj_support'));
     }
 }
Esempio n. 10
0
 /**
  * 个人信息
  */
 public function profile()
 {
     $id = $_GET['id'];
     if (!$id) {
         $this->error('参数不合法。');
     }
     $model = D('users');
     $userinfo = $model->getdetail($id);
     if ($userinfo == false) {
         $this->error($model->getError());
     }
     $this->pageTitle = get_membername($id);
     $this->userphoto = get_memberface($id);
     $this->userinfo = $userinfo;
     $this->display();
 }
Esempio n. 11
0
 public function getFollowing($uid, $page = '0', $number = '50', $order = 'createtime desc')
 {
     $userStatis = M('user_statistics');
     $data = array('uid' => $uid);
     $result = $userStatis->where($data)->find();
     if ($result != null) {
         $data['success'] = true;
         $data['total'] = $result['followingcount'];
         $data['per_page'] = $number;
         $data['page'] = $page + 1;
         $data['last_page'] = ceil($result['followingcount'] / $number);
         if ($page <= $data['last_page']) {
             $data['users'] = M('followers')->where('followers=' . $uid)->page($page . ',' . $number)->order($order)->field('following as id')->select();
             foreach ($data['users'] as &$user) {
                 $getUserInfo['nickname'] = get_membername($user['id']);
                 $getUserInfo['photo_url'] = 'http://' . $_SERVER['HTTP_HOST'] . get_memberface($user['id']);
                 $currentUser = is_login();
                 if ($currentUser > 0) {
                     $getUserInfo['relation'] = D('Followers')->getRelation($currentUser, $user['id']);
                 } else {
                     $getUserInfo['relation'] = null;
                 }
                 $user = array_merge($user, $getUserInfo);
             }
             return $data;
         }
         return array('success' => false, 'info' => '没有更多关注信息!');
     }
     return array('success' => true, 'info' => '没有关注信息!');
 }
Esempio n. 12
0
 public function cancel()
 {
     if (IS_AJAX) {
         $id = $_GET['id'];
         if ($id) {
             $ivest = M('ProjectInvestor')->field('fund,investor_id, project_id, status, lead_type')->find($id);
             if ($ivest['investor_id'] != is_login()) {
                 $this->error('非法操作。');
             }
             $proj = M('Project')->where(array('id' => $ivest['project_id']))->field('project_name, uid, stage')->find();
             if ($ivest['status'] >= 2 && $proj['stage'] < 8) {
                 M('ProjectFund')->where('project_id=' . $ivest['project_id'])->setDec('has_fund', $ivest['fund']);
                 if ($ivest['status'] >= 3) {
                     M('ProjectFund')->where('project_id=' . $ivest['project_id'])->setDec('agree_fund', $ivest['fund']);
                 }
                 if ($ivest['status'] == 4) {
                     $data = M('AccountInvest')->where(array('iid' => $id))->find();
                     if ($data) {
                         M('AccountUser')->where(array('uid' => $data['uid']))->setInc('use_able', $data['amount']);
                         M('AccountInvest')->where(array('iid' => $id))->delete();
                     }
                 }
                 M('AgreementInvest')->where(array('pid' => $ivest['project_id'], 'uid' => $ivest['investor_id']))->delete();
             }
             // 删除领投记录
             M('ProjLeader')->where(array('pid' => $ivest['project_id'], 'uid' => $ivest['investor_id'], 'del_flag' => 0))->save(array('del_flag' => -1));
             $data = array('status' => -1, 'id' => $id, 'update_time' => NOW_TIME, 'update_id' => is_login());
             M('ProjectInvestor')->save($data);
             // 发送系统消息(通知项目方有人询价)
             $ulink = '<a href="' . U('MCenter/profile?id=' . $ivest['investor_id']) . '">' . get_membername($ivest['investor_id']) . '</a>';
             $plink = '<a href="' . U('Manage/investinquiry') . '">《' . $proj['project_name'] . '》</a>';
             $content = $ulink . '撤消了对您' . $plink . "项目的认投";
             D('Message')->send(0, $proj['uid'], '', $content, 3);
             //更新待办事件
             update_pj_dolist($ivest['investor_id'], -1);
             $this->success('您撤消了对' . $proj['project_name'] . '项目的投资');
         }
     } else {
     }
 }