博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ajax与算法,sql的group处理
阅读量:7117 次
发布时间: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/

你可能感兴趣的文章
阿里巴巴和京东进军美国电商界,分别针对企业用户和普通用户
查看>>
Git 2.19 对Diff、Branch和Grep等做了改进
查看>>
SignalR Core尝鲜
查看>>
区块链技术精华:四十种智能合约支持平台(三)
查看>>
阿里9000万欧元收购Flink母公司Data Artisans
查看>>
The Agile Mind-Set作者访谈
查看>>
反应式服务的性能应该如何测试?
查看>>
使用Java获取服务器IP地址
查看>>
Visual Studio 2017 15.7预览版发布
查看>>
阿里云出现大规模宕机,原因系IO HANG,或将做出赔偿
查看>>
区块链和数据科学:如果同时应用这两种技术,将会实现什么?
查看>>
基于Flink的超大规模在线实时反欺诈系统的建设与实践
查看>>
es动态index查询
查看>>
将敏捷应用于工业机械开发
查看>>
有赞HBase技术实践:读流程解析与优化
查看>>
微软最具价值技术专家:我的16年软件开发经验总结
查看>>
腾讯云+未来高峰对话:智能+时代的创新与探索
查看>>
C# 8中的默认接口方法
查看>>
实现TeX的算法:回首编程技术的过去三十年
查看>>
京东构建了全球最大的Kubernetes集群,没有之一
查看>>