You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
894 lines
31 KiB
894 lines
31 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | YFCMF [ WE CAN DO IT MORE SIMPLE ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2015-2016 http://www.rainfer.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: rainfer <81818832@qq.com>
|
|
// +----------------------------------------------------------------------
|
|
namespace app\culture\controller;
|
|
|
|
|
|
use think\Validate;
|
|
|
|
class User extends Base{
|
|
protected $userinfo=[];
|
|
protected $apitoken='';
|
|
protected $current=[['title'=>'个人中心']];
|
|
protected function _initialize(){
|
|
parent::_initialize();
|
|
$this->assign('current',$this->current);
|
|
$apitoken=session('api_token');
|
|
if(empty($apitoken)){
|
|
if(request()->isAjax()){
|
|
$this->error('请先登录',url('culture/common/login'));
|
|
}else{
|
|
$this->redirect(url('culture/common/login'));
|
|
}
|
|
}
|
|
$this->apitoken=$apitoken;
|
|
$this->userinfo=$this->getUserProfile();
|
|
}
|
|
public function index(){
|
|
|
|
$this->assign('profile',$this->userinfo);
|
|
return $this->fetch(':user');
|
|
}
|
|
/**
|
|
* 获取已购买服务
|
|
* @return string
|
|
*/
|
|
public function mymarkets(){
|
|
$url=$this->hostpath."/api/user/markets";
|
|
$showlist=[];
|
|
try {
|
|
$showlist=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$showlist=json_decode($showlist,true);
|
|
if(count($showlist)==0||isset($showlist['id']))$showlist=[];
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$this->assign('showlist',$showlist);
|
|
$this->assign('my',1);
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'我已购买的服务']);
|
|
$this->assign('current',$current);
|
|
|
|
$this->assign('profile',$this->userinfo);
|
|
return $this->view->fetch(':markets');
|
|
}
|
|
/**
|
|
* 商城服务列表
|
|
* @return string
|
|
*/
|
|
public function markets(){
|
|
$url=$this->hostpath."/api/markets";
|
|
$showlist=[];
|
|
try {
|
|
$showlist=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$showlist=json_decode($showlist,true);
|
|
if(count($showlist)==0)$showlist=[];
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'积分商城']);
|
|
$this->assign('current',$current);
|
|
$this->assign('showlist',$showlist);
|
|
|
|
$this->assign('profile',$this->userinfo);
|
|
return $this->view->fetch(':markets');
|
|
}
|
|
/**
|
|
* 服务兑换
|
|
* @return string[]|mixed
|
|
*/
|
|
public function redeem(){
|
|
$id=input('id','','intval');
|
|
if(empty($id))$this->error('缺少id');
|
|
$url=$this->hostpath."/api/markets/".$id."/redeem";
|
|
$res=['message'=>'兑换失败'];
|
|
|
|
try {
|
|
$res=go_curl($url,'POST',false,["Accept:application/json","Authorization:Bearer ".$this->apitoken]);
|
|
|
|
$res=json_decode($res,true);
|
|
if(empty($res)){
|
|
$res=['message'=>'兑换失败'];
|
|
}
|
|
if(isset($res['id'])){
|
|
switch($res['message']){
|
|
case 'Unauthenticated.':
|
|
$res['message']='接口未授权';
|
|
break;
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
|
|
return $res;
|
|
}
|
|
/**
|
|
* 服务详情
|
|
* @return string
|
|
*/
|
|
public function market_detail(){
|
|
$id=input('id','','intval');
|
|
$this->assign('id',$id);
|
|
$this->assign('type','服务');
|
|
$title='';
|
|
$pro=[];
|
|
$url=$this->hostpath."/api/markets/".$id;
|
|
try {
|
|
$pro=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$pro=json_decode($pro,true);
|
|
if(!isset($pro['name']))$pro=[];
|
|
else $title=$pro['name'];
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'已购买的服务','jump'=>url('mymarkets')]);
|
|
if($title){
|
|
array_push($current, ['title'=>$title]);
|
|
}
|
|
$this->assign('current',$current);
|
|
$this->assign('detail',$pro);
|
|
|
|
$this->assign('profile',$this->userinfo);
|
|
return $this->view->fetch(':market_detail');
|
|
}
|
|
/**
|
|
* 获取个⼈资料
|
|
*/
|
|
public function individual_presentations(){
|
|
$url=$this->hostpath."/api/individual-investor/presentations";
|
|
if(request()->isPost()){
|
|
$rule=[
|
|
'avatar'=>'require',
|
|
'description'=>'require',
|
|
'images'=>'require'
|
|
];
|
|
$msg=[
|
|
'avatar.require'=>'请输入投资者照片',
|
|
'description.require'=>'请输入介绍文字',
|
|
'images.require'=>'请输入照片'
|
|
];
|
|
|
|
$data=request()->param();
|
|
$validate = new Validate($rule,$msg);
|
|
$result = $validate->check($data);
|
|
if(!$result){
|
|
$this->error($validate->getError());
|
|
}
|
|
|
|
$res=['message'=>'编辑失败'];
|
|
try {
|
|
$res=go_curl($url,'POST',$data,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
|
|
$this->success('编辑成功');
|
|
}
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$this->assign('detail',$res);
|
|
return $this->fetch(':indpresentations');
|
|
}
|
|
/**
|
|
* 获取机构资料
|
|
*/
|
|
public function institutional_presentations(){
|
|
$url=$this->hostpath."/api/institutional-investor/presentations";
|
|
if(request()->isPost()){
|
|
$rule=[
|
|
'avatar'=>'require',
|
|
'description'=>'require',
|
|
'images'=>'require'
|
|
];
|
|
$msg=[
|
|
'avatar.require'=>'请输入机构logo照片',
|
|
'description.require'=>'请输入介绍文字',
|
|
'images.require'=>'请输入照片'
|
|
];
|
|
|
|
$data=request()->param();
|
|
$validate = new Validate($rule,$msg);
|
|
$result = $validate->check($data);
|
|
if(!$result){
|
|
$this->error($validate->getError());
|
|
}
|
|
|
|
$res=['message'=>'编辑失败'];
|
|
try {
|
|
$res=go_curl($url,'POST',$data,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
|
|
$this->success('编辑成功');
|
|
}
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$this->assign('detail',$res);
|
|
return $this->fetch(':inspresentations');
|
|
}
|
|
/**
|
|
* ⽤户信息
|
|
* @return mixed|string
|
|
*/
|
|
public function profile(){
|
|
$this->assign('profiles',$this->userinfo);
|
|
if(request()->isPost()){
|
|
$rule=[
|
|
'name'=>'require',
|
|
'phone'=>'require|length:11',
|
|
'position'=>'require',
|
|
'email'=>'require|email',
|
|
'company'=>'require',
|
|
'avatar'=>'require'
|
|
];
|
|
$msg=[
|
|
'name.require'=>'请输入用户名称',
|
|
'phone.require'=>'请输入用户手机号码',
|
|
'phone.length'=>'请输入11位手机号码',
|
|
'position.require'=>'请输入用户职位',
|
|
'email.require'=>'请输入用户邮箱',
|
|
'email.email'=>'邮箱格式错误',
|
|
'company.require'=>'请输入公司名称',
|
|
'avatar.require'=>'请输入用户头像 '
|
|
];
|
|
|
|
$data=request()->param();
|
|
$validate = new Validate($rule,$msg);
|
|
$result = $validate->check($data);
|
|
if(!$result){
|
|
$this->error($validate->getError());
|
|
}
|
|
if(strpos($data['avatar'],'http')===false)$data['avatar']=SITE_PATH.$data['avatar'];
|
|
$url=$this->hostpath."/api/user/profiles";
|
|
$res=['message'=>'编辑失败'];
|
|
try {
|
|
$res=go_curl($url,'POST',$data,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
|
|
$this->success('编辑成功',url('profile'));
|
|
}
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'修改个人信息']);
|
|
$this->assign('current',$current);
|
|
$this->assign('profile',$this->userinfo);
|
|
return $this->fetch(':profile');
|
|
}
|
|
/**
|
|
* 投资认证
|
|
* @return mixed|string
|
|
*/
|
|
public function certification(){
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'投资认证']);
|
|
$this->assign('current',$current);
|
|
$this->assign('profile',$this->userinfo);
|
|
|
|
$url=$this->hostpath."/api/individual-investor/verifications";
|
|
$regions=$this->regions();
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
|
|
$res=json_decode($res,true);
|
|
|
|
if(isset($res['id'])&&$res['id']=='model.not_found'){
|
|
$res=[
|
|
'contact_name'=>'',
|
|
'contact_phone'=>'',
|
|
'region_id'=>'',
|
|
'address'=>'',
|
|
'industry_id'=>'',
|
|
'company'=>'',
|
|
'position'=>'',
|
|
'email'=>'',
|
|
'investment_stage_id'=>'',
|
|
'interested_industry_ids'=>'',
|
|
'investment_concerns'=>'',
|
|
'invested_projects'=>'',
|
|
'investment_point'=>'',
|
|
'province'=>'',
|
|
'city'=>'',
|
|
];
|
|
}
|
|
if(isset($res['region_id'])){
|
|
$row=deep_in_array($res['region_id'],$regions);
|
|
if(isset($row['id'])){
|
|
$res['province']=$row['id'];
|
|
$res['city']=$res['region_id'];
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$this->assign('detail1',$res);
|
|
|
|
|
|
$url=$this->hostpath."/api/institutional-investor/verifications";
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
|
|
$res=json_decode($res,true);
|
|
|
|
if(isset($res['id'])&&$res['id']=='model.not_found'){
|
|
$res=[
|
|
'contact_name'=>'',
|
|
'contact_phone'=>'',
|
|
'company'=>'',
|
|
'name'=>'',
|
|
'region_id'=>'',
|
|
'address'=>'',
|
|
'establish_date'=>'',
|
|
'registration_capital'=>'',
|
|
'company_size'=>'',
|
|
'company_website'=>'',
|
|
'legal_representative'=>'',
|
|
'investment_stage_id'=>'',
|
|
'interested_industry_ids'=>'',
|
|
'investment_concerns'=>'',
|
|
'invested_projects'=>'',
|
|
'investment_point'=>'',
|
|
'province'=>'',
|
|
'city'=>'',
|
|
];
|
|
}
|
|
if(isset($res['region_id'])){
|
|
$row=deep_in_array($res['region_id'],$regions);
|
|
if(isset($row['id'])){
|
|
$res['province']=$row['id'];
|
|
$res['city']=$res['region_id'];
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
|
|
$this->assign('detail2',$res);
|
|
|
|
$stages=$this->stages();
|
|
$this->assign('stages',$stages);
|
|
|
|
$industries=$this->industries();
|
|
$this->assign('industries',$industries);
|
|
|
|
$this->assign('regions',$regions);
|
|
return $this->fetch(':certification');
|
|
}
|
|
/**
|
|
* 个⼈投资者认证信息
|
|
* @return mixed|string
|
|
*/
|
|
public function individual(){
|
|
$url=$this->hostpath."/api/individual-investor/verifications";
|
|
$regions=$this->regions();
|
|
if(request()->isPost()){
|
|
$res=['message'=>'编辑失败'];
|
|
|
|
$rule=[
|
|
'contact_name'=>'require',
|
|
'contact_phone'=>'require',
|
|
'region_id'=>'require',
|
|
'address'=>'require',
|
|
'industry_id'=>'require',
|
|
'company'=>'require',
|
|
'position'=>'require',
|
|
'email'=>'require|email',
|
|
'investment_stage_id'=>'require',
|
|
'interested_industry_ids'=>'require',
|
|
];
|
|
$msg=[
|
|
'contact_name.require'=>'请输入联系人',
|
|
'contact_phone.require'=>'请输入联系手机号',
|
|
'region_id.require'=>'请输入地区',
|
|
'address.require'=>'请输入地址',
|
|
'industry_id.require'=>'请选择行业',
|
|
'company.require'=>'请输入任职机构',
|
|
'position.require'=>'请输入职位',
|
|
'email.require'=>'请输入公司邮箱',
|
|
'email.email'=>'错误邮箱地址',
|
|
'investment_stage_id.require'=>'请选择投资阶段',
|
|
'interested_industry_ids.require'=>'请选择关注行业',
|
|
];
|
|
$data=request()->param();
|
|
$validate = new Validate($rule,$msg);
|
|
$result = $validate->check($data);
|
|
if(!$result){
|
|
$this->error($validate->getError());
|
|
}
|
|
if(count($data['investment_stage_id'])){
|
|
$data['investment_stage_id']=$data['investment_stage_id'];
|
|
}
|
|
if(count($data['interested_industry_ids'])){
|
|
$data['interested_industry_ids']=$data['interested_industry_ids'];
|
|
}
|
|
|
|
try {
|
|
$res=go_curl($url,'POST',$data,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
|
|
$res=json_decode($res,true);
|
|
|
|
}catch (\Exception $e){
|
|
$this->error('编辑失败');
|
|
}
|
|
|
|
if(isset($res['id'])){
|
|
$this->error($res['message']);
|
|
}
|
|
$this->success('编辑成功',url('index'));
|
|
}
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
|
|
if(isset($res['id'])&&$res['id']=='model.not_found'){
|
|
$res=[
|
|
'contact_name'=>'',
|
|
'contact_phone'=>'',
|
|
'region_id'=>'',
|
|
'address'=>'',
|
|
'industry_id'=>'',
|
|
'company'=>'',
|
|
'position'=>'',
|
|
'email'=>'',
|
|
'investment_stage_id'=>'',
|
|
'interested_industry_ids'=>'',
|
|
'investment_concerns'=>'',
|
|
'invested_projects'=>'',
|
|
'investment_point'=>'',
|
|
'province'=>'',
|
|
'city'=>'',
|
|
];
|
|
}
|
|
if(isset($res['region_id'])){
|
|
$row=deep_in_array($res['region_id'],$regions);
|
|
if(isset($row['id'])){
|
|
$res['province']=$row['id'];
|
|
$res['city']=$res['region_id'];
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'投资认证']);
|
|
$this->assign('current',$current);
|
|
$this->assign('profile',$this->userinfo);
|
|
$this->assign('detail',$res);
|
|
|
|
|
|
$stages=$this->stages();
|
|
$this->assign('stages',$stages);
|
|
|
|
$industries=$this->industries();
|
|
$this->assign('industries',$industries);
|
|
|
|
$this->assign('regions',$regions);
|
|
return $this->fetch(':individual');
|
|
}
|
|
/**
|
|
* 投资机构认证
|
|
* @return mixed|string
|
|
*/
|
|
public function institutional(){
|
|
$url=$this->hostpath."/api/institutional-investor/verifications";
|
|
|
|
$regions=$this->regions();
|
|
if(request()->isPost()){
|
|
$res=['message'=>'编辑失败'];
|
|
|
|
$rule=[
|
|
'contact_name'=>'require',
|
|
'contact_phone'=>'require',
|
|
'company'=>'require',
|
|
'name'=>'require',
|
|
'region_id'=>'require',
|
|
'address'=>'require',
|
|
'establish_date'=>'require',
|
|
'registration_capital'=>'require',
|
|
'company_size'=>'require',
|
|
'legal_representative'=>'require',
|
|
'investment_stage_id'=>'require',
|
|
'interested_industry_ids'=>'require',
|
|
];
|
|
$msg=[
|
|
'contact_name.require'=>'请输入联系人',
|
|
'contact_phone.require'=>'请输入联系手机号',
|
|
'company.require'=>'请输入任职机构',
|
|
'name.require'=>'请输入用户姓名',
|
|
'region_id.require'=>'请输入地区',
|
|
'address.require'=>'请输入地址',
|
|
'establish_date.require'=>'请输入注册日期',
|
|
'registration_capital.require'=>'请输入注册资本',
|
|
'company_size.require'=>'请输入公司人数',
|
|
'company_website.require'=>'请输入公司网站',
|
|
'legal_representative.require'=>'请输入法人代表',
|
|
'investment_stage_id.require'=>'请选择投资阶段',
|
|
'interested_industry_ids.require'=>'请选择关注行业'
|
|
];
|
|
$data=request()->param();
|
|
$validate = new Validate($rule,$msg);
|
|
$result = $validate->check($data);
|
|
if(!$result){
|
|
$this->error($validate->getError());
|
|
}
|
|
if(count($data['investment_stage_id'])){
|
|
$data['investment_stage_id']=$data['investment_stage_id'];
|
|
}
|
|
if(count($data['interested_industry_ids'])){
|
|
$data['interested_industry_ids']=$data['interested_industry_ids'];
|
|
}
|
|
|
|
try {
|
|
$res=go_curl($url,'POST',$data,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
|
|
}catch (\Exception $e){
|
|
$this->success('编辑失败');
|
|
}
|
|
if(isset($res['id'])){
|
|
$this->error($res['message']);
|
|
}
|
|
$this->success('编辑成功',url('index'));
|
|
}
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
if(isset($res['id'])&&$res['id']=='model.not_found'){
|
|
$res=[
|
|
'contact_name'=>'',
|
|
'contact_phone'=>'',
|
|
'company'=>'',
|
|
'name'=>'',
|
|
'region_id'=>'',
|
|
'address'=>'',
|
|
'establish_date'=>'',
|
|
'registration_capital'=>'',
|
|
'company_size'=>'',
|
|
'company_website'=>'',
|
|
'legal_representative'=>'',
|
|
'investment_stage_id'=>'',
|
|
'interested_industry_ids'=>'',
|
|
'investment_concerns'=>'',
|
|
'invested_projects'=>'',
|
|
'investment_point'=>'',
|
|
'province'=>'',
|
|
'city'=>'',
|
|
];
|
|
}
|
|
if(isset($res['region_id'])){
|
|
$row=deep_in_array($res['region_id'],$regions);
|
|
if(isset($row['id'])){
|
|
$res['province']=$row['id'];
|
|
$res['city']=$res['region_id'];
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'投资机构认证']);
|
|
$this->assign('current',$current);
|
|
$this->assign('profile',$this->userinfo);
|
|
$this->assign('detail',$res);
|
|
|
|
|
|
$stages=$this->stages();
|
|
$this->assign('stages',$stages);
|
|
|
|
$industries=$this->industries();
|
|
$this->assign('industries',$industries);
|
|
|
|
$this->assign('regions',$regions);
|
|
return $this->fetch(':institutional');
|
|
}
|
|
/**
|
|
* 申请企业认证
|
|
*/
|
|
public function corporate(){
|
|
$url=$this->hostpath."/api/corporate/verifications";
|
|
$regions=$this->regions();
|
|
if(request()->isPost()){
|
|
$res=['message'=>'编辑失败'];
|
|
|
|
$rule=[
|
|
'name'=>'require',
|
|
'legal_person'=>'require',
|
|
'region_id'=>'require',
|
|
'address'=>'require',
|
|
'nature'=>'require',
|
|
'registration_date'=>'require',
|
|
'registration_capital'=>'require',
|
|
'contact_name'=>'require',
|
|
'contact_email'=>'require',
|
|
'contact_name'=>'require',
|
|
'contact_phone'=>'require',
|
|
'financing_way'=>'require',
|
|
'stock_transfer_proportion'=>'require',
|
|
];
|
|
$msg=[
|
|
'name.require'=>'请输入企业名称',
|
|
'legal_person.require'=>'请输入法人姓名',
|
|
'region_id.require'=>'请输入地区',
|
|
'address.require'=>'请输入地址',
|
|
'nature.require'=>'请输入企业性质',
|
|
'registration_date.require'=>'请输入注册日期',
|
|
'registration_capital.require'=>'请输入注册资本',
|
|
'contact_name.require'=>'请输入联系人',
|
|
'contact_email.require'=>'请输入联系邮箱',
|
|
'contact_phone.require'=>'请输入联系手机号',
|
|
'financing_way.require'=>'请输入融资方式',
|
|
'stock_transfer_proportion.require'=>'请输入股权出让比例'
|
|
];
|
|
$data=request()->param();
|
|
$validate = new Validate($rule,$msg);
|
|
$result = $validate->check($data);
|
|
if(!$result){
|
|
$this->error($validate->getError());
|
|
}
|
|
try {
|
|
$res=go_curl($url,'POST',$data,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
$this->error('保存失败');
|
|
}
|
|
if(isset($res['id'])){
|
|
$msg=isset($res['message'])&&$res['message']?$res['message']:'保存失败';
|
|
$this->error($msg);
|
|
}
|
|
$this->success('保存成功');
|
|
}
|
|
$res=[];
|
|
try {
|
|
$res=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
|
|
$res=json_decode($res,true);
|
|
if(isset($res['id'])){
|
|
$res=[
|
|
'name'=>'',
|
|
'legal_person'=>'',
|
|
'region_id'=>'',
|
|
'address'=>'',
|
|
'nature'=>'',
|
|
'registration_date'=>'',
|
|
'registration_capital'=>'',
|
|
'contact_name'=>'',
|
|
'contact_phone'=>'',
|
|
'contact_fax'=>'',
|
|
'contact_email'=>'',
|
|
'financing_way'=>'',
|
|
'stock_transfer_proportion'=>'',
|
|
'province'=>'',
|
|
'city'=>'',
|
|
];
|
|
}
|
|
if(isset($res['region_id'])){
|
|
$row=deep_in_array($res['region_id'],$regions);
|
|
if(isset($row['id'])){
|
|
$res['province']=$row['id'];
|
|
$res['city']=$res['region_id'];
|
|
}
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
|
|
|
|
$this->assign('regions',$regions);
|
|
|
|
$this->assign('detail',$res);
|
|
$this->assign('profile',$this->userinfo);
|
|
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>'企业认证']);
|
|
$this->assign('current',$current);
|
|
return $this->fetch(':corporate');
|
|
}
|
|
/**
|
|
* 项目列表
|
|
* @return string
|
|
*/
|
|
public function ajaxprojects(){
|
|
$page=input('page',1,'intval');
|
|
$industry_id=input('industry_id','','intval');
|
|
$investment_id=input('investment_id','','intval');
|
|
$region_id=input('region_id','','intval');
|
|
$keyword=input('keyword');
|
|
$sort=input('sort');
|
|
|
|
$parmas=['page'=>$page,'industry_id'=>$industry_id,'region_id'=>$region_id,'investment_id'=>$investment_id,'keyword'=>$keyword,'sort'=>$sort];
|
|
$params=http_build_query($parmas);
|
|
$url=$this->hostpath."/api/user/projects?".$params;
|
|
$projects="[]";
|
|
try {
|
|
$projects=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $projects;
|
|
}
|
|
/**
|
|
* 机构详情
|
|
* @return string
|
|
*/
|
|
public function detail(){
|
|
$id=input('id','','intval');
|
|
$this->assign('id',$id);
|
|
$this->assign('type','项目');
|
|
|
|
|
|
$pro=[];
|
|
$url=$this->hostpath."/api/user/projects/".$id;
|
|
try {
|
|
$pro=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$pro=json_decode($pro,true);
|
|
if(!isset($pro['name']))$pro=[];
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
if(isset($pro['reputation'])){
|
|
$score=$pro['reputation'];
|
|
if(!isset($this->userinfo['reputation'])||$score>$this->userinfo['reputation']){
|
|
$this->error('你的信誉积分不足,请补全认证资料增加信誉积分才可以查看');
|
|
}
|
|
}
|
|
$this->assign('detail',$pro);
|
|
|
|
return $this->view->fetch(':project_detail');
|
|
}
|
|
/**
|
|
* 删除自己项目
|
|
* @return string[]|mixed
|
|
*/
|
|
public function delprojects(){
|
|
$id=input('id','','intval');
|
|
$url=$this->hostpath."/api/user/delete-projects";
|
|
if(empty($id)){
|
|
return ['message'=>'缺少参数id'];
|
|
}
|
|
$res=['message'=>'删除失败'];
|
|
try {
|
|
$res=go_curl($url,'POST',["project_id"=>$id],['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$res=json_decode($res,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $res;
|
|
}
|
|
/**
|
|
* 项目列表
|
|
* @return string
|
|
*/
|
|
public function projects(){
|
|
$userscore='';
|
|
$apitoken=session('api_token');
|
|
if(isset($this->userinfo['reputation'])){
|
|
$userscore=$this->userinfo['reputation'];
|
|
}
|
|
$this->assign('userscore',$userscore);
|
|
$url=$this->hostpath."/api/project/filters";
|
|
$profilters="[]";
|
|
try {
|
|
$profilters=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$profilters=json_decode($profilters,true);
|
|
if(isset($profilters['id']))$profilters=[];
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$this->assign('profilters',$profilters);
|
|
|
|
return $this->view->fetch(':index');
|
|
}
|
|
|
|
/**
|
|
* 获取所属⾏业
|
|
* @return array|mixed
|
|
*/
|
|
protected function industries(){
|
|
$url=$this->hostpath."/api/association/industries";
|
|
$list=[];
|
|
try {
|
|
$investors=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$list=json_decode($investors);
|
|
$list=object_to_array($list);
|
|
if(!isset($list[0]['id'])){
|
|
$list=[];
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $list;
|
|
}
|
|
/**
|
|
* 获取投资⽅式
|
|
* @return array|mixed
|
|
*/
|
|
protected function investments(){
|
|
$url=$this->hostpath."/api/association/investments";
|
|
$list=[];
|
|
try {
|
|
$investors=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$list=json_decode($investors);
|
|
$list=object_to_array($list);
|
|
if(!isset($list[0]['id'])){
|
|
$list=[];
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $list;
|
|
}
|
|
/**
|
|
* 获取地区数据
|
|
* @return array|mixed
|
|
*/
|
|
protected function regions(){
|
|
$url=$this->hostpath."/api/association/regions";
|
|
$list=[];
|
|
try {
|
|
$investors=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$list=json_decode($investors);
|
|
$list=object_to_array($list);
|
|
if(!isset($list[0]['id'])){
|
|
$list=[];
|
|
}
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $list;
|
|
}
|
|
/**
|
|
* 获取投资阶段
|
|
* @return array|mixed
|
|
*/
|
|
protected function stages(){
|
|
$url=$this->hostpath."/api/association/investment-stages";
|
|
$list=[];
|
|
try {
|
|
$investors=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$list=json_decode($investors);
|
|
$list=object_to_array($list);
|
|
if(!isset($list[0]['id'])){
|
|
$list=[];
|
|
}
|
|
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $list;
|
|
}
|
|
}
|