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.
80 lines
2.4 KiB
80 lines
2.4 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 Policy extends Base{
|
|
protected $current=[['title'=>'文化金融政策']];
|
|
protected $apitoken='';
|
|
public function _initialize(){
|
|
parent::_initialize();
|
|
$this->assign('current',$this->current);
|
|
$this->apitoken=session('api_token');
|
|
}
|
|
|
|
/**
|
|
* 文化金融政策
|
|
* @return string
|
|
*/
|
|
public function index(){
|
|
$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');
|
|
}
|
|
|
|
}
|