shopnc 二次开发 每日签到积分领取

/*

开始shopnc!!!!!

url:xxx.com/index.php?act=index&op=userjf

一个四线城市的半吊子程序员~

实现:前台模板文件 随便加入<a>标签来实现。

*/

Mode :points.model.php

方法: savePointsLog 添加:

            case 'day':
if(!$insertarr['pl_desc']){
$insertarr['pl_desc'] = Language::get('pointsdaydesc');
}
break;

Language :common.php

            添加"pointsdaydesc"

$lang['alert_no'] = '对不起,您一天只能领取一次!';
$lang['alert_ok'] = '每天登录一点点';
$lang['user_check'] = '请登录';

control :index.php

          添加 "userjfOp"

public function userjfOp(){
Language::read("common");
$lang = Language::getLangContent();
$model = Model('member');
$user =array();
if($_SESSION['is_login'] != '1') { showDialog($lang['user_check'],'./index.php?act=login&op=index');}
$user['member_points'] = $model->getMemberInfo(array('member_id'=>$_SESSION['member_id']),'member_points');
if($user['member_points'] == '0' ) { $model->checkloginMember();}
$userpoints = rand(0,10);
if($userpoints =='0' ){ $userpoints = rand(0,10);}
//$userpoints ='0.'.$userpoints;
$model_points =Model('points');
$arr_points = array();
$pix = $model_points->getPointsInfo(array('pl_memberid'=>$_SESSION['member_id'],'order'=>'points_log.pl_points desc'));
$pix_r = date("Y-m-d H:i:s", $pix['pl_addtime']+86400) ; //计算24小时之内的时间
$today = date("Y-m-d H:i:s",time()); //当天的时间
if($pix_r < $today)
//调试的时候 可以当天时间大于24.
{$model_points->savePointsLog('day',array('pl_memberid'=>$_SESSION['member_id'],'pl_membername'=>$_SESSION['member_name'],'pl_points'=>$userpoints)); showDialog($lang['alert_ok']);}
else { showDialog($lang['alert_no']);}
上一篇:用Docker解决坑爹的环境搭建系列——ubuntu16.04 SSH


下一篇:光盘安装win7系统教程