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

alirpo
alirpo 这家伙很懒,还没有设置简介

6 人点赞了该文章 · 2842 浏览

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
|   http://www.wecenter.com
|   ========================================
|   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
|   http://www.wecenter.com
|   ========================================
|   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
下一期教大家做支付模块,当然都是基础的构建,要更深层次的自己在这基础上继续探索

发布于 2017-03-19 19:24

免责声明:

本文由 alirpo 原创发布于 WeCenter ,著作权归作者所有。

登录一下,更多精彩内容等你发现,贡献精彩回答,参与评论互动

登录! 还没有账号?去注册

萨思网络
2017-04-19 10:12
好赞,谢谢楼主
思路well
2017-03-30 21:38
伸手党路过
net
2017-03-20 10:11
感谢分享,虽然不用他
alirpo
2017-03-19 23:15
应该是SIGN 简写错误