SRCMS(轻响应)企业应急响应中心开发框架模版
This commit is contained in:
martinzhou2015
2015-07-28 15:15:57 +08:00
parent 0da4a2951c
commit c1dc9cf28e
856 changed files with 242152 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
<?php
/**
* @author Zhou Yuyang <1009465756@qq.com> 2015-07-27
* @copyright ©2105-2018 SRCMS
* @homepage http://www.src.pw
* @version 1.0
*/
namespace Home\Controller;
use Think\Controller;
class GiftController extends Controller{
public function index(){
$gift = M('links')->select();
$this->assign('gift',$gift);
$this->display();
}
}

View File

@@ -0,0 +1,31 @@
<?php
/**
* @author Zhou Yuyang <1009465756@qq.com> 2015-07-27
* @copyright ©2105-2018 SRCMS
* @homepage http://www.src.pw
* @version 1.0
*/
namespace Home\Controller;
use Think\Controller;
class HallController extends Controller{
public function index($key="")
{
if($key == ""){
$model = M('member');
}else{
$where['title'] = array('like',"%$key%");
$where['name'] = array('like',"%$key%");
$where['_logic'] = 'or';
$model = M('member')->where($where);
}
$user = $model->limit($Page->firstRow.','.$Page->listRows)->where($where)->order('jifen ASC')->where('type=1')->select();
$this->assign('user',getSortedCategory($user));
$this->display();
}
}

View File

@@ -0,0 +1,21 @@
<?php
/**
* @author Zhou Yuyang <1009465756@qq.com> 2015-07-27
* @copyright ©2105-2018 SRCMS
* @homepage http://www.src.pw
* @version 1.0
*/
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller{
public function index(){
$model = M('page')->limit(5)->select();
$this->assign('model',$model);
$this->display();
}
}

View File

@@ -0,0 +1,104 @@
<?php
/**
* @author Zhou Yuyang <1009465756@qq.com> 2015-07-27
* @copyright ©2105-2018 SRCMS
* @homepage http://www.src.pw
* @version 1.0
*/
namespace Home\Controller;
use Think\Controller;
use Extend\Oauth\ThinkOauth;
/**
* 用户本地登陆和第三方登陆
*/
class LoginController extends Controller{
public function index()
{
}
public function login($type=null)
{
//本地账号登陆
if(empty($type)){
if(!IS_POST){
$this->display();
}
if(IS_POST){
//验证码自己开启。代码省略
$data['username'] = I('post.username');
$data['password'] = I('post.password','','md5');
$member = M('member')->where($data)->find();
if($member){
session('userid',$member['id']);
session('username',$member['username']);
$this->success("登陆成功");
}else{
$this->error("账号或密码错误");
}
}
return;
}
//第三方登陆 这里最好先验证一下$type
//验证允许实用的登陆方式,可在后台用代码实现
$can_use = in_array(strtolower($type), array('qq','sina','github'));
if(!$can_use){
$this->error("不允许使用此方式登陆");
}
//验证通过 使用第三方登陆
if($type != null){
$sns = ThinkOauth::getInstance($type);
redirect($sns->getRequestCodeURL());
}
}
public function callback($type = null, $code = null)
{
if(empty($type) || empty($code)){
$this->error('参数错误');
}
$sns = ThinkOauth::getInstance($type);
//腾讯微博需传递的额外参数
$extend = null;
if ($type == 'tencent') {
$extend = array('openid' => $this->_get('openid'), 'openkey' => $this->_get('openkey'));
}
$tokenArray = $sns->getAccessToken($code, $extend);
$openid = $tokenArray['openid'];
//$token = $tokenArray['access_token']; //根据需求储存 主要用来刷新并延长授权时间
//dd($tokenArray);
//
//执行后续操作,代码自己实现。
//请记住每个用户的openid都是唯一的,所以把openid存到数据库即可
$member = D('MemberView');
//根据openid判断用户是否存在如果存在 ,判断用户是否被禁用。如果不存在,把openid存到数据库,相当于注册用户
#
#
# 代码自己实现
#
#
#
}
public function logout()
{
session('userid',null);
session('username',null);
$this->success("已成功退出登陆");
}
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* @author Zhou Yuyang <1009465756@qq.com> 2015-07-27
* @copyright ©2105-2018 SRCMS
* @homepage http://www.src.pw
* @version 1.0
*/
namespace Home\Controller;
use Think\Controller;
class PageController extends Controller{
public function index($key="")
{
if($key == ""){
$model = M('page');
}else{
$where['title'] = array('like',"%$key%");
$where['name'] = array('like',"%$key%");
$where['_logic'] = 'or';
$model = M('page')->where($where);
}
$count = $model->where($where)->count();// 查询满足要求的总记录数
$Page = new \Extend\Page($count,15);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$show = $Page->show();// 分页显示输出
$pages = $model->limit($Page->firstRow.','.$Page->listRows)->where($where)->order('id DESC')->select();
$this->assign('model', $pages);
$this->assign('page',$show);
$this->display();
}
public function view($id){
$model = M('page')->where('id='.$id)->find();
$this->assign('model',$model);
$this->display();
}
}

View File

@@ -0,0 +1 @@