48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 小说系统 [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\common\controller;
|
|
use Think\Request;
|
|
|
|
class Writer extends Fornt {
|
|
|
|
public function _initialize() {
|
|
parent::_initialize();
|
|
|
|
if (!is_login()) {
|
|
$request = request();
|
|
$this->redirect(config('web_site_url').'/login.html?backurl='.urlencode($request->url(true)));
|
|
}
|
|
$uid = session('user_auth.uid');
|
|
|
|
|
|
$user = db('member')->where('uid='.$uid)->find();
|
|
|
|
$this->url = strtolower($this->request->controller() . '/' . $this->request->action());
|
|
$this->assign('nav',$this->url);
|
|
$this->assign('uid',$uid);
|
|
$this->assign('user',$user);
|
|
}
|
|
|
|
|
|
/**
|
|
* 返回Json数据
|
|
* @param type $ResponseCode 响应码
|
|
* @param type $ResponseMsg 响应消息
|
|
* @param type $ResponseData 响应数据
|
|
*/
|
|
protected function Json($ResponseCode = 1,$ResponseMsg = '',$ResponseData = array()){
|
|
|
|
$result = array(
|
|
'status'=>$ResponseCode,
|
|
'info'=>$ResponseMsg,
|
|
'data'=>$ResponseData
|
|
);
|
|
header("Content-type: application/json;charset=utf-8");
|
|
echo json_encode($result);
|
|
exit();
|
|
}
|
|
}
|