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

本文共 3217 字,大约阅读时间需要 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;

 

转载于:https://www.cnblogs.com/jiqing9006/p/3760807.html

你可能感兴趣的文章
DotNetCore 3.0 助力 WPF 开发
查看>>
UML作业第六次:分析系统,绘制顺序图
查看>>
MySQL异常总结
查看>>
linq.js - LINQ for JavaScript
查看>>
Web 站点的水平扩展和垂直扩展 (译文)
查看>>
把DataTable中的身份证号导出excel的解决方案
查看>>
大三中期的鸭梨
查看>>
LeetCode-Palindrome Number
查看>>
C++ 哈希表
查看>>
一个 Java 的 Socket 服务器和客户端通信的例子
查看>>
poj 1113 Wall 凸包
查看>>
菜鸟开发WP APP…
查看>>
IntelliJ IDEA 中创建maven项目
查看>>
while循环的初始以及编码的初始
查看>>
关于数据库的建立及增删改查
查看>>
vs2010 ASP.NET, C#, Ajax 页面局部更新
查看>>
xmlSpy套件(Altova MissionKit 2016)的Ollydbg调试过程及破解
查看>>
无人驾驶技术之Kalman Filter原理介绍
查看>>
【BZOJ2002】[HNOI2010] 弹飞绵羊(大力分块)
查看>>
初学MillerRabin素数测试
查看>>