补上N久前欠大家的一个签到制作教程

WeCenter.png


WeCenter1.png


WeCenter2.png

教程后续跟上
 
签到表
--
-- 表的结构 `aws_sgin`
--

CREATE TABLE `aws_sgin` (
  `id` int(4) NOT NULL,
  `user_id` int(11) NOT NULL,
  `last_sgin_time` int(11) NOT NULL,
  `day` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DAY字段是当天几号
\app\sgin 创建签到模块
AJAX.PHP
<?php
/*
+--------------------------------------------------------------------------
| WeCenter [#RELEASE_VERSION#]
| ========================================
| by WeCenter Software
| © 2011 - 2014 WeCenter. All Rights Reserved
| [url=http://www.wecenter.com]http://www.wecenter.com[/url]
| ========================================
| Support: WeCenter@qq.com
|
+---------------------------------------------------------------------------
*/

define('IN_AJAX', TRUE);


if (!defined('IN_ANWSION'))
{
die;
}

class ajax extends AWS_CONTROLLER
{
public function get_access_rule()
{
$rule_action['rule_type'] = 'white'; //黑名单,黑名单中的检查 'white'白名单,白名单以外的检查

$rule_action['actions'] = array(
'get_sgin_user',
'get_sgin_list',
'get_focus_users'
);

return $rule_action;
}

public function setup()
{
HTTP::no_cache_header();
}

public function get_sgin_user_action()
{

H::ajax_json_output($this->model('sgin')->get_sgin_by_uid($_GET['userid']));
}
public function save_sgin_user_action()
{
if ($this->model('sgin')->get_sgin_by_time($_POST['userid']))
{

H::ajax_json_output(array('status'=>1));
}
if($this->model('sgin')->insert_sgin($_POST['userid'])){
H::ajax_json_output(array('status'=>0));

}

}

}
MAIN.PHP
<?php
/*
+--------------------------------------------------------------------------
| WeCenter [#RELEASE_VERSION#]
| ========================================
| by WeCenter Software
| © 2011 - 2014 WeCenter. All Rights Reserved
| [url=http://www.wecenter.com]http://www.wecenter.com[/url]
| ========================================
| Support: WeCenter@qq.com
|
+---------------------------------------------------------------------------
*/


if (!defined('IN_ANWSION'))
{
die;
}

class main extends AWS_CONTROLLER
{
public function get_access_rule()
{
$rule_action['rule_type'] = "white"; // 黑名单,黑名单中的检查 'white'白名单,白名单以外的检查

if ($this->user_info['permission']['visit_topic'] AND $this->user_info['permission']['visit_site'])
{
$rule_action['rule_type'] = "black"; //'black'黑名单,黑名单中的检查 'white'白名单,白名单以外的检查
}
$rule_action['actions'] = array();
return $rule_action;
}

public function index_action()
{
if (is_mobile())
{
HTTP::redirect('/m/sgin/' . $_GET['id']);
}

$list_info = $this->model('sgin')->get_sgin_list('', 'id DESC',10,1);
//var_dump($list_info);
TPL::output('sgin/index');
break;

}


}


\models
创建sgin.php文件
没人赞,教程删除,打压伸手党

这样就能实现签到了,如果要在签到的基础上扩展加积分,加其他什么的自行扩展


QQ:1162310088
下一期教大家做支付模块,当然都是基础的构建,要更深层次的自己在这基础上继续探索

4 个评论

应该是SIGN 简写错误
感谢分享,虽然不用他
伸手党路过
好赞,谢谢楼主

要回复文章请先登录注册