You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
638 lines
20 KiB
PHP
638 lines
20 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | OneThink [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: 麦当苗儿 <zuojiazi@vip.qq.com> <http://www.zjzit.cn>
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace Admin\Controller;
|
|
use User\Api\UserApi as UserApi;
|
|
use Base\Repository\UserRepository;
|
|
|
|
/**
|
|
* 后台首页控制器
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
*/
|
|
class IndexController extends AdminController {
|
|
/**
|
|
* 后台首页
|
|
* @author cz
|
|
*/
|
|
public function index()
|
|
{
|
|
if(session('user_auth.uid')){
|
|
$data=M('Member')
|
|
->field('uid,nickname,username,us.last_login_time,us.last_login_ip,login')
|
|
->join('sys_ucenter_member as us on sys_member.uid = us.id')
|
|
->where(array('uid'=>session('user_auth.uid')))
|
|
->find();
|
|
header("Content-type: text/html; charset=utf-8");
|
|
if(is_administrator()){
|
|
$data['group']='超级管理员';
|
|
}else{
|
|
$data['group'] = get_auth_group_name($data['uid']);
|
|
}
|
|
}
|
|
$this->assign('data',$data);
|
|
$this->indextt();
|
|
|
|
$this->meta_title = '管理首页';
|
|
|
|
// 日历
|
|
$this->calendar();
|
|
if(strtotime($_REQUEST['start']) == mktime(0,0,0,date('m'),date('d'),date('Y'))){
|
|
//今日时时
|
|
$this->nowday($_REQUEST['num']);
|
|
}else{
|
|
$this->foldLineDiagram($_REQUEST['start'],$_REQUEST['end'],$_REQUEST['num']);
|
|
}
|
|
$tm =strtotime(date("Y-m-d",strtotime("-1 day")));
|
|
$allcount = M("IndexChart","tab_")->field("all_count")->where("`date` = '{$tm}'")->find();
|
|
$allcount = unserialize($allcount['all_count']);
|
|
|
|
$this->assign('user_count',$allcount['user_count']);
|
|
$this->assign('active_count', $allcount['active_count']);
|
|
$this->assign('player_count', $allcount['player_count']);
|
|
$this->assign('money_sum', $allcount['money_sum']);
|
|
$this->assign('promote_sum',$allcount['promote_sum']);
|
|
//累计统计
|
|
$this->display();
|
|
}
|
|
/*
|
|
* 今日折线图
|
|
*/
|
|
public function nowday($num)
|
|
{
|
|
$starttime = mktime(0,0,0,date('m'),date('d'),date('Y'));
|
|
|
|
$endtime = $starttime+86399;
|
|
|
|
$start = date('Y-m-d',$starttime);
|
|
$end = date('Y-m-d',$endtime);
|
|
|
|
$user = D('User');
|
|
$spend = D('Spend');
|
|
$promote = D('Promote');
|
|
|
|
|
|
if ($start == date('Y-m-d',strtotime('-1 day'))) {$num = 2;}
|
|
|
|
$hours = ['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23'];
|
|
|
|
$data['date'] = [$start];
|
|
|
|
$data['hours'] = 1;
|
|
|
|
foreach($hours as $v) {
|
|
$data['news'][$v] = 0;
|
|
$data['active'][$v] = 0;
|
|
$data['player'][$v] = 0;
|
|
$data['money'][$v] = 0;
|
|
}
|
|
|
|
// 新增用户
|
|
$hoursnews = $user->newsAdd(['register_time'=>['between',[$starttime,$endtime]]],'news','time',5);
|
|
|
|
// 活跃用户
|
|
$hoursactive = $user->totalPlayerByGroup($hours,['tab_user_login_record.login_time'=>['between',[$starttime,$endtime]]],'active','time',5);
|
|
|
|
// 付费用户
|
|
$hoursplayer = $spend->totalPlayerByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'player','time',5);
|
|
|
|
// 充值金额
|
|
$hoursmoney = $spend->totalAmountByGroup(['pay_time'=>['between',[$starttime,$endtime]]],'money','time',5);
|
|
|
|
foreach($hours as $v) {
|
|
foreach($hoursnews as $h) {
|
|
$time = explode(' ',$h['time']);
|
|
if ($time[1] == $v){
|
|
$data['news'][$v] = (integer)$h['news'];break;
|
|
}
|
|
}
|
|
|
|
foreach($hoursactive as $h) {
|
|
|
|
if ($h['time'] == $v){
|
|
$data['active'][$v] = (integer)$h['active'];break;
|
|
}
|
|
}
|
|
|
|
foreach($hoursplayer as $h) {
|
|
$time = explode(' ',$h['time']);
|
|
if ($time[1] == $v){
|
|
$data['player'][$v] = (integer)$h['player'];break;
|
|
}
|
|
}
|
|
|
|
foreach($hoursmoney as $h) {
|
|
$time = explode(' ',$h['time']);
|
|
if ($time[1] == $v){
|
|
$data['money'][$v] = $h['money'];break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
// 新
|
|
$between = ['between',[$starttime-86400,$endtime]];
|
|
|
|
$cnewslist = $user->newsAdd(['register_time'=>$between],'count','time',1,'time desc');
|
|
$cnews['count'] = $cnewslist[0]['count']?$cnewslist[0]['count']:0;
|
|
$cnews['rate'] = $cnewslist[0] && $cnewslist[1]? round(($cnewslist[0]['count']/$cnewslist[1]['count']-1)*100,2):($cnewslist[0]&&!$cnewslist[1]?(100):(!$cnewslist[0]&&$cnewslist[1]?(-100):0));
|
|
|
|
// 活
|
|
$cactivelist = $user->totalPlayerByGroup([date('Y-m-d',$starttime-86400),$end],['tab_user_login_record.login_time'=>$between],'count','time',1,'time desc');
|
|
$cactive['count'] = $cactivelist[0]['count']?$cactivelist[0]['count']:0;
|
|
$cactive['rate'] = $cactivelist[0] && $cactivelist[1]? round(($cactivelist[0]['count']/$cactivelist[1]['count']-1)*100,2):($cactivelist[0]&&!$cactivelist[1]?(100):(!$cactivelist[0]&&$cactivelist[1]?(-100):0));
|
|
|
|
// 付
|
|
$cplayerlist = $spend->totalPlayerByGroup(['pay_time'=>$between],'count','time',1,'time desc');
|
|
$cplayer['count'] = $cplayerlist[0]['count']?$cplayerlist[0]['count']:0;
|
|
$cplayer['rate'] = $cplayerlist[0] && $cplayerlist[1]? round(($cplayerlist[0]['count']/$cplayerlist[1]['count']-1)*100,2):($cplayerlist[0]&&!$cplayerlist[1]?(100):(!$cplayerlist[0]&&$cplayerlist[1]?(-100):0));
|
|
|
|
// 充
|
|
$cmoneylist = $spend->totalAmountByGroup(['pay_time'=>$between],'count','time',1,'time desc');
|
|
$cmoney['count'] = $cmoneylist[0]['count']?$cmoneylist[0]['count']:0;
|
|
$cmoney['rate'] = $cmoneylist[0] && $cmoneylist[1]? round(($cmoneylist[0]['count']/$cmoneylist[1]['count']-1)*100,2):($cmoneylist[0]&&!$cmoneylist[1]?(100):(!$cmoneylist[0]&&$cmoneylist[1]?(-100):0));
|
|
|
|
// 渠
|
|
$cpromotelist = $promote->newsAdd(['create_time'=>$between],'count','time',1,'time desc');
|
|
$cpromote['count'] = $cpromotelist[0]['count']?$cpromotelist[0]['count']:0;
|
|
$cpromote['rate'] = $cpromotelist[0] && $cpromotelist[1]? round(($cpromotelist[0]['count']/$cpromotelist[1]['count']-1)*100,2):($cpromotelist[0]&&!$cpromotelist[1]?(100):(!$cpromotelist[0]&&$cpromotelist[1]?(-100):0));
|
|
|
|
|
|
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
|
|
if (is_array($v)) {
|
|
if ($k == 'date')
|
|
$data[$k] = '"'.implode('","',$v).'"';
|
|
else
|
|
$data[$k] = implode(',',$v);
|
|
|
|
}
|
|
}
|
|
|
|
$data['compare']['news'] = $cnews;
|
|
$data['compare']['active'] = $cactive;
|
|
$data['compare']['player'] = $cplayer;
|
|
$data['compare']['money'] = $cmoney;
|
|
$data['compare']['promote'] = $cpromote;
|
|
|
|
if ($flag) {
|
|
|
|
echo json_encode($data);
|
|
|
|
} else {
|
|
|
|
$this->assign('foldline',$data);
|
|
|
|
$this->assign('num',$num);
|
|
|
|
}
|
|
# code...
|
|
}
|
|
|
|
/*
|
|
* 折线图
|
|
* @param integer $start 开始时间
|
|
* @param integer $end 结束时间
|
|
* @param boolean $flag 是否ajax返回
|
|
* @author 鹿文学
|
|
*/
|
|
public function foldLineDiagram($start='',$end='',$num='',$flag=false)
|
|
{
|
|
$starttime = $start?strtotime($start):mktime(0,0,0,date('m'),date('d')-1,date('Y'));
|
|
|
|
$endtime = $end?strtotime($end)+86399:$starttime+86399;
|
|
|
|
$start = date('Y-m-d',$starttime);
|
|
$end = date('Y-m-d',$endtime);
|
|
|
|
$user = D('User');
|
|
$spend = D('Spend');
|
|
$promote = D('Promote');
|
|
|
|
if ($start == $end) { // 单天
|
|
|
|
if ($start == date('Y-m-d',strtotime('-1 day'))) {$num = 2;}
|
|
$data['date'] = [$start];
|
|
$data['hours'] = 1;
|
|
$tm = strtotime($start);
|
|
$dbdata = M("IndexChart","tab_")->field("new_user_count,new_user_hours,active_user_count,active_user_hours,pay_user_count,pay_user_hours,pay_money_count,pay_money_hours,promote_new_count")->where("`date` = '{$tm}'")->find();
|
|
$data['news'] = unserialize($dbdata["new_user_hours"]);
|
|
$data['active'] = unserialize($dbdata["active_user_hours"]);
|
|
$data['player']=unserialize($dbdata["pay_user_hours"]);
|
|
$data['money']=unserialize($dbdata["pay_money_hours"]);
|
|
|
|
//获取昨天
|
|
$ytm = $starttime-86400;
|
|
$ydbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,pay_user_count,pay_money_count,promote_new_count")->where("`date` = '{$ytm}'")->find();
|
|
//计算
|
|
$cnews['count'] = $dbdata['new_user_count'];
|
|
$cnews['rate'] = $this->setRate($dbdata['new_user_count'],$ydbdata['new_user_count']);
|
|
|
|
$cactive['count'] = $dbdata['active_user_count'];
|
|
$cactive['rate'] = $this->setRate($dbdata['active_user_count'],$ydbdata['active_user_count']);
|
|
|
|
$cplayer['count'] = $dbdata['pay_user_count'];
|
|
$cplayer['rate'] = $this->setRate($dbdata['pay_user_count'],$ydbdata['pay_user_count']);
|
|
|
|
$cmoney['count'] = $dbdata['pay_money_count'];
|
|
$cmoney['rate'] = $this->setRate($dbdata['pay_money_count'],$ydbdata['pay_money_count']);
|
|
|
|
$cpromote['count'] = $dbdata['promote_new_count'];
|
|
$cpromote['rate'] = $this->setRate($dbdata['promote_new_count'],$ydbdata['promote_new_count']);
|
|
|
|
} else {
|
|
|
|
$datelist = get_date_list($starttime,$endtime,$num==7?4:1);
|
|
$data['date'] = $datelist;
|
|
$data['hours'] = 0;
|
|
$map = array(
|
|
"date"=>['between',[$starttime,$endtime]]
|
|
);
|
|
//获取记录
|
|
$count1 = array();
|
|
$active_user_list = [];
|
|
$pay_user_list = [];
|
|
$dbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count")
|
|
->where($map)->select();
|
|
|
|
foreach($dbdata as $k => $v) {
|
|
$data['news'][$k] = $v['new_user_count'];
|
|
$data['active'][$k] = $v['active_user_count'];
|
|
$data['player'][$k] = $v['pay_user_count'];
|
|
$data['money'][$k] = $v['pay_money_count'];
|
|
$active_user_list += unserialize($v['active_user_list']);
|
|
unset($v['active_user_list']);
|
|
unset($dbdata[$k]['active_user_list']);
|
|
$pay_user_list += unserialize($v['pay_user_list']);
|
|
unset($v['pay_user_list']);
|
|
unset($dbdata[$k]['pay_user_list']);
|
|
$count1['new_user_count'] += $v['new_user_count'];
|
|
$count1['pay_money_count'] += $v['pay_money_count'];
|
|
$count1['promote_new_count'] += $v['promote_new_count'];
|
|
}
|
|
unset($dbdata);
|
|
$count1['active_user_count'] = count(array_flip(array_flip($active_user_list)));
|
|
unset($active_user_list);
|
|
$count1['pay_user_count'] = count(array_flip(array_flip($pay_user_list)));
|
|
unset($active_user_list);
|
|
//获取前num的日志
|
|
switch($num) {
|
|
case 3:{
|
|
$between = ['between',[strtotime('-7 day',$starttime),strtotime('-7 day',$endtime)]];
|
|
};break;
|
|
case 4:{
|
|
$temp = strtotime('-1 month',$starttime);
|
|
$between = ['between',[$temp,mktime(0,0,0,date('m',$temp)+1,1,date('Y',$temp))-1]];
|
|
|
|
};break;
|
|
case 5:{
|
|
$between = ['between',[strtotime('-7 day',$starttime),strtotime('-7 day',$endtime)]];
|
|
|
|
};break;
|
|
case 6:{
|
|
$between = ['between',[strtotime('-30 day',$starttime),strtotime('-30 day',$endtime)]];
|
|
};break;
|
|
case 7:{
|
|
$between = ['between',[strtotime('-365 day',$starttime),strtotime('-365 day',$endtime)]];
|
|
};break;
|
|
default:{
|
|
$day_num = count($datelist);
|
|
$between = ['between',[strtotime('-'.$day_num.' day',$starttime),strtotime('-'.$day_num.' day',$endtime)]];
|
|
};
|
|
}
|
|
//获取前几天记录
|
|
$map1 = array(
|
|
"date"=>$between
|
|
);
|
|
$ydbdata = M("IndexChart","tab_")->field("new_user_count,active_user_count,active_user_list,pay_user_count,pay_user_list,pay_money_count,promote_new_count")
|
|
->where($map1)->select();
|
|
$active_user_list = [];
|
|
$pay_user_list = [];
|
|
$count2 = array();
|
|
foreach($ydbdata as $k => $v) {
|
|
$active_user_list += unserialize($v['active_user_list']);
|
|
unset($v['active_user_list']);
|
|
unset($ydbdata[$k]['active_user_list']);
|
|
$pay_user_list += unserialize($v['pay_user_list']);
|
|
unset($v['pay_user_list']);
|
|
unset($ydbdata[$k]['pay_user_list']);
|
|
$count2['new_user_count'] += $v['new_user_count'];
|
|
$count2['pay_money_count'] += $v['pay_money_count'];
|
|
$count2['promote_new_count'] += $v['promote_new_count'];
|
|
}
|
|
unset($ydbdata);
|
|
$count2['active_user_count'] = count(array_flip(array_flip($active_user_list)));
|
|
unset($active_user_list);
|
|
$count2['pay_user_count'] = count(array_flip(array_flip($pay_user_list)));
|
|
unset($active_user_list);
|
|
//比较
|
|
$cnews['count'] = $count1['new_user_count'];
|
|
$cnews['rate'] = $this->setRate($count1['new_user_count'],$count2['new_user_count']);
|
|
|
|
$cactive['count'] =$count1['active_user_count'];
|
|
$cactive['rate'] = $this->setRate($count1['active_user_count'],$count2['active_user_count']);
|
|
|
|
$cplayer['count'] =$count1['pay_user_count'];
|
|
$cplayer['rate'] = $this->setRate($count1['pay_user_count'],$count2['pay_user_count']);
|
|
|
|
$cmoney['count'] = $count1['pay_money_count'];
|
|
$cmoney['rate'] = $this->setRate($count1['pay_money_count'],$count2['pay_money_count']);
|
|
|
|
$cpromote['count'] = $count1['promote_new_count'];
|
|
$cpromote['rate'] = $this->setRate($count1['promote_new_count'],$count2['promote_new_count']);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach($data as $k => $v) {
|
|
// dump($k);
|
|
if (is_array($v)) {
|
|
if ($k == 'date')
|
|
$data[$k] = '"'.implode('","',$v).'"';
|
|
else
|
|
$data[$k] = implode(',',$v);
|
|
|
|
}
|
|
}
|
|
|
|
$data['compare']['news'] = $cnews;
|
|
$data['compare']['active'] = $cactive;
|
|
$data['compare']['player'] = $cplayer;
|
|
$data['compare']['money'] = $cmoney;
|
|
$data['compare']['promote'] = $cpromote;
|
|
if ($flag) {
|
|
|
|
echo json_encode($data);
|
|
|
|
} else {
|
|
|
|
$this->assign('foldline',$data);
|
|
|
|
$this->assign('num',$num);
|
|
|
|
}
|
|
# code...
|
|
}
|
|
|
|
public function setRate($d1,$d2)
|
|
{
|
|
$rate = 0;
|
|
if($d1>0){
|
|
if($d2 > 0){
|
|
$rate = round(($d1/$d2-1)*100,2);
|
|
}else{
|
|
$rate = 100;
|
|
}
|
|
}else if($d1 == 0 && $d2 == 0){
|
|
$rate = 0;
|
|
}else{
|
|
$rate = -100;
|
|
}
|
|
return $rate;
|
|
}
|
|
|
|
/*
|
|
* 日历
|
|
* @param integer $start 开始时间(2018-04)
|
|
* @param integer $end 结束时间(2018-05)
|
|
* @param boolean $flag 是否ajax返回
|
|
* @author 鹿文学
|
|
*/
|
|
public function calendar($start='',$end='',$flag=false) {
|
|
|
|
$start = $start?$start:date('Y-m',strtotime('-1 month'));
|
|
$end = $end?$end:date('Y-m');
|
|
|
|
if ($start == $end) {$start = date('Y-m',strtotime('-1 month',$end));}
|
|
if (strtotime($start)>strtotime($end)) {$temp = $end;$end = $start;$start = $temp;}
|
|
if (strtotime($end) > strtotime(date('Y-m'))) {$end = date('Y-m');$start = date('Y-m',strtotime('-1 month'));}
|
|
|
|
$iscurrent = $end != date('Y-m')?1:0; // 默认是当前月,不可进入下一个月
|
|
|
|
$stime = strtotime($start);
|
|
$etime = strtotime($end);
|
|
|
|
$sw = date('w',$stime); // 周几
|
|
$ew = date('w',$etime);
|
|
$sw = $sw == 0? 6:(integer)$sw-1;
|
|
$ew = $ew == 0? 6:(integer)$ew-1;
|
|
|
|
$st = date('t',$stime); // 天数
|
|
$et = date('t',$etime);
|
|
|
|
$sf = $ef = $sr = $er = 1; // 行数 ,日期起始值
|
|
|
|
for($i=0;$i<7;$i++) {
|
|
if ($i<$sw)
|
|
$first[$sr][$i] = ['value'=>''];
|
|
else {
|
|
$first[$sr][$i] = ['value'=>set_date_day_format($sf),'full'=>$start.'-'.set_date_day_format($sf)];$sf++;
|
|
}
|
|
}
|
|
for($i=0;$i<7;$i++) {
|
|
if ($i<$ew)
|
|
$last[$er][$i] = ['value'=>''];
|
|
else {
|
|
$eday = set_date_day_format($ef);
|
|
if (strtotime($end.'-'.$eday)>strtotime(date('Y-m-d'))){
|
|
$last[$er][$i] = ['value'=>$eday,'full'=>$end.'-'.$eday,'no'=>1];$ef++;
|
|
}else{
|
|
$last[$er][$i] = ['value'=>$eday,'full'=>$end.'-'.$eday];$ef++;
|
|
}
|
|
}
|
|
}
|
|
|
|
$sn = $en = 0; // 列数
|
|
for ($i=$sf;$i<=$st;$i++) {
|
|
if (count($first[$sr])==7){$sr++;$sn=0;}
|
|
$sday = set_date_day_format($i);
|
|
$first[$sr][$sn] = ['value'=>$sday,'full'=>$start.'-'.$sday];
|
|
$sn++;
|
|
}
|
|
for ($i=$ef;$i<=$et;$i++) {
|
|
if (count($last[$er])==7){$er++;$en=0;}
|
|
$eday = set_date_day_format($i);
|
|
if (strtotime($end.'-'.$eday)>strtotime(date('Y-m-d'))){$last[$er][$en] = ['value'=>$eday,'full'=>$end.'-'.$eday,'no'=>1];} else{$last[$er][$en] = ['value'=>$eday,'full'=>$end.'-'.$eday];}
|
|
|
|
$en++;
|
|
}
|
|
|
|
$prev = date('Y-m',strtotime('-1 month',$stime)).','.$start;
|
|
$next = $end.','.date('Y-m',strtotime('+1 month',$etime));
|
|
|
|
$calendar = ['first'=>$first,'last'=>$last,'prev'=>$prev,'next'=>$next,'iscurrent'=>$iscurrent,'ftitle'=>date('Y年m月',$stime),'ltitle'=>date('Y年m月',$etime),'today'=>date('Y-m-d')];
|
|
|
|
if ($flag) {
|
|
|
|
echo json_encode($calendar);
|
|
|
|
} else {
|
|
|
|
$this->assign('calendar',$calendar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function indextt(){
|
|
$user = M("User","tab_");
|
|
$game = M("Game","tab_");
|
|
$spend = M('Spend',"tab_");
|
|
$deposit = M('Deposit',"tab_");
|
|
$promote = M("Promote","tab_");
|
|
|
|
if($gameso){
|
|
$gameso=implode(',',array_column($gameso, 'game_id'));
|
|
$sourcemap['id']=array('not in',$gameso);
|
|
}else{
|
|
$sourcemap['id']=0;
|
|
}
|
|
//游戏原包管理
|
|
$gac=$game->field('game_name')->where($sourcemap)->order('create_time desc')->select();
|
|
$tishi['gac']=$gac;
|
|
//代充额度
|
|
$prolc=$promote
|
|
->field('account,pay_limit')
|
|
->where(array('pay_limit'=>array('lt',10),'set_pay_time'=>array('gt',0)))
|
|
->select();
|
|
$tishi['prolc']=$prolc;
|
|
//返利设置
|
|
$map_rebc['endtime'] = array(array('neq',0),array('lt',time()), 'and') ;
|
|
$rebc=M('Rebate','tab_')
|
|
->field('game_name,endtime')
|
|
->where($map_rebc)
|
|
->select();
|
|
$tishi['rebc']=$rebc;
|
|
//礼包数量
|
|
$giftc=M('Giftbag','tab_')
|
|
->field('game_name,novice,giftbag_name')
|
|
->where(array('status'=>1))
|
|
->select();
|
|
foreach ($giftc as $key => $value) {
|
|
$novc=arr_count($value['novice']);
|
|
if($novc>10){
|
|
unset($giftc[$key]);
|
|
}
|
|
}
|
|
//渠道礼包
|
|
$pgiftc=M('promote_gift','tab_')
|
|
->field('game_name,novice,giftbag_name')
|
|
->where(array('status'=>1))
|
|
->select();
|
|
foreach ($pgiftc as $key => $value) {
|
|
$novc=arr_count($value['novice']);
|
|
if($novc>10){
|
|
unset($pgiftc[$key]);
|
|
}
|
|
}
|
|
$tishi['giftc']=$giftc;
|
|
$tishi['pgiftc']=$pgiftc;
|
|
$this->assign('tishi',$tishi);
|
|
// $this->display('index');
|
|
}
|
|
public function savekuaijie(){
|
|
$newstr['kuaijie_value']=substr($_POST['kuaijie'],0,strlen($_POST['kuaijie'])-1);
|
|
$data=M('Member')->where(array('uid'=>UID))->save($newstr);
|
|
if($data!==false){
|
|
$this->ajaxReturn(array('status'=>1));
|
|
}else{
|
|
$this->ajaxReturn(array('status'=>0));
|
|
}
|
|
}
|
|
|
|
public function setup() {
|
|
|
|
$data = M('kuaijieicon')->field('id,title,value,url')->where(['status'=>1])->select();
|
|
|
|
$this->assign('kuaijielist',$data);
|
|
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 添加快捷图标
|
|
* @author 鹿文学
|
|
*/
|
|
public function addShortcutIcon() {
|
|
|
|
$Kuaijieicon = M('Kuaijieicon');
|
|
|
|
$result = $Kuaijieicon->where(['url'=>$_REQUEST['url']])->find();
|
|
|
|
if ($result) {
|
|
|
|
if ($result['status'] == 0) {
|
|
|
|
$data = array('status'=>1,'id'=>$result['id']);
|
|
|
|
$id = $Kuaijieicon->save($data);
|
|
|
|
if($id){
|
|
//记录行为
|
|
action_log('Kuaijie/edit', 'Kuaijieicon', $result['id'], UID);
|
|
$this->success('添加成功');
|
|
} else {
|
|
$this->error('添加失败');
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->error('已添加过常用设置');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$data = array('title'=>$_REQUEST['title'],'status'=>1,'url'=>$_REQUEST['url'],'value'=>0);
|
|
|
|
$id = $Kuaijieicon->add($data);
|
|
|
|
if($id){
|
|
//记录行为
|
|
action_log('Kuaijie/add', 'Kuaijieicon', $id, UID);
|
|
$this->success('添加成功');
|
|
} else {
|
|
$this->error('添加失败');
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 删除快捷图标
|
|
* @param integer $id 快捷图标编号
|
|
* @author 鹿文学
|
|
*/
|
|
public function delShortcutIcon($id=0) {
|
|
|
|
if (!is_numeric($id) || $id<1) {$this->error('参数错误');}
|
|
|
|
$Kuaijieicon = M('Kuaijieicon');
|
|
|
|
$data = array('status'=>0,'id'=>$id);
|
|
|
|
$res = $Kuaijieicon->save($data);
|
|
|
|
if($res){
|
|
//记录行为
|
|
action_log('Kuaijie/del', 'Kuaijieicon', $id, UID);
|
|
$this->success('删除成功');
|
|
} else {
|
|
$this->error('删除失败');
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|