博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ajax与算法,sql的group处理
阅读量:7118 次
发布时间:2019-06-28

本文共 3163 字,大约阅读时间需要 10 分钟。

function correctAction(){        $semester_id = $this->_getParam("semester_id");        $day = $this->_getParam("day");        //todo...        $where = array();        $where['lx_lessons.semester_id = ?'] = array("type"=>1,"val"=>$semester_id);        $where['lx_lessons.lvalue = ?'] = array("type"=>1,"val"=>'1');        $where['lx_lessons.day = ?'] = array("type"=>1,"val"=>$day);        $where['lx_lessons.user_id > ?'] = array("type"=>1,"val"=>0);        $aLessons = $this->dao_lessons->getlessons($where,array('day desc','lorder desc','user_id desc'), false, false, false, array("id","day","lorder","lvalue","user_id","course_id"));        $a = $c = $d = array();        foreach($aLessons as $key=>$val)        {            $a[$val['user_id']][$val['id']] = $val['lorder'];        }        foreach($a as $k=>$v)        {            $total = count($v);            if($total > 1)            {                if($total !== count(array_unique($v)))                {                    foreach ($v as $key2 => $value2) {                        $c[$k][$value2][] = $key2;                    }                }            }        }        foreach ($c as $key3 => $value3) {            foreach ($value3 as $key4 => $value4) {                if(count($value4) > 1)                {                    $d[$key4] = $value4;                }            }        }        $total = $this->updateCourse($d);        echo $total;    }    function updateCourse($data)    {        $total = 0;        foreach ($data as $k => $v) {            $count = count($v);            foreach ($v as $k1 => $v1) {                $dataLessons['id'] = $v1;                $dataLessons['lvalue'] = 1/$count;                $res = $this->dao_lessons->updateLessons($dataLessons);                if($res){                    $total ++;                }            }        }        return $total;    }

导入学生数据表

导入
课时校准
Error:

 

function correct2Action(){        $semester_id = $this->_getParam("semester_id");        $day = $this->_getParam("day");        //todo...        $where = array();        $where['lx_lessons.semester_id = ?'] = array("type"=>1,"val"=>$semester_id);        //$where['lx_lessons.lvalue = ?'] = array("type"=>1,"val"=>'1');        $where['lx_lessons.day = ?'] = array("type"=>1,"val"=>$day);        $where['lx_lessons.user_id > ?'] = array("type"=>1,"val"=>0);        $aLessons = $this->dao_lessons->getlessons($where,false, false, false, false, array("COUNT(id) as num","day","lorder","user_id"),false,array('day','lorder','user_id'));        foreach($aLessons as $key=>$val)        {            if($val['num'] == 1)            {                unset($aLessons[$key]);            }        }        print_r($aLessons);exit;
 
 

转载地址:http://habel.baihongyu.com/

你可能感兴趣的文章
adt 22.6出现的问题
查看>>
Struts2(补充)
查看>>
Linux文件系统的目录结构详解
查看>>
MySQL server PID file could not be found!
查看>>
洛谷 P3049园林绿化 题解
查看>>
eclipse New菜单项的显示问题
查看>>
python3常用内置函数总结
查看>>
二分法在生活中的一次应用
查看>>
iOS7新特性的兼容性处理方法 之三
查看>>
转载:Python正则表达式
查看>>
UVA10140 Prime Distance
查看>>
.NET深入 c#数据类型2
查看>>
DIV+CSS颜色边框背景等样式
查看>>
HDU 1018 Big Number【斯特林公式/log10 / N!】
查看>>
nefu 115
查看>>
drf版本控制 和django缓存,跨域问题,
查看>>
SVN环境搭建详解(来源网络)
查看>>
设备驱动基础学习--字符驱动实现
查看>>
sourceinsight安装记录
查看>>
PHP函数索引-F
查看>>