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.
218 lines
7.7 KiB
218 lines
7.7 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\Db;
|
|
class Index extends Base{
|
|
protected $current=[['title'=>'文化金融服务项目']];
|
|
protected $apitoken='';
|
|
public function _initialize(){
|
|
parent::_initialize();
|
|
$this->assign('current',$this->current);
|
|
$this->apitoken=session('api_token');
|
|
}
|
|
protected function test(){
|
|
$apply_list=Db::name('cult4apply')->alias("a")->join(config('database.prefix').'cult4baseinfo b','a.apply_id =b.apply_id')->where(['b.new_flag'=>1,'a.status'=>array('in',[30,31])])->select();
|
|
|
|
foreach ($apply_list as $row){
|
|
$data=[];
|
|
$data['user_id']='57';
|
|
$data['logo']=$row['logo'];
|
|
$region_id='2162';
|
|
switch ($row['apply_type']){
|
|
case 1:
|
|
$addr=$row['c_reg_addr'];
|
|
$addrs=explode('市', $addr);
|
|
$city=$addrs[0];
|
|
if(strpos($city,'省')!=false){
|
|
$addrs=explode('省', $city);
|
|
$city=$addrs[1];
|
|
}
|
|
if($city){
|
|
$res=Db::connect('db1')->query("select * from regions where name like '%".$city."%'");
|
|
if($res){
|
|
$region_id=$res[0]['id'];
|
|
}
|
|
}
|
|
$data['name']=$row['c_name'];
|
|
$data['minimum_amount']=$row['c_reg_capital'];
|
|
$data['maximum_amount']=$row['c_reg_capital'];
|
|
$data['business_introduction']=$row['c_business_model_descr'];
|
|
$data['project_introduction']=$row['c_business_model_descr'];
|
|
$data['created_at']=$row['c_appl_date']?date("Y-m-d H:i:s",$row['c_appl_date']):'';
|
|
$data['updated_at']=$row['c_appl_date']?date("Y-m-d H:i:s",$row['c_appl_date']):'';
|
|
break;
|
|
case 2:
|
|
$data['name']=$row['p_name'];
|
|
$data['minimum_amount']=$row['p_amount'];
|
|
$data['maximum_amount']=$row['p_amount'];
|
|
$data['business_introduction']=$row['p_business_model_descr'];
|
|
$data['project_introduction']=$row['p_descr'];
|
|
$data['created_at']=$row['create_time']?date("Y-m-d H:i:s",$row['create_time']):'';
|
|
$data['updated_at']=$row['create_time']?date("Y-m-d H:i:s",$row['create_time']):'';
|
|
break;
|
|
case 3:
|
|
break;
|
|
}
|
|
|
|
|
|
$data['industry_id']=1;
|
|
$data['region_id']=$region_id;
|
|
$data['investment_id']=1;
|
|
$data['major_product_introduction']='';
|
|
$data['core_team_introduction']='';
|
|
$data['financing_introduction']='';
|
|
$data['proposal_images']='';
|
|
$data['proposal_file']='';
|
|
$data['approved_at']=$row['code_oper_time']?date("Y-m-d H:i:s",$row['code_oper_time']):'';
|
|
$data['tag']=1;
|
|
$query=Db::connect('db1')->table('projects')->insert($data);
|
|
$lastid=Db::connect('db1')->table('projects')->getLastInsID();
|
|
|
|
$data=[];
|
|
$data['user_id']='57';
|
|
$data['auditable_type']='App\Project';
|
|
$data['auditable_id']=$lastid;
|
|
$data['audited_at']=date("Y-m-d H:i:s",time());
|
|
$data['created_at']=date("Y-m-d H:i:s",time());
|
|
$data['updated_at']=date("Y-m-d H:i:s",time());
|
|
$data['tag']=1;
|
|
$query=Db::connect('db1')->table('audits')->insert($data);
|
|
}
|
|
}
|
|
/**
|
|
* 中心简介
|
|
* @return string
|
|
*/
|
|
public function index(){
|
|
$current=[];
|
|
$current[0]['jump']=url('introduction');
|
|
$current[0]['title']='中心简介';
|
|
$this->assign('current',$current);
|
|
|
|
$url=$this->hostpath."/api/about";
|
|
|
|
$page="[]";
|
|
try {
|
|
$page=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$page=json_decode($page,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
$this->assign('page',$page);
|
|
return $this->view->fetch(':introduction');
|
|
}
|
|
/**
|
|
* 文化金融政策
|
|
* @return string
|
|
*/
|
|
public function policy(){
|
|
$current=[];
|
|
$current[0]['jump']=url('policy');
|
|
$current[0]['title']='文化金融政策';
|
|
$this->assign('current',$current);
|
|
return $this->view->fetch(':policy');
|
|
}
|
|
/**
|
|
* 政策列表
|
|
* @return string
|
|
*/
|
|
public function ajaxpolicys(){
|
|
$page=input('page',1,'intval');
|
|
|
|
$parmas=['page'=>$page];
|
|
$params=http_build_query($parmas);
|
|
$url=$this->hostpath."/api/policys/index?".$params;
|
|
|
|
$policys="[]";
|
|
try {
|
|
$policys=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
return $policys;
|
|
}
|
|
/**
|
|
* 政策详情
|
|
* @return string
|
|
*/
|
|
public function policydetail(){
|
|
$id=input('id','','intval');
|
|
$this->assign('id',$id);
|
|
$pro=[];
|
|
$url=$this->hostpath."/api/policys/".$id;
|
|
|
|
try {
|
|
$pro=go_curl($url,'GET',false,['Accept'=>'application/json',"Authorization:Bearer ".$this->apitoken]);
|
|
$pro=json_decode($pro,true);
|
|
}catch (\Exception $e){
|
|
|
|
}
|
|
if(isset($pro['id'])&&isset($pro['message'])){
|
|
$this->error($pro['message']);
|
|
}
|
|
|
|
$current=$this->current;
|
|
$current[0]['jump']=url('index');
|
|
array_push($current, ['title'=>$pro['name']]);
|
|
$this->assign('current',$current);
|
|
$this->assign('detail',$pro);
|
|
return $this->view->fetch(':policy_detail');
|
|
}
|
|
/**
|
|
* 轮播图展示
|
|
* @return string
|
|
*/
|
|
public function carousels(){
|
|
$url=$this->hostpath."/api/carousels";
|
|
$carousels="[]";
|
|
try {
|
|
$carousels=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
}catch (\Exception $e){
|
|
}
|
|
return $carousels;
|
|
}
|
|
|
|
/**
|
|
* 获取项⽬联系⽅式
|
|
* @return array|mixed
|
|
*/
|
|
public function contact(){
|
|
$id=input('id','','intval');
|
|
$url=$this->hostpath."/api/projects/".$id."/contact";
|
|
$pro=[];
|
|
try {
|
|
$pro=go_curl($url,'GET',false,['Accept'=>'application/json']);
|
|
$pro=json_decode($pro,true);
|
|
if(!isset($pro['name']))$pro=[];
|
|
}catch (\Exception $e){
|
|
}
|
|
return $pro;
|
|
}
|
|
|
|
/**
|
|
* 检查积分
|
|
*/
|
|
protected function checkscore(){
|
|
$apitoken=session('api_token');
|
|
if(empty($apitoken)){
|
|
$this->error('请先登录');
|
|
}
|
|
$id=input('id');
|
|
$score=input('score');
|
|
$userinfo=$this->getUserProfile();
|
|
if(!isset($userinfo['reputation'])||$score>$userinfo['reputation']){
|
|
$this->error('你的信誉积分不足,请补全认证资料增加信誉积分才可以查看');
|
|
}
|
|
$jump=url('detail',['id'=>$id]);
|
|
$this->success('可访问',$jump);
|
|
}
|
|
|
|
|
|
}
|