diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..d465120e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+/.idea
+/.vscode
+/vendor
+*.log
+.env
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 00000000..36f7b6f9
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,42 @@
+sudo: false
+
+language: php
+
+branches:
+ only:
+ - stable
+
+cache:
+ directories:
+ - $HOME/.composer/cache
+
+before_install:
+ - composer self-update
+
+install:
+ - composer install --no-dev --no-interaction --ignore-platform-reqs
+ - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
+ - composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
+ - composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
+ - composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
+ - zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
+
+script:
+ - php think unit
+
+deploy:
+ provider: releases
+ api_key:
+ secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
+ file:
+ - ThinkPHP_Core.zip
+ - ThinkPHP_Full.zip
+ skip_cleanup: true
+ on:
+ tags: true
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 00000000..574a39c4
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
+All rights reserved。
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+Apache Licence是著名的非盈利开源组织Apache采用的协议。
+该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
+允许代码修改,再作为开源或商业软件发布。需要满足
+的条件:
+1. 需要给代码的用户一份Apache Licence ;
+2. 如果你修改了代码,需要在被修改的文件中说明;
+3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
+带有原来代码中的协议,商标,专利声明和其他原来作者规
+定需要包含的说明;
+4. 如果再发布的产品中包含一个Notice文件,则在Notice文
+件中需要带有本协议内容。你可以在Notice中增加自己的
+许可,但不可以表现为对Apache Licence构成更改。
+具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..34e0e3ee
--- /dev/null
+++ b/README.md
@@ -0,0 +1,52 @@
+ThinkPHP 6.0
+===============
+
+> 运行环境要求PHP7.1+。
+
+## 主要新特性
+
+* 采用`PHP7`强类型(严格模式)
+* 支持更多的`PSR`规范
+* 原生多应用支持
+* 更强大和易用的查询
+* 全新的事件系统
+* 模型事件和数据库事件统一纳入事件系统
+* 模板引擎分离出核心
+* 内部功能中间件化
+* SESSION/Cookie机制改进
+* 对Swoole以及协程支持改进
+* 对IDE更加友好
+* 统一和精简大量用法
+
+## 安装
+
+~~~
+composer create-project topthink/think tp 6.0.*-dev
+~~~
+
+如果需要更新框架使用
+~~~
+composer update topthink/framework
+~~~
+
+## 文档
+
+[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
+
+## 参与开发
+
+请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
+
+## 版权信息
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+
+本项目包含的第三方源码和二进制文件之版权信息另行标注。
+
+版权所有Copyright © 2006-2019 by ThinkPHP (http://thinkphp.cn)
+
+All rights reserved。
+
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+更多细节参阅 [LICENSE.txt](LICENSE.txt)
diff --git a/app/.htaccess b/app/.htaccess
new file mode 100644
index 00000000..3418e55a
--- /dev/null
+++ b/app/.htaccess
@@ -0,0 +1 @@
+deny from all
\ No newline at end of file
diff --git a/app/BaseController.php b/app/BaseController.php
new file mode 100644
index 00000000..b3bd7d37
--- /dev/null
+++ b/app/BaseController.php
@@ -0,0 +1,94 @@
+app = $app;
+ $this->request = $this->app->request;
+
+ // 控制器初始化
+ $this->initialize();
+ }
+
+ // 初始化
+ protected function initialize()
+ {}
+
+ /**
+ * 验证数据
+ * @access protected
+ * @param array $data 数据
+ * @param string|array $validate 验证器名或者验证规则数组
+ * @param array $message 提示信息
+ * @param bool $batch 是否批量验证
+ * @return array|string|true
+ * @throws ValidateException
+ */
+ protected function validate(array $data, $validate, array $message = [], bool $batch = false)
+ {
+ if (is_array($validate)) {
+ $v = new Validate();
+ $v->rule($validate);
+ } else {
+ if (strpos($validate, '.')) {
+ // 支持场景
+ list($validate, $scene) = explode('.', $validate);
+ }
+ $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
+ $v = new $class();
+ if (!empty($scene)) {
+ $v->scene($scene);
+ }
+ }
+
+ $v->message($message);
+
+ // 是否批量验证
+ if ($batch || $this->batchValidate) {
+ $v->batch(true);
+ }
+
+ return $v->failException(true)->check($data);
+ }
+
+}
diff --git a/app/ExceptionHandle.php b/app/ExceptionHandle.php
new file mode 100644
index 00000000..453d1260
--- /dev/null
+++ b/app/ExceptionHandle.php
@@ -0,0 +1,58 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取角色列表
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'id',
+ 'type'=>'asc',
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $ag = new AG;
+
+ // 查询要显示的数据
+ $data = $ag->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+ // 创建角色
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加角色',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/authgroup',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染
+ return $this->fetch();
+ }
+
+
+ // 保存角色信息
+ public function save()
+ {
+
+ // 实例化验证模型
+ $validate = new \app\admin\validate\RuleGroup;
+
+
+ // 获取表单数据
+ $list = request()->only(['title','rules','miaoshu'],'post');
+ $list['rules'] = implode(",",$list['rules']);
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 保存数据
+ $data = AG::create($list);
+
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 显示指定的资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改角色信息
+ public function edit($id)
+ {
+ // 获取单位信息
+ $list['data'] = AG::field('id,title,miaoshu,rules')
+ ->find($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑角色',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/authgroup/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+
+
+ // 更新角色信息
+ public function update($id)
+ {
+
+ // 实例化验证模型
+ $validate = new \app\admin\validate\RuleGroup;
+
+ // 获取表单数据
+ $list = request()->only(['title','rules','miaoshu'],'put');
+ $list['rules'] = implode(",",$list['rules']);
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ $data = AG::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+ // 删除角色
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = AG::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置角色状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 更新数据
+ $data= AG::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+}
diff --git a/app/admin/controller/AuthGroupAccess.php b/app/admin/controller/AuthGroupAccess.php
new file mode 100644
index 00000000..d55b50f9
--- /dev/null
+++ b/app/admin/controller/AuthGroupAccess.php
@@ -0,0 +1,14 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取权限信息列表
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1'
+ ,'limit'=>'10'
+ ,'field'=>'id'
+ ,'type'=>'asc'
+ ,'searchval'=>''
+ ],'POST');
+
+ // 实例化
+ $ar = new AR;
+
+ // 查询要显示的数据
+ $data = $ar->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+
+ // 创建权限
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加权限',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/authrule',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\admin\validate\Rule;
+
+
+ // 获取表单数据
+ $list = request()->only(['title','name','pid','condition','paixu','ismenu','font','beizhu','url'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 保存数据
+ $data = AR::create($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ //
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改权限信息
+ public function edit($id)
+ {
+
+ // 获取权限信息
+ $list['data'] = AR::field('id,title,name,condition,pid,paixu,ismenu,font,url')
+ ->find($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑权限',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/authrule/'.$id,
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+
+
+ // 更新权限信息
+ public function update($id)
+ {
+ $validate = new \app\admin\validate\Rule;
+
+ // 获取表单数据
+ $list = request()->only(['title','name','pid','condition','paixu','ismenu','font','beizhu','url'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ $data = AR::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除权限
+ public function delete($id)
+ {
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = AR::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置权限状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取权限信息
+ $data = AR::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+}
diff --git a/app/admin/controller/Error.php b/app/admin/controller/Error.php
new file mode 100644
index 00000000..23d823e6
--- /dev/null
+++ b/app/admin/controller/Error.php
@@ -0,0 +1,11 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取数据管理员数据
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1'
+ ,'limit'=>'10'
+ ,'field'=>'id'
+ ,'type'=>'desc'
+ ,'searchval'=>''
+ ],'POST');
+
+ // 实例化
+ $ad = new AD;
+
+ // 查询要显示的数据
+ $data = $ad->search($src);
+
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+ // 创建用户信息
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加管理员',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/admin',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+ // 保存管理员
+ public function save()
+ {
+
+ // 实例化加密类
+ $md5 = new APR1_MD5();
+ // 实例化验证模型
+ $validate = new \app\admin\validate\Admin;
+
+
+ // 获取表单数据
+ $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'post');
+
+
+ // 设置密码,默认为123456
+ $list['password'] = $md5->hash('123456');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 实例化管理员数据模型类
+ $admin = new AD();
+ $admindata = $admin->create($list);
+
+ // 更新中间表
+ $groupdata=$admindata->glGroup()->saveAll($list['group_id']);
+
+
+ // 根据更新结果设置返回提示信息
+ $admindata&&$groupdata ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+
+ }
+
+
+
+
+ // 读取用户信息
+ public function read($id)
+ {
+ // 获取管理员信息
+ $ad = new AD;
+ $list = AD::where('id',$id)
+ ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time')
+ ->with([
+ 'adSchool'=>function($query){
+ $query->field('id,title');
+ }
+ ])
+ ->find();
+ $list['webtitle'] = '帐号信息';
+ $list->groupnames = $ad->getGroupnames($id);
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 读取用户信息
+ public function myinfo()
+ {
+ $id = session('userid');
+ $ad = new AD;
+ // 获取管理员信息
+ $list = $ad->where('id',$id)
+ ->field('id,xingming,sex,shengri,username,school,phone,denglucishu,lastip,ip,lasttime,thistime,create_time,update_time')
+ ->with([
+ 'adSchool'=>function($query){
+ $query->field('id,title');
+ }
+ ])
+ ->find();
+ $list->groupnames = $ad->getGroupnames($id);
+
+
+ $list['webtitle'] = '我的信息';
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+
+ // 渲染模板
+ return $this->fetch('read');
+ }
+
+
+
+
+ //
+ public function edit($id)
+ {
+
+ // 获取用户信息
+ $list['data'] = AD::where('id',$id)
+ ->field('id,school,username,xingming,sex,shengri,phone,beizhu')
+ ->with([
+ 'adSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ,'glGroup'=>function($query){
+ $query->where('status',1)->field('title,rules,miaoshu');
+ }
+ ])
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑管理员',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/admin/'.$id,
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+
+ }
+
+ // 更新管理员信息
+ public function update($id)
+ {
+
+ // 实例化验证模型
+ $validate = new \app\admin\validate\Admin;
+
+ // 获取表单数据
+ $list = request()->only(['xingming','school','username','sex','shengri','phone','beizhu','group_id'],'put');
+
+ $list['group_id'] = array_values($list['group_id']);
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新管理员信息
+ $list['id'] = $id;
+ $admindata = AD::update($list);
+
+ // 更新中间表
+ $groupdata=$admindata->glGroup()->detach();
+ $groupdata=$admindata->glGroup()->attach($list['group_id']);
+
+ // 根据更新结果设置返回提示信息
+ $admindata&&$groupdata ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+
+ if($id == 'm'){
+ $id = request()->delete('ids');
+ }
+
+ $data = AD::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 修改管理员状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 更新管理员信息
+ $data = AD::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 重置密码
+ public function resetpassword($id)
+ {
+
+ // 实例化加密类
+ $md5 = new APR1_MD5();
+
+ // 生成密码
+ $password = $md5->hash('123456');
+
+ // 查询用户信息
+ $data = AD::where('id',$id)->update(['password'=>$password]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'密码已经重置为:
123456','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 修改自己的密码
+ public function editPassword()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'修改密码',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/editpassword/'.session('userid'),
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 保存新密码
+ public function updatePassword($id)
+ {
+ // 获取表单数据
+ $list = request()->post();
+
+ // 验证表单数据
+ // 实例化验证模型
+ $validate = new \app\admin\validate\SetPassword;
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 获取用户名
+ $serpassword = AD::where('id',$id)->value('password');
+
+ // 实例化加密类
+ $md5 = new APR1_MD5();
+ //验证密码
+ $check = $md5->check($list['oldpassword'],$serpassword);
+
+ if(!$check)
+ {
+ $data=['msg'=>'旧密码错误','val'=>0];
+ return json($data);
+ }
+
+ // 更新密码
+ $password = $md5->hash($list['newpassword']);
+ $data = AD::update(['id'=>$id,'password'=>$password]);
+
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'修改成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+}
diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php
new file mode 100644
index 00000000..2d89a907
--- /dev/null
+++ b/app/admin/model/Admin.php
@@ -0,0 +1,146 @@
+order([$src['field'] =>$src['type']])
+ ->where('id','>',2)
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('xingming|username','like','%'.$searchval.'%');
+ })
+ ->with([
+ 'adSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ,'glGroup'=>function($query){
+ $query->where('status',1)->field('title,rules,miaoshu');
+ }
+ ])
+ ->hidden(['password','create_time','update_time','delete_time'])
+ ->select();
+ return $data;
+ }
+
+ public function glGroup()
+ {
+ return $this->belongsToMany('AuthGroup','AuthGroupAccess','group_id','uid');
+ }
+
+
+ // 用户角色获取器
+ public function userGroup()
+ {
+ return $this->belongsToMany('AuthGroup','AuthGroupAccess','id','uid');
+ }
+
+
+ // 获取密码
+ public function password($username)
+ {
+ // 查询数据
+ $pasW = $this
+ ->where('username',$username)
+ ->value('password');
+
+ // 返回数据
+ return $pasW;
+ }
+
+ // 生日修改器
+ public function setShengriAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 生日获取器
+ public function getShengriAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ // 创建时间获取器
+ public function getCreateTimeAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ // 性别获取器
+ public function getSexAttr($value)
+ {
+ $sex = array('0'=>'女','1'=>'男','2'=>'保密');
+ return $sex[$value];
+ }
+
+
+ // 最后登录时间取器
+ public function getLasttimeAttr($value)
+ {
+ return date('Y年m月d日 H:i:s',$value);
+ }
+
+ // 本次登录时间取器
+ public function getThistimeAttr($value)
+ {
+ return date('Y年m月d日 H:i:s',$value);
+ }
+
+
+ // 角色关联
+ public function authGroup()
+ {
+ return $this->hasMany('AuthGroupAccess','uid','id')->field('id,uid,group_id');
+ }
+
+
+ // 获取角色名称
+ public function getGroupnames($userid)
+ {
+ // 如果用户ID为1或2,则为超级管理员
+ if($userid == 1 || $userid == 2)
+ {
+ return '超级管理员';
+ }
+
+ // 查询用户拥有的权限
+ $admininfo = $this->where('id',$userid)
+ ->field('id')
+ ->with([
+ 'glGroup'=>function($query){
+ $query->where('status',1)->field('title');
+ }
+ ])
+ ->find();
+ $groupname = '';
+ foreach ($admininfo->gl_group as $key => $value) {
+ if($key == 0){
+ $groupname = $value->title;
+ }else{
+ $groupname = $groupname.'、'.$value->title;
+ }
+ }
+
+ // 返回角色名
+ return $groupname;
+ }
+
+ // 单位关联模型
+ public function adSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','school','id');
+ }
+
+
+
+}
diff --git a/app/admin/model/AuthGroup.php b/app/admin/model/AuthGroup.php
new file mode 100644
index 00000000..06696f77
--- /dev/null
+++ b/app/admin/model/AuthGroup.php
@@ -0,0 +1,26 @@
+order([$src['field'] =>$src['type']])
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title','like','%'.$searchval.'%');
+ })
+ ->select();
+ return $data;
+ }
+
+}
diff --git a/app/admin/model/AuthGroupAccess.php b/app/admin/model/AuthGroupAccess.php
new file mode 100644
index 00000000..b8cede76
--- /dev/null
+++ b/app/admin/model/AuthGroupAccess.php
@@ -0,0 +1,11 @@
+belongsTo('AuthRule','pid','id');
+ }
+
+
+ // 子菜单数据模型关联
+ public function authCid()
+ {
+ return $this->hasMany('AuthRule','pid','id');
+ }
+
+
+ // 查询所有角色
+ public function search($src)
+ {
+ // 整理变量
+ $searchval = $src['searchval'];
+
+ // 查询数据
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title|name','like','%'.$searchval.'%');
+ })
+ ->with(['authPid'=>function($query){
+ $query->field('id,title');
+ }])
+ ->select();
+ return $data;
+ }
+}
diff --git a/app/admin/validate/Admin.php b/app/admin/validate/Admin.php
new file mode 100644
index 00000000..d18987eb
--- /dev/null
+++ b/app/admin/validate/Admin.php
@@ -0,0 +1,34 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'xingming|用户姓名' => 'require|chs|length:2,6',
+ 'username|帐号' => ['require','uset'=>'/^[a-z][a-z0-9-_]*$/'],
+ 'group_id|角色' => 'require|array',
+ 'shengri|出生日期' => 'date',
+ 'xingbie|性别' => 'in:0,1,2',
+ 'phone|手机' => 'mobile',
+ 'beizhu|备注' => 'max:80',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [
+ 'username.ustr' => '帐号格式错误',
+ ];
+}
diff --git a/app/admin/validate/Rule.php b/app/admin/validate/Rule.php
new file mode 100644
index 00000000..da6525ef
--- /dev/null
+++ b/app/admin/validate/Rule.php
@@ -0,0 +1,28 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|规则名' => 'require|chs|length:2,6',
+ 'name|规则' => ['require','length:1,80','uset'=>'/^[a-zA-Z\/]*$/'],
+ 'paixu|排序' => 'number|max:999',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/admin/validate/RuleGroup.php b/app/admin/validate/RuleGroup.php
new file mode 100644
index 00000000..3cad141f
--- /dev/null
+++ b/app/admin/validate/RuleGroup.php
@@ -0,0 +1,24 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/admin/validate/SetPassword.php b/app/admin/validate/SetPassword.php
new file mode 100644
index 00000000..93735d8e
--- /dev/null
+++ b/app/admin/validate/SetPassword.php
@@ -0,0 +1,30 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'oldpassword|原密码' => 'require',
+ 'newpassword|新密码' => ['require','regex'=>'/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){6,20}$/'],
+ 'newpassword2|两次密码' => 'require|confirm:newpassword',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [
+ 'newpassword.regex' => '只能输入6-16个字母、数字、半角句号、下划线',
+ ];
+}
diff --git a/app/admin/view/auth_group/create.html b/app/admin/view/auth_group/create.html
new file mode 100644
index 00000000..78097456
--- /dev/null
+++ b/app/admin/view/auth_group/create.html
@@ -0,0 +1,179 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+
+
\ No newline at end of file
diff --git a/app/chengji/common.php b/app/chengji/common.php
new file mode 100644
index 00000000..9719a412
--- /dev/null
+++ b/app/chengji/common.php
@@ -0,0 +1,53 @@
+where('id',$kaohaoid)->value('kaoshi');
+
+ // 根据考试号和学科名获取满分
+ $KSXK = new app\kaoshi\model\KaoshiSubject;
+ $manfen = $KSXK->where('kaoshiid',$kaoshiid)->where('subjectid','in',$subjectid)->value('manfen');
+ $manfen = floatval($manfen);
+ return $manfen;
+}
+
+// 分数验证
+function manfenvalidate($defen,$manfen)
+{
+ $data['val'] = 1;
+ $data['msg'] = '验证通过';
+
+ if(is_numeric($defen) == false)
+ {
+ $data['val'] = 0;
+ $data['msg'] = '得分必须是数字';
+ return $data;
+ }
+
+ if( $defen < 0 )
+ {
+ $data['val'] = 0;
+ $data['msg'] = '得分必须大于等于0';
+ return $data;
+ }
+
+ if($defen > $manfen)
+ {
+ $data['val'] = 0;
+ $data['msg'] = '得分必须必须小于等于'.$manfen;
+ return $data;
+ }
+
+ if( ($defen*10)%5 != 0 )
+ {
+ $data['val'] = 0;
+ $data['msg'] = '得分必须只能是x.5';
+ return $data;
+ }
+
+ return $data;
+}
+
diff --git a/app/chengji/controller/Bjtongji.php b/app/chengji/controller/Bjtongji.php
new file mode 100644
index 00000000..509e6dbb
--- /dev/null
+++ b/app/chengji/controller/Bjtongji.php
@@ -0,0 +1,213 @@
+where('id',$kaoshi)
+ ->with([
+ 'KsNianji'
+ ,'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,manfen')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->field('id,title')
+ ->find();
+
+ if(count($ksinfo->ks_nianji)>0)
+ {
+ $list['nianji'] = $ksinfo->ks_nianji[0]->nianji;
+ }else{
+ $list['nianji'] = "一年级";
+ }
+ $list['subject'] = $ksinfo->ks_subject->toArray();
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = '各年级的班级成绩列表';
+ $list['kaoshi'] = $kaoshi;
+ $list['kaoshititle'] = $ksinfo->title;
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取年级成绩统计结果
+ public function ajaxBianji()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'kaoshi'=>'',
+ 'nianji'=>'',
+ 'school'=>array(),
+ 'paixu'=>array(),
+ ],'POST');
+
+ // 统计成绩
+ $btj = new BTJ;
+
+ $data = $btj->tjBanji($src['kaoshi'],$src['nianji'],$src['school'],$src['paixu']);
+
+
+ // 获取记录总数
+ $cnt = count($data);
+ // 截取当前页数据
+ $data = array_slice($data,($src['page']-1)*$src['limit'],$src['limit']);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+ // 年级、班级学生成绩统计结果下载界面
+ public function dwBanji($kaoshi)
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'各班级成绩汇总表下载',
+ 'butname'=>'下载',
+ 'formpost'=>'POST',
+ 'url'=>'/bjtongji/dwBanji',
+ 'kaoshi'=>$kaoshi
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+
+ }
+
+
+ // 年级、班级学生成绩统计下载表格
+ public function dwBanjixls($kaoshi)
+ {
+ // 获取表单参数
+ $src = $this->request
+ ->only([
+ 'kaoshi'=>'',
+ 'nianji'=>'一年级',
+ 'school'=>array(),
+ ],'POST');
+
+ $schools = [$src['school']];
+
+
+ // 统计成绩
+ $btj = new BTJ;
+ $data = $btj->tjBanji($src['kaoshi'],$src['nianji'],$schools,array());
+
+
+ // 获取参考学科
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $ksinfo = $ks->where('id',$src['kaoshi'])
+ ->field('id,title')
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,manfen')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->find();
+ $xk = $ksinfo->ks_subject;
+
+
+ // 获取要下载成绩的学校和年级信息
+ $school = new \app\system\model\School;
+ $schoolname = $school->where('id',$src['school'])->value('jiancheng');
+ $tabletitle = $ksinfo->title.' '.$schoolname.' '.$src['nianji'].'各班级成绩汇总';
+
+ // 创建表格
+ $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
+ $sheet = $spreadsheet->getActiveSheet();
+
+ $sbjcol = ['xkcnt'=>'人数','avg'=>'平均分','jige'=>'及格率%','youxiu'=>'优秀率%'];
+ $sbjcolcnt = count($sbjcol);
+ $colname = excelLieming();
+ $colcnt = $sbjcolcnt*count($xk)+3;
+
+
+ // 设置表头信息
+ $sheet->mergeCells('A1:'.$colname[$colcnt].'1');
+ $sheet->setCellValue('A1', $tabletitle);
+ $sheet->mergeCells('A3:A4');
+ $sheet->setCellValue('A3', '序号');
+ $sheet->mergeCells('B3:B4');
+ $sheet->setCellValue('B3', '班级');
+ $col = 2;
+ foreach ($xk as $key => $value) {
+ $colend = $col + $sbjcolcnt - 1;
+ $sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3');
+ $sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')');
+ foreach ($sbjcol as $k => $val) {
+ $sheet->setCellValue($colname[$col].'4', $val);
+ $col++;
+ }
+ }
+ $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4');
+ $sheet->setCellValue($colname[$col].'3', '全科及格率%');
+ $col++;
+ $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4');
+ $sheet->setCellValue($colname[$col].'3', '全科平均');
+
+ $row = 5;
+ foreach ($data as $key => $value) {
+ $col = 2;
+ $sheet->setCellValue('A'.$row, $row-4);
+ $sheet->setCellValue('B'.$row, $value['banji']);
+ foreach ($xk as $ke => $val) {
+ foreach ($sbjcol as $k => $v) {
+ $sheet->setCellValue($colname[$col].$row, $value['chengji'][$val->subject_name->lieming][$k]);
+ $col++;
+ }
+ }
+ $sheet->setCellValue($colname[$col].$row, $value['chengji']['rate']);
+ $col++;
+ $sheet->setCellValue($colname[$col].$row, $value['chengji']['avg']);
+ $row++;
+ }
+
+
+ // 保存文件
+ $filename = $tabletitle.date('ymdHis').'.xlsx';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="' . $filename . '"');
+ header('Cache-Control: max-age=0');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+ $writer->save('php://output');
+ ob_flush();
+ flush();
+
+ }
+
+
+
+}
diff --git a/app/chengji/controller/Error.php b/app/chengji/controller/Error.php
new file mode 100644
index 00000000..303efba0
--- /dev/null
+++ b/app/chengji/controller/Error.php
@@ -0,0 +1,11 @@
+'扫码录成绩',
+ 'butname'=>'录入',
+ 'formpost'=>'PUT',
+ 'url'=>'/chengji/malu',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 保存使用二维码录入的成绩
+ public function malusave()
+ {
+ // 获取表单数据
+ $list = $this->request->only(['kaohao_id','subject_id','defen'],'post');
+
+ // 成绩验证
+ $manfen = getmanfen($list['kaohao_id'],$list['subject_id']);
+ $mfyz = manfenvalidate($list['defen'],$manfen);
+ if($mfyz['val'] == 0)
+ {
+ return json($mfyz);
+ }
+
+ $cj = new Chengji();
+ // 更新成绩
+ $data = Chengji::withTrashed()
+ ->where('subject_id',$list['subject_id'])
+ ->where('kaohao_id',$list['kaohao_id'])
+ ->find();
+
+ if($data)
+ {
+ $data->delete(true);
+ }
+
+ $cj->kaohao_id = $list['kaohao_id'];
+ $cj->subject_id = $list['subject_id'];
+ $cj->defen = $list['defen'];
+ $cj->user_id = session('userid');
+ $data = $cj->save();
+
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ return json($data);
+ }
+
+
+ // 学生成绩表中修改成绩
+ public function update($id) #id为考号ID
+ {
+ // 获取表单数据
+ $list = $this->request->only(
+ ['colname',
+ 'newdefen']
+ ,'post');
+ $list['kaohao_id'] = $id;
+ // 获取学科信息
+ $subject = new \app\teach\model\Subject;
+ $subject_id = $subject->where('lieming',$list['colname'])->value('id');
+
+ // 成绩验证
+ $manfen = getmanfen($list['kaohao_id'],$subject_id);
+ $mfyz = manfenvalidate($list['newdefen'],$manfen);
+ if($mfyz['val'] == 0)
+ {
+ return json($mfyz);
+ }
+
+ // 更新成绩
+ $cj = new Chengji;
+ $cjinfo = Chengji::withTrashed()
+ ->where('kaohao_id',$list['kaohao_id'])
+ ->where('subject_id',$subject_id)
+ ->find();
+ // 如果存在成绩则更新,不存在则添加
+ if($cjinfo){
+ $cjinfo->restore();
+ $cjinfo->defen = $list['newdefen'];
+ $cjinfo->user_id = session('userid');
+ $data = $cjinfo->save();
+ }else{
+ $cj->defen = $list['newdefen'];
+ $cj->kaohao_id = $list['kaohao_id'];
+ $cj->subject_id = $subject_id;
+ $cj->user_id = session('userid');
+ $data = $cj->save();
+ }
+ // update(['defen'=>$list['newdefen']]);
+
+ // 判断返回内容
+ $data ? $data=['msg'=>'录入成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回更新结果
+ return $data;
+ }
+
+
+
+ // 根据考号获取学生信息
+ public function read()
+ {
+ // 获取表单数据
+ // 获取表单数据
+ $val = input('post.val');
+ $val = action('system/Encrypt/decrypt',[$val,'key'=>'dlbz']);
+ $list = explode('|',$val);
+ $sbj = $list[1];
+
+ $cjlist = Kaohao::where('id',$list[0])
+ ->field('id,banji,school,student')
+ ->with([
+ 'ksChengji'=>function($q) use($sbj){
+ $q->where('subject_id',$sbj)
+ ->field('kaohao_id,subject_id,defen');
+ }
+ ,'cjBanji'=>function($q){
+ $q->field('id,paixu,ruxuenian')
+ ->append(['numTitle','banjiTitle']);
+ }
+ ,'cjSchool'=>function($q){
+ $q->field('id,jiancheng');
+ }
+ ,'cjStudent'=>function($q){
+ $q->field('id,xingming');
+ }
+ ])
+ ->find();
+ if($cjlist->cj_student == Null)
+ {
+ $stu = new \app\renshi\model\Student;
+ $stuinfo = $stu::withTrashed()
+ ->where('id',$cjlist->student)
+ ->field('id,xingming,sex')
+ ->find();
+ $cjlist->cj_student = array(
+ 'id'=>$stuinfo->id,
+ 'xingming'=>$stuinfo->xingming
+ );
+ }
+ $cjlist->sbj = Subject::where('id',$sbj)->field('id,title')->find();
+
+ // 获取列名
+ return json($cjlist);
+ }
+
+
+ // 表格录入成绩上传页面
+ public function biaolu()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'表格录入成绩',
+ 'butname'=>'批传',
+ 'formpost'=>'POST',
+ 'url'=>'/chengji/biaolu',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+
+
+ // 保存表格批量上传的成绩
+ public function saveAll()
+ {
+ set_time_limit(0);
+ // 获以电子表格存储位置
+ $url = input('post.url');
+
+ // 实例化操作表格类
+ $excel = new \app\renshi\controller\Myexcel;
+
+ // 读取表格数据
+ $cjinfo = $excel->readXls($url);
+
+ // 删除空单元格得到学科列名数组
+ array_splice($cjinfo[1],0,4);
+ $xk = $cjinfo[1];
+
+ // 删除成绩采集表无用的标题行得到成绩数组
+ array_splice($cjinfo,0,3);
+
+ // 查询考试信息
+ $kh = new Kaohao;
+ $ks = new \app\kaoshi\model\Kaoshi;
+
+ $user_id = session('userid');
+ // 重新组合成绩信息
+ foreach ($cjinfo as $key => $value) {
+ foreach ($xk as $k => $val) {
+
+ $thissbj = $val; # 当前学科
+ $defen = $value[$k+4]; # 当前学科
+
+ // 如果不存在值,跳过这次循环
+ if($defen === null){
+ continue;
+ }
+
+ // 成绩验证
+ $manfen = getmanfen($value[1],$val);
+ $mfyz = manfenvalidate($defen,$manfen);
+ if($mfyz['val'] == 0)
+ {
+ continue;
+ }
+
+
+ // 查询是否存在这个成绩
+ $cj = Chengji::withTrashed()
+ ->where('kaohao_id',$value[1])
+ ->where('subject_id',$val)
+ ->find();
+ // 如果存在则删除
+ if($cj){
+ $cj->delete(true);
+ }
+ $data = Chengji::create([
+ 'kaohao_id'=>$value[1],
+ 'subject_id'=>$val,
+ 'user_id'=>$user_id,
+ 'defen'=>$defen
+ ]);
+ }
+ }
+
+ // 判断成绩更新结果
+ empty($data) ? $data=['msg'=>'表格录入成绩失败','val'=>0] : $data=['msg'=>'表格录入成绩成功','val'=>1];
+
+ ob_flush();
+ flush();
+ // 返回成绩结果
+ return json($data);
+ }
+
+
+ // 上传成绩采集表格
+ public function upload()
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+
+ // 上传文件并返回结果
+ $data = upload($list,$file,true);
+
+ return json($data);
+ }
+
+
+ // 成绩列表
+ public function index($kaoshi)
+ {
+
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = '学生成绩列表';
+
+ // 实例化考试数据模型
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $ksinfo = $ks->where('id',$kaoshi)
+ ->field('id')
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ,'ksNianji'
+ ])
+ ->find();
+
+
+
+ $list['subject'] = $ksinfo->ks_subject;
+ $list['kaoshi'] = $kaoshi;
+ if(count($ksinfo->ks_nianji)>0)
+ {
+ $list['nianji'] = $ksinfo->ks_nianji[0]->nianji;
+ }else{
+ $list['nianji'] = "一年级";
+ }
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+
+ // 获取成绩信息
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only(['page','limit','field','type','kaoshi','school','nianji','paixu','searchval'
+ ],'POST');
+
+ // 根据班级排序获取班级id
+ if(isset($src['paixu']))
+ {
+ $banji = new \app\teach\model\Banji;
+ $src['banji'] = $banji
+ ->where('paixu','in',$src['paixu'])
+ ->column('id');
+ }
+
+
+ // 实例化
+ $kaohao = new Kaohao;
+
+ // 查询要显示的数据
+ $data = $kaohao->srcChengji($src);
+
+
+ // 获取符合条件记录总数
+ $cnt = count($data);
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = array_slice($data,$limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+
+ // 删除成绩
+ public function deletecj($id)
+ {
+
+ // 声明要删除成绩数组
+ $data = array();
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids/a');// 获取delete请求方式传送过来的数据并转换成数据
+ $i=0;
+ foreach ($id as $key => $value) {
+ $data[$i]['id'] = $value;
+ $data[$i]['yuwen'] = Null;
+ $data[$i]['shuxue'] = Null;
+ $data[$i]['wanyu'] = Null;
+ }
+ }else{
+ $data[0]['id'] = $id;
+ $data[0]['yuwen'] = Null;
+ $data[0]['shuxue'] = Null;
+ $data[0]['waiyu'] = Null;
+ $data[0]['stuSum'] = Null;
+ $data[0]['stuAvg'] = Null;
+ }
+
+
+ $cj = new Chengji();
+ $data = $cj->saveAll($data);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'成绩删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 批量删除成绩
+ public function deletecjs($kaoshi)
+ {
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'批量删除成绩',
+ 'butname'=>'删除',
+ 'formpost'=>'POST',
+ 'url'=>'/deletecjmore',
+ 'kaoshi'=>$kaoshi
+ );
+
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $subject = $ks
+ ->where('id',$kaoshi)
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title');
+ }]
+ );
+ }
+ ])
+ ->find()
+ ->toArray();
+ $list['subject'] = $subject['ks_subject'];
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+
+ // 按条件删除成绩
+ public function deletecjmore()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only(['kaoshi','banji','subject'],'POST');
+ $banji = $src['banji'];
+
+ // 获取要删除成绩的考号
+ $kaohao = new \app\kaoshi\model\Kaohao;
+ $kaohaolist = $kaohao::where('kaoshi',$src['kaoshi'])
+ ->where('banji','in',$src['banji'])
+ ->column('student');
+
+ // 查询成绩id
+ $chengjilist = Chengji::where('kaohao_id','in',$kaohaolist)
+ ->where('subject_id','in',$src['subject'])
+ ->column('id');
+ // 删除成绩
+ $data = Chengji::destroy($chengjilist);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'成绩删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除单人单科成绩
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = Chengji::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 设置成绩状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取班级信息
+ $data = Chengji::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+
+ // 下载成绩表格
+ public function dwChengji($kaoshi)
+ {
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'成绩下载',
+ 'butname'=>'下载',
+ 'formpost'=>'POST',
+ 'url'=>'/chengji/dwChengji',
+ 'kaoshi'=>$kaoshi
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+
+
+
+
+ //生成学生表格
+ public function dwchengjixls()
+ {
+ // 获取参数
+ $list = $this->request
+ ->only([
+ 'kaoshi'=>'1',
+ 'banji'=>array(),
+ 'school',
+ 'ruxuenian'
+ ],'POST');
+
+ // 获取要下载成绩的学校和年级信息
+ $school = new \app\system\model\School;
+ $schoolname = $school->where('id',$list['school'])->value('jiancheng');
+ $nianji = nianjiList();
+
+
+ // 实例化验证模型
+ $validate = new \app\chengji\validate\Cjdownload;
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ $this->error($msg);
+ }
+
+
+ // 获取数据库信息
+ $kh = new Kaohao();
+ $src = [
+ 'kaoshi'=>$list['kaoshi'],
+ 'banji'=>$list['banji'],
+ ];
+ $chengjiinfo = $kh->srcChengji($src);
+
+
+ // 获取考试标题
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $ks = $ks->where('id',$list['kaoshi'])
+ ->field('id,title')
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->find();
+
+ $tabletitle =$ks->title.' '.$schoolname.' '.$nianji[$list['ruxuenian']].' '.'学生成绩详细列表';
+
+ $colname = excelLieming();
+
+ set_time_limit(0);
+ // 创建表格
+ $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
+ $sheet = $spreadsheet->getActiveSheet();
+
+
+ // 设置表头信息
+ $sheet->setCellValue('A1', $tabletitle);
+ $sheet->setCellValue('A2', '序号');
+ $sheet->setCellValue('B2', '班级');
+ $sheet->setCellValue('C2', '姓名');
+ $sheet->setCellValue('D2', '性别');
+ $i = 4;
+ foreach ($ks->ks_subject as $key => $value) {
+ $sheet->setCellValue($colname[$i].'2', $value->subject_name->title);
+ $i++;
+ }
+ $sheet->setCellValue($colname[$i].'2', '平均分');
+ $sheet->setCellValue($colname[$i+1].'2', '总分');
+ $i=$i+4;
+ $sheet->setCellValue($colname[$i].'2', '项目');
+ $sheet->setCellValue($colname[$i].'3', '人数');
+ $sheet->setCellValue($colname[$i].'4', '平均分');
+ $sheet->setCellValue($colname[$i].'5', '优秀率%');
+ $sheet->setCellValue($colname[$i].'6', '及格率%');
+ $sheet->setCellValue($colname[$i].'7', '标准差');
+ $i++;
+ foreach ($ks->ks_subject as $key => $value) {
+ $sheet->setCellValue($colname[$i].'2', $value->subject_name->title);
+ $i++;
+ }
+ $sheet->setCellValue($colname[$i+1].'2', '总平均分');
+ $sheet->setCellValue($colname[$i+2].'2', '全科及格率%');
+
+
+ // 循环写出成绩及个人信息
+ $i = 3;
+ foreach ($chengjiinfo as $key => $value) {
+ // 表格赋值
+ $sheet->setCellValue('A'.$i, $i-2);
+ $sheet->setCellValue('B'.$i, $value['banji']);
+ $sheet->setCellValue('C'.$i, $value['student']);
+ $sheet->setCellValue('D'.$i, $value['sex']);
+ $colcnt = 4;
+ foreach ($ks->ks_subject as $k => $val) {
+ if(isset($value[$val->subject_name->lieming]))
+ {
+ $sheet->setCellValue($colname[$colcnt].$i, $value[$val->subject_name->lieming]);
+ }
+ $colcnt++;
+ }
+ $sheet->setCellValue($colname[$colcnt].$i, $value['avg']);
+ $sheet->setCellValue($colname[$colcnt+1].$i, $value['sum']);
+ $i++;
+ }
+
+ $tj = new \app\chengji\model\Tongji;
+ $nianji = array();
+ $chengjiinfo = $tj->srcChengji($list['kaoshi'],$list['banji']);
+ $temp = $tj->tongji($chengjiinfo,$list['kaoshi']);
+ isset($colcnt) ? $colcnt = $colcnt+5 : $colcnt = 12;
+ // 循环写出统计结果
+ foreach ($ks->ks_subject as $key => $value) {
+ $sheet->setCellValue($colname[$colcnt].'3', $temp[$value->subject_name->lieming]['xkcnt']);
+ $sheet->setCellValue($colname[$colcnt].'4', $temp[$value->subject_name->lieming]['avg']);
+ $sheet->setCellValue($colname[$colcnt].'5', $temp[$value->subject_name->lieming]['youxiu']);
+ $sheet->setCellValue($colname[$colcnt].'6', $temp[$value->subject_name->lieming]['jige']);
+ $sheet->setCellValue($colname[$colcnt].'7', $temp[$value->subject_name->lieming]['biaozhuncha']);
+ $colcnt++;
+ }
+
+ $sheet->setCellValue($colname[$colcnt+1].'3', $temp['avg']);
+ $sheet->setCellValue($colname[$colcnt+2].'3', $temp['rate']);
+
+
+ // 保存文件
+ $filename = $tabletitle.date('ymdHis').'.xlsx';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="' . $filename . '"');
+ header('Cache-Control: max-age=0');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+ $writer->save('php://output');
+ ob_flush();
+ flush();
+ }
+
+
+
+
+
+ // 学生成绩录入信息
+ public function readAdd($kaohao)
+ {
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = '查看成绩录入信息';
+ $list['kaohao'] = $kaohao;
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+
+
+
+ // ajax获取学生成绩录入信息
+ public function ajaxaddinfo()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'subject_id',
+ 'type'=>'desc',
+ 'kaohao'=>''
+ ],'POST');
+
+ $chengji = new Chengji;
+
+ $data = $chengji
+ ->where('kaohao_id',$src['kaohao'])
+ ->field('id,kaohao_id,subject_id,user_id,defen,update_time')
+ ->order([$src['field']=>$src['type']])
+ ->with([
+ 'subjectName'=>function($query){
+ $query->field('id,title');
+ },
+ 'userName'=>function($query){
+ $query->field('id,school,xingming')
+ ->with([
+ 'adSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ]);
+ }
+ ])
+ ->select();
+
+ $cnt = count($data);
+
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+}
diff --git a/app/chengji/controller/Njtongji.php b/app/chengji/controller/Njtongji.php
new file mode 100644
index 00000000..bd548272
--- /dev/null
+++ b/app/chengji/controller/Njtongji.php
@@ -0,0 +1,204 @@
+where('id',$kaoshi)
+ ->with([
+ 'KsNianji'
+ ,'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,manfen')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->field('id,title')
+ ->find();
+
+ if(count($ksinfo->ks_nianji)>0)
+ {
+ $list['nianji'] = $ksinfo->ks_nianji[0]->nianji;
+ }else{
+ $list['nianji'] = "一年级";
+ }
+
+ $list['subject'] = $ksinfo->ks_subject;
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = '各学校的年级成绩统计表';
+ $list['kaoshi'] = $kaoshi;
+ $list['kaoshititle'] = $ksinfo->title;
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取年级成绩统计结果
+ public function ajaxNianji()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'kaoshi'=>'',
+ 'nianji'=>'一年级',
+ ],'POST');
+ // 统计成绩
+ $ntj = new NTJ;
+ $data = $ntj->tjNianji($kaoshi=$src['kaoshi'],$nianji=$src['nianji']);
+ // 获取记录数
+ $cnt = count($data);
+ // 截取当前页数据
+ $data = array_slice($data,($src['page']-1)*$src['limit'],$src['limit']);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+ // 年级、班级学生成绩统计结果下载界面
+ public function dwNianji($kaoshi)
+ {
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'各年级成绩汇总表下载',
+ 'butname'=>'下载',
+ 'formpost'=>'POST',
+ 'url'=>'/njtongji/dwNanji',
+ 'kaoshi'=>$kaoshi
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+
+ }
+
+
+ // 年级、班级学生成绩统计下载表格
+ public function dwNianjixls($kaoshi)
+ {
+
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'kaoshi'=>'',
+ 'nianji'=>'一年级',
+ ],'POST');
+
+ // 统计成绩
+ $ntj = new NTJ;
+ $data = $ntj->tjNianji($kaoshi=$src['kaoshi'],$nianji=$src['nianji']);
+
+ // 获取参考学科
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $ksinfo = $ks->where('id',$src['kaoshi'])
+ ->field('id,title')
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,manfen')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->find();
+ $xk = $ksinfo->ks_subject;
+
+ // 获取要下载成绩的学校和年级信息
+ $tabletitle = $ksinfo->title.' '.$src['nianji'].'各学校成绩汇总';
+
+
+ // 创建表格
+ $spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
+ $sheet = $spreadsheet->getActiveSheet();
+
+ $sbjcol = ['xkcnt'=>'人数','avg'=>'平均分','jige'=>'及格率%','youxiu'=>'优秀率%'];
+ $sbjcolcnt = count($sbjcol);
+ $colname = excelLieming();
+ $colcnt = $sbjcolcnt*count($xk)+3;
+
+
+ // 设置表头信息
+ $sheet->mergeCells('A1:'.$colname[$colcnt].'1');
+ $sheet->setCellValue('A1', $tabletitle);
+ $sheet->mergeCells('A3:A4');
+ $sheet->setCellValue('A3', '序号');
+ $sheet->mergeCells('B3:B4');
+ $sheet->setCellValue('B3', '班级');
+ $col = 2;
+ foreach ($xk as $key => $value) {
+ $colend = $col + $sbjcolcnt - 1;
+ $sheet->mergeCells($colname[$col].'3:'.$colname[$colend].'3');
+ $sheet->setCellValue($colname[$col].'3', $value->subject_name->title.' ('.$value->manfen.')');
+ foreach ($sbjcol as $k => $val) {
+ $sheet->setCellValue($colname[$col].'4', $val);
+ $col++;
+ }
+ }
+ $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4');
+ $sheet->setCellValue($colname[$col].'3', '全科及格率%');
+ $col++;
+ $sheet->mergeCells($colname[$col].'3:'.$colname[$col].'4');
+ $sheet->setCellValue($colname[$col].'3', '总平均分');
+
+ $row = 5;
+ foreach ($data as $key => $value) {
+ $col = 2;
+ $sheet->setCellValue('A'.$row, $row-4);
+ $sheet->setCellValue('B'.$row, $value['school']);
+ foreach ($xk as $ke => $val) {
+ foreach ($sbjcol as $k => $v) {
+ $sheet->setCellValue($colname[$col].$row, $value['chengji'][$val->subject_name->lieming][$k]);
+ $col++;
+ }
+ }
+ $sheet->setCellValue($colname[$col].$row, $value['chengji']['rate']);
+ $col++;
+ $sheet->setCellValue($colname[$col].$row, $value['chengji']['avg']);
+ $row++;
+ }
+
+ // 保存文件
+ $filename = $tabletitle.date('ymdHis').'.xlsx';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="' . $filename . '"');
+ header('Cache-Control: max-age=0');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
+ $writer->save('php://output');
+ ob_flush();
+ flush();
+ }
+}
diff --git a/app/chengji/controller/Tongji.php b/app/chengji/controller/Tongji.php
new file mode 100644
index 00000000..0d3af2db
--- /dev/null
+++ b/app/chengji/controller/Tongji.php
@@ -0,0 +1,52 @@
+where('id',$kaoshi)
+ ->with([
+ 'KsNianji'
+ ,'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,manfen')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->field('id,title')
+ ->find();
+
+ if(count($ksinfo->ks_nianji)>0)
+ {
+ $list['nianji'] = $ksinfo->ks_nianji[0]->nianji;
+ }else{
+ $list['nianji'] = "一年级";
+ }
+ $list['subject'] = $ksinfo->ks_subject->toArray();
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = '各年级的班级成绩列表';
+ $list['kaoshi'] = $kaoshi;
+ $list['kaoshititle'] = $ksinfo->title;
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+}
diff --git a/app/chengji/model/Bjtongji.php b/app/chengji/model/Bjtongji.php
new file mode 100644
index 00000000..52af791f
--- /dev/null
+++ b/app/chengji/model/Bjtongji.php
@@ -0,0 +1,63 @@
+cyBanji($kaoshi=$kaoshi,$ruxuenian=$nianji,$school=$school,$paixu=$paixu);
+
+ $data = array();
+ if($bj->isEmpty()){
+ return $data;
+ }
+
+ // 实例化学生成绩统计类
+ $tj = new TJ;
+
+ // 获取并统计各班级成绩
+ $data = array();
+ $bjs = array();
+ foreach ($bj as $key => $value) {
+ $bjs[] = $value->banji;
+ $banji=[$value->banji];
+ $temp = $tj->srcChengji($kaoshi=$kaoshi,$banji=$banji,$nianji=$nianji,$school=array());
+ $temp = $tj->tongji($temp,$kaoshi);
+ $data[] = [
+ 'banji'=>$value->bjtitle,
+ 'school'=>$value->cj_school->jiancheng,
+ 'chengji'=>$temp
+ ];
+
+ }
+
+
+ // 获取年级成绩
+ $allcj = $tj->srcChengji($kaoshi=$kaoshi,$banji=$bjs,$nianji=$nianji,$school=array());
+ $temp = $tj->tongji($allcj,$kaoshi);
+ $data[] = [
+ 'banji'=>'合计',
+ 'school'=>'',
+ 'chengji'=>$temp
+ ];
+
+
+ return $data;
+ }
+}
diff --git a/app/chengji/model/Chengji.php b/app/chengji/model/Chengji.php
new file mode 100644
index 00000000..7c01bb9f
--- /dev/null
+++ b/app/chengji/model/Chengji.php
@@ -0,0 +1,31 @@
+belongsTo('\app\teach\model\Subject');
+ }
+
+ // 学科关联
+ public function subjectName()
+ {
+ return $this->belongsTo('\app\teach\model\Subject','subject_id','id');
+ }
+
+ // 学科关联
+ public function userName()
+ {
+ return $this->belongsTo('\app\admin\model\Admin','user_id','id');
+ }
+
+
+}
diff --git a/app/chengji/model/Njtongji.php b/app/chengji/model/Njtongji.php
new file mode 100644
index 00000000..3c7fb764
--- /dev/null
+++ b/app/chengji/model/Njtongji.php
@@ -0,0 +1,55 @@
+cySchool($kaoshi=$kaoshi,$ruxuenian=$nianji);
+
+ $data = array();
+ if($school->isEmpty()){
+ return $data;
+ }
+
+ // 实例化学生成绩统计类
+ $tj = new TJ;
+
+ // 获取并统计各班级成绩
+ $data = array();
+ foreach ($school as $key => $value) {
+ $schools=[$value->cj_school->id];
+ $temp = $tj->srcChengji($kaoshi=$kaoshi,$banji=array(),$nianji=$nianji,$schools=$schools);
+ $temp = $tj->tongji($temp,$kaoshi);
+ $data[] = [
+ 'school'=>$value->cj_school->jiancheng,
+ 'chengji'=>$temp
+ ];
+ }
+
+ // 获取年级成绩
+ $allcj = $tj->srcChengji($kaoshi=$kaoshi,$banji=array(),$nianji=$nianji,$school=array());
+ $temp = $tj->tongji($allcj,$kaoshi);
+ $data[] = [
+ 'school'=>'合计',
+ 'chengji'=>$temp
+ ];
+ return $data;
+ }
+}
diff --git a/app/chengji/model/Tongji.php b/app/chengji/model/Tongji.php
new file mode 100644
index 00000000..32a08fde
--- /dev/null
+++ b/app/chengji/model/Tongji.php
@@ -0,0 +1,234 @@
+where('kaoshi',$kaoshi)
+ ->field('id,nianji,banji')
+ ->when(count($school)>0,function($query) use($school){
+ $query->where('school','in',$school);
+ })
+ ->when(strlen($nianji)>0,function($query) use($nianji){
+ $query->where('ruxuenian',$nianji);
+ })
+ ->when(count($banji)>0,function($query) use($banji){
+ $query->where('banji','in',$banji);
+ })
+ ->with([
+ 'ksChengji'=>function($query){
+ $query->field('kaohao_id,subject_id,defen');
+ }
+ ])
+ ->select();
+ if($khlist->isEmpty())
+ {
+ return $data = array();
+ }
+
+ // 获取参考学科
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $ksinfo = $ks->where('id',$kaoshi)
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,lieming');
+ }
+ ])
+ ->find();
+ if($ksinfo->ks_subject->isEmpty())
+ {
+ return $data = array();
+ }
+ $xk = array();
+ foreach ($ksinfo->ks_subject as $key => $value) {
+ $xk[$value->subjectid] = $value->lieming;
+ }
+
+ // 整理数据
+ $data = array();
+ foreach ($khlist as $key => $value) {
+ if(count($value->ks_chengji)== 0)
+ {
+ continue;
+ }
+ $data[$key]['sum'] = 0;
+ $sbjcnt = 0;
+ foreach ($value->ks_chengji as $k => $val) {
+ $data[$key][$xk[$val->subject_id]] = $val->defen*1;
+ $data[$key]['sum'] = ($data[$key]['sum'] + $val->defen) * 1;
+ $sbjcnt ++ ;
+ }
+ $data[$key]['sum'] == 0 ? $data[$key]['avg'] = 0 : $data[$key]['sum'] / $sbjcnt;
+ }
+
+ return $data;
+ }
+
+
+
+ // 统计成绩
+ public function tongji($cj=array(),$kaoshi)
+ {
+
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $ksinfo = $ks->where('id',$kaoshi)
+ ->field('id')
+ ->with('ksSubject')
+ ->find();
+ $data = array();
+ // $allcj = array();
+ foreach ($ksinfo->ks_subject as $key => $value) {
+ $cjcol = array_column($cj,$value->lieming);
+ // $allcj = array_merge($allcj,$cjcol);
+ $temp = array();
+ $temp['xkcnt'] = count($cjcol);
+ $temp['sum'] = array_sum($cjcol);
+ $temp['xkcnt']>0 ? $temp['avg'] = $temp['sum']/$temp['xkcnt'] : $temp['avg']=0;
+ $temp['biaozhuncha'] = round($this->getVariance($temp['avg'], $cjcol,true),2);
+ $temp['avg'] = round($temp['avg'],2);
+ $temp['youxiu'] = $this->rate($cjcol,$value->youxiu);
+ $temp['jige'] = $this->rate($cjcol,$value->jige);
+ $temp['sifenwei'] = $this->quartile($cjcol);
+ $data[$value->lieming] = $temp;
+ }
+ $cjcol = array_column($cj,'sum');
+ $data['bmcnt'] = count($cj); # 报名人数
+ $data['sum'] = array_sum($cjcol);
+ $data['bmcnt']>0 ? $data['avg'] = round($data['sum']/$data['bmcnt'],2) : $data['avg']=0;
+ foreach ($cj as $key => $value) {
+ unset($cj[$key]['avg']);
+ unset($cj[$key]['sum']);
+ }
+ $data['rate'] = $this->rateAll($cj,$ksinfo->ks_subject); #全科及格率
+
+ return $data;
+ }
+
+
+ // 统计优秀、及格率
+ public function rate($cj = array(),$fenshuxian)
+ {
+ $cnt = 0;
+ foreach ($cj as $key => $value) {
+ if($value>=$fenshuxian)
+ {
+ $cnt++;
+ }
+ }
+ if(count($cj)>0)
+ {
+ return round($cnt/count($cj)*100,2);
+ }else{
+ return '0';
+ }
+
+ }
+
+
+ // 全科及格率
+ public function rateAll($cj = array(), $sbj=array())
+ {
+ $jige = 0; # 总及格人数
+ $sbjcnt = count($sbj);
+ // 开始循环每个人的成绩
+ foreach ($cj as $key => $value) {
+ $temjige = 0; #记录学生及格的学科数
+ // 开始循环这个学生的每个学科成绩
+ foreach ($sbj as $k => $val) {
+ if(isset($value[$val->lieming]))
+ {
+ if($value[$val->lieming]>=$val->jige)
+ {
+ $temjige++;
+ }
+ }
+ }
+ // 如果这个学生及格学科数等于学科总数,那么全科及格总数加1
+ $temjige == $sbjcnt && $temjige>0 ? $jige++ : $jige ;
+ }
+
+
+ if(count($cj)>0)
+ {
+ return round($jige/count($cj)*100,2);
+ }else{
+ return 0;
+ }
+ }
+
+
+
+
+ /**
+ * 得到数组的标准差
+ * @param unknown type $avg
+ * @param Array $list
+ * @param Boolen $isSwatch
+ * @return unknown type
+ */
+ public static function getVariance($avg, $list, $isSwatch = FALSE) {
+ $arrayCount = count($list);
+ if($arrayCount == 1 && $isSwatch == TRUE){
+ return '-';
+ }elseif($arrayCount > 0 ){
+ $total_var = 0;
+ foreach ($list as $lv)
+ $total_var += pow(($lv - $avg), 2);
+ if($arrayCount == 1 && $isSwatch == TRUE)
+ return FALSE;
+ return $isSwatch?sqrt($total_var / (count($list) - 1 )):sqrt($total_var / count($list));
+ }
+ else
+ return '-';
+ }
+
+
+ // 四分位
+ public function quartile($items) {
+ // 获取数组长度
+ $length = count($items);
+ if ($items == null || $length == 0) return $result = [0=>'-',1=>'-',2=>'-'];
+
+ if ($length < 5) return $result = [0=>'-',1=>'-',2=>'-'];
+ $result = array();
+
+ sort($items);
+
+ if ($length % 2 == 0) {//偶数
+ $result[1] = ($items[$length/2 - 1] + $items[$length/2]) / 2;
+ } else {//奇数
+ $result[1] = $items[($length + 1)/2 - 1];
+ }
+
+ if ($length % 4 == 0) {
+ $result[0] = ($items[$length/4 - 1] + $items[$length/4]) / 2;
+ $result[2] = ($items[3*$length/4 - 1] + $items[3*$length/4]) / 2;
+ } else {
+ $result[0] = $items[$length/4];
+ $result[2] = $items[3*$length/4];
+ }
+
+ return $result;
+ }
+
+
+}
diff --git a/app/chengji/validate/Cjdownload.php b/app/chengji/validate/Cjdownload.php
new file mode 100644
index 00000000..6d335ac5
--- /dev/null
+++ b/app/chengji/validate/Cjdownload.php
@@ -0,0 +1,27 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'banji|班级' => 'require|array',
+ 'kaoshi|考试' => 'require|number'
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/chengji/validate/Tjschool.php b/app/chengji/validate/Tjschool.php
new file mode 100644
index 00000000..30484351
--- /dev/null
+++ b/app/chengji/validate/Tjschool.php
@@ -0,0 +1,24 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/chengji/view/bjtongji/biaoge.html b/app/chengji/view/bjtongji/biaoge.html
new file mode 100644
index 00000000..4421b988
--- /dev/null
+++ b/app/chengji/view/bjtongji/biaoge.html
@@ -0,0 +1,176 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 考试管理
+ 更多操作
+ 成绩查看
+ 各班级成绩统计表
+ {$list['kaoshititle']}
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/chengji/view/bjtongji/dw_banji.html b/app/chengji/view/bjtongji/dw_banji.html
new file mode 100644
index 00000000..7fbcf141
--- /dev/null
+++ b/app/chengji/view/bjtongji/dw_banji.html
@@ -0,0 +1,61 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/view/index/biaolu.html b/app/chengji/view/index/biaolu.html
new file mode 100644
index 00000000..498751bc
--- /dev/null
+++ b/app/chengji/view/index/biaolu.html
@@ -0,0 +1,59 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/view/index/deletecjs.html b/app/chengji/view/index/deletecjs.html
new file mode 100644
index 00000000..1f5a4dbf
--- /dev/null
+++ b/app/chengji/view/index/deletecjs.html
@@ -0,0 +1,145 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/view/index/dw_chengji.html b/app/chengji/view/index/dw_chengji.html
new file mode 100644
index 00000000..0baeeb79
--- /dev/null
+++ b/app/chengji/view/index/dw_chengji.html
@@ -0,0 +1,129 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/view/index/edit.html b/app/chengji/view/index/edit.html
new file mode 100644
index 00000000..50015273
--- /dev/null
+++ b/app/chengji/view/index/edit.html
@@ -0,0 +1,90 @@
+{extend name="common@create" /}
+{block name="formaa"}
+
+{/block}
+{block name="yanzheng"}
+
+{/block}
\ No newline at end of file
diff --git a/app/chengji/view/index/index.html b/app/chengji/view/index/index.html
new file mode 100644
index 00000000..4a195f6e
--- /dev/null
+++ b/app/chengji/view/index/index.html
@@ -0,0 +1,199 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 考试管理
+ 更多操作
+ 成绩查看
+ 成绩列表
+
+{/block}
+{block name="search"}
+
+
+
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/chengji/view/index/malu.html b/app/chengji/view/index/malu.html
new file mode 100644
index 00000000..194bfb09
--- /dev/null
+++ b/app/chengji/view/index/malu.html
@@ -0,0 +1,117 @@
+{extend name="common@createhref" /}
+
+{block name="form"}
+
+
+
+
+
+
+
学校
+
+
班级
+
+
姓名
+
+
学科
+
+
+
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/view/index/read_add.html b/app/chengji/view/index/read_add.html
new file mode 100644
index 00000000..98774b30
--- /dev/null
+++ b/app/chengji/view/index/read_add.html
@@ -0,0 +1,122 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 成绩管理
+ 成绩列表
+ 录入信息
+
+{/block}
+{block name="search"}
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/chengji/view/njtongji/biaoge.html b/app/chengji/view/njtongji/biaoge.html
new file mode 100644
index 00000000..bcb5612a
--- /dev/null
+++ b/app/chengji/view/njtongji/biaoge.html
@@ -0,0 +1,150 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 考试管理
+ 更多操作
+ 成绩查看
+ 各年级成绩统计表
+ {$list['kaoshititle']}
+
+{/block}
+{block name="search"}
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/chengji/view/njtongji/dw_nianji.html b/app/chengji/view/njtongji/dw_nianji.html
new file mode 100644
index 00000000..c6dc00ba
--- /dev/null
+++ b/app/chengji/view/njtongji/dw_nianji.html
@@ -0,0 +1,41 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/chengji/view/tongji/yilu_cnt.html b/app/chengji/view/tongji/yilu_cnt.html
new file mode 100644
index 00000000..e964d419
--- /dev/null
+++ b/app/chengji/view/tongji/yilu_cnt.html
@@ -0,0 +1,171 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 考试管理
+ 更多操作
+ 前期操作
+ 已录成绩数量
+ {$list['kaoshititle']}
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/common.php b/app/common.php
new file mode 100644
index 00000000..57cb6d83
--- /dev/null
+++ b/app/common.php
@@ -0,0 +1,2 @@
+[
+ 'except'=>[
+ 'exit',
+ ],
+ ],
+ ];
+
+ public function _empty()
+ {
+ $this->error('不好意思,您访问的页面不存在~');
+ }
+
+}
diff --git a/app/common/controller/BaseError.php b/app/common/controller/BaseError.php
new file mode 100644
index 00000000..cea4231b
--- /dev/null
+++ b/app/common/controller/BaseError.php
@@ -0,0 +1,26 @@
+error('不好意思,您访问的页面不存在~');
+ }
+
+ public function _empty()
+ {
+ $this->error('不好意思,您访问的页面不存在~');
+ }
+
+}
diff --git a/app/common/model/Base.php b/app/common/model/Base.php
new file mode 100644
index 00000000..e358707d
--- /dev/null
+++ b/app/common/model/Base.php
@@ -0,0 +1,20 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/common/view/admininfo.html b/app/common/view/admininfo.html
new file mode 100644
index 00000000..8fd605cf
--- /dev/null
+++ b/app/common/view/admininfo.html
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/css/H-ui.min.css" /}
+{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/H-ui.admin.css" /}
+{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/Hui-iconfont/1.0.8/iconfont.css" /}
+{css href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/skin/default/skin.css" id="skin" /}
+{css rel="stylesheet" type="text/css" href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/css/style.css" /}
+
+
用户查看
+
+
+{block name="topdiv"}{/block}
+
+ {block name="mytable"}{/block}
+
+
+{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/jquery/1.9.1/jquery.min.js"}
+{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/lib/layer/2.4/layer.js"}
+{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui/js/H-ui.min.js"}
+{js href="/static/H-ui.admin_v3.1.3.1/H-ui.admin/static/h-ui.admin/js/H-ui.admin.js"}
+
+
+
+
+
\ No newline at end of file
diff --git a/app/common/view/create.html b/app/common/view/create.html
new file mode 100644
index 00000000..7224c559
--- /dev/null
+++ b/app/common/view/create.html
@@ -0,0 +1,72 @@
+
+
+
+
+
+
{$list.set.webtitle}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+
+
+ {block name="jscss"}{/block}
+
+
+
+ {block name="form"}{/block}
+
+
+ {block name="myjs"}{/block}
+
+
\ No newline at end of file
diff --git a/app/common/view/createhref.html b/app/common/view/createhref.html
new file mode 100644
index 00000000..84311210
--- /dev/null
+++ b/app/common/view/createhref.html
@@ -0,0 +1,40 @@
+
+
+
+
+
+
{$list.set.webtitle}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+
+
+ {block name="jscss"}{/block}
+
+
+
+ {block name="form"}{/block}
+
+
+ {block name="myjs"}{/block}
+
+
\ No newline at end of file
diff --git a/app/common/view/list.html b/app/common/view/list.html
new file mode 100644
index 00000000..b1711ca6
--- /dev/null
+++ b/app/common/view/list.html
@@ -0,0 +1,137 @@
+
+
+
+
+
{$list.webtitle}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+ {load href="__STATIC__/xadmin/js/md5.min.js" /}
+ {block name="jsset"}{/block}
+
+
+
+
+
+ {block name="nav"}{/block}
+
+
+
+
+
+ {block name="table"}{/block}
+
+
+
+
+ {block name="myjs"}{/block}
+
+
+
\ No newline at end of file
diff --git a/app/event.php b/app/event.php
new file mode 100644
index 00000000..e9851bb5
--- /dev/null
+++ b/app/event.php
@@ -0,0 +1,17 @@
+ [
+ ],
+
+ 'listen' => [
+ 'AppInit' => [],
+ 'HttpRun' => [],
+ 'HttpEnd' => [],
+ 'LogLevel' => [],
+ 'LogWrite' => [],
+ ],
+
+ 'subscribe' => [
+ ],
+];
diff --git a/app/home/controller/Error.php b/app/home/controller/Error.php
new file mode 100644
index 00000000..132697e4
--- /dev/null
+++ b/app/home/controller/Error.php
@@ -0,0 +1,11 @@
+error('不好意思,您访问的页面不存在~');
+ }
+}
diff --git a/app/http/middleware/OnLine.php b/app/http/middleware/OnLine.php
new file mode 100644
index 00000000..1fb5cc55
--- /dev/null
+++ b/app/http/middleware/OnLine.php
@@ -0,0 +1,86 @@
+top.location.href='/login';";
+ }
+
+ // 检验用户名或密码是否正确
+ $yz = action('login/index/check',['username'=>$username,'password'=>$password]);
+ if($yz['status'] == 0){
+ echo "";
+ }
+
+
+ // 实例化权限验证类
+ $auth = new Auth();
+
+ // 获取当前地址
+ $mod = $request->module();
+ $con = $request->controller();
+ $act = $request->action();
+ $url = $mod.'/'.$con.'/'.$act;
+
+ // 排除模块
+ $uneed_m = array('home');
+ // 排除控制器
+ $uneed_c = array(); # 荣誉器名首字母要大写
+ // 排除方法
+ $uneed_a = array(
+ 'welcome','upload','myinfo',
+ 'mybanji','banjilist',
+ 'editpassword','updatepassword',
+ // 教师信息查询
+ 'srcteacher','srcry','srckt',
+ // 查询班级成绩、查询年级成绩、查询录入成绩人员信息
+ 'ajaxbianji','ajaxnianji','ajaxaddinfo',
+ // 批量保存
+ // 'saveall',
+ // 下载成绩表、下载成绩统计表
+ 'dwchengjixls','dwbanjixls','dwnianjixls',
+ //保存考号、下载试卷标签、下载成绩采集表
+ 'updateset','kaohaosave','biaoqianxls','dwcaiji',
+ //课题结题图片上传和更新
+ 'jtupload','jtupdate','ajaxdata'
+ );
+ // 排除指定模块下的指定方法
+ $uneed_u = array('index/Index/index');
+
+ // 验证是否是排除方法
+ if(in_array($mod,$uneed_m) || in_array($con,$uneed_c) || in_array($act,$uneed_a) || in_array($url,$uneed_u))
+ {
+ $except = true;
+ }else{
+ $except = false;
+ }
+
+ // 验证方法
+ if( !$auth->check($url, session('userid')) && $except == false ){// 第一个参数是规则名称,第二个参数是用户UID
+ $this->error('哎哟~ 因为权限不足');
+ }
+
+ return $next($request);
+ }
+}
diff --git a/app/index/controller/Error.php b/app/index/controller/Error.php
new file mode 100644
index 00000000..47118e29
--- /dev/null
+++ b/app/index/controller/Error.php
@@ -0,0 +1,12 @@
+order(['id'=>'desc'])
+ ->field('id,webtitle,keywords,description')
+ ->find();
+
+ // 存储网站名
+ session('webtitle',$list->webtitle);
+
+ // 获取版本号
+ $list->version = config('app.chengji.version');
+ // 获取用户姓名
+ $ad = new \app\admin\model\Admin;
+ $list->xingming = $ad->where('id',session('userid'))->value('xingming');
+
+ // 查询用户拥有的权限
+ $admin = new \app\admin\model\Admin;
+ $admininfo = $admin->where('id',session('userid'))
+ ->field('id')
+ ->with([
+ 'glGroup'=>function($query){
+ $query->where('status',1)->field('title,rules,miaoshu');
+ }
+ ])
+ ->find();
+ $rules = '';
+ foreach ($admininfo->gl_group as $key => $value) {
+ if($key == 0){
+ $rules = $value->rules;
+ }else{
+ $rules = $rules.','.$value->rules;
+ }
+ }
+
+
+ // 实例化权限数据模型
+ $authrule = new \app\admin\model\AuthRule;
+
+ $list['menu'] = $authrule
+ ->where('pid',0)
+ ->where('status&ismenu',1)
+ ->when(session('userid')>2,function($query) use($rules){
+ $query->where('id','in',$rules);
+ })
+ ->field('id,title,font,name,pid')
+ ->with([
+ 'authCid'=>function($query) use($rules){
+ $query->where('status&ismenu',1)
+ ->when(session('userid')>2,function($query) use($rules)
+ {
+ $query->where('id','in',$rules);
+ })
+ ->field('id,title,name,pid,url');
+ },
+ ])
+ ->order(['paixu'])
+ ->select();
+
+
+
+
+ // 模版赋值
+ $this->assign('list',$list);
+
+ // 渲染输出
+ return $this->fetch();
+ }
+
+ public function welcome()
+ {
+
+ //实例化数据模型
+ $sysbasemod = new sysbasemod();
+
+ // 查询系统设置
+ $list = $sysbasemod
+ ->order(['id'=>'desc'])
+ ->field('webtitle,thinks,danwei')
+ ->find();
+
+ // 查询用户登信息
+ $list['username'] = session('username');
+
+ // 查询用户姓名及用户拥有的权限
+ $admin = new \app\admin\model\Admin;
+ $list['xingming'] = $admin->where('id',session('userid'))->value('xingming');
+ $list['group'] = $admin->getGroupnames(session('userid'));
+
+ $list['server'] = request()->server();
+ // 获取版本号
+ $list->version = config('app.chengji.version');
+
+
+ // 考试数
+ $con = new \app\kaoshi\model\Kaoshi;
+ $list['kaoshi'] = $con->count();
+ // 教师数
+ $con = new \app\renshi\model\Teacher;
+ $list['teacher'] = $con->count();
+ // 学生数
+ $con = new \app\renshi\model\Student;
+ $list['student'] = $con->count();
+ // 管理员数
+ $con = new \app\admin\model\Admin;
+ $list['admin'] = $con->count();
+ // 荣誉数
+ $con = new \app\rongyu\model\JsRongyuInfo;
+ $list['rongyu'] = $con->count();
+ // 课题数
+ $con = new \app\keti\model\KetiInfo;
+ $list['keti'] = $con->count();
+
+
+
+
+ // 模版赋值
+ $this->assign('list',$list);
+
+
+ // 渲染输出
+ return $this->fetch();
+ }
+
+
+}
diff --git a/app/index/route/index.php b/app/index/route/index.php
new file mode 100644
index 00000000..0a9b0f58
--- /dev/null
+++ b/app/index/route/index.php
@@ -0,0 +1,15 @@
+
+// +----------------------------------------------------------------------
+
+use think\facade\Route;
+
+Route::rule('/','login/index'); //主页
+// Route::get('welcome','index/welcome'); //欢迎页
diff --git a/app/index/view/index/index.html b/app/index/view/index/index.html
new file mode 100644
index 00000000..847b92e1
--- /dev/null
+++ b/app/index/view/index/index.html
@@ -0,0 +1,118 @@
+
+
+
+
+
{php}echo session('webtitle'){/php} v{$list['version']}
+
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/js/md5.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/index/view/index/welcome.html b/app/index/view/index/welcome.html
new file mode 100644
index 00000000..9883acda
--- /dev/null
+++ b/app/index/view/index/welcome.html
@@ -0,0 +1,127 @@
+
+
+
+
+
{php}echo session('webtitle'){/php}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+
{$list.webtitle}
+
+
+
+
欢迎『{$list.group}』:
+ {$list['xingming']}!当前时间:{php} echo date('Y-m-d h:m:s'){/php}
+
+
+
+
+
感谢{$list.thinks}本系统由大连巴掌(w86112@vip.163.com)提供技术支持。
+
+
+
\ No newline at end of file
diff --git a/app/kaoshi/common.php b/app/kaoshi/common.php
new file mode 100644
index 00000000..0705b1d3
--- /dev/null
+++ b/app/kaoshi/common.php
@@ -0,0 +1,5 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取考试信息列表
+ public function ajaxData()
+ {
+
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'id',
+ 'order'=>'desc',
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $ks = new KS;
+
+ // 查询要显示的数据
+ $data = $ks->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+ // 创建考试
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'新建考试',
+ 'butname'=>'创建',
+ 'formpost'=>'POST',
+ 'url'=>'/kaoshi',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\kaoshi\validate\Kaoshi;
+
+
+ // 获取表单数据
+ $list = request()->only(['title','xueqi','category','bfdate','enddate','zuzhi'],'post');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+
+ // 保存数据
+ $ks = new KS();
+
+ $ksdata = $ks->create($list);
+
+
+ // 根据更新结果设置返回提示信息
+ $ksdata ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ //
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改考试信息
+ public function edit($id)
+ {
+
+ // 获取考试信息
+ $list['data'] = KS::where('id',$id)
+ ->field('id,title,xueqi,category,bfdate,enddate,zuzhi')
+ ->append(['nianjiids','manfenedit'])
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑考试',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/kaoshi/'.$id,
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+
+ }
+
+
+
+
+
+ // 更新考试信息
+ public function update($id)
+ {
+ $validate = new \app\kaoshi\validate\Kaoshi;
+
+ // 获取表单数据
+ $list = request()->only(['title','xueqi','category','bfdate','enddate','zuzhi'],'post');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ $list['id'] = $id;
+ // 更新数据
+ $ks = new KS();
+ $ksdata = $ks::update($list);
+
+
+ // 根据更新结果设置返回提示信息
+ $ksdata ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 设置考试信息
+ public function kaoshiset($id)
+ {
+
+ // 获取考试信息
+ $data = KS::where('id',$id)
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->with([
+ 'subjectName'=>function($q){
+ $q->field('id,jiancheng');
+ }
+ ]);
+ }
+ ,'ksNianji'
+ ])
+ ->field('id')
+ ->find();
+
+
+ // 重新整理年级和学科
+ $subject=array();
+ $subjectid=array();
+ foreach ($data['ks_subject'] as $key => $value) {
+ $subjectid[] = $value['subjectid'];
+ $subject[$value->lieming]['manfen'] = $value['manfen'];
+ $subject[$value->lieming]['youxiu'] = $value['youxiu'];
+ $subject[$value->lieming]['jige'] = $value['jige'];
+ }
+
+
+ $nianji = array();
+ foreach ($data['ks_nianji'] as $key => $value) {
+ $nianji[] = $value['nianji'];
+ }
+
+ $list['data']['ks_subjectid'] = implode(',' , $subjectid);
+ $list['data']['ks_nianjiid'] = implode(',' , $nianji);
+ $list['data']['ks_subject'] = $subject;
+
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'设置考试',
+ 'butname'=>'设置',
+ 'formpost'=>'PUT',
+ 'url'=>'/kaoshiset/'.$id,
+ 'kaoshi'=>$id,
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+
+ }
+
+
+
+
+
+ // 更新考试信息
+ public function updateset($id)
+ {
+ $validate = new \app\kaoshi\validate\Kaoshiset;
+
+ // 获取表单数据
+ $list = request()->only(['nianji','subject','manfen','youxiu','jige','lieming','nianjiname'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ $list['id'] = $id;
+
+ // 整理数据
+ $data = array();
+ $i = 0;
+ foreach ($list['subject'] as $key => $value) {
+ $data[$i]['subjectid'] = $key;
+ $data[$i]['manfen'] = $list['manfen'][$key];
+ $data[$i]['youxiu'] = $list['youxiu'][$key];
+ $data[$i]['jige'] = $list['jige'][$key];
+ $data[$i]['lieming'] = $list['lieming'][$key];
+ $data[$i]['kaoshiid'] = $id;
+ $i++;
+ }
+
+ // 更新数据
+ $subject = new \app\kaoshi\model\KaoshiSubject;
+ $subject->where('kaoshiid',$id)->delete();
+ $subjectdata = $subject->saveAll($data);
+
+ // 整理数据
+ $data = array();
+ $i = 0;
+ foreach ($list['nianji'] as $key => $value) {
+ $data[$i]['nianji'] = $key;
+ $data[$i]['nianjiname'] = $list['nianjiname'][$key];
+ $data[$i]['kaoshiid'] = $id;
+ $i++;
+ }
+
+ // 更新数据
+ $nianji = new \app\kaoshi\model\KaoshiNianji;
+ $nianji->where('kaoshiid',$id)->delete();
+ $nianjidata = $nianji->saveAll($data);
+
+
+ // 根据更新结果设置返回提示信息
+ $subjectdata && $nianjidata ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除考试
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = KS::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置考试状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取考试信息
+ $data = KS::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 考试更多操作页面
+ public function moreAction($kaoshi)
+ {
+ // 获取考试信息
+ $kaoshi = KS::where('id',$kaoshi)
+ ->field('id,title,bfdate,enddate')
+ ->find();
+
+ // 设置页面标题
+ $list['webtitle'] = $kaoshi['title'] .'('. $kaoshi['bfdate'].'~'.$kaoshi['enddate'].')';
+ $list['kaoshiid'] = $kaoshi['id'];
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+}
diff --git a/app/kaoshi/controller/Kaohao.php b/app/kaoshi/controller/Kaohao.php
new file mode 100644
index 00000000..070a8ec1
--- /dev/null
+++ b/app/kaoshi/controller/Kaohao.php
@@ -0,0 +1,589 @@
+with([
+ 'ksNianji'
+ ])
+ ->find();
+ if(count($kaoshilist->ks_nianji)>0)
+ {
+ foreach ($kaoshilist->ks_nianji as $key => $value) {
+ $list['data']['nianji'][$key]['id']=$value->nianji;
+ $list['data']['nianji'][$key]['title']=$value->nianjiname;
+ }
+ }else{
+ $list['data']['nianji']= array();
+ }
+
+
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'生成考号',
+ 'butname'=>'生成',
+ 'formpost'=>'POST',
+ 'url'=>'/kaoshi/kaohao',
+ 'kaoshi'=>$kaoshi
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 保存考号
+ public function save()
+ {
+
+ // 实例化验证模型
+ $validate = new \app\kaoshi\validate\Kaohao;
+
+ // 获取表单数据
+ $list = request()->only(['school','kaoshi','banjiids'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return ['msg'=>$msg,'val'=>0];
+ }
+
+ if(enddate($list['kaoshi']))
+ {
+ return ['msg'=>'考试已经结束,不能分配考号','val'=>0];
+ }
+
+
+
+ // 将班级转换成数组
+ $list['banjiids'] = implode(',',$list['banjiids']);
+ $ksid = $list['kaoshi'];
+
+ // 获取实例化学生数据模型
+ $stu = new \app\renshi\model\Student;
+ // 获取参加考试学生名单
+ $stulist = $stu::where('school',$list['school'])
+ ->where('banji','in',$list['banjiids'])
+ ->where('status',1)
+ ->field('id,school,banji')
+ ->with([
+ 'stuBanji'=>function($query){
+ $query->field('id,ruxuenian');
+ }
+ ])
+ ->select();
+ $njlist = nianjiList();
+ // 重新组合学生信息
+ $kaohao = array();
+ foreach ($stulist as $key => $value) {
+ $check = KH::withTrashed()
+ ->where('kaoshi',$list['kaoshi'])
+ ->where('student',$value->id)
+ ->find();
+ if($check)
+ {
+ if($check->delete_time>0)
+ {
+ $check->restore();
+ }
+ if($check->status == 0)
+ {
+ $check->status = 1;
+ $check->save();
+ }
+
+ continue;
+ }
+ $kaohao[$key]['student']= $value->id;
+ $kaohao[$key]['school']= $list['school'];
+ $kaohao[$key]['ruxuenian']= $value->stu_banji->ruxuenian;
+ $kaohao[$key]['nianji']= $njlist[$kaohao[$key]['ruxuenian']];
+ $kaohao[$key]['banji']= $value->stu_banji->id;
+ $kaohao[$key]['kaoshi']= $list['kaoshi'];
+ }
+
+ // 保存考号
+ $kh = new \app\kaoshi\model\Kaohao;
+
+ $data = $kh
+ ->allowField(['id','kaoshi','student','school','ruxuenian','nianji','banji','create_time','update_time'])
+ ->saveAll($kaohao);
+
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'生成成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ /**
+ * 生成指定网址的二维码
+ * @param string $url 二维码中所代表的网址
+ */
+ public function create_qrcode($url='127.0.0.1')
+ {
+ $qrCode = new QrCode($url);
+ header("Content-type: image/jpg");
+ return $qrCode->writeString();
+ }
+
+
+
+
+ // 生成试卷标签二维码可以换成pdf格式
+ public function biaoqiandoc($id)
+ {
+
+ set_time_limit(0);
+ // 获取数据库信息
+ $chengjiinfo = Chengji::where('kaoshi',$id)
+ ->where('ruxuenian',2017)
+ ->append(['cj_school.jiancheng','cj_Student.xingming','banjiNumname'])
+ ->select();
+
+ // 获取学科信息
+ $xks = KS::get($id);
+ $xks = $xks->Subjectids;
+
+ $subject = new \app\teach\model\Subject();
+ $xks = $subject->where('id','in',$xks)->column('id,title');
+
+ // Word处理
+ // 实例化类
+ $phpWord = new \PhpOffice\PhpWord\PhpWord();
+
+
+ // 设置页面格式
+ $sectionStyle = array(
+ 'pageSizeW'=>2*567,
+ 'pageSizeH'=>3*567,
+ 'orientation'=>'landscape',
+ 'marginLeft'=>80,
+ 'marginRight'=>80,
+ 'marginTop'=>100,
+ 'marginBottom'=>100
+ );
+ $section = $phpWord->createSection($sectionStyle);
+
+
+ // 设置图片格式
+ $imageStyle = array('width'=>45,'height'=>45,'align'=>'left');
+
+ // 学生信息样式
+ $myStyle = 'myStyle';
+ $phpWord->addFontStyle(
+ $myStyle,
+ [
+ 'name' => '宋体',
+ 'size' => 6.5,
+ 'color' => '000000',
+ 'bold' => true,
+ ]
+ );
+
+
+ // 循环写出信息
+ foreach ($chengjiinfo as $key => $value) {
+ foreach ($xks as $xkkey => $val) {
+ // 创建表格
+ $table = $section->addTable($key);
+ $table->addRow(1500);
+
+
+ $img = $this->create_qrcode($value['id'].','.$xkkey);
+ $table->addCell(850)->addImage($img,$imageStyle);
+
+
+ // $table->addCell(700)->addImage('aaaa.jpg',$imageStyle);
+ $info = $table->addCell(650);
+ $info->addText($value['cj_school']['jiancheng'],$myStyle);
+ $info->addText($value['banjiNumname'],$myStyle);
+ $info->addText($value['cj_student']['xingming'],$myStyle);
+ $info->addText($val,$myStyle);
+
+ }
+ }
+
+
+
+ // 保存文件
+ $filename = '试卷标签.docx';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="' . $filename . '"');
+ header('Cache-Control: max-age=0');
+ $objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
+ $objWriter->save('php://output');
+ ob_flush();
+ flush();
+
+ }
+
+
+
+ // 标签下载
+ public function biaoqian($kaoshi)
+ {
+ // 获取参考年级
+ $kaoshilist = KS::where('id',$kaoshi)
+ ->with([
+ 'ksNianji'
+ ,'ksSubject'=>function($query){
+ $query->field('id,subjectid,kaoshiid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title');
+ }]
+ );
+ }
+ ])
+ ->find();
+
+
+ // 获取考试年级
+ if(count($kaoshilist->ks_nianji)>0)
+ {
+ foreach ($kaoshilist->ks_nianji as $key => $value) {
+ $list['data']['nianji'][$key]['id']=$value->nianji;
+ $list['data']['nianji'][$key]['title']=$value->nianjiname;
+ }
+ }else{
+ $list['data']['nianji']= array();
+ }
+ // 获取考试学科
+ if(count($kaoshilist->ks_subject)>0)
+ {
+ foreach ($kaoshilist->ks_subject as $key => $value) {
+ $list['data']['subject'][$key]['id']=$value->subjectid;
+ $list['data']['subject'][$key]['title']=$value->subject_name->title;
+ }
+ }else{
+ $list['data']['subject']= array();
+ }
+
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'下载考号',
+ 'butname'=>'下载',
+ 'formpost'=>'POST',
+ 'url'=>'/kaoshi/'.$kaoshi.'/biaoqianXls',
+ 'kaoshi'=>$kaoshi
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+
+
+ //生成标签信息
+ public function biaoqianXls()
+ {
+ set_time_limit(0);
+ // 获取表单数据
+ $list = request()->only(['banjiids','kaoshi','subject'],'post');
+
+ $kaoshi = $list['kaoshi'];
+ $banji = $list['banjiids'];
+ $subject = $list['subject'];
+
+ // 实例化验证模型
+ $validate = new \app\kaoshi\validate\Biaoqian;
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ $data=['msg'=>'数据处理错误','val'=>0];
+ return json($data);
+ }
+
+ $ks = new KS();
+ $kslist = $ks::where('id',$kaoshi)
+ ->field('id,title')
+ ->with([
+ 'ksSubject'=>function($query) use($subject){
+ $query->where('subjectid','in',$subject)
+ ->field('kaoshiid,subjectid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,jiancheng,lieming');
+ }]
+ );
+ }
+ ])
+ ->find();
+
+ $kh = new KH();
+ // 获取考试信息
+ $kaohao = $kh->srcKaohao($kaoshi,$banji);
+
+
+ // 创建表格
+ $spreadsheet = new Spreadsheet();
+ $sheet = $spreadsheet->getActiveSheet();
+
+ // 设置表头信息
+ $sheet->setCellValue('A1', '序号');
+ $sheet->setCellValue('B1', '考号');
+ $sheet->setCellValue('C1', '学校');
+ $sheet->setCellValue('D1', '班级');
+ $sheet->setCellValue('E1', '学科');
+ $sheet->setCellValue('F1', '姓名');
+
+
+ // 循环写出信息
+ $i = 2;
+ foreach ($kaohao as $key=>$bj)
+ {
+ foreach ($kslist->ks_subject as $ksbj => $sbj)
+ {
+ foreach ($bj->banji_kaohao as $kkh => $kh)
+ {
+ // 表格赋值
+ $sheet->setCellValue('A'.$i, $i-1);
+ $sheet->setCellValue('B'.$i, action('system/Encrypt/encrypt',['data'=>$kh->id.'|'.$sbj->subject_name->id,'key'=>'dlbz']));
+ $sheet->setCellValue('C'.$i, $bj->cj_school->jiancheng);
+ $sheet->setCellValue('D'.$i, $bj->cj_banji->numTitle);
+ $sheet->setCellValue('E'.$i, $sbj->subject_name->jiancheng);
+ $sheet->setCellValue('F'.$i, $kh->cj_student['xingming']);
+ $i++;
+ }
+ }
+ }
+
+ // 保存文件
+ $filename = $kslist->title.' 标签数据'.date('ymdHis').'.xls';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="' . $filename . '"');
+ header('Cache-Control: max-age=0');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+ $writer->save('php://output');
+ ob_flush();
+ flush();
+ }
+
+
+
+
+ // 下载考试成绩采集表
+ public function caiji($kaoshi)
+ {
+ // 获取参考年级
+ $kaoshilist = KS::where('id',$kaoshi)
+ ->with([
+ 'ksNianji'
+ ,'ksSubject'=>function($query){
+ $query->field('id,subjectid,kaoshiid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title');
+ }]
+ );
+ }
+ ])
+ ->find();
+ // 获取考试年级
+ if(count($kaoshilist->ks_nianji)>0)
+ {
+ foreach ($kaoshilist->ks_nianji as $key => $value) {
+ $list['data']['nianji'][$key]['id']=$value->nianji;
+ $list['data']['nianji'][$key]['title']=$value->nianjiname;
+ }
+ }else{
+ $list['data']['nianji']= array();
+ }
+ // 获取考试学科
+ if(count($kaoshilist->ks_subject)>0)
+ {
+ foreach ($kaoshilist->ks_subject as $key => $value) {
+ $list['data']['subject'][$key]['id']=$value->subjectid;
+ $list['data']['subject'][$key]['title']=$value->subject_name->title;
+ }
+ }else{
+ $list['data']['subject']= array();
+ }
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'下载成绩采集表',
+ 'butname'=>'下载',
+ 'formpost'=>'POST',
+ 'url'=>'/kaoshi/caiji',
+ 'kaoshi'=>$kaoshi
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('biaoqian');
+ }
+
+
+
+
+
+
+ // 获取参考名单
+ public function dwcaiji()
+ {
+ // 实例化验证模型
+ $validate = new \app\kaoshi\validate\Biaoqian;
+
+ // 获取表单数据
+ $list = request()->only(['banjiids','kaoshi','subject'],'post');
+
+ $kaoshi = $list['kaoshi'];
+ $banji = $list['banjiids'];
+ $subject = $list['subject'];
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ $this->error($msg);
+ }
+
+ $ks = new KS();
+ $kslist = $ks::where('id',$kaoshi)
+ ->field('id,title')
+ ->with([
+ 'ksSubject'=>function($query) use($subject){
+ $query->where('subjectid','in',$subject)
+ ->field('kaoshiid,subjectid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,title,lieming');
+ }]
+ );
+ }
+ ])
+ ->find();
+
+ $kh = new KH();
+ // 获取考试信息
+ $kaohao = $kh->srcKaohao($kaoshi,$banji);
+
+
+ // 获取电子表格列名
+ $lieming = excelLieming();
+
+ // 创建表格
+ $spreadsheet = new Spreadsheet();
+ $sheet = $spreadsheet->getActiveSheet();
+
+ // 设置表格标题与表头信息
+ $sheet->setCellValue('A1',$kslist->title.' 成绩采集表');
+
+ $sheet->setCellValue('A3', '序号');
+ $sheet->setCellValue('B3', '考号');
+ $sheet->setCellValue('C3', '班级');
+ $sheet->setCellValue('D3', '姓名');
+ // 获取列数并合并和一行
+ $col = $lieming[count($kslist->ks_subject)+3];
+ $sheet->mergeCells('A1:'.$col.'1');
+
+
+ // 写入列名
+ foreach ($kslist->ks_subject as $key => $value) {
+ $sheet->setCellValue($lieming[$key + 4].'3', $value->subject_name->title);
+ $sheet->setCellValue($lieming[$key + 4].'2', $value->subject_name->id);
+ }
+ // 隐藏第二行和第二列
+ $sheet->getRowDimension('2')->setRowHeight('0');
+ $sheet->getColumnDimension('B')->setWidth('0');
+
+
+ // 将学生信息循环写入表中
+ $i = 4;
+ foreach ($kaohao as $key=>$bj)
+ {
+ foreach ($bj->banji_kaohao as $k => $kh) {
+ $sheet->setCellValue('A'.$i, $i-3);
+ $sheet->setCellValue('B'.$i, $kh->id);
+ $sheet->setCellValue('C'.$i, $bj->cj_banji->banjiTitle);
+ $sheet->setCellValue('D'.$i, $kh->cj_student->xingming);
+ $i++;
+ }
+ }
+
+
+ // 保存文件
+ $filename = $kslist->title.'成绩采集表'.date('ymdHis').'.xls';
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ header('Content-Disposition: attachment;filename="' . $filename . '"');
+ header('Cache-Control: max-age=0');
+ $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xls');
+ $writer->save('php://output');
+ }
+
+
+ // 删除考号
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }else{
+ $id = array($id);
+ }
+
+ // 删除成绩
+ $db = new \think\Db;
+ $db::startTrans(); # 启动事务
+ try {
+ KH::destroy($id);
+ $chengji = new \app\chengji\model\Chengji;
+ $cjids = $chengji::where('kaohao_id','in',$id)->column('id');
+ $chengji::destroy($cjids);
+ $data = true;
+ $db::commit();
+ } catch (\Exception $e) {
+ $data = false;
+ // 回滚事务
+ $db::rollback();
+ }
+
+ // 根据更新结果设置返回提示信息
+ $data==true ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+}
diff --git a/app/kaoshi/model/Kaohao.php b/app/kaoshi/model/Kaohao.php
new file mode 100644
index 00000000..73496b65
--- /dev/null
+++ b/app/kaoshi/model/Kaohao.php
@@ -0,0 +1,350 @@
+where('kaoshi',$kaoshi)
+ ->where('banji','in',$banji)
+ ->field('id,banji,school')
+ ->order(['banji'])
+ ->group('banji')
+ ->with([
+ 'cjBanji'=>function($query){
+ $query->field('id,paixu,ruxuenian')
+ ->append(['numTitle','banjiTitle']);
+ }
+ ,'cjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ,'banjiKaohao'=>function($query) use($kaoshi){
+ $query->field('id,banji,student,kaoshi,school')
+ ->where('kaoshi',$kaoshi)
+ ->order(['banji','id'])
+ ->with([
+ 'cjStudent'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ }
+ ])
+ ->select();
+
+ $stu = new \app\renshi\model\Student;
+ // 找出已经被删除学生,并添加该学生信息
+ foreach ($data as $key => $value) {
+ foreach ($value->banji_kaohao as $k => $val) {
+ if($val->cj_student == Null)
+ {
+ $stuinof = $stu::withTrashed()
+ ->where('id',$val->student)
+ ->field('id,xingming')
+ ->find();
+ $data[$key]->banji_kaohao[$key]->cj_student = array('id'=>$stuinof->id,'xingming'=>$stuinof->xingming);
+ }
+ }
+ }
+
+ return $data;
+ }
+
+
+ /**
+ * 以考号为基础查询学生成绩信息并排序
+ * 信息包括:学校、年级、班级、姓名、性别、各学科成绩、平均分、总分
+ * @access public
+ * @param array $src 参数数组
+ * @param number $src['school'] 学生所在学校
+ * @param number $src['nianji'] 学生所在年级
+ * @param number $src['paixu'] 班级标识
+ * @param number $src['searchval'] 关键字
+ * @param number $src['field'] 排序字段
+ * @param number $src['type'] 排序类型
+ * @return array 返回类型
+ */
+ public function srcChengji($srcfrom)
+ {
+ // 初始化参数
+ $src = array(
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'banji',
+ 'type'=>'desc',
+ 'kaoshi'=>'',
+ 'school'=>array(),
+ 'nianji'=>'',
+ 'banji'=>array(),
+ 'searchval'=>''
+ );
+ // 用新值替换初始值
+ $src = array_cover( $srcfrom , $src ) ;
+
+ // 重新定义变量
+ $school = $src['school'];
+ $nianji = $src['nianji'];
+ $banji = $src['banji'];
+ $seachval = $src['searchval'];
+
+ // 查询成绩
+ $khlist = $this->where('kaoshi',$src['kaoshi'])
+ ->field('id,school,student,nianji,banji')
+ ->when(count($school)>0,function($query) use($school){
+ $query->where('school','in',$school);
+ })
+ ->when(count($banji)>0,function($query) use($banji){
+ $query->where('banji','in',$banji);
+ })
+ ->when(strlen($nianji)>0,function($query) use($nianji){
+ $query->where('ruxuenian',$nianji);
+ })
+ ->when(strlen($seachval)>0,function($query) use($seachval){
+ $query->where(function($w) use ($seachval){
+ $w->whereOr('id',$seachval)
+ ->whereOr('student','in',function($q)use($seachval){
+ $q->name('student')->where('xingming','like','%'.$seachval.'%')->field('id');
+ });
+ });
+ })
+ ->with([
+ 'ksChengji'=>function($query){
+ $query->field('kaohao_id,subject_id,defen');
+ }
+ ,'cjBanji'=>function($query){
+ $query->field('id,paixu,ruxuenian');
+ }
+ ,'cjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ,'cjStudent'=>function($query){
+ $query->field('id,xingming,sex');
+ }
+ ])
+ ->select();
+
+ if($khlist->isEmpty())
+ {
+ return $data = array();
+ }
+
+
+ // 获取参考学科
+ $kaoshi = new \app\kaoshi\model\Kaoshi;
+ $ksinfo = $kaoshi->where('id',$src['kaoshi'])
+ ->with([
+ 'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid,lieming');
+ }
+ ])
+ ->find();
+
+ if($ksinfo->ks_subject->isEmpty())
+ {
+ return $data = array();
+ }
+
+ $xk = array();
+ foreach ($ksinfo->ks_subject as $key => $value) {
+ $xk[$value->subjectid] = $value->lieming;
+ }
+
+ $bjlist = banjinamelist();
+
+ // 整理数据
+ $data = array();
+ foreach ($khlist as $key => $value) {
+ $data[$key]['id'] = $value->id;
+ $data[$key]['school'] = $value->cj_school->jiancheng;
+ if($value->cj_student != Null){
+ $data[$key]['student'] = $value->cj_student->xingming;
+ $data[$key]['sex'] = $value->cj_student->sex;
+ }else{
+ $stuinfo = $stu::withTrashed()
+ ->where('id',$value->student)
+ ->field('id,xingming,sex')
+ ->find();
+ $data[$key]['student'] = $stuinfo->xingming;
+ $data[$key]['sex'] = $stuinfo->sex;
+ }
+ $data[$key]['nianji'] = $value->nianji;
+ $data[$key]['banji'] = $value->nianji.$bjlist[$value->cj_banji->paixu];
+ $dfsum = 0;
+ $sbjcnt = 0;
+
+ $cjarr = $this->zzcj($value->ks_chengji);
+
+ // 初始化参数
+ $dfsum = 0;
+ $sbjcnt = 0;
+
+ foreach ($xk as $k => $val) {
+ // 为每个学科赋值并记录学科数
+ if(array_key_exists($k,$cjarr))
+ {
+ $data[$key][$val]=$cjarr[$k] * 1;
+ $sbjcnt++;
+ $dfsum = $dfsum + $data[$key][$val];
+ }else{
+ $data[$key][$val]='';
+ }
+ }
+
+
+ $data[$key]['sum'] = $dfsum;
+ if($sbjcnt>0){
+ $data[$key]['avg'] = round($dfsum/$sbjcnt,1);
+ }else{
+ $data[$key]['avg'] = 0;
+ }
+ }
+
+
+ // 按条件排序
+ if(count($data)>0){
+ $data = arraySequence($data,$src['field'],$src['type']); //排序
+ }
+
+ return $data;
+ }
+
+
+
+ // 满分
+ public function banjiKaohao()
+ {
+ return $this->hasMany('\app\kaoshi\model\Kaohao','banji','banji');
+ }
+
+ // 学校信息关联表
+ public function cjSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','school','id');
+ }
+
+ // 班级信息关联表
+ public function cjBanji()
+ {
+ return $this->belongsTo('\app\teach\model\Banji','banji','id');
+ }
+
+ // 学生信息关联
+ public function cjStudent()
+ {
+ return $this->belongsTo('\app\renshi\model\Student','student','id');
+ }
+
+ // 满分
+ public function cjManfen()
+ {
+ return $this->hasMany('\app\kaoshi\model\KaoshiSubject','kaoshiid','kaoshi');
+ }
+
+ // 考试关联
+ public function cjKaoshi()
+ {
+ return $this->belongsTo('\app\kaoshi\model\Kaoshi','kaoshi','id');
+ }
+
+
+ // 考试成绩
+ public function ksChengji()
+ {
+ return $this->hasMany('\app\chengji\model\Chengji','kaohao_id','id');
+ }
+
+ // 转置成绩数组
+ private function zzcj($array = array())
+ {
+
+ $arr = array();
+ foreach ($array as $key => $value) {
+ $arr[$value['subject_id']] = $value['defen'];
+ }
+ return $arr;
+ }
+
+ /**
+ * 获取参加考试的学校
+ * @access public
+ * @param number $kaoshi 考试id
+ * @param number $ruxuenian 入学年
+ * @return array 返回类型
+ */
+ public function cySchool($kaoshi,$ruxuenian)
+ {
+ $data = $this->where('ruxuenian',$ruxuenian)
+ ->where('kaoshi',$kaoshi)
+ ->with(['cjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ])
+ ->group('school')
+ ->field('school')
+ ->select();
+ return $data;
+
+ }
+
+
+ /**
+ * 获取参加考试的班级
+ * @access public
+ * @param number $kaoshi 考试id
+ * @param number $ruxuenian 入学年
+ * @return array 返回类型
+ */
+ public function cyBanji($kaoshi,$ruxuenian,$school=array(),$paixu=array())
+ {
+ // 获取考试时间
+ $ks = new \app\kaoshi\model\Kaoshi;
+ $kssj = $ks::where('id',$kaoshi)->value('bfdate');
+ $year = date('Y',$kssj);
+
+
+ $data = $this->where('ruxuenian',$ruxuenian)
+ ->where('kaoshi',$kaoshi)
+ ->when(count($school)>0,function($query) use($school){
+ $query->where('school','in',$school);
+ })
+ ->when(count($paixu)>0,function($query) use($paixu){
+ $query->where('banji','in',function($q)use($paixu){
+ $q->name('banji')->where('paixu','in',$paixu)->field('id');
+ });
+ })
+ ->with([
+ 'cjBanji'=>function($query){
+ $query->field('id,paixu,ruxuenian');
+ }
+ ,'cjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ }
+ ])
+ ->group('banji,school')
+ ->field('banji,school')
+ ->select();
+ $njlist = nianjiList($year);
+ $bjlist = banjinamelist();
+
+
+ foreach ($data as $key => $value) {
+ # code...
+ $data[$key]['bjtitle'] = $njlist[$value->cjBanji->ruxuenian].$bjlist[$value->cjBanji->paixu];
+ }
+
+ return $data;
+ }
+
+}
diff --git a/app/kaoshi/model/Kaoshi.php b/app/kaoshi/model/Kaoshi.php
new file mode 100644
index 00000000..47dad9e2
--- /dev/null
+++ b/app/kaoshi/model/Kaoshi.php
@@ -0,0 +1,98 @@
+order([$src['field'] =>$src['order']])
+ // ->when(count($xingzhi)>0,function($query) use($xingzhi){
+ // $query->where('xingzhi','in',$xingzhi);
+ // })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'ksCategory'=>function($query){
+ $query->field('id,title');
+ }
+ ,'ksSubject'=>function($query){
+ $query->field('kaoshiid,subjectid')
+ ->with(['subjectName'=>function($q){
+ $q->field('id,jiancheng');
+ }]
+ );
+ }
+ ,'ksNianji'
+ ]
+ )
+ ->select();
+ return $data;
+ }
+
+
+
+ // 开始时间修改器
+ public function setBfdateAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 开始时间获取器
+ public function getBfdateAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ // 结束时间修改器
+ public function setEnddateAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 结束时间获取器
+ public function getEnddateAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ //参考年级关联表
+ public function ksNianji()
+ {
+ return $this->hasMany('KaoshiNianji','kaoshiid','id')->field('kaoshiid,nianji,nianjiname');
+ }
+
+ // 参考学科关联表
+ public function ksSubject()
+ {
+ return $this->hasMany('KaoshiSubject','kaoshiid','id');
+ }
+ // 参考学科关联表
+ public function ksCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','category','id');
+ }
+
+ // 考试成绩关联表
+ public function ksChengji()
+ {
+ return $this->hasMany('\app\chengji\model\Chengji','kaoshi','id');
+ }
+
+
+
+
+}
diff --git a/app/kaoshi/model/KaoshiNianji.php b/app/kaoshi/model/KaoshiNianji.php
new file mode 100644
index 00000000..1d06b85b
--- /dev/null
+++ b/app/kaoshi/model/KaoshiNianji.php
@@ -0,0 +1,11 @@
+belongsTo('\app\teach\model\Subject','subjectid','id');
+ }
+}
diff --git a/app/kaoshi/validate/Biaoqian.php b/app/kaoshi/validate/Biaoqian.php
new file mode 100644
index 00000000..c9a45f20
--- /dev/null
+++ b/app/kaoshi/validate/Biaoqian.php
@@ -0,0 +1,28 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'banjiids|班级' => 'require|array',
+ 'kaoshi|考试' => 'require|number',
+ 'subject|学科' => 'require|array',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/kaoshi/validate/Kaohao.php b/app/kaoshi/validate/Kaohao.php
new file mode 100644
index 00000000..38457974
--- /dev/null
+++ b/app/kaoshi/validate/Kaohao.php
@@ -0,0 +1,27 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'kaoshi|考试号' => 'require|number',
+ 'banjiids|参考班级' => 'require|array',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/kaoshi/validate/Kaoshi.php b/app/kaoshi/validate/Kaoshi.php
new file mode 100644
index 00000000..97923051
--- /dev/null
+++ b/app/kaoshi/validate/Kaoshi.php
@@ -0,0 +1,31 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|标题' => 'require|length:1,25',
+ 'zuzhi|组织单位' => 'require|number',
+ 'xueqi|学期' => 'require|number',
+ 'category|分类' => 'require|number',
+ 'bfdate|考试时间' => 'require|date',
+ 'enddate|考试时间' => 'require|date',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/kaoshi/validate/Kaoshiset.php b/app/kaoshi/validate/Kaoshiset.php
new file mode 100644
index 00000000..a8523f92
--- /dev/null
+++ b/app/kaoshi/validate/Kaoshiset.php
@@ -0,0 +1,31 @@
+ ['规则1','规则2'...]
+ *
+ * @var
+ */
+ protected $rule = [
+ 'nianji|年级' => 'require|array',
+ 'subject|学科' => 'require|array',
+ 'manfen|满分' => 'require|array',
+ 'youxiu|优秀' => 'require|array',
+ 'jige|及格' => 'require|array',
+ 'lieming|列名' => 'require|array',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/kaoshi/view/index/create.html b/app/kaoshi/view/index/create.html
new file mode 100644
index 00000000..d4c0f7b6
--- /dev/null
+++ b/app/kaoshi/view/index/create.html
@@ -0,0 +1,126 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/kaoshi/view/index/index.html b/app/kaoshi/view/index/index.html
new file mode 100644
index 00000000..7c6ae650
--- /dev/null
+++ b/app/kaoshi/view/index/index.html
@@ -0,0 +1,146 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 考试管理
+ 考试列表
+
+{/block}
+{block name="search"}
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/kaoshi/view/index/kaoshiset.html b/app/kaoshi/view/index/kaoshiset.html
new file mode 100644
index 00000000..c9097816
--- /dev/null
+++ b/app/kaoshi/view/index/kaoshiset.html
@@ -0,0 +1,159 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/kaoshi/view/index/more_action.html b/app/kaoshi/view/index/more_action.html
new file mode 100644
index 00000000..c06f0140
--- /dev/null
+++ b/app/kaoshi/view/index/more_action.html
@@ -0,0 +1,136 @@
+
+
+
+
+
{$list.webtitle}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+ {load href="__STATIC__/xadmin/js/md5.min.js" /}
+ {block name="jsset"}{/block}
+
+
+
+
+
+
+ {php}$kaoshiid =$list['kaoshiid']; {/php}
+
+
+ - 1、前期操作
+ - 2、成绩录入
+ - 3、学生成绩
+ - 4、班级成绩
+ - 5、年级成绩
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/kaoshi/view/kaohao/biaoqian.html b/app/kaoshi/view/kaohao/biaoqian.html
new file mode 100644
index 00000000..653a7758
--- /dev/null
+++ b/app/kaoshi/view/kaohao/biaoqian.html
@@ -0,0 +1,161 @@
+{extend name="common@createhref" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/kaoshi/view/kaohao/caiji.html b/app/kaoshi/view/kaohao/caiji.html
new file mode 100644
index 00000000..68c530ef
--- /dev/null
+++ b/app/kaoshi/view/kaohao/caiji.html
@@ -0,0 +1,123 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/kaoshi/view/kaohao/index.html b/app/kaoshi/view/kaohao/index.html
new file mode 100644
index 00000000..bdd7900f
--- /dev/null
+++ b/app/kaoshi/view/kaohao/index.html
@@ -0,0 +1,131 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/keti/common.php b/app/keti/common.php
new file mode 100644
index 00000000..b3d9bbc7
--- /dev/null
+++ b/app/keti/common.php
@@ -0,0 +1 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+
+ /**
+ * 显示课题册列表
+ *
+ * @return \think\Response
+ */
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'lxdanweiid'=>array(),
+ 'category'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $keti = new keti;
+
+ // 查询要显示的数据
+ $data = $keti->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+ /**
+ * 显示创建资源表单页.
+ *
+ * @return \think\Response
+ */
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加课题册',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/kt',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存新建的资源
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function save()
+ {
+ // 获取表单数据
+ $list = request()->only(['title','category','lxshijian','lxdanweiid'],'post');
+
+ // 实例化验证模型
+ $validate = new \app\keti\validate\Keti;
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 保存数据
+ $data = keti::create($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 显示指定的资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function read($id)
+ {
+
+ }
+
+ /**
+ * 显示编辑资源表单页.
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function edit($id)
+ {
+ // 获取荣誉册信息
+ $list['data'] = keti::where('id',$id)
+ ->field('id,title,category,lxshijian,lxdanweiid')
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑课题册',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/kt/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存更新的资源
+ *
+ * @param \think\Request $request
+ * @param int $id
+ * @return \think\Response
+ */
+ public function update($id)
+ {
+ // 获取表单数据
+ $list = request()->only(['title','category','lxshijian','lxdanweiid'],'put');
+ $list['id'] = $id;
+
+
+ // 实例化验证类
+ $validate = new \app\keti\validate\Keti;
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $data = keti::update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = keti::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置荣誉状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学生信息
+ $data = keti::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+}
diff --git a/app/keti/controller/KetiInfo.php b/app/keti/controller/KetiInfo.php
new file mode 100644
index 00000000..af77eb7d
--- /dev/null
+++ b/app/keti/controller/KetiInfo.php
@@ -0,0 +1,592 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ /**
+ * 显示指定的资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function ketiList($ketice)
+ {
+
+ $kt = new \app\keti\model\Keti;
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = $kt->where('id',$ketice)->value('title').' 列表';
+ $list['ketice'] = $ketice;
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+
+ /**
+ * 显示课题信息列表
+ *
+ * @return \think\Response
+ */
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'lxdanweiid'=>array(),
+ 'lxcategory'=>array(),
+ 'fzdanweiid'=>array(),
+ 'subject'=>array(),
+ 'category'=>array(),
+ 'jddengji'=>array(),
+ 'ketice'=>'',
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $ktinfo = new ktinfo;
+
+ // 查询要显示的数据
+ $data = $ktinfo->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+
+ /**
+ * 显示创建资源表单页.
+ *
+ * @return \think\Response
+ */
+ public function create($ketice=0)
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加课题册',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/ktinfo',
+ 'ketice'=>$ketice
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存新建的资源
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function save()
+ {
+ // 获取表单数据
+ $list = request()->only(['ketice','title','bianhao','fzdanweiid','subject','category','jhjtshijian','hjteachers'],'POST');
+
+
+ // 实例化验证类
+ $validate = new \app\keti\validate\KetiInfo;
+ // 验证表单数据
+ $result = $validate->scene('add')->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+
+ // 更新数据
+ $data = ktinfo::create($list);
+
+ // 声明教师数组
+ $teacherlist = [];
+ // 循环组成获奖教师信息
+ foreach ($list['hjteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 1,
+ ];
+ }
+
+
+ // 添加新的获奖人与参与人信息
+ $cy = $data->ktZcr()->saveAll($canyulist);
+
+ // 根据更新结果设置返回提示信息
+ if($cy){
+ $data=['msg'=>'添加成功','val'=>1];
+ }else{
+ $data=['msg'=>'数据处理错误','val'=>0];
+ $data->delete(true);
+ }
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 批量上传立项通知书
+ public function createAll($ketice)
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'批量添加课题信息',
+ 'butname'=>'批传',
+ 'formpost'=>'POST',
+ 'url'=>'/ktinfoaddall/'.$ketice,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 批量保存图片
+ public function saveall($ketice)
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file);
+
+ if($data['val'] != 1)
+ {
+ $data=['msg'=>'添加失败','val'=>0];
+ }
+
+ $data = ktinfo::create([
+ 'lxpic'=>$data['url']
+ ,'title'=>'批传立项'
+ ,'ketice'=>$ketice
+ ]);
+
+ $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ return json($data);
+ }
+
+
+ /**
+ * 上传荣誉图片并保存
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function upload()
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file);
+
+ return json($data);
+ }
+
+
+ /**
+ * 显示指定的资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function read($id)
+ {
+ //
+ }
+
+ /**
+ * 显示编辑资源表单页.
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function edit($id)
+ {
+ // 获取课题信息
+ $list['data'] = ktinfo::where('id',$id)
+ ->field('id,title,fzdanweiid,bianhao,subject,category,jhjtshijian,lxpic')
+ ->with([
+ 'ktZcr'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with([
+ 'teacher'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ },
+ ])
+ ->find();
+
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑课题',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/ktinfo/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存更新的资源
+ *
+ * @param \think\Request $request
+ * @param int $id
+ * @return \think\Response
+ */
+ public function update($id)
+ {
+ // 获取表单数据
+ $list = request()->only(['title','bianhao','fzdanweiid','subject','category','jhjtshijian','hjteachers','lxpic'],'PUT');
+ $list['id'] = $id;
+
+
+ // 实例化验证类
+ $validate = new \app\keti\validate\KetiInfo;
+ // 验证表单数据
+ $result = $validate->scene('edit')->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+
+ // 更新数据
+ $data = ktinfo::update($list);
+
+ // 删除原来的获奖人与参与人信息
+ $data->ktZcr()->delete(true);
+ // 声明教师数组
+ $teacherlist = [];
+ // 循环组成获奖教师信息
+ foreach ($list['hjteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 1,
+ ];
+ }
+
+
+ // 添加新的获奖人与参与人信息
+ $data = $data->ktZcr()->saveAll($canyulist);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = ktinfo::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置荣誉状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学生信息
+ $data = ktinfo::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 结题页面
+ public function jieTi($id)
+ {
+ // 获取课题信息
+ $list['data'] = ktinfo::where('id',$id)
+ ->field('id,title,jddengji,jtshijian,jtpic')
+ ->with([
+ 'ktCy'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ ])
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑结题',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/ktjt/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+
+ // 更新结题信息
+ public function jtUpdate($id)
+ {
+ // 获取表单数据
+ $list = request()->only(['jtpic','jddengji','jtshijian','cyteachers'],'PUT');
+ $list['id'] = $id;
+
+
+ // 实例化验证类
+ $validate = new \app\keti\validate\KetiInfo;
+ // 验证表单数据
+ $result = $validate->scene('jieti')->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+
+ // 更新数据
+ $data = ktinfo::update($list);
+
+ // 删除原来的获奖人与参与人信息
+ $data->ktCy()->delete(true);
+ // 声明教师数组
+ $teacherlist = [];
+ // 循环组成获奖教师信息
+ foreach ($list['cyteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 2,
+ ];
+ }
+
+
+ // 添加新的获奖人与参与人信息
+ $data = $data->ktCy()->saveAll($canyulist);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+
+
+ }
+
+
+ /**
+ * 上传荣誉图片并保存
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function jtupload()
+ {
+
+ // 获取表单上传文件 例如上传了001.jpg
+ $file = request()->file('file');
+ // 移动到框架应用根目录/uploads/ 目录下
+ $info = $file->validate(['size'=>2*1024*1024,'ext'=>'jpg,png,gif,jpeg'])->move('uploads\keti\jieti');
+
+ if($info){
+ // 成功上传后 获取上传信息
+ $list['url'] = $info->getSaveName();
+ $list['url'] = str_replace('\\','/',$list['url']);
+ // 如果图片上传成功,则返回
+ $data = array('msg'=>'上传成功','val'=>true,'url'=>$list['url']);
+ }else{
+ // 上传失败获取错误信息
+ $data = array('msg'=>$file->getError(),'val'=>false,'url'=>null);
+ }
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 下载课题信息表
+ public function outXlsx($ketice)
+ {
+ $ketiinfo = new ketiinfo();
+ $list = $ketiinfo->srcTuceRy($ketice);
+
+ halt($list);
+
+ if($list->isEmpty())
+ {
+ $this->error('兄弟,没有要下载的信息呀~');
+ return '';
+ }else{
+ $filename = $list[0]['ryTuce']['title'];
+ $fzschool = $list[0]['ryTuce']['fz_school']['title'];
+ $fzshijian = strtotime($list[0]['ryTuce']['fzshijian']);
+ $fzshijian = date('Ym',$fzshijian);
+ }
+
+ //通过工厂模式创建内容
+ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load('jsRongyu.xlsx');
+ $worksheet = $spreadsheet->getActiveSheet();
+
+ $worksheet->getCell('A1')->setValue($filename);
+ $worksheet->getCell('A2')->setValue('发证单位:'.$fzschool);
+ $worksheet->getCell('G2')->setValue('发证时间:'.$list[0]['ryTuce']['fzshijian']);
+ // 循环为excel每行赋值
+ foreach ($list as $key => $value) {
+ $myrowid = $key + 4;
+ $worksheet->getCell('A'.$myrowid)->setValue($key+1);
+ $worksheet->getCell('B'.$myrowid)->setValue($value->title);
+ $worksheet->getCell('C'.$myrowid)->setValue($value->hjJsName);
+ if($value->hj_school){
+ $worksheet->getCell('D'.$myrowid)->setValue($value->hj_school->jiancheng);
+ }
+ if($value->ry_subject){
+ $worksheet->getCell('E'.$myrowid)->setValue($value->ry_subject->title);
+ }
+ $worksheet->getCell('F'.$myrowid)->setValue($value->cyJsName);
+ if($value->jx_category){
+ $worksheet->getCell('G'.$myrowid)->setValue($value->jx_category->title);
+ }
+ $worksheet->getCell('H'.$myrowid)->setValue($value->bianhao);
+ }
+
+ // 给单元格加边框
+ $styleArray = [
+ 'borders' => [
+ 'allBorders' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['argb' => '00000000'],
+ ],
+ ],
+ ];
+
+ if($key+4>9)
+ {
+
+ $worksheet->getStyle('A10:I'.($key+4))->applyFromArray($styleArray);
+ // 设置行高
+ for($i = 10; $i<=($key+4); $i++){
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ }
+
+ }
+
+ $worksheet->getStyle('A4')->applyFromArray($styleArray);
+
+
+ //告诉浏览器输出07Excel文件
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ //告诉浏览器输出浏览器名称
+ header('Content-Disposition: attachment;filename="'. $filename .$fzshijian.'.xlsx"');
+ //禁止缓存
+ header('Cache-Control: max-age=0');
+ $writer = new Xlsx($spreadsheet);
+ $writer->save('php://output');
+ // ob_end_clean();
+ // ob_start();
+ // 释放内存
+ $spreadsheet->disconnectWorksheets();
+ unset($spreadsheet);
+
+ // return '下载后请关闭窗口';
+ }
+
+
+
+}
diff --git a/app/keti/model/Keti.php b/app/keti/model/Keti.php
new file mode 100644
index 00000000..4489eb3e
--- /dev/null
+++ b/app/keti/model/Keti.php
@@ -0,0 +1,104 @@
+order([$src['field'] =>$src['type']])
+ ->when(count($lxdanweiid)>0,function($query) use($lxdanweiid){
+ $query->where('lxdanweiid','in',$lxdanweiid);
+ })
+ ->when(count($category)>0,function($query) use($category){
+ $query->where('category','in',$category);
+ })
+ ->when(strlen( $searchval)>0,function($query) use( $searchval){
+ $query->where('title','like', $searchval);
+ })
+ ->with(
+ [
+ 'ktCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ktLxdanwei'=>function($query){
+ $query->field('id,title');
+ },
+ ]
+ )
+ ->withCount(['ktInfo'=>'lxcount'],'id')
+ ->withCount(['ktInfo'=>function($query){
+ $query->where('jddengji','between',[1,2]);
+ }])
+ ->select();
+
+
+ return $data;
+ }
+
+
+ // 类型关联
+ public function ktCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','category','id');
+ }
+
+
+ // 立项单位关联
+ public function ktLxdanwei()
+ {
+ return $this->belongsTo('\app\system\model\School','lxdanweiid','id');
+ }
+
+
+ // 课题信息关联
+ public function ktInfo()
+ {
+ return $this->hasMany('KetiInfo','ketice','id');
+ }
+
+
+ // 立项时间获取器
+ public function getLxshijianAttr($value)
+ {
+ if ($value>0)
+ {
+ $value = date('Y-m-d',$value);
+ }else{
+ $value = "";
+ }
+ return $value;
+ }
+
+
+ // 立项时间
+ public function setLxshijianAttr($value)
+ {
+ return strtotime($value);
+ }
+
+
+ // 课题数量
+ public function getKtcntAttr()
+ {
+ return $this->ktInfo->count();
+ }
+
+
+ // 结题课题数量
+ public function getJtcntAttr()
+ {
+ return $this->ktInfo->where('jddengji','>',0)->where('jtshijian','>',0)->count();
+ }
+}
diff --git a/app/keti/model/KetiCanyu.php b/app/keti/model/KetiCanyu.php
new file mode 100644
index 00000000..b17285c7
--- /dev/null
+++ b/app/keti/model/KetiCanyu.php
@@ -0,0 +1,20 @@
+belongsTo('\app\keti\model\Keti','ketiinfoid','id');
+ }
+
+ // 教师关联
+ public function teacher()
+ {
+ return $this->belongsTo('\app\renshi\model\Teacher','teacherid','id');
+ }
+}
diff --git a/app/keti/model/KetiInfo.php b/app/keti/model/KetiInfo.php
new file mode 100644
index 00000000..fcf615aa
--- /dev/null
+++ b/app/keti/model/KetiInfo.php
@@ -0,0 +1,244 @@
+order([$src['field'] =>$src['type']])
+ ->when(count($lxdanweiid)>0,function($query) use($lxdanweiid){
+ $query->where('ketice','in',function ($q) use($lxdanweiid){
+ $q->name('keti')->where('lxdanweiid','in',$lxdanweiid)->field('id');
+ });
+ })
+ ->when(count($lxcategory)>0,function($query) use($lxcategory){
+ $query->where('ketice','in',function($q) use($lxcategory){
+ $q->name('keti')->where('category','in',$lxcategory)->field('id');
+ });
+ })
+ ->when(count($fzdanweiid)>0,function($query) use($fzdanweiid){
+ $query->where('fzdanweiid','in',$fzdanweiid);
+ })
+ ->when(count($subject)>0,function($query) use($subject){
+ $query->where('subject','in',$subject);
+ })
+ ->when(count($category)>0,function($query) use($category){
+ $query->where('category','in',$category);
+ })
+ ->when(count($jddengji)>0,function($query) use($jddengji){
+ $query->where('jddengji','in',$jddengji);
+ })
+ ->when(strlen($ketice)>0,function($query) use($ketice){
+ $query->where('ketice',$ketice);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title','like',$searchval);
+ })
+ ->with(
+ [
+ 'fzSchool'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'KtCe'=>function($query){
+ $query->field('id,lxdanweiid,category,lxshijian')
+ ->with([
+ 'ktCategory' => function($q){
+ $q->field('id,title');
+ },
+ 'ktLxdanwei' => function($q){
+ $q->field('id,jiancheng');
+ }
+ ]);
+ },
+ 'ktCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ktSubject'=>function($query){
+ $query->field('id,title');
+ },
+ 'ktZcr'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with([
+ 'teacher'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ },
+ 'ktCy'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with([
+ 'teacher'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ }
+ ])
+ ->select();
+
+
+ return $data;
+ }
+
+
+ //搜索课题册
+ public function srcketi($ketice)
+ {
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->where('ketice',$ketice)
+ ->with(
+ [
+ 'fzSchool'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'KtCe'=>function($query){
+ $query->field('id,lxdanweiid,category,lxshijian')
+ ->with([
+ 'ktCategory' => function($q){
+ $q->field('id,title');
+ },
+ 'ktLxdanwei' => function($q){
+ $q->field('id,jiancheng');
+ }
+ ]);
+ },
+ 'ktCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ktSubject'=>function($query){
+ $query->field('id,title');
+ },
+ 'ktZcr'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with([
+ 'teacher'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ },
+ 'ktCy'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with([
+ 'teacher'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ }
+ ]
+ )
+ ->select();
+
+
+ return $data;
+ }
+
+
+ // 课题主持人关联
+ public function ktZcr()
+ {
+ return $this->hasMany('\app\keti\model\KetiCanyu','ketiinfoid','id')->where('category',1);
+ }
+ // 课题参与人关联
+ public function ktCy()
+ {
+ return $this->hasMany('\app\keti\model\KetiCanyu','ketiinfoid','id')->where('category',2);
+ }
+
+ // 立项单位关联
+ public function fzSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','fzdanweiid','id');
+ }
+
+
+ // 研究类型关联
+ public function ktCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','category','id');
+ }
+
+
+ // 所属学科关联
+ public function ktSubject()
+ {
+ return $this->belongsTo('\app\system\model\Category','subject','id');
+ }
+
+
+ // 课题册关联
+ public function ktCe()
+ {
+ return $this->belongsTo('\app\keti\model\Keti','ketice','id');
+ }
+
+
+
+ // 结题等级获取器
+ public function getJddengjiAttr($value)
+ {
+ // 结题数组
+ $jtdj = array('0'=>'研究中','1'=>'合格','2'=>'优秀','3'=>'流失');
+ // 获取结题鉴定等级
+ $str = $jtdj[$value];
+ // 返回结题等级
+ return $str;
+ }
+
+
+
+ // 计划结题时间修改器
+ public function setJhjtshijianAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 计划结题时间获取器
+ public function getJhjtshijianAttr($value)
+ {
+ if ($value>0)
+ {
+ $value = date('Y-m-d',$value);
+ }else{
+ $value = "";
+ }
+ return $value;
+ }
+
+ // 结题时间修改器
+ public function setJtshijianAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 结题时间获取器
+ public function getJtshijianAttr($value)
+ {
+ if ($value>0)
+ {
+ $value = date('Y-m-d',$value);
+ }else{
+ $value = "";
+ }
+ return $value;
+ }
+
+
+
+
+}
diff --git a/app/keti/validate/Keti.php b/app/keti/validate/Keti.php
new file mode 100644
index 00000000..4ac222aa
--- /dev/null
+++ b/app/keti/validate/Keti.php
@@ -0,0 +1,29 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|课题册标题' => 'require|length:1,30',
+ 'category|课题类型' => 'require|number',
+ 'lxshijian|立项时间' => 'require|date',
+ 'lxdanweiid|立项单位' => 'require|number',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/keti/validate/KetiInfo.php b/app/keti/validate/KetiInfo.php
new file mode 100644
index 00000000..fd10c444
--- /dev/null
+++ b/app/keti/validate/KetiInfo.php
@@ -0,0 +1,45 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'id|请先上传立项通知书图片' => 'require',
+ 'ketice|课题册ID丢失' => 'require',
+ 'title|课题名称' => 'require|length:1,60',
+ 'bianhao|课题编号' => 'require|length:1,11',
+ 'hjteachers|课题主持人' => 'require|array',
+ 'fzdanweiid|课题负责单位' => 'require|number',
+ 'subject|课题所属学科' => 'require|number',
+ 'category|课题研究类型' => 'require|number',
+ 'jhjtshijian|计划结题时间' => 'require|date',
+ 'cyteachers|参与人' => 'array',
+ 'jtpic|结题鉴定图片' => 'length:1,100',
+ 'jtshijian|结题时间' => 'require|date',
+ 'jddengji|鉴定等级' => 'require|number',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+
+ // 验证场景
+ protected $scene = [
+ 'add' => ['ketice','title','bianhao','fzdanweiid','subject','category','jhjtshijian','hjteachers'],
+ 'edit' => ['id','title','hjteachers','hjschool','subject','hjshijian','jiangxiang'],
+ 'jieti' => ['id','jtpic','jddengji','jtshijian','cyteachers'],
+ ];
+}
diff --git a/app/keti/view/index/create.html b/app/keti/view/index/create.html
new file mode 100644
index 00000000..f00f31e8
--- /dev/null
+++ b/app/keti/view/index/create.html
@@ -0,0 +1,84 @@
+{extend name="common@create" /}
+{block name="jscss"}
+{/block}
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+
+{/block}
+
diff --git a/app/keti/view/index/index.html b/app/keti/view/index/index.html
new file mode 100644
index 00000000..7e70dc2c
--- /dev/null
+++ b/app/keti/view/index/index.html
@@ -0,0 +1,131 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 课题管理
+ 课题册
+
+{/block}
+{block name="search"}
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/keti/view/keti_info/create.html b/app/keti/view/keti_info/create.html
new file mode 100644
index 00000000..9ede2800
--- /dev/null
+++ b/app/keti/view/keti_info/create.html
@@ -0,0 +1,244 @@
+{extend name="common@create" /}
+{block name="jscss"}
+
+{/block}
+{block name="form"}
+
+
+{/block}
+
+{block name="myjs"}
+
+
+{/block}
+
diff --git a/app/keti/view/keti_info/create_all.html b/app/keti/view/keti_info/create_all.html
new file mode 100644
index 00000000..c902f834
--- /dev/null
+++ b/app/keti/view/keti_info/create_all.html
@@ -0,0 +1,43 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/keti/view/keti_info/index.html b/app/keti/view/keti_info/index.html
new file mode 100644
index 00000000..adc5e2e6
--- /dev/null
+++ b/app/keti/view/keti_info/index.html
@@ -0,0 +1,159 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 课题管理
+ 课题册
+ 课题列表
+
+{/block}
+{block name="search"}
+
+
+
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/keti/view/keti_info/jie_ti.html b/app/keti/view/keti_info/jie_ti.html
new file mode 100644
index 00000000..ff65894d
--- /dev/null
+++ b/app/keti/view/keti_info/jie_ti.html
@@ -0,0 +1,207 @@
+{extend name="common@create" /}
+{block name="jscss"}
+
+{/block}
+{block name="form"}
+
+
+{/block}
+
+{block name="myjs"}
+
+
+{/block}
+
diff --git a/app/keti/view/keti_info/keti_list.html b/app/keti/view/keti_info/keti_list.html
new file mode 100644
index 00000000..a8b5a6b4
--- /dev/null
+++ b/app/keti/view/keti_info/keti_list.html
@@ -0,0 +1,203 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 课题管理
+ 课题册
+ 课题列表
+
+{/block}
+{block name="search"}
+
+
+
+
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/login/controller/Error.php b/app/login/controller/Error.php
new file mode 100644
index 00000000..342e6341
--- /dev/null
+++ b/app/login/controller/Error.php
@@ -0,0 +1,20 @@
+error('不好意思,您访问的页面不存在~');
+ }
+
+ public function _empty()
+ {
+ $this->error('不好意思,您访问的页面不存在~');
+ }
+}
diff --git a/app/login/controller/Index.php b/app/login/controller/Index.php
new file mode 100644
index 00000000..a6b35841
--- /dev/null
+++ b/app/login/controller/Index.php
@@ -0,0 +1,144 @@
+only(['username','password','captcha']);
+
+ // 验证表单数据
+ try {
+ validate(Yanzheng::class)->check($data);
+ } catch (ValidateException $e) {
+ // 验证失败 输出错误信息
+ $data=['msg'=>$e->getError(),'status'=>0];
+ return json($data);
+ }
+
+ // 验证用户名和密码
+ $check = $this->check($data['username'],$data['password']);
+
+ if($check['status']==1)
+ {
+
+ // 设置cookie值
+ if( request()->post('online') == true )
+ {
+ // 设置
+ cookie('userid', session('userid') ,259200);
+ cookie('username', $data['username'] ,259200);
+ cookie('password', $data['password'] ,259200);
+ }
+
+ // 将本次信息上传到服务器上
+ $userinfo = AD::where('username',$data['username'])
+ ->field('lastip,username,ip,denglucishu,lasttime,thistime')
+ ->find();
+ $userinfo->lastip = $userinfo->ip;
+ $userinfo->ip = request()->ip();
+ $userinfo->denglucishu = ['inc', 1];
+ $userinfo->lasttime = $userinfo->getData('thistime');
+ $userinfo->thistime = time();
+ $userinfo->save();
+
+ // 跳转到首页
+ $data=['msg'=>'验证成功','status'=>1];
+ }else{
+ // 提示错误信息
+ $data=['msg'=>$check['msg'],'status'=>0];
+ }
+
+ return json($data);
+ }
+
+
+ // 已知密码进行验证
+ public function check($username,$password)
+ {
+ // 实例化加密类
+ $md5 = new APR1_MD5();
+
+ // 获取服务器密码
+ $userinfo = AD::where('username',$username)->where('status',1)->find();
+
+ if($userinfo == null)
+ {
+
+ // 清除session(当前作用域)
+ session(null);
+ // 验证结果;
+ $data=['msg'=>'用户名不存在或被禁用','status'=>0];
+ return $data;
+ }
+
+
+ //验证密码
+ $check = $md5->check($password,$userinfo->password);
+
+ if($check)
+ {
+ session(null);
+ session('userid', $userinfo->id);
+ session('username', $username);
+ session('password', $password);
+ $data=['msg'=>'验证成功','status'=>1];
+ }else{
+ // 清除cookie
+ cookie('userid', null);
+ cookie('username', null);
+ cookie('password', null);
+ // 清除session(当前作用域)
+ session(null);
+ $data=['msg'=>'用户名或密码错误','status'=>0];
+ }
+ return $data;
+ }
+
+}
diff --git a/app/login/route/app.php b/app/login/route/app.php
new file mode 100644
index 00000000..c00c6381
--- /dev/null
+++ b/app/login/route/app.php
@@ -0,0 +1,14 @@
+
+// +----------------------------------------------------------------------
+use think\facade\Route;
+
+Route::get('/','index/index');
+Route::post('/','index/yanzheng');
diff --git a/app/login/validate/Yanzheng.php b/app/login/validate/Yanzheng.php
new file mode 100644
index 00000000..d9044341
--- /dev/null
+++ b/app/login/validate/Yanzheng.php
@@ -0,0 +1,24 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'username|用户名' => 'require',
+ 'password|密码' => 'require',
+ 'captcha|验证码'=>'require|captcha',
+ ];
+
+ protected $message = [
+
+ ];
+}
diff --git a/app/login/view/index/index.html b/app/login/view/index/index.html
new file mode 100644
index 00000000..d5c9b361
--- /dev/null
+++ b/app/login/view/index/index.html
@@ -0,0 +1,71 @@
+
+
+
+
+
小学生成绩管理平台 v{$list['version']}
+
+
+
+
+ {load href="/static/xadmin/css/font.css" /}
+ {load href="/static/xadmin/css/xadmin.css" /}
+ {load href="/static/xadmin/js/jquery.min.js" /}
+ {load href="/static/xadmin/lib/layui/layui.js" /}
+ {load href="/static/xadmin/js/xadmin.js" /}
+ {load href="/static/xadmin/js/cookie.js" /}
+
+
+
+
+
+
成绩管理v{$list['version']}-管理登录
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/middleware.php b/app/middleware.php
new file mode 100644
index 00000000..32d02ce9
--- /dev/null
+++ b/app/middleware.php
@@ -0,0 +1,10 @@
+ Request::class,
+ 'think\exception\Handle' => ExceptionHandle::class,
+];
diff --git a/app/renshi/common.php b/app/renshi/common.php
new file mode 100644
index 00000000..b9d2bde1
--- /dev/null
+++ b/app/renshi/common.php
@@ -0,0 +1,66 @@
+where('title',$str)->value('id');
+
+ return $subjectId;
+}
+
+// 查找职务
+function srcZw($str)
+{
+ // 实例化类型数据模型
+ $category = new \app\system\model\Category;
+
+ // 查询学科id
+ $categoryId = $category->where('pid',107)->where('title',$str)->value('id');
+
+ return $categoryId;
+}
+
+
+// 查找学历
+function srcXl($str)
+{
+ // 实例化类型数据模型
+ $category = new \app\system\model\Category;
+
+ // 查询学科id
+ $categoryId = $category->where('pid',105)->where('title',$str)->value('id');
+
+ return $categoryId;
+}
+
+// 查找职称
+function srcZc($str)
+{
+ // 实例化类型数据模型
+ $category = new \app\system\model\Category;
+
+ // 查询学科id
+ $categoryId = $category->where('pid',106)->where('title',$str)->value('id');
+
+ return $categoryId;
+}
+
diff --git a/app/renshi/controller/Error.php b/app/renshi/controller/Error.php
new file mode 100644
index 00000000..7db451b5
--- /dev/null
+++ b/app/renshi/controller/Error.php
@@ -0,0 +1,11 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ /**
+ * 显示教师信息列表
+ *
+ * @return \think\Response
+ */
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'zhiwu'=>array(),
+ 'danwei'=>array(),
+ 'xueli'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $teacher = new Teacher;
+
+ // 查询要显示的数据
+ $data = $teacher->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+ // 创建教师
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加教师',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/teacher',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\renshi\validate\Teacher;
+
+
+ // 获取表单数据
+ $list = request()->only(['xingming','sex','quanpin','shoupin','shengri','zhiwu','zhicheng','xueli','biye','worktime','zhuanye','danwei'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ $list['quanpin'] = strtolower(str_replace(' ', '', $list['quanpin']));
+ $list['shoupin'] = strtolower($list['shoupin']);
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 保存数据
+ $data = Teacher::create($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ // 查看教师信息
+ public function read($id)
+ {
+
+ // 查询教师信息
+ $myInfo = Teacher::where('id',$id)
+ ->with(
+ [
+ 'jsDanwei'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsZhiwu'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsZhicheng'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsXueli'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsSubject'=>function($query){
+ $query->field('id,title');
+ },
+ ]
+ )
+ ->append(['age','gongling'])
+ ->limit(1)
+ ->select();
+ $myInfo = $myInfo[0];
+ // 设置页面标题
+ $myInfo['webtitle'] = $myInfo->xingming.'信息';
+
+ // 模板赋值
+ $this->assign('list',$myInfo);
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+
+
+ // 修改教师信息
+ public function edit($id)
+ {
+
+ // 获取教师信息
+ $list['data'] = Teacher::field('id,xingming,sex,quanpin,shoupin,shengri,zhiwu,zhicheng,xueli,biye,worktime,zhuanye,danwei')
+ ->find($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑教师',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/teacher/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+
+
+ // 更新教师信息
+ public function update($id)
+ {
+ $validate = new \app\renshi\validate\Teacher;
+
+ // 获取表单数据
+ $list = request()->only(['xingming','sex','quanpin','shoupin','shengri','zhiwu','zhicheng','xueli','biye','worktime','zhuanye','danwei'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ $list['quanpin'] = strtolower(str_replace(' ', '', $list['quanpin']));
+ $list['shoupin'] = strtolower($list['shoupin']);
+ // 更新数据
+ $teacher = new Teacher();
+ $data = $teacher->save($list,['id'=>$id]);
+ // $data = Teacher::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除教师
+ public function delete($id)
+ {
+
+ if($id == 'm'){
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = Teacher::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置教师状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取教师信息
+ $data = Teacher::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ // 批量添加
+ public function createAll()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'批量上传教师信息',
+ 'butname'=>'批传',
+ 'formpost'=>'POST',
+ 'url'=>'/teacher/createall',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 批量保存
+ public function saveAll()
+ {
+ // 获取表单数据
+ $list = request()->only(['school','url'],'post');
+
+ // 实例化操作表格类
+ $excel = new \app\renshi\controller\Myexcel;;
+
+ // 读取表格数据
+ $teacherinfo = $excel->readXls($list['url']);
+
+ // 判断表格是否正确
+ if($teacherinfo[0][1] != "教师基本情况表" )
+ {
+ $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null);
+ return json($data);
+ }
+
+ // 删除标题行
+ array_splice($teacherinfo,0,4 );
+
+ // 整理数据
+ $i = 0;
+ $teacherlist = array();
+
+ foreach ($teacherinfo as $key => $value) {
+ // 如果姓名、性别、出生日期、全拼、首拼为空则跳过
+ if(empty($value[1]) || empty($value[2]) || empty($value[3]) || empty($value[11]) || empty($value[12]))
+ {
+ continue;
+ }
+
+ // 整理数据
+ $teacherlist[$i]['xingming'] = $value[1];
+ $teacherlist[$i]['sex'] = srcSex($value[2]);
+ $teacherlist[$i]['shengri'] = $value[3];
+ $teacherlist[$i]['worktime'] = $value[4];
+ $teacherlist[$i]['zhiwu'] = srcZw($value[5]);
+ $teacherlist[$i]['zhicheng'] = srcZc($value[6]);
+ $teacherlist[$i]['danwei'] = $list['school'];
+ $teacherlist[$i]['biye'] = $value[8];
+ $teacherlist[$i]['subject'] = srcSubject($value[7]);
+ $teacherlist[$i]['zhuanye'] = $value[9];
+ $teacherlist[$i]['xueli'] = srcXl($value[10]);
+ $teacherlist[$i]['quanpin'] = strtolower(str_replace(' ', '', $value[11]));
+ $teacherlist[$i]['shoupin'] = strtolower($value[12]);
+
+ $i++;
+ }
+
+ // 实例化学生信息数据模型
+ $teacher = new Teacher();
+
+ // dump($teacherinfo[0]);
+
+ // 保存或更新信息
+ $data = $teacher->saveAll($teacherlist);
+
+ // 返回添加结果
+ $data ? $data = ['msg'=>'数据上传成功','val'=>1] : ['msg'=>'数据上传失败','val'=>0];
+
+ return json($data);
+ }
+
+ // 根据教师姓名、首拼、全拼搜索教师信息
+ public function srcTeacher($str="")
+ {
+ // 声明结果数组
+ $data = array();
+
+ // 判断是否存在数据,如果没有数据则返回。
+ if(strlen($str) <= 0){
+ return json($data);
+ }
+
+ // 如果有数据则查询教师信息
+ $list = Teacher::field('id,xingming,danwei,shengri,sex')
+ ->whereOr('xingming|quanpin|shoupin','like','%'.$str.'%')
+ ->with(
+ [
+ 'jsDanwei'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ ]
+ )
+ ->append(['age'])
+ ->all();
+ return json($list);
+ }
+
+ // 上传文件
+ public function upload()
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file,true);
+
+ return json($data);
+ }
+
+
+ // 下载表格模板
+ public function download()
+ {
+ $download = new \think\response\Download('uploads\teacher\TeacherInfo.xlsx');
+ return $download->name('TeacherInfo.xlsx');
+ }
+
+ // 下载表格VBA代码
+ public function downloadVba()
+ {
+ $download = new \think\response\Download('uploads\teacher\jiaoShiXingMingVBA.bas');
+ return $download->name('TeacherVBA');
+ }
+
+
+ // 查询教师荣誉
+ public function srcRy($teacherid)
+ {
+ // 实例化荣誉数据模型
+ $ry = new \app\rongyu\model\JsRongyuInfo;
+
+ // 查询荣誉信息
+ $data = $ry->where('status',1)
+ ->where('id','in',function($query) use($teacherid){
+ $query->name('jsRongyuCanyu')
+ ->where('teacherid',$teacherid)
+ ->field('rongyuid');
+ })
+ ->with(
+ [
+ 'jxCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ryTuce'=>function($query){
+ $query->field('id,title,fzschool,category')
+ ->with([
+ 'fzSchool'=>function($query){
+ $query->field('id,jiancheng,jibie')
+ ->with(['dwJibie'=>function($q){
+ $q->field('id,title');
+ }]);
+ },
+ 'lxCategory'=>function($query){
+ $query->field('id,title');
+ },
+
+ ]);
+ },
+ 'hjJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ ])
+ ->field('id,rongyuce,jiangxiang,hjshijian,title')
+ ->order('hjshijian')
+ ->select();
+
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+ // 查询教师课题
+ public function srcKt($teacherid)
+ {
+ // 实例化荣誉数据模型
+ $ry = new \app\keti\model\KetiInfo;
+
+ // 查询荣誉信息
+ $data = $ry->where('status',1)
+ ->where('id','in',function($query) use($teacherid){
+ $query->name('KetiCanyu')
+ ->where('teacherid',$teacherid)
+ ->field('ketiinfoid');
+ })
+ ->with(
+ [
+ 'fzSchool'=>function($query){
+ $query->field('id,jiancheng,jibie')
+ ->with(['dwJibie'=>function($q){
+ $q->field('id,title');
+ }]);
+ },
+ 'ktCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ktZcr'=>function($query){
+ $query->field('ketiinfoid,teacherid')
+ ->with([
+ 'teacher'=>function($q){
+ $q->field('id,xingming');
+ }
+ ]);
+ }
+ ])
+ ->field('id,title,fzdanweiid,category,jddengji')
+ ->order('id')
+ ->select();
+
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+}
diff --git a/app/renshi/controller/Myexcel.php b/app/renshi/controller/Myexcel.php
new file mode 100644
index 00000000..a26d5c7f
--- /dev/null
+++ b/app/renshi/controller/Myexcel.php
@@ -0,0 +1,28 @@
+setInputEncoding('GBK');
+ $excelReader->setDelimiter(',');
+ }
+ $phpexcel = $excelReader->load($path);
+ $activeSheet = $phpexcel->getActiveSheet();
+ $sheet = $activeSheet->toArray();
+ return $sheet;
+ }
+}
diff --git a/app/renshi/controller/Student.php b/app/renshi/controller/Student.php
new file mode 100644
index 00000000..74b6ef7c
--- /dev/null
+++ b/app/renshi/controller/Student.php
@@ -0,0 +1,519 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取学生信息列表
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'school'=>array(),
+ 'ruxuenian'=>array(),
+ 'paixu'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+ $ruxuenian = $src['ruxuenian'];
+ $paixu = $src['paixu'];
+
+ // 实例化班级数据模型
+ $banji = new \app\teach\model\Banji;
+ $src['banji'] = $banji->where('status',1)
+ ->when(count($ruxuenian)>0,function($query) use($ruxuenian){
+ $query->where('ruxuenian','in',$ruxuenian);
+ })
+ ->when(count($paixu)>0,function($query) use($paixu){
+ $query->where('paixu','in',$paixu);
+ })
+ ->column('id');
+
+ // 实例化
+ $stu = new STU;
+
+ // 查询要显示的数据
+ $data = $stu->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+ // 创建学生
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加学生',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/student',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\renshi\validate\Student;
+
+
+ // 获取表单数据
+ $list = request()->only(['xingming','sex','shenfenzhenghao','shengri','school','ruxuenian','banji'],'post');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ $list['shenfenzhenghao'] = strtolower($list['shenfenzhenghao']);
+
+ // 查询数据是否重复
+ $chongfu = STU::withTrashed()->where('shenfenzhenghao',$list['shenfenzhenghao'])->find();
+ // 保存或更新数据
+ $stu = new STU;
+ if($chongfu == Null)
+ {
+ $stu::create($list);
+
+ }else{
+ if($chongfu->delete_time>0)
+ {
+ $chongfu->restore();
+ }
+ $data = $stu->save($list,['id'=>$chongfu->id]);
+ }
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ //
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改学生信息
+ public function edit($id)
+ {
+
+ // 获取学生信息
+ $list['data'] = STU::field('id,xingming,sex,shenfenzhenghao,shengri,banji,school,status')
+ ->with([
+ 'stuBanji'=>function($query){
+ $query->field('id,ruxuenian,paixu')->append(['banTitle']);
+ }
+ ])
+ ->find($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑学生',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/student/'.$id,
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+
+
+ // 更新学生信息
+ public function update($id)
+ {
+ $validate = new \app\renshi\validate\Student;
+
+ // 获取表单数据
+ $list = request()->only(['xingming','sex','shengri','school','shenfenzhenghao','ruxuenian','banji'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $stu = new STU();
+ $data = $stu->save($list,['id'=>$id]);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除学生
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = STU::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置学生状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学生信息
+ $data = STU::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ // 批量添加
+ public function createAll()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'批量上传学生信息',
+ 'butname'=>'批传',
+ 'formpost'=>'POST',
+ 'url'=>'/student/createall',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 批量保存
+ public function saveAll()
+ {
+ // 获取表单数据
+ $list = request()->only(['school','url'],'post');
+
+ // 实例化操作表格类
+ $excel = new Myexcel();
+
+ // 读取表格数据
+ $stuinfo = $excel->readXls($list['url']);
+
+ // 判断表格是否正确
+ if($stuinfo[0][0] != "学生信息上传模板" )
+ {
+ $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null);
+ return json($data);
+ }
+
+ // 删除标题行
+ array_splice($stuinfo,0,3);
+
+ // 实例化班级数据模型
+ $banji = new \app\teach\model\Banji;
+ $njlist = nianjilist();
+ $bjlist = banjinamelist();
+
+
+ $i = 0;
+ $bfbanji = '';
+ $bj = '';
+ $students = array();
+ // 重新计算组合数据,如果存在数据则更新数据
+ foreach ($stuinfo as $key => $value) {
+ // 如果姓名、身份证号为空则跳过
+ if(empty($value[1]) || empty($value[2]))
+ {
+ continue;
+ }
+ // 判断本行班级与上行班级数据是否相等,如果不相等则从数据库查询班级ID
+ if($bfbanji != $value[3])
+ {
+ // 获取入学年与排序
+ $paixu = array_search(substr($value[3],9),$bjlist);
+ $ruxuenian = array_search(substr($value[3],0,9),$njlist);
+ // 查询班级ID
+ $bj = $banji::where('school',$list['school'])
+ ->where('ruxuenian',$ruxuenian)
+ ->where('paixu',$paixu)
+ ->value('id');
+ // 如果班级ID为空,删除数据并跳出当前循环
+ if( empty($bj) )
+ {
+ continue;
+ }
+ }
+ $bfbanji = $value[3];
+
+ // 各变量赋值
+ $students[$i]['banji'] = $bj;
+ $students[$i]['xingming'] = $value[1];
+ $students[$i]['shenfenzhenghao'] = strtolower($value[2]);
+ intval(substr($value[2],16,1) )% 2 ? $students[$i]['sex'] = 1 :$students[$i]['sex'] = 0 ;
+ $students[$i]['shengri'] = substr($value[2],6,4).'-'.substr($value[2],10,2).'-'.substr($value[2],12,2);
+ $students[$i]['school'] = $list['school'];
+ $stuid = STU::withTrashed()->where('shenfenzhenghao',$value[2])->find();
+ if($stuid)
+ {
+ if($stuid->delete_time>0)
+ {
+ $stuid->restore();
+ }
+ if($stuid->status == 0)
+ {
+ $stuid->status = 1;
+ $stuid->save();
+ }
+ $students[$i]['id'] = $stuid->id;
+ }
+ // 销毁无用变量
+ $i++;
+ }
+
+
+ // 实例化学生信息数据模型
+ $student = new STU();
+
+ // 保存或更新信息
+ $data = $student->saveAll($students);
+
+ $data ? $data = ['msg'=>'数据同步成功','val'=>1] : ['msg'=>'数据同步失败','val'=>0];
+
+ return json($data);
+ }
+
+
+
+ // 使用上传的表格进行校对,表格中不存在的数据删除
+ public function Jiaodui()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'校对并删除学生信息',
+ 'butname'=>'校对删除',
+ 'formpost'=>'POST',
+ 'url'=>'/student/jiaodui',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create_all');
+ }
+
+
+ // 使用上传的表格进行校对,表格中不存在的数据删除
+ public function JiaoduiDel()
+ {
+ // 获取表单数据
+ $list = request()->only(['school','url'],'post');
+
+ // 实例化操作表格类
+ $excel = new Myexcel();
+
+ // 读取表格数据
+ $stuinfo = $excel->readXls($list['url']);
+
+ // 判断表格是否正确
+ if($stuinfo[0][0] != "学生信息上传模板" )
+ {
+ $data = array('msg'=>'请使用模板上传','val'=>0,'url'=>null);
+ return json($data);
+ }
+
+ // 删除标题行
+ array_splice($stuinfo,0,3);
+
+ // 实例化班级数据模型
+ $banji = new \app\teach\model\Banji;
+ $njlist = nianjilist();
+ $bjlist = banjinamelist();
+
+
+ $i = 0;
+ $bfbanji = ''; #前一个班级名
+ $bj = ''; #当前班级名
+ $students = array(); #存储整理后学生信息
+ $bjarr = array(); #储存电子表格中包含的班级
+ // 重新计算组合数据,如果存在数据则更新数据
+ foreach ($stuinfo as $key => $value) {
+ // 如果姓名、身份证号为空则跳过
+ if(empty($value[1]) || empty($value[2]))
+ {
+ continue;
+ }
+ // 判断本行班级与上行班级数据是否相等,如果不相等则从数据库查询班级ID
+ if($bfbanji != $value[3])
+ {
+ // 获取入学年与排序
+ $paixu = array_search(substr($value[3],9),$bjlist);
+ $ruxuenian = array_search(substr($value[3],0,9),$njlist);
+ // 查询班级ID
+ $bj = $banji::where('school',$list['school'])
+ ->where('ruxuenian',$ruxuenian)
+ ->where('paixu',$paixu)
+ ->value('id');
+ // 如果班级ID为空,删除数据并跳出当前循环
+ if( empty($bj) )
+ {
+ continue;
+ }
+ array_push($bjarr, $bj);
+ }
+ $bfbanji = $value[3];
+
+
+ // 各变量赋值
+ $students[strtolower($value[2])] = $bj;
+
+ // 销毁无用变量
+ $i++;
+ }
+
+ // 查询数据库中学生的信息
+ // $student = new STU();
+
+ $stulist = STU::where('banji','in',$bjarr)
+ ->where('school',$list['school'])
+ ->field('banji')
+ ->column('id,shenfenzhenghao,school,banji');
+ // 声明要删除学生的ID数组
+ $stuidarr = array();
+
+ // 循环数据库中的学生信息,与电子表格中的信息对比,如果电子表格中不存在,则放数数组中。
+ foreach ($stulist as $key => $value) {
+ if(array_key_exists($value['shenfenzhenghao'],$students)==false){
+ array_push($stuidarr, $value['id']);
+ }else{
+ if($value['banji']!=$students[$value['shenfenzhenghao']])
+ {
+ array_push($stuidarr, $value['id']);
+ }
+ }
+ }
+ // 删除学生信息
+ $data = STU::destroy($stuidarr);
+
+ $data ? $data = ['msg'=>'数据同步成功','val'=>1] : ['msg'=>'数据同步失败','val'=>0];
+
+ return json($data);
+ }
+
+
+
+ // 上传文件
+ public function upload()
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file,true);
+
+ return json($data);
+ }
+
+
+
+ // 下载表格模板
+ public function download()
+ {
+ $download = new \think\response\Download('uploads\student\student_template.xlsx');
+ return $download->name('student_template.xlsx');
+ }
+
+
+
+
+}
diff --git a/app/renshi/model/Student.php b/app/renshi/model/Student.php
new file mode 100644
index 00000000..9e57c912
--- /dev/null
+++ b/app/renshi/model/Student.php
@@ -0,0 +1,98 @@
+belongsTo('\app\teach\model\Banji','banji','id');
+ }
+
+ // 学校获取器
+ public function stuSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','school','id');
+ }
+
+ // 年龄获取器
+ public function getAgeAttr()
+ {
+ if(strlen($this->getData('shengri')) == 0){
+ return '';
+ };
+ return getAgeByBirth($this->getData('shengri'),2);
+ }
+
+
+ // 生日修改器
+ public function setShengriAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 生日获取器
+ public function getShengriAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ // 性别获取器
+ public function getSexAttr($value)
+ {
+ $sex = array('0'=>'女','1'=>'男','2'=>'保密');
+ return $sex[$value];
+ }
+
+
+ // 数据筛选
+ public function search($src)
+ {
+ // 获取参数
+ $school = $src['school'];
+ $banji = $src['banji'];
+ $searchval = $src['searchval'];
+
+
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->when(count($school)>0,function($query) use($school){
+ $query->where('school','in',$school);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('xingming','like','%'.$searchval.'%')->field('id');
+ })
+ ->where('banji','in',$banji)
+ ->with([
+ 'stuSchool'=>function($query){
+ $query->field('id,title');
+ },
+ 'stuBanji'=>function($query){
+ $query->field('id,ruxuenian,paixu')->append(['banjiTitle']);
+ }
+ ])
+ ->field('id,xingming,school,sex,shengri,banji,status')
+ ->append(['age'])
+ ->select();
+
+ return $data;
+ }
+
+
+ // 获取全部数据
+ public function searchAll()
+ {
+ return $this->select();
+ }
+
+
+
+
+
+}
diff --git a/app/renshi/model/Teacher.php b/app/renshi/model/Teacher.php
new file mode 100644
index 00000000..57dc1e1c
--- /dev/null
+++ b/app/renshi/model/Teacher.php
@@ -0,0 +1,145 @@
+order([$src['field'] =>$src['type']])
+ ->when(count($danwei)>0,function($query) use($danwei){
+ $query->where('danwei','in',$danwei);
+ })
+ ->when(count($zhiwu)>0,function($query) use($zhiwu){
+ $query->where('zhiwu','in',$zhiwu);
+ })
+ ->when(count($xueli)>0,function($query) use($xueli){
+ $query->where('xueli','in',$xueli);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('xingming|quanpin|shoupin','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'jsDanwei'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'jsZhiwu'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsZhicheng'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsXueli'=>function($query){
+ $query->field('id,title');
+ },
+ 'jsSubject'=>function($query){
+ $query->field('id,title');
+ },
+ ]
+ )
+ ->append(['age','gongling'])
+ ->select();
+
+
+ return $data;
+ }
+
+
+ // 职务关联模型
+ public function jsZhiwu()
+ {
+ return $this->belongsTo('\app\system\model\Category','zhiwu','id');
+ }
+
+
+ // 职称关联模型
+ public function jsZhicheng()
+ {
+ return $this->belongsTo('\app\system\model\Category','zhicheng','id');
+ }
+
+ // 学历关联模型
+ public function jsXueli()
+ {
+ return $this->belongsTo('\app\system\model\Category','xueli','id');
+ }
+
+ // 单位关联模型
+ public function jsDanwei()
+ {
+ return $this->belongsTo('\app\system\model\School','danwei','id');
+ }
+
+ // 学科关联模型
+ public function jsSubject()
+ {
+ return $this->belongsTo('\app\teach\model\Subject','subject','id');
+ }
+
+
+ // 生日修改器
+ public function setShengriAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 生日获取器
+ public function getShengriAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ // 参加工作时间获取器
+ public function getWorktimeAttr($value)
+ {
+ return date('Y-m-d',$value);
+ }
+
+ // 参加工作时间修改器
+ public function setWorktimeAttr($value)
+ {
+ return strtotime($value);
+ }
+
+
+ // 性别获取器
+ public function getSexAttr($value)
+ {
+ $sex = array('0'=>'女','1'=>'男','2'=>'未知');
+ return $sex[$value];
+ }
+
+
+
+ // 年龄获取器
+ public function getAgeAttr()
+ {
+ return getAgeByBirth($this->getdata('shengri'),2);
+ }
+
+
+ // 工龄获取器
+ public function getGonglingAttr()
+ {
+ return getAgeByBirth($this->getdata('worktime'),2);
+ }
+
+
+
+
+
+}
diff --git a/app/renshi/validate/Student.php b/app/renshi/validate/Student.php
new file mode 100644
index 00000000..ed6c5440
--- /dev/null
+++ b/app/renshi/validate/Student.php
@@ -0,0 +1,32 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'xingming|姓名' => 'require|chs|length:2,8',
+ 'sex|性别' => 'require|number',
+ 'shengri|出生日期' => 'date',
+ 'shenfenzhenghao|身份证号' => "require|idCard",
+ 'school|学校' => 'require|number',
+ 'ruxuenian|年级' => 'require|number',
+ 'banji|班级' => 'require|number'
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/renshi/validate/Teacher.php b/app/renshi/validate/Teacher.php
new file mode 100644
index 00000000..bfa381b8
--- /dev/null
+++ b/app/renshi/validate/Teacher.php
@@ -0,0 +1,37 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'xingming|姓名' => 'require|chs|length:2,8',
+ 'quanpin|姓名全拼' => 'require|alpha|length:1,30',
+ 'shoupin|姓名首拼' => 'require|alpha|length:1,5',
+ 'sex|性别' => 'require|number|max:2',
+ 'danwei|单位' => 'require|number',
+ 'shengri|出生日期' => 'date',
+ 'zhiwu|职务' => 'number',
+ 'zhicheng|职称' => 'number',
+ 'xueli|学历' => 'number',
+ 'biye|毕业院校' => 'length:1,50',
+ 'zhuanye|专业' => 'length:1,20',
+ 'worktime|参加工作时间' => 'date',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/renshi/view/index/create.html b/app/renshi/view/index/create.html
new file mode 100644
index 00000000..a9580fde
--- /dev/null
+++ b/app/renshi/view/index/create.html
@@ -0,0 +1,193 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/renshi/view/index/create_all.html b/app/renshi/view/index/create_all.html
new file mode 100644
index 00000000..bb756e30
--- /dev/null
+++ b/app/renshi/view/index/create_all.html
@@ -0,0 +1,78 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/renshi/view/index/index.html b/app/renshi/view/index/index.html
new file mode 100644
index 00000000..621cdbaf
--- /dev/null
+++ b/app/renshi/view/index/index.html
@@ -0,0 +1,161 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 师生名单
+ 教师管理
+ 教师列表
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/renshi/view/index/read.html b/app/renshi/view/index/read.html
new file mode 100644
index 00000000..7785c110
--- /dev/null
+++ b/app/renshi/view/index/read.html
@@ -0,0 +1,188 @@
+
+
+
+
+
{php}echo session('webtitle'){/php}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+ {load href="__STATIC__/xadmin/js/md5.min.js" /}
+
{$list.webtitle}
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/renshi/view/student/create.html b/app/renshi/view/student/create.html
new file mode 100644
index 00000000..841b73f7
--- /dev/null
+++ b/app/renshi/view/student/create.html
@@ -0,0 +1,220 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/renshi/view/student/create_all.html b/app/renshi/view/student/create_all.html
new file mode 100644
index 00000000..82d654b5
--- /dev/null
+++ b/app/renshi/view/student/create_all.html
@@ -0,0 +1,78 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/renshi/view/student/index.html b/app/renshi/view/student/index.html
new file mode 100644
index 00000000..5e7b07a1
--- /dev/null
+++ b/app/renshi/view/student/index.html
@@ -0,0 +1,165 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 师生名单
+ 学生管理
+ 学生列表
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/rongyu/common.php b/app/rongyu/common.php
new file mode 100644
index 00000000..3e582f69
--- /dev/null
+++ b/app/rongyu/common.php
@@ -0,0 +1,7 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+ /**
+ * 显示单位荣誉列表
+ *
+ * @return \think\Response
+ */
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'fzschool'=>array(),
+ 'hjschool'=>array(),
+ 'category'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $dwry = new dwry;
+
+ // 查询要显示的数据
+ $data = $dwry->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+ /**
+ * 显示创建资源表单页.
+ *
+ * @return \think\Response
+ */
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加单位荣誉',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/dwry',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存新建的资源
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function save()
+ {
+ // 获取表单数据
+ $list = request()->only(['url','project','title','teachers'=>array(),'hjschool','category','fzshijian','fzschool','jiangxiang'],'post');
+
+ // 实例化验证模型
+ $validate = new \app\rongyu\validate\DwRongyu;
+ // 验证表单数据
+ $result = $validate->scene('add')->check($list);
+ $msg = $validate->getError();
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+ // 保存数据
+ $data = dwry::create($list);
+
+
+ // 重组教师id
+ $teachers = array();
+ foreach ($list['teachers'] as $key => $value) {
+ $teachers[]['teacherid'] = $value;
+ }
+
+
+ $data->cyDwry()->saveAll($teachers);
+
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 批量上传单位荣誉图片
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ // 批量添加
+ public function createAll()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'批量上传荣誉图片',
+ 'butname'=>'批传',
+ 'formpost'=>'POST',
+ 'url'=>'/dwry/createall',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 保存批传
+ public function saveall()
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file);
+
+ if($data['val'] != 1)
+ {
+ $data=['msg'=>'添加失败','val'=>0];
+ }
+
+ $data = dwry::create([
+ 'url'=>$data['url']
+ ,'title'=>'批传单位荣誉图片'
+ ]);
+
+ $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ return json($data);
+ }
+
+ /**
+ * 上传荣誉图片并保存
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function upload()
+ {
+
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file);
+
+ return json($data);
+ }
+
+ /**
+ * 显示指定的资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function read($id)
+ {
+ //
+ }
+
+ /**
+ * 显示编辑资源表单页.
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function edit($id)
+ {
+ // 获取学生信息
+ $list['data'] = dwry::where('id',$id)
+ ->field('id,title,project,category,hjschool,fzshijian,fzschool,jiangxiang,url')
+ ->with([
+ 'cyDwry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ ])
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑单位荣誉',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/dwry/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+
+ }
+
+ /**
+ * 保存更新的资源
+ *
+ * @param \think\Request $request
+ * @param int $id
+ * @return \think\Response
+ */
+ public function update($id)
+ {
+ // 获取表单数据
+ $list = request()->only(['title','project','category','hjschool','fzshijian','fzschool','jiangxiang','teachers'=>array(),'url'],'put');
+ $list['id'] = $id;
+
+
+ // 实例化验证类
+ $validate = new \app\rongyu\validate\DwRongyu;
+ // 验证表单数据
+ $result = $validate->scene('edit')->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $dwry = new dwry();
+ $data = dwry::update($list);
+
+ // 删除原来的参与教师
+ $data->cyDwry()->where('rongyuid',$id)->delete(true);
+
+ // 声明参与教师数组
+ $canyulist = [];
+ // 循环组成参与教师
+ foreach ($list['teachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ ];
+ }
+ // 更新参考教师
+ $data->cyDwry()->saveAll($canyulist);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = dwry::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置荣誉状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学生信息
+ $data = dwry::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+}
diff --git a/app/rongyu/controller/Error.php b/app/rongyu/controller/Error.php
new file mode 100644
index 00000000..9d798a66
--- /dev/null
+++ b/app/rongyu/controller/Error.php
@@ -0,0 +1,11 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+ /**
+ * 显示教师荣誉册列表
+ *
+ * @return \think\Response
+ */
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'fzschool'=>array(),
+ 'hjschool'=>array(),
+ 'category'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $jsry = new jsry;
+
+ // 查询要显示的数据
+ $data = $jsry->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+ /**
+ * 显示创建资源表单页.
+ *
+ * @return \think\Response
+ */
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加荣誉册',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/jsry',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存新建的资源
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function save()
+ {
+ // 获取表单数据
+ $list = request()->only(['title','category','fzshijian','fzschool'],'post');
+
+ // 实例化验证模型
+ $validate = new \app\rongyu\validate\JsRongyu;
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+ // 保存数据
+ $data = jsry::create($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ /**
+ * 显示指定的资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function read($id)
+ {
+
+ }
+
+ /**
+ * 显示编辑资源表单页.
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function edit($id)
+ {
+ // 获取荣誉册信息
+ $list['data'] = jsry::where('id',$id)
+ ->field('id,title,category,fzshijian,fzschool')
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑荣誉册',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/jsry/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存更新的资源
+ *
+ * @param \think\Request $request
+ * @param int $id
+ * @return \think\Response
+ */
+ public function update($id)
+ {
+ // 获取表单数据
+ $list = request()->only(['title','category','fzshijian','fzschool'],'put');
+ $list['id'] = $id;
+
+
+ // 实例化验证类
+ $validate = new \app\rongyu\validate\JsRongyu;
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $data = jsry::update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = jsry::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置荣誉状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学生信息
+ $data = jsry::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+}
diff --git a/app/rongyu/controller/JsRongyuInfo.php b/app/rongyu/controller/JsRongyuInfo.php
new file mode 100644
index 00000000..0efff6c1
--- /dev/null
+++ b/app/rongyu/controller/JsRongyuInfo.php
@@ -0,0 +1,586 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+/**
+ *荣誉册中荣誉信息列表
+ *
+ * @return \think\Response
+ */
+ public function rongyuList($rongyuce)
+ {
+ // 荣誉数据模型
+ $ry = new \app\rongyu\model\JsRongyu;
+ // 设置要给模板赋值的信息
+ $list['webtitle'] = $ry->where('id',$rongyuce)->value('title') . ' 荣誉';
+ $list['rongyuce'] = $rongyuce;
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ /**
+ * 显示教师荣誉册列表
+ *
+ * @return \think\Response
+ */
+ public function ajaxData()
+ {
+
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'desc',
+ 'fzschool'=>array(),
+ 'hjschool'=>array(),
+ 'category'=>array(),
+ 'rongyuce'=>'',
+ 'subject'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $ryinfo = new ryinfo;
+
+ // 查询要显示的数据
+ $data = $ryinfo->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+ /**
+ * 显示创建资源表单页.
+ *
+ * @return \think\Response
+ */
+ public function create($rongyuce = 0)
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加荣誉',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/jsryinfo',
+ 'rongyuce'=>$rongyuce
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**留备用
+ * 保存新建的资源
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function save()
+ {
+
+ // 获取表单数据
+ $list = request()->only(['rongyuce','title','bianhao','category','hjschool','subject','hjshijian','jiangxiang','hjteachers','cyteachers','pic'],'put');
+
+ // 判断获奖时间是否为空,如果为空,则使用荣誉册时间
+ if($list['hjshijian'] == "")
+ {
+ $ryce = new \app\rongyu\model\JsRongyu;
+ $ryceinfo = $ryce::where('id',$list['rongyuce'])
+ ->field('id,fzshijian')
+ ->find();
+ $list['hjshijian'] = $ryceinfo->fzshijian;
+ }
+
+ // 实例化验证类
+ $validate = new \app\rongyu\validate\JsRongyuInfo;
+ // 验证表单数据
+ $result = $validate->scene('add')->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+
+ // 更新数据
+ $data = ryinfo::create($list);
+
+ // 声明教师数组
+ $teacherlist = [];
+ // 循环组成获奖教师信息
+ foreach ($list['hjteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 1,
+ ];
+ }
+ if(!empty($list['cyteachers'])){
+ // 循环组成参与教师信息
+ foreach ($list['cyteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 2,
+ ];
+ }
+ }
+
+
+ // 添加新的获奖人与参与人信息
+ $data->allJsry()->saveAll($canyulist);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 批量上传教师荣誉册图片
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function createAll($rongyuce)
+ {
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'批量上传教师荣誉册图片',
+ 'butname'=>'批传',
+ 'formpost'=>'POST',
+ 'url'=>'/jsryinfoaddall/'.$rongyuce,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch();
+ }
+
+ // 保存批传
+ public function saveall($rongyuce)
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file);
+
+ if($data['val'] != 1)
+ {
+ $data=['msg'=>'添加失败','val'=>0];
+ }
+
+ $data = ryinfo::create([
+ 'pic'=>$data['url']
+ ,'title'=>'批传教师荣誉'
+ ,'rongyuce'=>$rongyuce
+ ]);
+
+ $data ? $data=['msg'=>'批传成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ return json($data);
+ }
+
+
+
+ /**
+ * 上传荣誉图片并保存
+ *
+ * @param \think\Request $request
+ * @return \think\Response
+ */
+ public function upload()
+ {
+ // 获取文件信息
+ $list['text'] = $this->request->post('text');
+ $list['serurl'] = $this->request->post('serurl');
+
+ // 获取表单上传文件
+ $file = request()->file('file');
+ // 上传文件并返回结果
+ $data = upload($list,$file);
+
+ return json($data);
+ }
+
+ /**
+ * 荣誉册中荣誉信息列表
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function read($id)
+ {
+
+ }
+
+ /**
+ * 显示编辑资源表单页.
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function edit($id)
+ {
+ // 获取荣誉信息
+ $list['data'] = ryinfo::where('id',$id)
+ ->field('id,rongyuce,title,bianhao,hjschool,subject,jiangxiang,hjshijian,pic')
+ ->with([
+ 'hjJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ 'cyJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ 'ryTuce'=>function($query){
+ $query->field('id,fzshijian');
+ }
+ ])
+ ->find();
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑荣誉',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/jsryinfo/'.$id,
+ 'rongyuce'=>$id
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ /**
+ * 保存更新的资源
+ *
+ * @param \think\Request $request
+ * @param int $id
+ * @return \think\Response
+ */
+ public function update($id)
+ {
+ // 获取表单数据
+ $list = request()->only(['bianhao','title','category','hjschool','subject','hjshijian','jiangxiang','hjteachers','cyteachers','pic'],'put');
+ $list['id'] = $id;
+ // 判断获奖时间是否为空,如果为空,则使用荣誉册时间
+ if($list['hjshijian'] == "")
+ {
+ $ryinfo = ryinfo::where('id',$id)
+ ->field('id,rongyuce')
+ ->with([
+ 'ryTuce'=>function($query){
+ $query->field('id,fzshijian');
+ }
+ ])
+ ->find();
+ $list['hjshijian'] = $ryinfo->ry_tuce->fzshijian;
+ }
+
+
+ // 实例化验证类
+ $validate = new \app\rongyu\validate\JsRongyuInfo;
+ // 验证表单数据
+ $result = $validate->scene('edit')->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+
+ // 更新数据
+ $data = ryinfo::update($list);
+
+ // 删除原来的获奖人与参与人信息
+ $data->allJsry()->where('rongyuid',$id)->delete(true);
+ // 声明教师数组
+ $teacherlist = [];
+ // 循环组成获奖教师信息
+ foreach ($list['hjteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 1,
+ ];
+ }
+ if(!empty($list['cyteachers'])){
+ // 循环组成参与教师信息
+ foreach ($list['cyteachers'] as $key => $value) {
+ $canyulist[] = [
+ 'teacherid' => $value,
+ 'category' => 2,
+ ];
+ }
+ }
+
+
+ // 添加新的获奖人与参与人信息
+ $data->allJsry()->saveAll($canyulist);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = ryinfo::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置荣誉状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学生信息
+ $data = ryinfo::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 下载荣誉信息
+ public function outXlsx($rongyuce)
+ {
+
+ $ryinfo = new ryinfo();
+ $list = $ryinfo->srcTuceRy($rongyuce);
+
+ // halt($list);
+
+ if($list->isEmpty())
+ {
+ $this->error('兄弟,没有要下载的信息呀~');
+ return '';
+ }else{
+ $filename = $list[0]['ryTuce']['title'];
+ $fzschool = $list[0]['ryTuce']['fz_school']['title'];
+ $fzshijian = strtotime($list[0]['ryTuce']['fzshijian']);
+ $fzshijian = date('Ym',$fzshijian);
+ }
+
+ //通过工厂模式创建内容
+ $spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load("uploads/rongyu_teacher/js_rongyu.xlsx");
+ $worksheet = $spreadsheet->getActiveSheet();
+
+ $worksheet->getCell('A1')->setValue($filename);
+ $worksheet->getCell('A2')->setValue('发证单位:'.$fzschool);
+ $worksheet->getCell('G2')->setValue('发证时间:'.$list[0]['ryTuce']['fzshijian']);
+ // 循环为excel每行赋值
+ foreach ($list as $key => $value) {
+ $myrowid = $key + 4;
+ $worksheet->getCell('A'.$myrowid)->setValue($key+1);
+ $worksheet->getCell('B'.$myrowid)->setValue($value->title);
+ $worksheet->getCell('C'.$myrowid)->setValue($value->hjJsName);
+ if($value->hj_school){
+ $worksheet->getCell('D'.$myrowid)->setValue($value->hj_school->jiancheng);
+ }
+ if($value->ry_subject){
+ $worksheet->getCell('E'.$myrowid)->setValue($value->ry_subject->title);
+ }
+ $worksheet->getCell('F'.$myrowid)->setValue($value->cyJsName);
+ if($value->jx_category){
+ $worksheet->getCell('G'.$myrowid)->setValue($value->jx_category->title);
+ }
+ $worksheet->getCell('H'.$myrowid)->setValue($value->bianhao);
+ }
+
+ // 给单元格加边框
+ $styleArray = [
+ 'borders' => [
+ 'allBorders' => [
+ 'borderStyle' => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
+ 'color' => ['argb' => '00000000'],
+ ],
+ ],
+ ];
+
+ if($key+4>9)
+ {
+
+ $worksheet->getStyle('A10:I'.($key+4))->applyFromArray($styleArray);
+ // 设置行高
+ for($i = 10; $i<=($key+4); $i++){
+ $worksheet->getRowDimension($i)->setRowHeight(30);
+ }
+
+ }
+
+ $worksheet->getStyle('A4')->applyFromArray($styleArray);
+
+
+ //告诉浏览器输出07Excel文件
+ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+ //告诉浏览器输出浏览器名称
+ header('Content-Disposition: attachment;filename="'. $filename .$fzshijian.'.xlsx"');
+ //禁止缓存
+ header('Cache-Control: max-age=0');
+ $writer = new Xlsx($spreadsheet);
+ $writer->save('php://output');
+ // ob_end_clean();
+ // ob_start();
+ // 释放内存
+ $spreadsheet->disconnectWorksheets();
+ unset($spreadsheet);
+
+ // return '下载后请关闭窗口';
+ }
+
+
+ // 搜索教师荣誉
+ public function ryTeacher($id)
+ {
+ // 获取DT的传值
+ $getdt = request()->param();
+
+ //得到排序的方式
+ $order = $getdt['order'][0]['dir'];
+ //得到排序字段的下标
+ $order_column = $getdt['order'][0]['column'];
+ //根据排序字段的下标得到排序字段
+ $order_field = $getdt['columns'][$order_column]['name'];
+ if($order_field=='')
+ {
+ $order_field = $getdt['columns'][$order_column]['data'];
+ }
+ //得到limit参数
+ $limit_start = $getdt['start'];
+ $limit_length = $getdt['length'];
+
+ //得到搜索的关键词
+ $search = [
+ 'teacherid'=>$id,
+ 'order'=>$order,
+ 'order_field'=>$order_field
+ ];
+
+
+ // 实例化
+ $ryinfo = new ryinfo;
+
+ // 获取荣誉总数
+ $cnt = $ryinfo->select()->count();
+
+ // 查询数据
+ $data = $ryinfo->srcTeacher($search);
+ $datacnt = $data->count();
+
+ // 获取当前页数据
+ $data = $data->slice($limit_start,$limit_length);
+
+
+ // 重组返回内容
+ $data = [
+ 'draw'=> $getdt["draw"] , // ajax请求次数,作为标识符
+ 'recordsTotal'=>$cnt, // 获取到的结果数(每页显示数量)
+ 'recordsFiltered'=>$datacnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+
+
+
+}
diff --git a/app/rongyu/model/DwRongyu.php b/app/rongyu/model/DwRongyu.php
new file mode 100644
index 00000000..e6dc5074
--- /dev/null
+++ b/app/rongyu/model/DwRongyu.php
@@ -0,0 +1,113 @@
+order([$src['field'] =>$src['type']])
+ ->when(count($hjschool)>0,function($query) use($hjschool){
+ $query->where('hjschool','in',$hjschool);
+ })
+ ->when(count($fzschool)>0,function($query) use($fzschool){
+ $query->where('fzschool','in',$fzschool);
+ })
+ ->when(count($category)>0,function($query) use($category){
+ $query->where('category','in',$category);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title|jiancheng','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'hjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'fzSchool'=>function($query){
+ $query->field('id,jiancheng,jibie')
+ ->with([
+ 'dwJibie'=>function($query){
+ $query->field('id,title');
+ },
+ ]);
+ },
+ 'lxCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'jxCategory'=>function($query){
+ $query->field('id,title');
+ }
+ ]
+ )
+ ->select();
+ return $data;
+ }
+
+
+ // 获奖单位关联
+ public function hjSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','hjschool','id');
+ }
+
+ // 颁奖单位关联
+ public function fzSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','fzschool','id');
+ }
+
+ // 荣誉类型
+ public function lxCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','category','id');
+ }
+
+ // 奖项
+ public function jxCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','jiangxiang','id');
+ }
+
+ // 参与人
+ public function cyDwry()
+ {
+ return $this->hasMany('\app\rongyu\model\DwRongyuCanyu','rongyuid','id');
+ }
+
+
+ // 发证时间修改器
+ public function setFzshijianAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 发证时间获取器
+ public function getFzshijianAttr($value)
+ {
+ // 判断发证时间是否为空
+ if ($value>0)
+ {
+ $value = date('Y-m-d',$value);
+ }else{
+ $value = "";
+ }
+
+ // 返回发证时间
+ return $value;
+ }
+
+}
diff --git a/app/rongyu/model/DwRongyuCanyu.php b/app/rongyu/model/DwRongyuCanyu.php
new file mode 100644
index 00000000..ff66ffd1
--- /dev/null
+++ b/app/rongyu/model/DwRongyuCanyu.php
@@ -0,0 +1,25 @@
+belongsTo('\app\rongyu\model\DwRongyu','rongyuid','id');
+ }
+
+ // 教师关联
+ public function teacher()
+ {
+ return $this->belongsTo('\app\renshi\model\Teacher','teacherid','id');
+ }
+
+}
diff --git a/app/rongyu/model/JsRongyu.php b/app/rongyu/model/JsRongyu.php
new file mode 100644
index 00000000..1ee185c4
--- /dev/null
+++ b/app/rongyu/model/JsRongyu.php
@@ -0,0 +1,99 @@
+order([$src['field'] =>$src['type']])
+ ->when(count($fzschool)>0,function($query) use($fzschool){
+ $query->where('fzschool','in',$fzschool);
+ })
+ ->when(count($category)>0,function($query) use($category){
+ $query->where('category','in',$category);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'fzSchool'=>function($query){
+ $query->field('id,jiancheng,jibie')
+ ->with(['dwJibie'=>function($q){
+ $q->field('id,title');
+ }]);
+ },
+ 'lxCategory'=>function($query){
+ $query->field('id,title');
+ },
+
+ ]
+ )
+ ->withCount(['ryInfo'=>'count'])
+ ->select();
+
+
+ return $data;
+ }
+
+
+ // 颁奖单位关联
+ public function fzSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','fzschool','id');
+ }
+
+ // 荣誉类型关联
+ public function lxCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','category','id');
+ }
+
+
+ // 荣誉信息关联
+ public function ryInfo()
+ {
+ return $this->hasMany('JsRongyuInfo','rongyuce','id');
+ }
+
+
+ // 荣誉级别
+ public function getCntAttr()
+ {
+ return $this->ryInfo->count();
+ }
+
+
+ // 发证时间修改器
+ public function setFzshijianAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 发证时间获取器
+ public function getFzshijianAttr($value)
+ {
+ if ($value>0)
+ {
+ $value = date('Y-m-d',$value);
+ }else{
+ $value = "";
+ }
+ return $value;
+ }
+
+
+
+}
diff --git a/app/rongyu/model/JsRongyuCanyu.php b/app/rongyu/model/JsRongyuCanyu.php
new file mode 100644
index 00000000..b7a90777
--- /dev/null
+++ b/app/rongyu/model/JsRongyuCanyu.php
@@ -0,0 +1,22 @@
+belongsTo('\app\rongyu\model\JsRongyu','rongyuid','id');
+ }
+
+ // 教师关联
+ public function teacher()
+ {
+ return $this->belongsTo('\app\renshi\model\Teacher','teacherid','id');
+ }
+}
diff --git a/app/rongyu/model/JsRongyuInfo.php b/app/rongyu/model/JsRongyuInfo.php
new file mode 100644
index 00000000..7d3d4978
--- /dev/null
+++ b/app/rongyu/model/JsRongyuInfo.php
@@ -0,0 +1,299 @@
+order([$src['field'] =>$src['type']])
+ ->when(count($hjschool)>0,function($query) use($hjschool){
+ $query->where('hjschool','in',$hjschool);
+ })
+ ->when(count($fzschool)>0,function($query) use($fzschool){
+ $query->where('rongyuce','in',function($q) use($fzschool){
+ $q->name('JsRongyu')->where('fzschool','in',$fzschool)->field('id');
+ });
+
+ })
+ ->when(count($category)>0,function($query) use($category){
+ $query->where('rongyuce','in',function($q) use($category){
+ $q->name('JsRongyu')->where('category','in',$category)->field('id');
+ });
+ })
+ ->when(count($subject)>0,function($query) use($subject){
+ $query->where('rongyuce','in',function($q) use($subject){
+ $q->name('JsRongyu')->where('subject','in',$subject)->field('id');
+ });
+ })
+ ->when(strlen($rongyuce)>0,function($query) use($rongyuce){
+ $query->where('rongyuce',$rongyuce);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where(function($z) use($searchval){
+ $z->whereOr('title|bianhao','like','%'.$searchval.'%')
+ ->whereOr('id','in',function($q) use($searchval){
+ $q->name('JsRongyuCanyu')
+ ->distinct(true)
+ ->where('teacherid','in',function($w) use($searchval){
+ $w->name('Teacher')
+ ->where('xingming','like','%'.$searchval.'%')
+ ->field('id');
+ })
+ ->field('rongyuid');
+ });
+ });
+ })
+ ->with(
+ [
+ 'hjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'rySubject'=>function($query){
+ $query->field('id,title');
+ },
+ 'jxCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ryTuce'=>function($query){
+ $query->field('id,title,fzschool')
+ ->with([
+ 'fzSchool'=>function($q){
+ $q->field('id,title');
+ }
+ ]);
+ },
+ 'hjJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ 'cyJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ ]
+ )
+ // ->append(['hjJsName','cyJsName'])
+ ->select();
+
+
+ return $data;
+ }
+
+
+ // 获取需要下载的荣誉信息
+ public function srcTuceRy($id)
+ {
+ // 查询数据
+ $data =$this->where('rongyuce',$id)
+ ->field('id,rongyuce,title,bianhao,hjschool,subject,jiangxiang,hjshijian,pic')
+ ->with([
+ 'hjJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ 'cyJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ 'ryTuce'=>function($query){
+ $query->field('id,title,fzshijian,fzschool')
+ ->with(['fzSchool'=>function($q){
+ $q->field('id,title');
+ }]);
+ },
+ 'rySubject'=>function($query){
+ $query->field('id,title');
+ },
+ 'hjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'jxCategory'=>function($query){
+ $query->field('id,title');
+ }
+ ])
+ ->order(['hjschool'])
+ ->append(['hjJsName','cyJsName'])
+ ->select();
+
+ return $data;
+ }
+
+
+ //搜索单位获奖荣誉
+ public function srcTeacher($search)
+ {
+ // 获取参数
+ $teacherid = $search['teacherid'];
+ $order_field = $search['order_field'];
+ $order = $search['order'];
+
+ $data = $this->order([$order_field =>$order])
+ ->where('id','in',function($query) use($teacherid){
+ $query->name('JsRongyuCanyu')
+ ->where('category',1)
+ ->where('teacherid',$teacherid)
+ ->field('rongyuid');
+ })
+ ->where('status',1)
+ ->with(
+ [
+ 'hjSchool'=>function($query){
+ $query->field('id,jiancheng');
+ },
+ 'rySubject'=>function($query){
+ $query->field('id,title');
+ },
+ 'jxCategory'=>function($query){
+ $query->field('id,title');
+ },
+ 'ryTuce'=>function($query){
+ $query->field('id,title')
+ ->with([
+ 'fzSchool'=>function($query){
+ $query->field('id,title,jibie')
+ ->with(['']);
+ }
+ ]);
+ },
+ 'hjJsry'=>function($query){
+ $query->field('rongyuid,teacherid')
+ ->with(['teacher'=>function($query){
+ $query->field('id,xingming');
+ }]);
+ },
+ ]
+ )
+ ->append(['hjJsName','cyJsName'])
+ ->select();
+
+
+ return $data;
+ }
+
+
+ // 荣誉图册关联
+ public function ryTuce()
+ {
+ return $this->belongsTo('\app\rongyu\model\JsRongyu','rongyuce','id');
+ }
+
+
+ // 获奖单位关联
+ public function hjSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','hjschool','id');
+ }
+
+ // 颁奖单位关联
+ public function fzSchool()
+ {
+ return $this->belongsTo('\app\system\model\School','fzschool','id');
+ }
+
+ // 荣誉所属学科
+ public function rySubject()
+ {
+ return $this->belongsTo('\app\teach\model\Subject','subject','id');
+ }
+
+ // 奖项关联
+ public function jxCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','jiangxiang','id');
+ }
+
+ // 获奖人信息关联
+ public function hjJsry()
+ {
+ return $this->hasMany('\app\rongyu\model\JsRongyuCanyu','rongyuid','id')->where('category',1);
+ }
+
+
+ // 获奖人与参与教师关联
+ public function allJsry()
+ {
+ return $this->hasMany('\app\rongyu\model\JsRongyuCanyu','rongyuid','id');
+ }
+
+
+ // 参与人关联
+ public function cyJsry()
+ {
+ return $this->hasMany('\app\rongyu\model\JsRongyuCanyu','rongyuid','id')->where('category',2);
+ }
+
+
+ // 荣誉级别
+ public function getJibieAttr()
+ {
+ $jibie = '';
+
+ if($this->fzschool){
+ $jibie = $this->fzSchool->jibie;
+ }
+
+ return $jibie;
+ }
+
+
+ // 发证时间修改器
+ public function setHjshijianAttr($value)
+ {
+ return strtotime($value);
+ }
+
+ // 发证时间获取器
+ public function getHjshijianAttr($value)
+ {
+ if ($value>0)
+ {
+ $value = date('Y-m-d',$value);
+ }else{
+ $value = "";
+ }
+ return $value;
+ }
+
+ // 获奖教师名整理
+ public function getHjJsNameAttr($value)
+ {
+ $teacherList = $this->getAttr('hjJsry');
+ $teachNames = teacherNames($teacherList);
+
+ return $teachNames;
+
+ }
+
+ // 获奖教师名整理
+ public function getCyJsNameAttr($value)
+ {
+ $teacherList = $this->getAttr('cyJsry');
+ $teachNames = teacherNames($teacherList);
+
+ return $teachNames;
+
+ }
+}
diff --git a/app/rongyu/validate/DwRongyu.php b/app/rongyu/validate/DwRongyu.php
new file mode 100644
index 00000000..37726887
--- /dev/null
+++ b/app/rongyu/validate/DwRongyu.php
@@ -0,0 +1,41 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ // 'url|请先上传荣誉图片' => 'require',
+ 'id|请先上传荣誉图片' => 'require',
+ 'title|荣誉标题' => 'length:1,50',
+ 'category|荣誉类型' => 'require|number',
+ 'hjschool|获奖单位' => 'require|number',
+ 'fzshijian|发证时间' => 'require|date',
+ 'fzschool|发证单位' => 'require|number',
+ 'jiangxiang|奖项' => 'require|number',
+ 'teachers|参与人' =>'array',
+ ];
+
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+
+ // 验证场景
+ protected $scene = [
+ 'add' => ['title','category','hjschool','fzshijian','fzschool','jiangxiang'],
+ 'edit' => ['id','title','category','hjschool','fzshijian','fzschool','jiangxiang' ],
+ ];
+}
diff --git a/app/rongyu/validate/JsRongyu.php b/app/rongyu/validate/JsRongyu.php
new file mode 100644
index 00000000..b43aeffc
--- /dev/null
+++ b/app/rongyu/validate/JsRongyu.php
@@ -0,0 +1,29 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|荣誉册标题' => 'require|length:1,50',
+ 'category|荣誉类型' => 'require|number',
+ 'fzshijian|发证时间' => 'require|date',
+ 'fzschool|颁奖单位' => 'require|number',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/rongyu/validate/JsRongyuInfo.php b/app/rongyu/validate/JsRongyuInfo.php
new file mode 100644
index 00000000..9dd96086
--- /dev/null
+++ b/app/rongyu/validate/JsRongyuInfo.php
@@ -0,0 +1,40 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'id|请先上传图片' => 'require',
+ 'rongyuce|荣誉册ID丢失' => 'require',
+ 'title|荣册标题' => 'require|length:1,50',
+ 'hjteachers|获奖人' => 'require|array',
+ 'hjschool|荣誉所在单位' => 'require|number',
+ 'subject|荣誉所属学科' => 'require|number',
+ 'hjshijian|发证时间' => 'require|date',
+ 'jiangxiang|奖项' => 'require|number',
+ 'cyteachers|参与人' => 'array',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+
+ // 验证场景
+ protected $scene = [
+ 'add' => ['rongyuce','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers','pic'],
+ 'edit' => ['id','title','hjteachers','hjschool','subject','hjshijian','jiangxiang','cyteachers','pic'],
+ ];
+}
diff --git a/app/rongyu/view/dw_rongyu/create.html b/app/rongyu/view/dw_rongyu/create.html
new file mode 100644
index 00000000..0ac1b505
--- /dev/null
+++ b/app/rongyu/view/dw_rongyu/create.html
@@ -0,0 +1,256 @@
+{extend name="common@create" /}
+{block name="jscss"}
+
+{/block}
+{block name="form"}
+
+
+{/block}
+
+{block name="myjs"}
+
+
+{/block}
+
diff --git a/app/rongyu/view/dw_rongyu/create_all.html b/app/rongyu/view/dw_rongyu/create_all.html
new file mode 100644
index 00000000..930ed1f9
--- /dev/null
+++ b/app/rongyu/view/dw_rongyu/create_all.html
@@ -0,0 +1,43 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/rongyu/view/dw_rongyu/index.html b/app/rongyu/view/dw_rongyu/index.html
new file mode 100644
index 00000000..bec3b9a7
--- /dev/null
+++ b/app/rongyu/view/dw_rongyu/index.html
@@ -0,0 +1,164 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 荣誉管理
+ 单位荣誉
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/rongyu/view/js_rongyu/create.html b/app/rongyu/view/js_rongyu/create.html
new file mode 100644
index 00000000..2612eab9
--- /dev/null
+++ b/app/rongyu/view/js_rongyu/create.html
@@ -0,0 +1,84 @@
+{extend name="common@create" /}
+{block name="jscss"}
+{/block}
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+
+{/block}
+
diff --git a/app/rongyu/view/js_rongyu/index.html b/app/rongyu/view/js_rongyu/index.html
new file mode 100644
index 00000000..db3c8d2b
--- /dev/null
+++ b/app/rongyu/view/js_rongyu/index.html
@@ -0,0 +1,138 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 荣誉管理
+ 荣誉册
+
+{/block}
+{block name="search"}
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/rongyu/view/js_rongyu_info/create.html b/app/rongyu/view/js_rongyu_info/create.html
new file mode 100644
index 00000000..f893467a
--- /dev/null
+++ b/app/rongyu/view/js_rongyu_info/create.html
@@ -0,0 +1,264 @@
+{extend name="common@create" /}
+{block name="jscss"}
+
+{/block}
+{block name="form"}
+
+
+{/block}
+
+{block name="myjs"}
+
+
+{/block}
+
diff --git a/app/rongyu/view/js_rongyu_info/create_all.html b/app/rongyu/view/js_rongyu_info/create_all.html
new file mode 100644
index 00000000..81105ca9
--- /dev/null
+++ b/app/rongyu/view/js_rongyu_info/create_all.html
@@ -0,0 +1,43 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/rongyu/view/js_rongyu_info/index.html b/app/rongyu/view/js_rongyu_info/index.html
new file mode 100644
index 00000000..187c04eb
--- /dev/null
+++ b/app/rongyu/view/js_rongyu_info/index.html
@@ -0,0 +1,152 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 荣誉管理
+ 荣誉册
+ 荣誉列表
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/rongyu/view/js_rongyu_info/rongyu_list.html b/app/rongyu/view/js_rongyu_info/rongyu_list.html
new file mode 100644
index 00000000..9f4258cb
--- /dev/null
+++ b/app/rongyu/view/js_rongyu_info/rongyu_list.html
@@ -0,0 +1,164 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 荣誉管理
+ 荣誉册
+ 荣誉列表
+
+{/block}
+{block name="search"}
+
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/system/common.php b/app/system/common.php
new file mode 100644
index 00000000..b3d9bbc7
--- /dev/null
+++ b/app/system/common.php
@@ -0,0 +1 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取单位列表数据
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'id',
+ 'type'=>'asc',
+ 'pid'=>'',
+ 'searchval'=>''
+ ],'POST');
+
+ // 实例化
+ $cg = new CG;
+
+ // 查询要显示的数据
+ $data = $cg->search($src);
+ // 获取记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ // $data = $data->page(1,10);
+ // dump($data);
+
+ $limit_start = $src['page'] * $src['limit']-$src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+
+ // 添加类别
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加类别',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/category',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染
+ return $this->fetch();
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+
+ // 实例化验证模型
+ $validate = new \app\system\validate\Category;
+
+
+ // 获取表单数据
+ $list = request()->only(['title','pid','paixu'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 保存数据
+ $data = CG::create($list);
+
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 编辑类别
+ public function edit($id)
+ {
+ // 获取单位信息
+ $list['data'] = CG::field('id,title,pid,paixu')
+ ->find($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑类别',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/category/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ // 更新类别信息
+ public function update($id)
+ {
+ $validate = new \app\system\validate\Category;
+
+ // 获取表单数据
+ $list = request()->only(['title','pid','paixu'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ $data = CG::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 删除类别
+ public function delete($id)
+ {
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');
+ }
+
+ $data = CG::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ // 设置类别状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取类别信息
+ $data = CG::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+}
diff --git a/app/system/controller/Encrypt.php b/app/system/controller/Encrypt.php
new file mode 100644
index 00000000..0c432227
--- /dev/null
+++ b/app/system/controller/Encrypt.php
@@ -0,0 +1,68 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+ // 获取单位列表数据
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'id',
+ 'type'=>'desc',
+ ],'POST');
+
+
+ // 实例化
+ $fl = new FL;
+
+ // 查询要显示的数据
+ $data = $fl->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+ // 下载文件
+ public function download($id)
+ {
+ // 实例化文件数据模型
+ $fl = new FL;
+ // 查询文件信息
+ $filist = $fl->where('id',$id)->find();
+
+ // 下载文件
+ $download = new \think\response\Download('uploads\\'.$filist->url);
+
+ return $download->name($filist->oldname);
+
+ }
+
+
+
+ /**
+ * 删除指定资源
+ *
+ * @param int $id
+ * @return \think\Response
+ */
+ public function delete($id)
+ {
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');
+ }
+
+ $data = FL::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+}
diff --git a/app/system/controller/School.php b/app/system/controller/School.php
new file mode 100644
index 00000000..1b3827cb
--- /dev/null
+++ b/app/system/controller/School.php
@@ -0,0 +1,209 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取单位列表数据
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'paixu',
+ 'type'=>'asc',
+ 'jibie'=>array(),
+ 'xingzhi'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $sch = new sch;
+
+ // 查询要显示的数据
+ $data = $sch->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+
+ return json($data);
+ }
+
+
+
+ // 添加单位
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加单位',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/school',
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染
+ return $this->fetch();
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+
+ // 实例化验证模型
+ $validate = new \app\system\validate\School;
+
+
+ // 获取表单数据
+ $list = request()
+ ->only(['title','jiancheng','biaoshi','xingzhi','jibie','xueduan','paixu'=>999],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+ // 保存数据
+ $data = sch::create($list);
+
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 编辑单位
+ public function edit($id)
+ {
+ // 获取单位信息
+ $list['data'] = sch::field('id,title,jiancheng,biaoshi,xingzhi,jibie,status,xueduan,paixu')
+ ->get($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑单位',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/school/'.$id,
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+ // 更新单位信息
+ public function update($id)
+ {
+ $validate = new \app\system\validate\School;
+
+ // 获取表单数据
+ $list = request()
+ ->only(['title','jiancheng','biaoshi','xingzhi','jibie','xueduan','paixu'=>999],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ $data = sch::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ // 删除单位
+ public function delete($id)
+ {
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');
+ }
+
+ $data = sch::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ // 设置单位状态
+ public function setStatus()
+ {
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取单位信息
+ $data = sch::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+}
diff --git a/app/system/controller/SystemBase.php b/app/system/controller/SystemBase.php
new file mode 100644
index 00000000..6cc81991
--- /dev/null
+++ b/app/system/controller/SystemBase.php
@@ -0,0 +1,66 @@
+order(['id'=>'desc'])
+ ->find();
+
+ $list['set'] = array(
+ 'webtitle'=>'设置系统信息',
+ 'butname'=>'设置',
+ 'formpost'=>'PUT',
+ 'url'=>'/sysbase/'.$list['data']['id'],
+ );
+
+
+ // 模板赋值
+ $this->assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 更新资源
+ public function update($id)
+ {
+ $validate = new \app\system\validate\SystemBase;
+
+ // 获取表单数据
+ $list = request()->only(['webtitle','keywords','description','thinks','danwei'],'put');
+ $list['id'] = $id;
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ $data = sysbasemod::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+}
diff --git a/app/system/model/Category.php b/app/system/model/Category.php
new file mode 100644
index 00000000..a4561a86
--- /dev/null
+++ b/app/system/model/Category.php
@@ -0,0 +1,52 @@
+belongsTo('Category','pid','id');
+ }
+
+
+ // 子类型关联
+ public function glCid()
+ {
+ return $this->hasMany('Category','pid','id');
+ }
+
+
+ // 查询所有类别
+ public function search($src)
+ {
+ // 整理变量
+ $pid = $src['pid'];
+ $searchval = $src['searchval'];
+
+ // 查询数据
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->when(strlen($pid)>0,function($query) use($pid){
+ $query->whereOr('pid','in',$pid);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'glPid'=>function($query){
+ $query->field('id,title');
+ }
+ ]
+ )
+ ->select();
+ return $data;
+ }
+}
diff --git a/app/system/model/Fields.php b/app/system/model/Fields.php
new file mode 100644
index 00000000..f2e5ed19
--- /dev/null
+++ b/app/system/model/Fields.php
@@ -0,0 +1,54 @@
+where('hash',$str)->find();
+ if($list){
+ $hasHash = 1;
+ }
+ return $hasHash;
+ }
+
+
+ // 查询所有单位
+ public function search($src)
+ {
+ // 查询数据
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->with([
+ 'flUser'=>function($query){
+ $query->withField('id,xingming,school')
+ ->with([
+ 'adSchool'=>function($q){
+ $q->withField('id,jiancheng');
+ }
+ ]);
+ }
+ ])
+ ->select();
+
+ return $data;
+ }
+
+ // 上传人数据关联
+ public function flUser()
+ {
+ return $this->belongsTo('\app\admin\model\Admin','userid','id');
+ }
+
+}
diff --git a/app/system/model/School.php b/app/system/model/School.php
new file mode 100644
index 00000000..f6c81b30
--- /dev/null
+++ b/app/system/model/School.php
@@ -0,0 +1,81 @@
+hasMany('\app\renshi\model\Teacher','danwei','id');
+ }
+
+ // 单位性质数据模型关联
+ public function dwXingzhi()
+ {
+ return $this->belongsTo('\app\system\model\Category','xingzhi','id');
+ }
+
+
+ // 单位级别数模型关联
+ public function dwJibie()
+ {
+ return $this->belongsTo('\app\system\model\Category','jibie','id');
+ }
+
+
+ // 单位学段数模型关联
+ public function dwXueduan()
+ {
+ return $this->belongsTo('\app\system\model\Category','xueduan','id');
+ }
+
+
+
+ // 查询所有单位
+ public function search($src)
+ {
+ // 整理变量
+ $xingzhi = $src['xingzhi'];
+ $jibie = $src['jibie'];
+ $searchval = $src['searchval'];
+
+ // 查询数据
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->when(count($xingzhi)>0,function($query) use($xingzhi){
+ $query->where('xingzhi','in',$xingzhi);
+ })
+ ->when(count($jibie)>0,function($query) use($jibie){
+ $query->where('jibie','in',$jibie);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title|jiancheng','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'dwXingzhi'=>function($query){
+ $query->field('id,title');
+ },
+ 'dwJibie'=>function($query){
+ $query->field('id,title');
+ },
+ 'dwXueduan'=>function($query){
+ $query->field('id,title');
+ },
+ ]
+ )
+ ->withCount(
+ [
+ 'dwTeacher'=>function($query){
+ $query->where('status',1);
+ }
+ ]
+ )
+ ->select();
+ return $data;
+ }
+}
diff --git a/app/system/model/SystemBase.php b/app/system/model/SystemBase.php
new file mode 100644
index 00000000..96867ced
--- /dev/null
+++ b/app/system/model/SystemBase.php
@@ -0,0 +1,10 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|规则名' => 'require|chs|length:2,50',
+ 'paixu|排序' => 'number|max:999',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/system/validate/School.php b/app/system/validate/School.php
new file mode 100644
index 00000000..8e465c26
--- /dev/null
+++ b/app/system/validate/School.php
@@ -0,0 +1,33 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|单位名称' => 'require|chs|length:2,25',
+ 'jiancheng|单位简称' => 'require|chs|length:1,6',
+ 'biaoshi|单位标识' => 'number',
+ 'jibie|级别 ' => 'number',
+ 'xingzhi|性质' => 'number',
+ 'xueduan|学段' => 'number',
+ 'paixu|排序 ' => 'number|max:999',
+
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/system/validate/SystemBase.php b/app/system/validate/SystemBase.php
new file mode 100644
index 00000000..283a7a5e
--- /dev/null
+++ b/app/system/validate/SystemBase.php
@@ -0,0 +1,30 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'webtitle|标题' => 'require|length:2,50',
+ 'keywords|关键字' => 'require|length:2,60',
+ 'description|描述' => 'require|length:1,100',
+ 'thinks|感谢' => 'require|length:1,80',
+ 'danwei|单位' => 'require|length:2,80',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/system/view/category/create.html b/app/system/view/category/create.html
new file mode 100644
index 00000000..dd54e9bc
--- /dev/null
+++ b/app/system/view/category/create.html
@@ -0,0 +1,53 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/system/view/category/index.html b/app/system/view/category/index.html
new file mode 100644
index 00000000..58511f67
--- /dev/null
+++ b/app/system/view/category/index.html
@@ -0,0 +1,108 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 系统管理
+ 类别管理
+ 类别列表
+
+{/block}
+{block name="search"}
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/system/view/fields/create.html b/app/system/view/fields/create.html
new file mode 100644
index 00000000..64368451
--- /dev/null
+++ b/app/system/view/fields/create.html
@@ -0,0 +1,111 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/system/view/fields/index.html b/app/system/view/fields/index.html
new file mode 100644
index 00000000..f73739cc
--- /dev/null
+++ b/app/system/view/fields/index.html
@@ -0,0 +1,117 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 系统管理
+ 文件管理
+ 文件列表
+
+{/block}
+{block name="search"}
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/system/view/school/create.html b/app/system/view/school/create.html
new file mode 100644
index 00000000..64368451
--- /dev/null
+++ b/app/system/view/school/create.html
@@ -0,0 +1,111 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/system/view/school/index.html b/app/system/view/school/index.html
new file mode 100644
index 00000000..26297765
--- /dev/null
+++ b/app/system/view/school/index.html
@@ -0,0 +1,135 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 系统管理
+ 单位管理
+ 单位列表
+
+{/block}
+{block name="search"}
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/system/view/system_base/edit.html b/app/system/view/system_base/edit.html
new file mode 100644
index 00000000..744aa21f
--- /dev/null
+++ b/app/system/view/system_base/edit.html
@@ -0,0 +1,111 @@
+
+
+
+
+
+
{$list.set.webtitle}
+
+
+
+ {load href="__STATIC__/xadmin/css/font.css" /}
+ {load href="__STATIC__/xadmin/css/xadmin.css" /}
+ {load href="__STATIC__/xadmin/js/jquery.min.js" /}
+ {load href="__STATIC__/xadmin/lib/layui/layui.js" /}
+ {load href="__STATIC__/xadmin/js/xadmin.js" /}
+ {load href="__STATIC__/xadmin/js/cookie.js" /}
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/teach/common.php b/app/teach/common.php
new file mode 100644
index 00000000..8bf3131c
--- /dev/null
+++ b/app/teach/common.php
@@ -0,0 +1,5 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+
+ // 获取班级信息列表
+ public function ajaxData()
+ {
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'asc',
+ 'school'=>'',
+ 'ruxuenian'=>'',
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $bj = new BJ;
+
+ // 查询要显示的数据
+ $data = $bj->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+
+ // 创建班级
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加班级',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/banji',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\teach\validate\Banji;
+
+
+ // 获取表单数据
+ $list = request()->only(['school','ruxuenian','bjsum'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+ $paixumax = BJ::where('school',$list['school'])
+ ->where('ruxuenian',$list['ruxuenian'])
+ ->max('paixu');
+
+ if($paixumax + $list['bjsum'] > 25){
+ $list['bjsum'] = 25 - $paixumax;
+ }
+
+ $i = 1;
+ while($i<=$list['bjsum'])
+ {
+ $bjarr[] = array(
+ 'school'=>$list['school'],
+ 'ruxuenian'=>$list['ruxuenian'],
+ 'paixu'=>$paixumax+$i
+ );
+ $i++;
+ }
+
+ // 实例化班级数据模型类
+ $bj = new BJ();
+
+ // 保存数据
+ $data = $bj->saveAll($bjarr);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ //
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改班级信息
+ public function edit($id)
+ {
+
+ // 获取班级信息
+ $list = BJ::field('id,school,ruxuenian,paixu')
+ ->get($id);
+
+
+ $this->assign('list',$list);
+
+ return $this->fetch();
+ }
+
+
+
+
+
+ // 更新班级信息
+ public function update($id)
+ {
+ $validate = new \app\teach\validate\Xueqi;
+
+ // 获取表单数据
+ $list = request()->only(['title','xuenian','category','bfdate','enddate'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $xq = new XQ();
+ $data = $xq->save($list,['id'=>$id]);
+ // $data = BJ::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除班级
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = BJ::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置班级状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取班级信息
+ $data = BJ::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+ public function yidong($id)
+ {
+ // 获取操作参数
+ $caozuo = input('post.cz');
+
+ // 获取当前班级信息
+ $thisbj = BJ::get($id);
+
+ // 获取别一个班级信息
+ if( $caozuo > 0 )
+ {
+ $bjinfo = BJ::where('school',$thisbj->getData('school'))
+ ->where('ruxuenian',$thisbj->ruxuenian)
+ ->where('paixu','>=',$thisbj->paixu)
+ ->order(['paixu'])
+ ->limit('2')
+ ->field('id,paixu')
+ ->select();
+ }else{
+ $bjinfo = BJ::where('school',$thisbj->getData('school'))
+ ->where('ruxuenian',$thisbj->ruxuenian)
+ ->where('paixu','<=',$thisbj->paixu)
+ ->order(['paixu'=>'desc'])
+ ->limit('2')
+ ->field('id,paixu')
+ ->select();
+ }
+ if($bjinfo->count() == 2)
+ {
+ // 更改班级位置
+ foreach ($bjinfo as $key => $value) {
+ $value->paixu = $value->paixu + $caozuo;
+ $caozuo = $caozuo * -1;
+ }
+ $bjinfo = $bjinfo->toArray();
+
+ // 实例化班级数据模型
+ $bj = new BJ();
+ // 更新数据
+ $data = $bj->saveAll($bjinfo);
+ $data ? $data = ['msg'=>'移动成功','val'=>1] : $data = ['msg'=>'数据处理错误','val'=>0];
+ }else{
+ $data = ['msg'=>'已经到头啦~','val'=>0];
+ }
+
+ // 返回处理结果
+ return json($data);
+
+ }
+
+
+ // 根据单位年级获取班级列表
+ public function mybanji($school,$ruxuenian)
+ {
+ // 获取变量
+ $school = input('post.school');
+ $ruxuenian = input('post.ruxuenian');
+ // 获取班级id列表
+ $list = BJ::where('school',$school)
+ ->where('ruxuenian','in',$ruxuenian)
+ ->order('paixu')
+ ->field('id,ruxuenian,paixu')
+ ->where('status',1)
+ ->append(['banTitle'])
+ ->select();
+
+ return json($list);
+ }
+
+
+ // 获取该学校各年级的班级名和id
+ public function banjilist($school,$ruxuenian)
+ {
+ // 获取年级名对应的入学年
+ $njanmelist = nianjiList();
+ $bjnamelist = banjinamelist();
+ $njlist = array_keys($njanmelist);
+
+ if(is_array($ruxuenian)==false)
+ {
+ $ruxuenian = array($ruxuenian);
+ }
+
+ // 查询年级数据
+ $list = BJ:: where('school',$school)
+ ->where('ruxuenian','in',$ruxuenian)
+ ->where('status',1)
+ ->group('ruxuenian')
+ ->field('ruxuenian')
+ ->with([
+ 'njBanji'=>function($query)use($school){
+ $query->where('status',1)
+ ->where('school',$school)
+ ->field('id,ruxuenian,paixu')
+ ->where('status',1)
+ ->order('paixu')
+ ->append(['banjiTitle','banTitle']);
+ }
+ ])
+ ->select();
+ // 返回数据
+ return json($list);
+
+ }
+
+
+
+}
diff --git a/app/teach/controller/Error.php b/app/teach/controller/Error.php
new file mode 100644
index 00000000..f028576d
--- /dev/null
+++ b/app/teach/controller/Error.php
@@ -0,0 +1,11 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取学期信息列表
+ public function ajaxData()
+ {
+
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'update_time',
+ 'type'=>'asc',
+ 'xingzhi'=>array(),
+ 'searchval'=>''
+ ],'POST');
+
+ // 实例化
+ $sj = new SJ;
+
+ // 查询要显示的数据
+ $data = $sj->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+
+ // 创建学期
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加学科',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/subject',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\teach\validate\Subject;
+
+
+ // 获取表单数据
+ $list = request()->only(['title','jiancheng','category','kaoshi','paixu','lieming'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+ // 保存数据
+ $data = SJ::create($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ //
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改学期信息
+ public function edit($id)
+ {
+
+ // 获取学期信息
+ $list['data'] = SJ::field('id,title,jiancheng,category,kaoshi,lieming,paixu,status')
+ ->find($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑学科',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/subject/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+
+
+ // 更新学期信息
+ public function update($id)
+ {
+ $validate = new \app\teach\validate\Subject;
+
+ // 获取表单数据
+ $list = request()->only(['title','jiancheng','category','kaoshi','lieming','paixu'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $data = SJ::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除学期
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = SJ::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置学期状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学期信息
+ $data = SJ::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 学科列表
+ public function subjectlist(){
+ $data = SJ::where('status',1)
+ ->where('kaoshi',1)
+ ->field('id,title,jiancheng,lieming')
+ ->select();
+ return $data;
+ }
+
+}
diff --git a/app/teach/controller/Xueqi.php b/app/teach/controller/Xueqi.php
new file mode 100644
index 00000000..f66ce439
--- /dev/null
+++ b/app/teach/controller/Xueqi.php
@@ -0,0 +1,222 @@
+assign('list',$list);
+
+ // 渲染模板
+ return $this->fetch();
+ }
+
+
+ // 获取学期信息列表
+ public function ajaxData()
+ {
+
+ // 获取参数
+ $src = $this->request
+ ->only([
+ 'page'=>'1',
+ 'limit'=>'10',
+ 'field'=>'id',
+ 'type'=>'desc',
+ 'searchval'=>''
+ ],'POST');
+
+
+ // 实例化
+ $xq = new XQ;
+
+ // 查询要显示的数据
+ $data = $xq->search($src);
+ // 获取符合条件记录总数
+ $cnt = $data->count();
+ // 获取当前页数据
+ $limit_start = $src['page'] * $src['limit'] - $src['limit'];
+ $limit_length = $src['limit'];
+ $data = $data->slice($limit_start,$limit_length);
+
+ // 重组返回内容
+ $data = [
+ 'code'=> 0 , // ajax请求次数,作为标识符
+ 'msg'=>"", // 获取到的结果数(每页显示数量)
+ 'count'=>$cnt, // 符合条件的总数据量
+ 'data'=>$data, //获取到的数据结果
+ ];
+
+ return json($data);
+ }
+
+
+
+ // 创建学期
+ public function create()
+ {
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'添加学期',
+ 'butname'=>'添加',
+ 'formpost'=>'POST',
+ 'url'=>'/xueqi',
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+ // 保存信息
+ public function save()
+ {
+ // 实例化验证模型
+ $validate = new \app\teach\validate\Xueqi;
+
+
+ // 获取表单数据
+ $list = request()->only(['title','xuenian','category','bfdate','enddate'],'post');
+
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);
+ }
+
+ // 保存数据
+ $data = XQ::create($list);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'添加成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+ //
+ public function read($id)
+ {
+ //
+ }
+
+
+
+
+ // 修改学期信息
+ public function edit($id)
+ {
+
+ // 获取学期信息
+ $list['data'] = XQ::field('id,title,xuenian,category,bfdate,enddate')
+ ->get($id);
+
+ // 设置页面标题
+ $list['set'] = array(
+ 'webtitle'=>'编辑学期',
+ 'butname'=>'修改',
+ 'formpost'=>'PUT',
+ 'url'=>'/xueqi/'.$id,
+ );
+
+ // 模板赋值
+ $this->assign('list',$list);
+ // 渲染
+ return $this->fetch('create');
+ }
+
+
+
+
+
+ // 更新学期信息
+ public function update($id)
+ {
+ $validate = new \app\teach\validate\Xueqi;
+
+ // 获取表单数据
+ $list = request()->only(['title','xuenian','category','bfdate','enddate'],'put');
+
+ // 验证表单数据
+ $result = $validate->check($list);
+ $msg = $validate->getError();
+
+ // 如果验证不通过则停止保存
+ if(!$result){
+ return json(['msg'=>$msg,'val'=>0]);;
+ }
+
+
+ // 更新数据
+ $xq = new XQ();
+ $data = $xq->save($list,['id'=>$id]);
+ // $data = XQ::where('id',$id)->update($list);
+
+ // 根据更新结果设置返回提示信息
+ $data>=0 ? $data=['msg'=>'更新成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+
+
+ // 删除学期
+ public function delete($id)
+ {
+
+ if($id == 'm')
+ {
+ $id = request()->delete('ids');// 获取delete请求方式传送过来的数据并转换成数据
+ }
+
+ $data = XQ::destroy($id);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'删除成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+
+
+
+ // 设置学期状态
+ public function setStatus()
+ {
+
+ // 获取id变量
+ $id = request()->post('id');
+ $value = request()->post('value');
+
+ // 获取学期信息
+ $data = XQ::where('id',$id)->update(['status'=>$value]);
+
+ // 根据更新结果设置返回提示信息
+ $data ? $data=['msg'=>'状态设置成功','val'=>1] : $data=['msg'=>'数据处理错误','val'=>0];
+
+ // 返回信息
+ return json($data);
+ }
+}
diff --git a/app/teach/model/Banji.php b/app/teach/model/Banji.php
new file mode 100644
index 00000000..61bd5843
--- /dev/null
+++ b/app/teach/model/Banji.php
@@ -0,0 +1,120 @@
+order([$src['field'] =>$src['type']])
+ ->when(strlen($school)>0,function($query) use($school){
+ $query->where('school',$school);
+ })
+ ->when(strlen($ruxuenian)>0,function($query) use($ruxuenian){
+ $query->where('ruxuenian',$ruxuenian);
+ })
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'glSchool'=>function($query){
+ $query->field('id,title');
+ },
+ ]
+ )
+ ->withCount([
+ 'glStudent'=>function($query){
+ $query->where('status',1);
+ }
+ ])
+ ->append(['banjiTitle'])
+ ->select();
+ return $data;
+ }
+
+
+ // 学校关联模型
+ public function glSchool(){
+ return $this->belongsTo('\app\system\model\School','school','id');
+ }
+
+ // 学校关联模型
+ public function glStudent(){
+ return $this->hasMany('\app\renshi\model\Student','banji','id');
+ }
+
+
+ // 班级名获取器
+ public function getNumTitleAttr()
+ {
+ $njname = nianjilist();
+ // $bjname = banjinamelist();
+ $nj = $this->getAttr('ruxuenian');
+ $bj = $this->getAttr('paixu');
+
+ $numnj = array_flip(array_keys($njname));
+
+ if(array_key_exists($nj,$numnj))
+ {
+ $numname = ($numnj[$nj] + 1).'级'.$bj.'班';
+ }else{
+ $numname = $nj.'级'.$bj.'班';
+ }
+
+
+ return $numname;
+ }
+
+
+
+ // 班级名获取器
+ public function getBanjiTitleAttr()
+ {
+ $njname = nianjilist();
+ $bjname = banjinamelist();
+ $nj = $this->getAttr('ruxuenian');
+ $bj = $this->getAttr('paixu');
+
+ $njkeys = array_keys($njname);
+ $bjkeys = array_keys($bjname);
+
+ in_array($nj,$njkeys) ? $title = $njname[$nj] : $title = $nj.'届';
+ in_array($bj,$bjkeys) ? $title = $title.$bjname[$bj] : $title = $title.$bj.'班';
+
+ return $title;
+ }
+
+ // 班级名获取器
+ public function getBanTitleAttr()
+ {
+ $bjname = banjinamelist();
+ $bj = $this->getAttr('paixu');
+
+ $bjkeys = array_keys($bjname);
+
+ in_array($bj,$bjkeys) ? $title = $bjname[$bj] : $title = $bj.'班';
+
+ return $title;
+ }
+
+
+ // 年级-班级关联表
+ public function njBanji()
+ {
+ return $this->hasMany('Banji','ruxuenian','ruxuenian');
+ }
+
+}
diff --git a/app/teach/model/Subject.php b/app/teach/model/Subject.php
new file mode 100644
index 00000000..be5840d5
--- /dev/null
+++ b/app/teach/model/Subject.php
@@ -0,0 +1,42 @@
+order([$src['field'] =>$src['type']])
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title|jiancheng','like','%'.$searchval.'%');
+ })
+ ->with([
+ 'sujCategory'=>function($query){
+ $query->field('id,title');
+ }
+ ])
+ ->select();
+ return $data;
+ }
+
+ // 大类别关联
+ public function sujCategory()
+ {
+ return $this->belongsTo('\app\system\model\Category','category','id');
+ }
+
+
+ // 是否参加考试获取器
+ public function getKaoshiAttr($value){
+ $kaoshi = array(0=>'否',1=>'是');
+ return $kaoshi[$value];
+ }
+}
diff --git a/app/teach/model/Xueqi.php b/app/teach/model/Xueqi.php
new file mode 100644
index 00000000..4db1ac45
--- /dev/null
+++ b/app/teach/model/Xueqi.php
@@ -0,0 +1,62 @@
+belongsTo('\app\system\model\Category','category','id');
+ }
+
+ // 查询所有单位
+ public function search($src)
+ {
+ // 整理变量
+ $searchval = $src['searchval'];
+
+ // 查询数据
+ $data = $this
+ ->order([$src['field'] =>$src['type']])
+ ->when(strlen($searchval)>0,function($query) use($searchval){
+ $query->where('title|xuenian','like','%'.$searchval.'%');
+ })
+ ->with(
+ [
+ 'glCategory'=>function($query){
+ $query->field('id,title');
+ },
+ ]
+ )
+ ->select();
+ return $data;
+ }
+}
diff --git a/app/teach/validate/Banji.php b/app/teach/validate/Banji.php
new file mode 100644
index 00000000..1bd80124
--- /dev/null
+++ b/app/teach/validate/Banji.php
@@ -0,0 +1,28 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'school|学校' => 'require|number',
+ 'ruxuenian|年级' => 'require|number',
+ 'bjsum|班级数' => 'require|number'
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/teach/validate/Subject.php b/app/teach/validate/Subject.php
new file mode 100644
index 00000000..c934c7db
--- /dev/null
+++ b/app/teach/validate/Subject.php
@@ -0,0 +1,30 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|名称' => 'require|length:1,25',
+ 'jiancheng|简称' => 'require|length:1,6',
+ 'lieming|列标识' => 'require',
+ 'category|分类' => 'require|number',
+ 'paixu|排序' => 'number',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/teach/validate/Xueqi.php b/app/teach/validate/Xueqi.php
new file mode 100644
index 00000000..fa750332
--- /dev/null
+++ b/app/teach/validate/Xueqi.php
@@ -0,0 +1,30 @@
+ ['规则1','规则2'...]
+ *
+ * @var array
+ */
+ protected $rule = [
+ 'title|标题' => 'require|length:2,25',
+ 'xuenian|学年' => 'require|length:1,15',
+ 'category|分类' => 'require|number',
+ 'bfdate|时间' => 'require|date',
+ 'enddate|时间' => 'require|date',
+ ];
+
+ /**
+ * 定义错误信息
+ * 格式:'字段名.规则名' => '错误信息'
+ *
+ * @var array
+ */
+ protected $message = [];
+}
diff --git a/app/teach/view/banji/create.html b/app/teach/view/banji/create.html
new file mode 100644
index 00000000..7f0e43d6
--- /dev/null
+++ b/app/teach/view/banji/create.html
@@ -0,0 +1,55 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/teach/view/banji/index.html b/app/teach/view/banji/index.html
new file mode 100644
index 00000000..58cbf1f1
--- /dev/null
+++ b/app/teach/view/banji/index.html
@@ -0,0 +1,130 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 教务管理
+ 班级管理
+ 班级列表
+
+{/block}
+{block name="search"}
+
+
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/teach/view/subject/create.html b/app/teach/view/subject/create.html
new file mode 100644
index 00000000..1cc40c4a
--- /dev/null
+++ b/app/teach/view/subject/create.html
@@ -0,0 +1,93 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/teach/view/subject/index.html b/app/teach/view/subject/index.html
new file mode 100644
index 00000000..7fb061ce
--- /dev/null
+++ b/app/teach/view/subject/index.html
@@ -0,0 +1,102 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 系统管理
+ 教务管理
+ 学科列表
+
+{/block}
+{block name="search"}
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/app/teach/view/xueqi/create.html b/app/teach/view/xueqi/create.html
new file mode 100644
index 00000000..7fd22178
--- /dev/null
+++ b/app/teach/view/xueqi/create.html
@@ -0,0 +1,86 @@
+{extend name="common@create" /}
+
+{block name="form"}
+
+{/block}
+
+{block name="myjs"}
+
+{/block}
+
diff --git a/app/teach/view/xueqi/index.html b/app/teach/view/xueqi/index.html
new file mode 100644
index 00000000..2e5f88ce
--- /dev/null
+++ b/app/teach/view/xueqi/index.html
@@ -0,0 +1,102 @@
+
+{extend name="common@list" /}
+{block name="jsset"}
+
+{/block}
+{block name="nav"}
+
+ 系统管理
+ 教务管理
+ 学期列表
+
+{/block}
+{block name="search"}
+
+{/block}
+{block name="table"}
+
+{/block}
+{block name="myjs"}
+
+
+
+
+
+
+{/block}
\ No newline at end of file
diff --git a/composer.json b/composer.json
new file mode 100644
index 00000000..da028145
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,49 @@
+{
+ "name": "topthink/think",
+ "description": "the new thinkphp framework",
+ "type": "project",
+ "keywords": [
+ "framework",
+ "thinkphp",
+ "ORM"
+ ],
+ "homepage": "http://thinkphp.cn/",
+ "license": "Apache-2.0",
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ }
+ ],
+ "require": {
+ "php": ">=7.1.0",
+ "topthink/framework": "^6.0.0",
+ "topthink/think-orm": "^2.0",
+ "topthink/think-multi-app": "^1.0",
+ "topthink/think-view": "^1.0",
+ "topthink/think-template": "^2.0",
+ "topthink/think-captcha": "^3.0",
+ "whitehat101/apr1-md5": "^1.0"
+ },
+ "require-dev": {
+ "symfony/var-dumper": "^4.2",
+ "topthink/think-trace":"^1.0"
+ },
+ "autoload": {
+ "psr-4": {
+ "app\\": "app"
+ },
+ "psr-0": {
+ "": "extend/"
+ }
+ },
+ "config": {
+ "preferred-install": "dist"
+ },
+ "scripts": {
+ "post-autoload-dump": [
+ "@php think service:discover",
+ "@php think vendor:publish"
+ ]
+ }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 00000000..2279e15c
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,1111 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "5867a37e2dfac8abed05338ba1d7fe2b",
+ "packages": [
+ {
+ "name": "league/flysystem",
+ "version": "1.0.57",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/thephpleague/flysystem.git",
+ "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a",
+ "reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "ext-fileinfo": "*",
+ "php": ">=5.5.9"
+ },
+ "conflict": {
+ "league/flysystem-sftp": "<1.0.6"
+ },
+ "require-dev": {
+ "phpspec/phpspec": "^3.4",
+ "phpunit/phpunit": "^5.7.10"
+ },
+ "suggest": {
+ "ext-fileinfo": "Required for MimeType",
+ "ext-ftp": "Allows you to use FTP server storage",
+ "ext-openssl": "Allows you to use FTPS server storage",
+ "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
+ "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3",
+ "league/flysystem-azure": "Allows you to use Windows Azure Blob storage",
+ "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching",
+ "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem",
+ "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files",
+ "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib",
+ "league/flysystem-webdav": "Allows you to use WebDAV storage",
+ "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter",
+ "spatie/flysystem-dropbox": "Allows you to use Dropbox storage",
+ "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "League\\Flysystem\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Frank de Jonge",
+ "email": "info@frenky.net"
+ }
+ ],
+ "description": "Filesystem abstraction: Many filesystems, one API.",
+ "keywords": [
+ "Cloud Files",
+ "WebDAV",
+ "abstraction",
+ "aws",
+ "cloud",
+ "copy.com",
+ "dropbox",
+ "file systems",
+ "files",
+ "filesystem",
+ "filesystems",
+ "ftp",
+ "rackspace",
+ "remote",
+ "s3",
+ "sftp",
+ "storage"
+ ],
+ "time": "2019-10-16T21:01:05+00:00"
+ },
+ {
+ "name": "league/flysystem-cached-adapter",
+ "version": "1.0.9",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/thephpleague/flysystem-cached-adapter.git",
+ "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/thephpleague/flysystem-cached-adapter/zipball/08ef74e9be88100807a3b92cc9048a312bf01d6f",
+ "reference": "08ef74e9be88100807a3b92cc9048a312bf01d6f",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "league/flysystem": "~1.0",
+ "psr/cache": "^1.0.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "~0.9",
+ "phpspec/phpspec": "^3.4",
+ "phpunit/phpunit": "^5.7",
+ "predis/predis": "~1.0",
+ "tedivm/stash": "~0.12"
+ },
+ "suggest": {
+ "ext-phpredis": "Pure C implemented extension for PHP"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "League\\Flysystem\\Cached\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "frankdejonge",
+ "email": "info@frenky.net"
+ }
+ ],
+ "description": "An adapter decorator to enable meta-data caching.",
+ "time": "2018-07-09T20:51:04+00:00"
+ },
+ {
+ "name": "opis/closure",
+ "version": "3.4.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/opis/closure.git",
+ "reference": "27fdc275b7963492d0bf0852525da57ff2be67a0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/opis/closure/zipball/27fdc275b7963492d0bf0852525da57ff2be67a0",
+ "reference": "27fdc275b7963492d0bf0852525da57ff2be67a0",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": "^5.4 || ^7.0"
+ },
+ "require-dev": {
+ "jeremeamia/superclosure": "^2.0",
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.4.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Opis\\Closure\\": "src/"
+ },
+ "files": [
+ "functions.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Marius Sarca",
+ "email": "marius.sarca@gmail.com"
+ },
+ {
+ "name": "Sorin Sarca",
+ "email": "sarca_sorin@hotmail.com"
+ }
+ ],
+ "description": "A library that can be used to serialize closures (anonymous functions) and arbitrary objects.",
+ "homepage": "https://opis.io/closure",
+ "keywords": [
+ "anonymous functions",
+ "closure",
+ "function",
+ "serializable",
+ "serialization",
+ "serialize"
+ ],
+ "time": "2019-11-29T11:33:32+00:00"
+ },
+ {
+ "name": "psr/cache",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/cache.git",
+ "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8",
+ "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Cache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for caching libraries",
+ "keywords": [
+ "cache",
+ "psr",
+ "psr-6"
+ ],
+ "time": "2016-08-06T20:24:11+00:00"
+ },
+ {
+ "name": "psr/container",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/container.git",
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Container\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common Container Interface (PHP FIG PSR-11)",
+ "homepage": "https://github.com/php-fig/container",
+ "keywords": [
+ "PSR-11",
+ "container",
+ "container-interface",
+ "container-interop",
+ "psr"
+ ],
+ "time": "2017-02-14T16:28:37+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801",
+ "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.1.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "time": "2019-11-01T11:05:21+00:00"
+ },
+ {
+ "name": "psr/simple-cache",
+ "version": "1.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/simple-cache.git",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\SimpleCache\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interfaces for simple caching",
+ "keywords": [
+ "cache",
+ "caching",
+ "psr",
+ "psr-16",
+ "simple-cache"
+ ],
+ "time": "2017-10-23T01:57:42+00:00"
+ },
+ {
+ "name": "topthink/framework",
+ "version": "v6.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/framework.git",
+ "reference": "79c555aab0313d1a33ddcdb3c395f2c47f37f597"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/framework/zipball/79c555aab0313d1a33ddcdb3c395f2c47f37f597",
+ "reference": "79c555aab0313d1a33ddcdb3c395f2c47f37f597",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "ext-json": "*",
+ "ext-mbstring": "*",
+ "league/flysystem": "^1.0",
+ "league/flysystem-cached-adapter": "^1.0",
+ "opis/closure": "^3.1",
+ "php": ">=7.1.0",
+ "psr/container": "~1.0",
+ "psr/log": "~1.0",
+ "psr/simple-cache": "^1.0",
+ "topthink/think-helper": "^3.1.1",
+ "topthink/think-orm": "^2.0"
+ },
+ "require-dev": {
+ "mikey179/vfsstream": "^1.6",
+ "mockery/mockery": "^1.2",
+ "phpunit/phpunit": "^7.0"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [],
+ "psr-4": {
+ "think\\": "src/think/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ },
+ {
+ "name": "yunwuxin",
+ "email": "448901948@qq.com"
+ }
+ ],
+ "description": "The ThinkPHP Framework.",
+ "homepage": "http://thinkphp.cn/",
+ "keywords": [
+ "framework",
+ "orm",
+ "thinkphp"
+ ],
+ "time": "2019-10-23T23:28:43+00:00"
+ },
+ {
+ "name": "topthink/think-captcha",
+ "version": "v3.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-captcha.git",
+ "reference": "0b4305da19e118cefd934007875a8112f9352f01"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-captcha/zipball/0b4305da19e118cefd934007875a8112f9352f01",
+ "reference": "0b4305da19e118cefd934007875a8112f9352f01",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "topthink/framework": "^6.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "think": {
+ "services": [
+ "think\\captcha\\CaptchaService"
+ ],
+ "config": {
+ "captcha": "src/config.php"
+ }
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "think\\captcha\\": "src/"
+ },
+ "files": [
+ "src/helper.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "yunwuxin",
+ "email": "448901948@qq.com"
+ }
+ ],
+ "description": "captcha package for thinkphp",
+ "time": "2019-10-03T07:45:11+00:00"
+ },
+ {
+ "name": "topthink/think-helper",
+ "version": "v3.1.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-helper.git",
+ "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-helper/zipball/4d85dfd3778623bbb1de3648f1dcd0c82f4439f4",
+ "reference": "4d85dfd3778623bbb1de3648f1dcd0c82f4439f4",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=7.1.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "think\\": "src"
+ },
+ "files": [
+ "src/helper.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "yunwuxin",
+ "email": "448901948@qq.com"
+ }
+ ],
+ "description": "The ThinkPHP6 Helper Package",
+ "time": "2019-09-30T02:36:48+00:00"
+ },
+ {
+ "name": "topthink/think-multi-app",
+ "version": "v1.0.11",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-multi-app.git",
+ "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-multi-app/zipball/215f4a6bb88e53ad41b448c61957336eb55ce6f9",
+ "reference": "215f4a6bb88e53ad41b448c61957336eb55ce6f9",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=7.1.0",
+ "topthink/framework": "^6.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "think": {
+ "services": [
+ "think\\app\\Service"
+ ]
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "think\\app\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ }
+ ],
+ "description": "thinkphp6 multi app support",
+ "time": "2019-10-29T06:34:59+00:00"
+ },
+ {
+ "name": "topthink/think-orm",
+ "version": "v2.0.28",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-orm.git",
+ "reference": "ff5f112f5559497222f2716385b5a709ab82741b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-orm/zipball/ff5f112f5559497222f2716385b5a709ab82741b",
+ "reference": "ff5f112f5559497222f2716385b5a709ab82741b",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "ext-json": "*",
+ "php": ">=7.1.0",
+ "psr/log": "~1.0",
+ "psr/simple-cache": "^1.0",
+ "topthink/think-helper": "^3.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "think\\": "src"
+ },
+ "files": []
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ }
+ ],
+ "description": "think orm",
+ "keywords": [
+ "database",
+ "orm"
+ ],
+ "time": "2019-11-17T07:53:45+00:00"
+ },
+ {
+ "name": "topthink/think-template",
+ "version": "v2.0.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-template.git",
+ "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-template/zipball/e98bdbb4a4c94b442f17dfceba81e0134d4fbd19",
+ "reference": "e98bdbb4a4c94b442f17dfceba81e0134d4fbd19",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=7.1.0",
+ "psr/simple-cache": "^1.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "think\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ }
+ ],
+ "description": "the php template engine",
+ "time": "2019-09-20T15:31:04+00:00"
+ },
+ {
+ "name": "topthink/think-view",
+ "version": "v1.0.13",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-view.git",
+ "reference": "90803b73f781db5d42619082c4597afc58b2d4c5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-view/zipball/90803b73f781db5d42619082c4597afc58b2d4c5",
+ "reference": "90803b73f781db5d42619082c4597afc58b2d4c5",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=7.1.0",
+ "topthink/think-template": "^2.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "think\\view\\driver\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ }
+ ],
+ "description": "thinkphp template driver",
+ "time": "2019-10-07T12:23:10+00:00"
+ },
+ {
+ "name": "whitehat101/apr1-md5",
+ "version": "v1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/whitehat101/apr1-md5.git",
+ "reference": "8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/whitehat101/apr1-md5/zipball/8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819",
+ "reference": "8b261c9fc0481b4e9fa9d01c6ca70867b5d5e819",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.0.*"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "WhiteHat101\\Crypt\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jeremy Ebler",
+ "email": "jebler@gmail.com"
+ }
+ ],
+ "description": "Apache's APR1-MD5 algorithm in pure PHP",
+ "homepage": "https://github.com/whitehat101/apr1-md5",
+ "keywords": [
+ "MD5",
+ "apr1"
+ ],
+ "time": "2015-02-11T11:06:42+00:00"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "symfony/polyfill-mbstring",
+ "version": "v1.13.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-mbstring.git",
+ "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f",
+ "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mbstring": "For best performance"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.13-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Mbstring\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill for the Mbstring extension",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "mbstring",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2019-11-27T14:18:11+00:00"
+ },
+ {
+ "name": "symfony/polyfill-php72",
+ "version": "v1.13.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/polyfill-php72.git",
+ "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038",
+ "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.13-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Symfony\\Polyfill\\Php72\\": ""
+ },
+ "files": [
+ "bootstrap.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "compatibility",
+ "polyfill",
+ "portable",
+ "shim"
+ ],
+ "time": "2019-11-27T13:56:44+00:00"
+ },
+ {
+ "name": "symfony/var-dumper",
+ "version": "v4.4.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/var-dumper.git",
+ "reference": "eade2890f8b0eeb279b6cf41b50a10007294490f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/var-dumper/zipball/eade2890f8b0eeb279b6cf41b50a10007294490f",
+ "reference": "eade2890f8b0eeb279b6cf41b50a10007294490f",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": "^7.1.3",
+ "symfony/polyfill-mbstring": "~1.0",
+ "symfony/polyfill-php72": "~1.5"
+ },
+ "conflict": {
+ "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
+ "symfony/console": "<3.4"
+ },
+ "require-dev": {
+ "ext-iconv": "*",
+ "symfony/console": "^3.4|^4.0|^5.0",
+ "symfony/process": "^4.4|^5.0",
+ "twig/twig": "^1.34|^2.4|^3.0"
+ },
+ "suggest": {
+ "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).",
+ "ext-intl": "To show region name in time zone dump",
+ "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script"
+ },
+ "bin": [
+ "Resources/bin/var-dump-server"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "4.4-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "Resources/functions/dump.php"
+ ],
+ "psr-4": {
+ "Symfony\\Component\\VarDumper\\": ""
+ },
+ "exclude-from-classmap": [
+ "/Tests/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony mechanism for exploring and dumping PHP variables",
+ "homepage": "https://symfony.com",
+ "keywords": [
+ "debug",
+ "dump"
+ ],
+ "time": "2019-11-12T14:51:11+00:00"
+ },
+ {
+ "name": "topthink/think-trace",
+ "version": "v1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/top-think/think-trace.git",
+ "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/top-think/think-trace/zipball/4589d06a07945d57478cc2236f4b23d51ff919cc",
+ "reference": "4589d06a07945d57478cc2236f4b23d51ff919cc",
+ "shasum": "",
+ "mirrors": [
+ {
+ "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+ "preferred": true
+ }
+ ]
+ },
+ "require": {
+ "php": ">=7.1.0",
+ "topthink/framework": "^6.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "think": {
+ "services": [
+ "think\\trace\\Service"
+ ],
+ "config": {
+ "trace": "src/config.php"
+ }
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "think\\trace\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "Apache-2.0"
+ ],
+ "authors": [
+ {
+ "name": "liu21st",
+ "email": "liu21st@gmail.com"
+ }
+ ],
+ "description": "thinkphp debug trace",
+ "time": "2019-10-17T02:14:09+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": ">=7.1.0"
+ },
+ "platform-dev": []
+}
diff --git a/config/app.php b/config/app.php
new file mode 100644
index 00000000..098d9604
--- /dev/null
+++ b/config/app.php
@@ -0,0 +1,52 @@
+ Env::get('app.host', ''),
+ // 应用的命名空间
+ 'app_namespace' => '',
+ // 是否启用路由
+ 'with_route' => true,
+ // 是否启用事件
+ 'with_event' => true,
+ // 开启应用快速访问
+ 'app_express' => true,
+ // 默认应用
+ 'default_app' => 'index',
+ // 默认时区
+ 'default_timezone' => 'Asia/Shanghai',
+
+ // 应用映射(自动多应用模式有效)
+ 'app_map' => [],
+ // 域名绑定(自动多应用模式有效)
+ 'domain_bind' => [],
+ // 禁止URL访问的应用列表(自动多应用模式有效)
+ 'deny_app_list' => [],
+
+ // 异常页面的模板文件
+ 'exception_tmpl' => app()->getThinkPath() . 'tpl/think_exception.tpl',
+
+ // 错误显示信息,非调试模式有效
+ 'error_message' => '页面错误!请稍后再试~',
+ // 显示错误信息
+ 'show_error_msg' => true,
+ // 版本号
+ 'chengji' => [
+ 'version' => '1.5',
+ ],
+ // Auth权限验证公共配置
+ 'auth' => [
+ 'auth_on' => 1, // 权限开关
+ 'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。
+ 'auth_group' => 'cj_auth_group', // 用户组数据不带前缀表名
+ 'auth_group_access' => 'cj_auth_group_access', // 用户-用户组关系不带前缀表
+ 'auth_rule' => 'cj_auth_rule', // 权限规则不带前缀表
+ 'auth_user' => 'cj_member', // 用户信息不带前缀表
+ 'administrator' => [1,2], // 超级管理员列表
+ ],
+];
diff --git a/config/cache.php b/config/cache.php
new file mode 100644
index 00000000..dd492dfb
--- /dev/null
+++ b/config/cache.php
@@ -0,0 +1,30 @@
+ Env::get('cache.driver', 'file'),
+
+ // 缓存连接方式配置
+ 'stores' => [
+ 'file' => [
+ // 驱动方式
+ 'type' => 'File',
+ // 缓存保存目录
+ 'path' => '',
+ // 缓存前缀
+ 'prefix' => '',
+ // 缓存有效期 0表示永久缓存
+ 'expire' => 0,
+ // 缓存标签前缀
+ 'tag_prefix' => 'tag:',
+ // 序列化机制 例如 ['serialize', 'unserialize']
+ 'serialize' => [],
+ ],
+ // 更多的缓存连接
+ ],
+];
diff --git a/config/captcha.php b/config/captcha.php
new file mode 100644
index 00000000..9661b06d
--- /dev/null
+++ b/config/captcha.php
@@ -0,0 +1,39 @@
+ 5,
+ // 验证码字符集合
+ 'codeSet' => '2345678abcdefhijkmnpqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY',
+ // 验证码过期时间
+ 'expire' => 1800,
+ // 是否使用中文验证码
+ 'useZh' => false,
+ // 是否使用算术验证码
+ 'math' => true,
+ // 是否使用背景图
+ 'useImgBg' => false,
+ //验证码字符大小
+ 'fontSize' => 25,
+ // 是否使用混淆曲线
+ 'useCurve' => true,
+ //是否添加杂点
+ 'useNoise' => true,
+ // 验证码字体 不设置则随机
+ 'fontttf' => '',
+ //背景颜色
+ 'bg' => [243, 251, 254],
+ // 验证码图片高度
+ 'imageH' => 0,
+ // 验证码图片宽度
+ 'imageW' => 0,
+
+ // 添加额外的验证码设置
+ // verify => [
+ // 'length'=>4,
+ // ...
+ //],
+];
diff --git a/config/console.php b/config/console.php
new file mode 100644
index 00000000..a818a980
--- /dev/null
+++ b/config/console.php
@@ -0,0 +1,9 @@
+ [
+ ],
+];
diff --git a/config/cookie.php b/config/cookie.php
new file mode 100644
index 00000000..f728024f
--- /dev/null
+++ b/config/cookie.php
@@ -0,0 +1,18 @@
+ 0,
+ // cookie 保存路径
+ 'path' => '/',
+ // cookie 有效域名
+ 'domain' => '',
+ // cookie 启用安全传输
+ 'secure' => false,
+ // httponly设置
+ 'httponly' => false,
+ // 是否使用 setcookie
+ 'setcookie' => true,
+];
diff --git a/config/database.php b/config/database.php
new file mode 100644
index 00000000..54b73887
--- /dev/null
+++ b/config/database.php
@@ -0,0 +1,63 @@
+ Env::get('database.driver', 'mysql'),
+
+ // 自定义时间查询规则
+ 'time_query_rule' => [],
+
+ // 自动写入时间戳字段
+ // true为自动识别类型 false关闭
+ // 字符串则明确指定时间字段类型 支持 int timestamp datetime date
+ 'auto_timestamp' => true,
+
+ // 时间字段取出后的默认时间格式
+ 'datetime_format' => 'Y-m-d H:i:s',
+
+ // 数据库连接配置信息
+ 'connections' => [
+ 'mysql' => [
+ // 数据库类型
+ 'type' => Env::get('database.type', 'mysql'),
+ // 服务器地址
+ 'hostname' => Env::get('database.hostname', '127.0.0.1'),
+ // 数据库名
+ 'database' => Env::get('database.database', '`'),
+ // 用户名
+ 'username' => Env::get('database.username', 'root'),
+ // 密码
+ 'password' => Env::get('database.password', ''),
+ // 端口
+ 'hostport' => Env::get('database.hostport', '3306'),
+ // 数据库连接参数
+ 'params' => [],
+ // 数据库编码默认采用utf8
+ 'charset' => Env::get('database.charset', 'utf8'),
+ // 数据库表前缀
+ 'prefix' => Env::get('database.prefix', 'cj_'),
+
+ // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+ 'deploy' => 0,
+ // 数据库读写是否分离 主从式有效
+ 'rw_separate' => false,
+ // 读写分离后 主服务器数量
+ 'master_num' => 1,
+ // 指定从服务器序号
+ 'slave_no' => '',
+ // 是否严格检查字段是否存在
+ 'fields_strict' => true,
+ // 是否需要断线重连
+ 'break_reconnect' => false,
+ // 监听SQL
+ 'trigger_sql' => true,
+ // 开启字段缓存
+ 'fields_cache' => false,
+ // 字段缓存路径
+ 'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
+ ],
+
+ // 更多的数据库配置信息
+ ],
+];
diff --git a/config/filesystem.php b/config/filesystem.php
new file mode 100644
index 00000000..c851aed1
--- /dev/null
+++ b/config/filesystem.php
@@ -0,0 +1,26 @@
+ Env::get('filesystem.driver', 'local'),
+ // 磁盘列表
+ 'disks' => [
+ 'local' => [
+ 'type' => 'local',
+ 'root' => app()->getRuntimePath() . 'storage',
+ ],
+ 'public' => [
+ // 磁盘类型
+ 'type' => 'local',
+ // 磁盘路径
+ 'root' => app()->getRootPath() . 'public/storage',
+ // 磁盘路径对应的外部URL路径
+ 'url' => '/storage',
+ // 可见性
+ 'visibility' => 'public',
+ ],
+ // 更多的磁盘配置信息
+ ],
+];
diff --git a/config/lang.php b/config/lang.php
new file mode 100644
index 00000000..33232bd6
--- /dev/null
+++ b/config/lang.php
@@ -0,0 +1,27 @@
+ Env::get('lang.default_lang', 'zh-cn'),
+ // 允许的语言列表
+ 'allow_lang_list' => [],
+ // 多语言自动侦测变量名
+ 'detect_var' => 'lang',
+ // 是否使用Cookie记录
+ 'use_cookie' => true,
+ // 多语言cookie变量
+ 'cookie_var' => 'think_lang',
+ // 扩展语言包
+ 'extend_list' => [],
+ // Accept-Language转义为对应语言包名称
+ 'accept_language' => [
+ 'zh-hans-cn' => 'zh-cn',
+ ],
+ // 是否支持语言分组
+ 'allow_group' => false,
+];
diff --git a/config/log.php b/config/log.php
new file mode 100644
index 00000000..5f7afcbf
--- /dev/null
+++ b/config/log.php
@@ -0,0 +1,46 @@
+ Env::get('log.channel', 'file'),
+ // 日志记录级别
+ 'level' => [],
+ // 日志类型记录的通道 ['error'=>'email',...]
+ 'type_channel' => [],
+ // 关闭全局日志写入
+ 'close' => false,
+ // 全局日志处理 支持闭包
+ 'processor' => null,
+
+ // 日志通道列表
+ 'channels' => [
+ 'file' => [
+ // 日志记录方式
+ 'type' => 'File',
+ // 日志保存目录
+ 'path' => '',
+ // 单文件日志写入
+ 'single' => false,
+ // 独立日志级别
+ 'apart_level' => [],
+ // 最大日志文件数量
+ 'max_files' => 0,
+ // 使用JSON格式记录
+ 'json' => false,
+ // 日志处理
+ 'processor' => null,
+ // 关闭通道日志写入
+ 'close' => false,
+ // 日志输出格式化
+ 'format' => '[%s][%s] %s',
+ // 是否实时写入
+ 'realtime_write' => false,
+ ],
+ // 其它日志通道配置
+ ],
+
+];
diff --git a/config/middleware.php b/config/middleware.php
new file mode 100644
index 00000000..7e1972f5
--- /dev/null
+++ b/config/middleware.php
@@ -0,0 +1,8 @@
+ [],
+ // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
+ 'priority' => [],
+];
diff --git a/config/route.php b/config/route.php
new file mode 100644
index 00000000..f04b6000
--- /dev/null
+++ b/config/route.php
@@ -0,0 +1,45 @@
+ '/',
+ // URL伪静态后缀
+ 'url_html_suffix' => 'html',
+ // URL普通方式参数 用于自动生成
+ 'url_common_param' => true,
+ // 是否开启路由延迟解析
+ 'url_lazy_route' => false,
+ // 是否强制使用路由
+ 'url_route_must' => true,
+ // 合并路由规则
+ 'route_rule_merge' => false,
+ // 路由是否完全匹配
+ 'route_complete_match' => false,
+ // 访问控制器层名称
+ 'controller_layer' => 'controller',
+ // 空控制器名
+ 'empty_controller' => 'Error',
+ // 是否使用控制器后缀
+ 'controller_suffix' => false,
+ // 默认的路由变量规则
+ 'default_route_pattern' => '[\w\.]+',
+ // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
+ 'request_cache' => false,
+ // 请求缓存有效期
+ 'request_cache_expire' => null,
+ // 全局请求缓存排除规则
+ 'request_cache_except' => [],
+ // 默认控制器名
+ 'default_controller' => 'Index',
+ // 默认操作名
+ 'default_action' => 'index',
+ // 操作方法后缀
+ 'action_suffix' => '',
+ // 默认JSONP格式返回的处理方法
+ 'default_jsonp_handler' => 'jsonpReturn',
+ // 默认JSONP处理方法
+ 'var_jsonp_handler' => 'callback',
+];
diff --git a/config/session.php b/config/session.php
new file mode 100644
index 00000000..c1ef6e16
--- /dev/null
+++ b/config/session.php
@@ -0,0 +1,19 @@
+ 'PHPSESSID',
+ // SESSION_ID的提交变量,解决flash上传跨域
+ 'var_session_id' => '',
+ // 驱动方式 支持file cache
+ 'type' => 'file',
+ // 存储连接标识 当type使用cache的时候有效
+ 'store' => null,
+ // 过期时间
+ 'expire' => 1440,
+ // 前缀
+ 'prefix' => '',
+];
diff --git a/config/trace.php b/config/trace.php
new file mode 100644
index 00000000..fad2392d
--- /dev/null
+++ b/config/trace.php
@@ -0,0 +1,10 @@
+ 'Html',
+ // 读取的日志通道名
+ 'channel' => '',
+];
diff --git a/config/view.php b/config/view.php
new file mode 100644
index 00000000..adddbbd0
--- /dev/null
+++ b/config/view.php
@@ -0,0 +1,34 @@
+ 'Think',
+ // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
+ 'auto_rule' => 1,
+ // 模板目录名
+ 'view_dir_name' => 'view',
+ // 模板后缀
+ 'view_suffix' => 'html',
+ // 模板文件名分隔符
+ 'view_depr' => DIRECTORY_SEPARATOR,
+ // 模板引擎普通标签开始标记
+ 'tpl_begin' => '{',
+ // 模板引擎普通标签结束标记
+ 'tpl_end' => '}',
+ // 标签库标签开始标记
+ 'taglib_begin' => '{',
+ // 标签库标签结束标记
+ 'taglib_end' => '}',
+ // 布局模板开关
+ // 'layout_on' => true,
+ // 布局模板入口文件
+ // 'layout_name' => 'layout',
+ 'tpl_replace_string' => [
+ '__STATIC__'=>'/static',
+ '__UPLOAD__'=>'/uploads',
+ ]
+
+];
diff --git a/extend/.gitignore b/extend/.gitignore
new file mode 100644
index 00000000..c96a04f0
--- /dev/null
+++ b/extend/.gitignore
@@ -0,0 +1,2 @@
+*
+!.gitignore
\ No newline at end of file
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 00000000..cbc78689
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,8 @@
+
+ Options +FollowSymlinks -Multiviews
+ RewriteEngine On
+
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
+
diff --git a/public/examples/20190524162731.png b/public/examples/20190524162731.png
new file mode 100644
index 00000000..264652ea
Binary files /dev/null and b/public/examples/20190524162731.png differ
diff --git a/public/examples/20190524164321.png b/public/examples/20190524164321.png
new file mode 100644
index 00000000..c8157636
Binary files /dev/null and b/public/examples/20190524164321.png differ
diff --git a/public/examples/20190524164409.png b/public/examples/20190524164409.png
new file mode 100644
index 00000000..4bd79648
Binary files /dev/null and b/public/examples/20190524164409.png differ
diff --git a/public/examples/20190524164451.png b/public/examples/20190524164451.png
new file mode 100644
index 00000000..eb638df3
Binary files /dev/null and b/public/examples/20190524164451.png differ
diff --git a/public/examples/timg.jpg b/public/examples/timg.jpg
new file mode 100644
index 00000000..1d9acfc7
Binary files /dev/null and b/public/examples/timg.jpg differ
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 00000000..3d2ec742
Binary files /dev/null and b/public/favicon.ico differ
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 00000000..e3c0fe90
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,24 @@
+
+// +----------------------------------------------------------------------
+
+// [ 应用入口文件 ]
+namespace think;
+
+require __DIR__ . '/../vendor/autoload.php';
+
+// 执行HTTP应用并响应
+$http = (new App())->http;
+
+$response = $http->run();
+
+$response->send();
+
+$http->end($response);
diff --git a/public/robots.txt b/public/robots.txt
new file mode 100644
index 00000000..eb053628
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:
diff --git a/public/router.php b/public/router.php
new file mode 100644
index 00000000..ac7b3c8a
--- /dev/null
+++ b/public/router.php
@@ -0,0 +1,17 @@
+
+// +----------------------------------------------------------------------
+// $Id$
+
+if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
+ return false;
+} else {
+ require __DIR__ . "/index.php";
+}
diff --git a/public/static/echarts/echarts-gl.js b/public/static/echarts/echarts-gl.js
new file mode 100644
index 00000000..09910548
--- /dev/null
+++ b/public/static/echarts/echarts-gl.js
@@ -0,0 +1,56990 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory(require("echarts"));
+ else if(typeof define === 'function' && define.amd)
+ define(["echarts"], factory);
+ else if(typeof exports === 'object')
+ exports["echarts-gl"] = factory(require("echarts"));
+ else
+ root["echarts-gl"] = factory(root["echarts"]);
+})(this, function(__WEBPACK_EXTERNAL_MODULE_0__) {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/
+/******/ // Check if module is in cache
+/******/ if(installedModules[moduleId]) {
+/******/ return installedModules[moduleId].exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ i: moduleId,
+/******/ l: false,
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+/******/
+/******/ // Flag the module as loaded
+/******/ module.l = true;
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+/******/
+/******/ // define getter function for harmony exports
+/******/ __webpack_require__.d = function(exports, name, getter) {
+/******/ if(!__webpack_require__.o(exports, name)) {
+/******/ Object.defineProperty(exports, name, {
+/******/ configurable: false,
+/******/ enumerable: true,
+/******/ get: getter
+/******/ });
+/******/ }
+/******/ };
+/******/
+/******/ // getDefaultExport function for compatibility with non-harmony modules
+/******/ __webpack_require__.n = function(module) {
+/******/ var getter = module && module.__esModule ?
+/******/ function getDefault() { return module['default']; } :
+/******/ function getModuleExports() { return module; };
+/******/ __webpack_require__.d(getter, 'a', getter);
+/******/ return getter;
+/******/ };
+/******/
+/******/ // Object.prototype.hasOwnProperty.call
+/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
+/******/
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+/******/
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(__webpack_require__.s = 106);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ (function(module, exports) {
+
+module.exports = __WEBPACK_EXTERNAL_MODULE_0__;
+
+/***/ }),
+/* 1 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_claygl_src_Mesh__ = __webpack_require__(40);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_claygl_src_Renderer__ = __webpack_require__(52);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__ = __webpack_require__(5);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__ = __webpack_require__(8);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__ = __webpack_require__(19);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__ = __webpack_require__(35);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_claygl_src_Geometry__ = __webpack_require__(15);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__ = __webpack_require__(36);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU__ = __webpack_require__(60);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU__);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__ = __webpack_require__(61);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__EChartsSurface__ = __webpack_require__(124);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_claygl_src_light_AmbientCubemap__ = __webpack_require__(125);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_claygl_src_light_AmbientSH__ = __webpack_require__(129);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_claygl_src_util_sh__ = __webpack_require__(130);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__retrieve__ = __webpack_require__(2);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_claygl_src_geometry_Sphere__ = __webpack_require__(132);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_claygl_src_geometry_Plane__ = __webpack_require__(43);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_19_claygl_src_geometry_Cube__ = __webpack_require__(76);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_claygl_src_light_Ambient__ = __webpack_require__(133);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_21_claygl_src_light_Directional__ = __webpack_require__(134);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_22_claygl_src_light_Point__ = __webpack_require__(135);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_23_claygl_src_light_Spot__ = __webpack_require__(136);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_24_claygl_src_camera_Perspective__ = __webpack_require__(41);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_25_claygl_src_camera_Orthographic__ = __webpack_require__(37);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_26_claygl_src_math_Vector2__ = __webpack_require__(26);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_27_claygl_src_math_Vector3__ = __webpack_require__(3);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_28_claygl_src_math_Vector4__ = __webpack_require__(137);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_29_claygl_src_math_Quaternion__ = __webpack_require__(56);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_30_claygl_src_math_Matrix2__ = __webpack_require__(138);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_31_claygl_src_math_Matrix2d__ = __webpack_require__(139);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_32_claygl_src_math_Matrix3__ = __webpack_require__(140);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_33_claygl_src_math_Matrix4__ = __webpack_require__(9);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_34_claygl_src_math_Plane__ = __webpack_require__(74);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_35_claygl_src_math_Ray__ = __webpack_require__(54);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_36_claygl_src_math_BoundingBox__ = __webpack_require__(18);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_37_claygl_src_math_Frustum__ = __webpack_require__(59);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__animatableMixin__ = __webpack_require__(141);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_39_claygl_src_shader_source_util_glsl_js__ = __webpack_require__(146);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_40_claygl_src_shader_source_prez_glsl_js__ = __webpack_require__(71);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__shader_common_glsl_js__ = __webpack_require__(147);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__shader_color_glsl_js__ = __webpack_require__(148);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__shader_lambert_glsl_js__ = __webpack_require__(149);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__shader_realistic_glsl_js__ = __webpack_require__(150);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__shader_hatching_glsl_js__ = __webpack_require__(151);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__shader_shadow_glsl_js__ = __webpack_require__(152);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// Math
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// Some common shaders
+
+
+
+
+
+
+
+
+
+
+__WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default.a.util.extend(__WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__["a" /* default */].prototype, __WEBPACK_IMPORTED_MODULE_38__animatableMixin__["a" /* default */]);
+
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_39_claygl_src_shader_source_util_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_40_claygl_src_shader_source_prez_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_41__shader_common_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_42__shader_color_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_43__shader_lambert_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_44__shader_realistic_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_45__shader_hatching_glsl_js__["a" /* default */]);
+__WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].import(__WEBPACK_IMPORTED_MODULE_46__shader_shadow_glsl_js__["a" /* default */]);
+
+function isValueNone(value) {
+ return !value || value === 'none';
+}
+
+function isValueImage(value) {
+ return value instanceof HTMLCanvasElement
+ || value instanceof HTMLImageElement
+ || value instanceof Image;
+}
+
+function isECharts(value) {
+ return value.getZr && value.setOption;
+}
+
+// Overwrite addToScene and removeFromScene
+var oldAddToScene = __WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.addToScene;
+var oldRemoveFromScene = __WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.removeFromScene;
+
+__WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.addToScene = function (node) {
+ oldAddToScene.call(this, node);
+
+ if (this.__zr) {
+ var zr = this.__zr;
+ node.traverse(function (child) {
+ child.__zr = zr;
+ if (child.addAnimatorsToZr) {
+ child.addAnimatorsToZr(zr);
+ }
+ });
+ }
+};
+
+__WEBPACK_IMPORTED_MODULE_9_claygl_src_Scene__["a" /* default */].prototype.removeFromScene = function (node) {
+ oldRemoveFromScene.call(this, node);
+
+ node.traverse(function (child) {
+ var zr = child.__zr;
+ child.__zr = null;
+ if (zr && child.removeAnimatorsFromZr) {
+ child.removeAnimatorsFromZr(zr);
+ }
+ });
+};
+
+/**
+ * @param {string} textureName
+ * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue
+ * @param {module:echarts/ExtensionAPI} api
+ * @param {Object} [textureOpts]
+ */
+__WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__["a" /* default */].prototype.setTextureImage = function (textureName, imgValue, api, textureOpts) {
+ if (!this.shader) {
+ return;
+ }
+
+ var zr = api.getZr();
+ var material = this;
+ var texture;
+ material.autoUpdateTextureStatus = false;
+ // disableTexture first
+ material.disableTexture(textureName);
+ if (!isValueNone(imgValue)) {
+ texture = graphicGL.loadTexture(imgValue, api, textureOpts, function (texture) {
+ material.enableTexture(textureName);
+ zr && zr.refresh();
+ });
+ // Set texture immediately for other code to verify if have this texture.
+ material.set(textureName, texture);
+ }
+
+ return texture;
+};
+
+var graphicGL = {};
+
+graphicGL.Renderer = __WEBPACK_IMPORTED_MODULE_1_claygl_src_Renderer__["a" /* default */];
+
+graphicGL.Node = __WEBPACK_IMPORTED_MODULE_6_claygl_src_Node__["a" /* default */];
+
+graphicGL.Mesh = __WEBPACK_IMPORTED_MODULE_0_claygl_src_Mesh__["a" /* default */];
+
+graphicGL.Shader = __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */];
+
+graphicGL.Material = __WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__["a" /* default */];
+
+graphicGL.Texture = __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */];
+
+graphicGL.Texture2D = __WEBPACK_IMPORTED_MODULE_2_claygl_src_Texture2D__["a" /* default */];
+
+// Geometries
+graphicGL.Geometry = __WEBPACK_IMPORTED_MODULE_7_claygl_src_Geometry__["a" /* default */];
+graphicGL.SphereGeometry = __WEBPACK_IMPORTED_MODULE_17_claygl_src_geometry_Sphere__["a" /* default */];
+graphicGL.PlaneGeometry = __WEBPACK_IMPORTED_MODULE_18_claygl_src_geometry_Plane__["a" /* default */];
+graphicGL.CubeGeometry = __WEBPACK_IMPORTED_MODULE_19_claygl_src_geometry_Cube__["a" /* default */];
+
+// Lights
+graphicGL.AmbientLight = __WEBPACK_IMPORTED_MODULE_20_claygl_src_light_Ambient__["a" /* default */];
+graphicGL.DirectionalLight = __WEBPACK_IMPORTED_MODULE_21_claygl_src_light_Directional__["a" /* default */];
+graphicGL.PointLight = __WEBPACK_IMPORTED_MODULE_22_claygl_src_light_Point__["a" /* default */];
+graphicGL.SpotLight = __WEBPACK_IMPORTED_MODULE_23_claygl_src_light_Spot__["a" /* default */];
+
+// Cameras
+graphicGL.PerspectiveCamera = __WEBPACK_IMPORTED_MODULE_24_claygl_src_camera_Perspective__["a" /* default */];
+graphicGL.OrthographicCamera = __WEBPACK_IMPORTED_MODULE_25_claygl_src_camera_Orthographic__["a" /* default */];
+
+// Math
+graphicGL.Vector2 = __WEBPACK_IMPORTED_MODULE_26_claygl_src_math_Vector2__["a" /* default */];
+graphicGL.Vector3 = __WEBPACK_IMPORTED_MODULE_27_claygl_src_math_Vector3__["a" /* default */];
+graphicGL.Vector4 = __WEBPACK_IMPORTED_MODULE_28_claygl_src_math_Vector4__["a" /* default */];
+
+graphicGL.Quaternion = __WEBPACK_IMPORTED_MODULE_29_claygl_src_math_Quaternion__["a" /* default */];
+
+graphicGL.Matrix2 = __WEBPACK_IMPORTED_MODULE_30_claygl_src_math_Matrix2__["a" /* default */];
+graphicGL.Matrix2d = __WEBPACK_IMPORTED_MODULE_31_claygl_src_math_Matrix2d__["a" /* default */];
+graphicGL.Matrix3 = __WEBPACK_IMPORTED_MODULE_32_claygl_src_math_Matrix3__["a" /* default */];
+graphicGL.Matrix4 = __WEBPACK_IMPORTED_MODULE_33_claygl_src_math_Matrix4__["a" /* default */];
+
+graphicGL.Plane = __WEBPACK_IMPORTED_MODULE_34_claygl_src_math_Plane__["a" /* default */];
+graphicGL.Ray = __WEBPACK_IMPORTED_MODULE_35_claygl_src_math_Ray__["a" /* default */];
+graphicGL.BoundingBox = __WEBPACK_IMPORTED_MODULE_36_claygl_src_math_BoundingBox__["a" /* default */];
+graphicGL.Frustum = __WEBPACK_IMPORTED_MODULE_37_claygl_src_math_Frustum__["a" /* default */];
+
+// Texture utilities
+
+var blankImage = __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__["a" /* default */].createBlank('rgba(255,255,255,0)').image;
+
+
+function nearestPowerOfTwo(val) {
+ return Math.pow(2, Math.round(Math.log(val) / Math.LN2));
+}
+function convertTextureToPowerOfTwo(texture) {
+ if ((texture.wrapS === __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].REPEAT || texture.wrapT === __WEBPACK_IMPORTED_MODULE_3_claygl_src_Texture__["a" /* default */].REPEAT)
+ && texture.image
+ ) {
+ // var canvas = document.createElement('canvas');
+ var width = nearestPowerOfTwo(texture.width);
+ var height = nearestPowerOfTwo(texture.height);
+ if (width !== texture.width || height !== texture.height) {
+ var canvas = document.createElement('canvas');
+ canvas.width = width;
+ canvas.height = height;
+ var ctx = canvas.getContext('2d');
+ ctx.drawImage(texture.image, 0, 0, width, height);
+ texture.image = canvas;
+ }
+ }
+}
+/**
+ * @param {string|HTMLImageElement|HTMLCanvasElement} imgValue
+ * @param {module:echarts/ExtensionAPI} api
+ * @param {Object} [textureOpts]
+ * @param {Function} cb
+ */
+// TODO Promise, test
+graphicGL.loadTexture = function (imgValue, api, textureOpts, cb) {
+ if (typeof textureOpts === 'function') {
+ cb = textureOpts;
+ textureOpts = {};
+ }
+ textureOpts = textureOpts || {};
+
+ var keys = Object.keys(textureOpts).sort();
+ var prefix = '';
+ for (var i = 0; i < keys.length; i++) {
+ prefix += keys[i] + '_' + textureOpts[keys[i]] + '_';
+ }
+
+ var textureCache = api.__textureCache = api.__textureCache || new __WEBPACK_IMPORTED_MODULE_10_zrender_lib_core_LRU___default.a(20);
+
+ if (isECharts(imgValue)) {
+ var id = imgValue.__textureid__;
+ var textureObj = textureCache.get(prefix + id);
+ if (!textureObj) {
+ var surface = new __WEBPACK_IMPORTED_MODULE_12__EChartsSurface__["a" /* default */](imgValue);
+ surface.onupdate = function () {
+ api.getZr().refresh();
+ };
+ textureObj = {
+ texture: surface.getTexture()
+ };
+ for (var i = 0; i < keys.length; i++) {
+ textureObj.texture[keys[i]] = textureOpts[keys[i]];
+ }
+ id = imgValue.__textureid__ || '__ecgl_ec__' + textureObj.texture.__uid__;
+ imgValue.__textureid__ = id;
+ textureCache.put(prefix + id, textureObj);
+ cb && cb(textureObj.texture);
+ }
+ else {
+ textureObj.texture.surface.setECharts(imgValue);
+
+ cb && cb(textureObj.texture);
+ }
+ return textureObj.texture;
+ }
+ else if (isValueImage(imgValue)) {
+ var id = imgValue.__textureid__;
+ var textureObj = textureCache.get(prefix + id);
+ if (!textureObj) {
+ textureObj = {
+ texture: new graphicGL.Texture2D({
+ image: imgValue
+ })
+ };
+ for (var i = 0; i < keys.length; i++) {
+ textureObj.texture[keys[i]] = textureOpts[keys[i]];
+ }
+ id = imgValue.__textureid__ || '__ecgl_image__' + textureObj.texture.__uid__;
+ imgValue.__textureid__ = id;
+ textureCache.put(prefix + id, textureObj);
+
+ convertTextureToPowerOfTwo(textureObj.texture);
+ // TODO Next tick?
+ cb && cb(textureObj.texture);
+ }
+ return textureObj.texture;
+ }
+ else {
+ var textureObj = textureCache.get(prefix + imgValue);
+ if (textureObj) {
+ if (textureObj.callbacks) {
+ // Add to pending callbacks
+ textureObj.callbacks.push(cb);
+ }
+ else {
+ // TODO Next tick?
+ cb && cb(textureObj.texture);
+ }
+ }
+ else {
+ // Maybe base64
+ if (imgValue.match(/.hdr$|^data:application\/octet-stream/)) {
+ textureObj = {
+ callbacks: [cb]
+ };
+ var texture = __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__["a" /* default */].loadTexture(imgValue, {
+ exposure: textureOpts.exposure,
+ fileType: 'hdr'
+ }, function () {
+ texture.dirty();
+ textureObj.callbacks.forEach(function (cb) {
+ cb && cb(texture);
+ });
+ textureObj.callbacks = null;
+ });
+ textureObj.texture = texture;
+ textureCache.put(prefix + imgValue, textureObj);
+ }
+ else {
+ var texture = new graphicGL.Texture2D({
+ image: new Image()
+ });
+ for (var i = 0; i < keys.length; i++) {
+ texture[keys[i]] = textureOpts[keys[i]];
+ }
+
+ textureObj = {
+ texture: texture,
+ callbacks: [cb]
+ };
+ var originalImage = texture.image;
+ originalImage.onload = function () {
+ texture.image = originalImage;
+ convertTextureToPowerOfTwo(texture);
+
+ texture.dirty();
+ textureObj.callbacks.forEach(function (cb) {
+ cb && cb(texture);
+ });
+ textureObj.callbacks = null;
+ };
+ originalImage.src = imgValue;
+ // Use blank image as place holder.
+ texture.image = blankImage;
+
+ textureCache.put(prefix + imgValue, textureObj);
+ }
+ }
+
+ return textureObj.texture;
+ }
+};
+
+/**
+ * Create ambientCubemap and ambientSH light. respectively to have specular and diffuse light
+ * @return {Object} { specular, diffuse }
+ */
+graphicGL.createAmbientCubemap = function (opt, renderer, api, cb) {
+ opt = opt || {};
+ var textureUrl = opt.texture;
+ var exposure = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(opt.exposure, 1.0);
+
+ var ambientCubemap = new __WEBPACK_IMPORTED_MODULE_13_claygl_src_light_AmbientCubemap__["a" /* default */]({
+ intensity: __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(opt.specularIntensity, 1.0)
+ });
+ var ambientSH = new __WEBPACK_IMPORTED_MODULE_14_claygl_src_light_AmbientSH__["a" /* default */]({
+ intensity: __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(opt.diffuseIntensity, 1.0),
+ coefficients: [0.844, 0.712, 0.691, -0.037, 0.083, 0.167, 0.343, 0.288, 0.299, -0.041, -0.021, -0.009, -0.003, -0.041, -0.064, -0.011, -0.007, -0.004, -0.031, 0.034, 0.081, -0.060, -0.049, -0.060, 0.046, 0.056, 0.050]
+ });
+
+
+ ambientCubemap.cubemap = graphicGL.loadTexture(textureUrl, api, {
+ exposure: exposure
+ }, function () {
+ // TODO Performance when multiple view
+ ambientCubemap.cubemap.flipY = false;
+ if (true) {
+ var time = Date.now();
+ }
+ ambientCubemap.prefilter(renderer, 32);
+ if (true) {
+ var dTime = Date.now() - time;
+ console.log('Prefilter environment map: ' + dTime + 'ms');
+ }
+ ambientSH.coefficients = __WEBPACK_IMPORTED_MODULE_15_claygl_src_util_sh__["a" /* default */].projectEnvironmentMap(renderer, ambientCubemap.cubemap, {
+ lod: 1
+ });
+
+ cb && cb();
+
+ // TODO Refresh ?
+ });
+
+ return {
+ specular: ambientCubemap,
+ diffuse: ambientSH
+ };
+};
+
+/**
+ * Create a blank texture for placeholder
+ */
+graphicGL.createBlankTexture = __WEBPACK_IMPORTED_MODULE_11_claygl_src_util_texture__["a" /* default */].createBlank;
+
+/**
+ * If value is image
+ * @param {*}
+ * @return {boolean}
+ */
+graphicGL.isImage = isValueImage;
+
+graphicGL.additiveBlend = function (gl) {
+ gl.blendEquation(gl.FUNC_ADD);
+ gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
+};
+
+/**
+ * @param {string|Array.
} colorStr
+ * @param {Array.} [rgba]
+ * @return {Array.} rgba
+ */
+graphicGL.parseColor = function (colorStr, rgba) {
+ if (colorStr instanceof Array) {
+ if (!rgba) {
+ rgba = [];
+ }
+ // Color has been parsed.
+ rgba[0] = colorStr[0];
+ rgba[1] = colorStr[1];
+ rgba[2] = colorStr[2];
+ if (colorStr.length > 3) {
+ rgba[3] = colorStr[3];
+ }
+ else {
+ rgba[3] = 1;
+ }
+ return rgba;
+ }
+
+ rgba = __WEBPACK_IMPORTED_MODULE_8_echarts_lib_echarts___default.a.color.parse(colorStr || '#000', rgba) || [0, 0, 0, 0];
+ rgba[0] /= 255;
+ rgba[1] /= 255;
+ rgba[2] /= 255;
+ return rgba;
+};
+
+/**
+ * Convert alpha beta rotation to direction.
+ * @param {number} alpha
+ * @param {number} beta
+ * @return {Array.}
+ */
+graphicGL.directionFromAlphaBeta = function (alpha, beta) {
+ var theta = alpha / 180 * Math.PI + Math.PI / 2;
+ var phi = -beta / 180 * Math.PI + Math.PI / 2;
+
+ var dir = [];
+ var r = Math.sin(theta);
+ dir[0] = r * Math.cos(phi);
+ dir[1] = -Math.cos(theta);
+ dir[2] = r * Math.sin(phi);
+
+ return dir;
+};
+/**
+ * Get shadow resolution from shadowQuality configuration
+ */
+graphicGL.getShadowResolution = function (shadowQuality) {
+ var shadowResolution = 1024;
+ switch (shadowQuality) {
+ case 'low':
+ shadowResolution = 512;
+ break;
+ case 'medium':
+ break;
+ case 'high':
+ shadowResolution = 2048;
+ break;
+ case 'ultra':
+ shadowResolution = 4096;
+ break;
+ }
+ return shadowResolution;
+};
+
+/**
+ * Shading utilities
+ */
+graphicGL.COMMON_SHADERS = ['lambert', 'color', 'realistic', 'hatching'];
+
+/**
+ * Create shader including vertex and fragment
+ * @param {string} prefix.
+ */
+graphicGL.createShader = function (prefix) {
+ var vertexShaderStr = __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source(prefix + '.vertex');
+ var fragmentShaderStr = __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */].source(prefix + '.fragment');
+ if (!vertexShaderStr) {
+ console.error('Vertex shader of \'%s\' not exits', prefix);
+ }
+ if (!fragmentShaderStr) {
+ console.error('Fragment shader of \'%s\' not exits', prefix);
+ }
+ var shader = new __WEBPACK_IMPORTED_MODULE_4_claygl_src_Shader__["a" /* default */](vertexShaderStr, fragmentShaderStr);
+ shader.name = prefix;
+ return shader;
+};
+
+graphicGL.createMaterial = function (prefix, defines) {
+ if (!(defines instanceof Array)) {
+ defines = [defines];
+ }
+ var shader = graphicGL.createShader(prefix);
+ var material = new __WEBPACK_IMPORTED_MODULE_5_claygl_src_Material__["a" /* default */]({
+ shader: shader
+ });
+ defines.forEach(function (defineName) {
+ if (typeof defineName === 'string') {
+ material.define(defineName);
+ }
+ });
+ return material;
+};
+/**
+ * Set material from model.
+ * @param {clay.Material} material
+ * @param {module:echarts/model/Model} model
+ * @param {module:echarts/ExtensionAPI} api
+ */
+graphicGL.setMaterialFromModel = function (shading, material, model, api) {
+ material.autoUpdateTextureStatus = false;
+
+ var materialModel = model.getModel(shading + 'Material');
+ var detailTexture = materialModel.get('detailTexture');
+ var uvRepeat = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('textureTiling'), 1.0);
+ var uvOffset = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('textureOffset'), 0.0);
+ if (typeof uvRepeat === 'number') {
+ uvRepeat = [uvRepeat, uvRepeat];
+ }
+ if (typeof uvOffset === 'number') {
+ uvOffset = [uvOffset, uvOffset];
+ }
+ var repeatParam = (uvRepeat[0] > 1 || uvRepeat[1] > 1) ? graphicGL.Texture.REPEAT : graphicGL.Texture.CLAMP_TO_EDGE;
+ var textureOpt = {
+ anisotropic: 8,
+ wrapS: repeatParam,
+ wrapT: repeatParam
+ };
+ if (shading === 'realistic') {
+ var roughness = materialModel.get('roughness');
+ var metalness = materialModel.get('metalness');
+ if (metalness != null) {
+ // Try to treat as a texture, TODO More check
+ if (isNaN(metalness)) {
+ material.setTextureImage('metalnessMap', metalness, api, textureOpt);
+ metalness = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('metalnessAdjust'), 0.5);
+ }
+ }
+ else {
+ // Default metalness.
+ metalness = 0;
+ }
+ if (roughness != null) {
+ // Try to treat as a texture, TODO More check
+ if (isNaN(roughness)) {
+ material.setTextureImage('roughnessMap', roughness, api, textureOpt);
+ roughness = __WEBPACK_IMPORTED_MODULE_16__retrieve__["a" /* default */].firstNotNull(materialModel.get('roughnessAdjust'), 0.5);
+ }
+ }
+ else {
+ // Default roughness.
+ roughness = 0.5;
+ }
+ var normalTextureVal = materialModel.get('normalTexture');
+ material.setTextureImage('detailMap', detailTexture, api, textureOpt);
+ material.setTextureImage('normalMap', normalTextureVal, api, textureOpt);
+ material.set({
+ roughness: roughness,
+ metalness: metalness,
+ detailUvRepeat: uvRepeat,
+ detailUvOffset: uvOffset
+ });
+ // var normalTexture = material.get('normalMap');
+ // if (normalTexture) {
+ // PENDING
+ // normalTexture.format = Texture.SRGB;
+ // }
+ }
+ else if (shading === 'lambert') {
+ material.setTextureImage('detailMap', detailTexture, api, textureOpt);
+ material.set({
+ detailUvRepeat: uvRepeat,
+ detailUvOffset: uvOffset
+ });
+ }
+ else if (shading === 'color') {
+ material.setTextureImage('detailMap', detailTexture, api, textureOpt);
+ material.set({
+ detailUvRepeat: uvRepeat,
+ detailUvOffset: uvOffset
+ });
+ }
+ else if (shading === 'hatching') {
+ var tams = materialModel.get('hatchingTextures') || [];
+ if (tams.length < 6) {
+ if (true) {
+ console.error('Invalid hatchingTextures.');
+ }
+ }
+ for (var i = 0; i < 6; i++) {
+ material.setTextureImage('hatch' + (i + 1), tams[i], api, {
+ anisotropic: 8,
+ wrapS: graphicGL.Texture.REPEAT,
+ wrapT: graphicGL.Texture.REPEAT
+ });
+ }
+ material.set({
+ detailUvRepeat: uvRepeat,
+ detailUvOffset: uvOffset
+ });
+ }
+};
+
+graphicGL.updateVertexAnimation = function (
+ mappingAttributes, previousMesh, currentMesh, seriesModel
+) {
+ var enableAnimation = seriesModel.get('animation');
+ var duration = seriesModel.get('animationDurationUpdate');
+ var easing = seriesModel.get('animationEasingUpdate');
+ var shadowDepthMaterial = currentMesh.shadowDepthMaterial;
+
+ if (enableAnimation && previousMesh && duration > 0
+ // Only animate when bar count are not changed
+ && previousMesh.geometry.vertexCount === currentMesh.geometry.vertexCount
+ ) {
+ currentMesh.material.define('vertex', 'VERTEX_ANIMATION');
+ currentMesh.ignorePreZ = true;
+ if (shadowDepthMaterial) {
+ shadowDepthMaterial.define('vertex', 'VERTEX_ANIMATION');
+ }
+ for (var i = 0; i < mappingAttributes.length; i++) {
+ currentMesh.geometry.attributes[mappingAttributes[i][0]].value =
+ previousMesh.geometry.attributes[mappingAttributes[i][1]].value;
+ }
+ currentMesh.geometry.dirty();
+ currentMesh.__percent = 0;
+ currentMesh.material.set('percent', 0);
+ currentMesh.stopAnimation();
+ currentMesh.animate()
+ .when(duration, {
+ __percent: 1
+ })
+ .during(function () {
+ currentMesh.material.set('percent', currentMesh.__percent);
+ if (shadowDepthMaterial) {
+ shadowDepthMaterial.set('percent', currentMesh.__percent);
+ }
+ })
+ .done(function () {
+ currentMesh.ignorePreZ = false;
+ currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION');
+ if (shadowDepthMaterial) {
+ shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION');
+ }
+ })
+ .start(easing);
+ }
+ else {
+ currentMesh.material.undefine('vertex', 'VERTEX_ANIMATION');
+ if (shadowDepthMaterial) {
+ shadowDepthMaterial.undefine('vertex', 'VERTEX_ANIMATION');
+ }
+ }
+};
+
+/* harmony default export */ __webpack_exports__["a"] = (graphicGL);
+
+/***/ }),
+/* 2 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__ = __webpack_require__(0);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts__);
+
+
+var retrieve = {
+
+ firstNotNull: function () {
+ for (var i = 0, len = arguments.length; i < len; i++) {
+ if (arguments[i] != null) {
+ return arguments[i];
+ }
+ }
+ },
+
+ /**
+ * @param {module:echarts/data/List} data
+ * @param {Object} payload Contains dataIndex (means rawIndex) / dataIndexInside / name
+ * each of which can be Array or primary type.
+ * @return {number|Array.} dataIndex If not found, return undefined/null.
+ */
+ queryDataIndex: function (data, payload) {
+ if (payload.dataIndexInside != null) {
+ return payload.dataIndexInside;
+ }
+ else if (payload.dataIndex != null) {
+ return __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(payload.dataIndex)
+ ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.map(payload.dataIndex, function (value) {
+ return data.indexOfRawIndex(value);
+ })
+ : data.indexOfRawIndex(payload.dataIndex);
+ }
+ else if (payload.name != null) {
+ return __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.isArray(payload.name)
+ ? __WEBPACK_IMPORTED_MODULE_0_echarts_lib_echarts___default.a.util.map(payload.name, function (value) {
+ return data.indexOfName(value);
+ })
+ : data.indexOfName(payload.name);
+ }
+ }
+};
+
+/* harmony default export */ __webpack_exports__["a"] = (retrieve);
+
+/***/ }),
+/* 3 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__ = __webpack_require__(12);
+
+
+/**
+ * @constructor
+ * @alias clay.Vector3
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ */
+var Vector3 = function(x, y, z) {
+
+ x = x || 0;
+ y = y || 0;
+ z = z || 0;
+
+ /**
+ * Storage of Vector3, read and write of x, y, z will change the values in array
+ * All methods also operate on the array instead of x, y, z components
+ * @name array
+ * @type {Float32Array}
+ * @memberOf clay.Vector3#
+ */
+ this.array = __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].fromValues(x, y, z);
+
+ /**
+ * Dirty flag is used by the Node to determine
+ * if the matrix is updated to latest
+ * @name _dirty
+ * @type {boolean}
+ * @memberOf clay.Vector3#
+ */
+ this._dirty = true;
+};
+
+Vector3.prototype = {
+
+ constructor: Vector3,
+
+ /**
+ * Add b to self
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ add: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].add(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Set x, y and z components
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @return {clay.Vector3}
+ */
+ set: function (x, y, z) {
+ this.array[0] = x;
+ this.array[1] = y;
+ this.array[2] = z;
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Set x, y and z components from array
+ * @param {Float32Array|number[]} arr
+ * @return {clay.Vector3}
+ */
+ setArray: function (arr) {
+ this.array[0] = arr[0];
+ this.array[1] = arr[1];
+ this.array[2] = arr[2];
+
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Clone a new Vector3
+ * @return {clay.Vector3}
+ */
+ clone: function () {
+ return new Vector3(this.x, this.y, this.z);
+ },
+
+ /**
+ * Copy from b
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ copy: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].copy(this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Cross product of self and b, written to a Vector3 out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ cross: function (a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].cross(this.array, a.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Alias for distance
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+ dist: function (b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].dist(this.array, b.array);
+ },
+
+ /**
+ * Distance between self and b
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+ distance: function (b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].distance(this.array, b.array);
+ },
+
+ /**
+ * Alias for divide
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ div: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].div(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Divide self by b
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ divide: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].divide(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Dot product of self and b
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+ dot: function (b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].dot(this.array, b.array);
+ },
+
+ /**
+ * Alias of length
+ * @return {number}
+ */
+ len: function () {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].len(this.array);
+ },
+
+ /**
+ * Calculate the length
+ * @return {number}
+ */
+ length: function () {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].length(this.array);
+ },
+ /**
+ * Linear interpolation between a and b
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @param {number} t
+ * @return {clay.Vector3}
+ */
+ lerp: function (a, b, t) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].lerp(this.array, a.array, b.array, t);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Minimum of self and b
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ min: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].min(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Maximum of self and b
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ max: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].max(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Alias for multiply
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ mul: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].mul(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Mutiply self and b
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ multiply: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].multiply(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Negate self
+ * @return {clay.Vector3}
+ */
+ negate: function () {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].negate(this.array, this.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Normalize self
+ * @return {clay.Vector3}
+ */
+ normalize: function () {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].normalize(this.array, this.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Generate random x, y, z components with a given scale
+ * @param {number} scale
+ * @return {clay.Vector3}
+ */
+ random: function (scale) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].random(this.array, scale);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Scale self
+ * @param {number} scale
+ * @return {clay.Vector3}
+ */
+ scale: function (s) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scale(this.array, this.array, s);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Scale b and add to self
+ * @param {clay.Vector3} b
+ * @param {number} scale
+ * @return {clay.Vector3}
+ */
+ scaleAndAdd: function (b, s) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scaleAndAdd(this.array, this.array, b.array, s);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Alias for squaredDistance
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+ sqrDist: function (b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrDist(this.array, b.array);
+ },
+
+ /**
+ * Squared distance between self and b
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+ squaredDistance: function (b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].squaredDistance(this.array, b.array);
+ },
+
+ /**
+ * Alias for squaredLength
+ * @return {number}
+ */
+ sqrLen: function () {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrLen(this.array);
+ },
+
+ /**
+ * Squared length of self
+ * @return {number}
+ */
+ squaredLength: function () {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].squaredLength(this.array);
+ },
+
+ /**
+ * Alias for subtract
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ sub: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sub(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Subtract b from self
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+ subtract: function (b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].subtract(this.array, this.array, b.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Transform self with a Matrix3 m
+ * @param {clay.Matrix3} m
+ * @return {clay.Vector3}
+ */
+ transformMat3: function (m) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat3(this.array, this.array, m.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Transform self with a Matrix4 m
+ * @param {clay.Matrix4} m
+ * @return {clay.Vector3}
+ */
+ transformMat4: function (m) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat4(this.array, this.array, m.array);
+ this._dirty = true;
+ return this;
+ },
+ /**
+ * Transform self with a Quaternion q
+ * @param {clay.Quaternion} q
+ * @return {clay.Vector3}
+ */
+ transformQuat: function (q) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformQuat(this.array, this.array, q.array);
+ this._dirty = true;
+ return this;
+ },
+
+ /**
+ * Trasnform self into projection space with m
+ * @param {clay.Matrix4} m
+ * @return {clay.Vector3}
+ */
+ applyProjection: function (m) {
+ var v = this.array;
+ m = m.array;
+
+ // Perspective projection
+ if (m[15] === 0) {
+ var w = -1 / v[2];
+ v[0] = m[0] * v[0] * w;
+ v[1] = m[5] * v[1] * w;
+ v[2] = (m[10] * v[2] + m[14]) * w;
+ }
+ else {
+ v[0] = m[0] * v[0] + m[12];
+ v[1] = m[5] * v[1] + m[13];
+ v[2] = m[10] * v[2] + m[14];
+ }
+ this._dirty = true;
+
+ return this;
+ },
+
+ eulerFromQuat: function(q, order) {
+ Vector3.eulerFromQuat(this, q, order);
+ },
+
+ eulerFromMat3: function (m, order) {
+ Vector3.eulerFromMat3(this, m, order);
+ },
+
+ toString: function() {
+ return '[' + Array.prototype.join.call(this.array, ',') + ']';
+ },
+
+ toArray: function () {
+ return Array.prototype.slice.call(this.array);
+ }
+};
+
+var defineProperty = Object.defineProperty;
+// Getter and Setter
+if (defineProperty) {
+
+ var proto = Vector3.prototype;
+ /**
+ * @name x
+ * @type {number}
+ * @memberOf clay.Vector3
+ * @instance
+ */
+ defineProperty(proto, 'x', {
+ get: function () {
+ return this.array[0];
+ },
+ set: function (value) {
+ this.array[0] = value;
+ this._dirty = true;
+ }
+ });
+
+ /**
+ * @name y
+ * @type {number}
+ * @memberOf clay.Vector3
+ * @instance
+ */
+ defineProperty(proto, 'y', {
+ get: function () {
+ return this.array[1];
+ },
+ set: function (value) {
+ this.array[1] = value;
+ this._dirty = true;
+ }
+ });
+
+ /**
+ * @name z
+ * @type {number}
+ * @memberOf clay.Vector3
+ * @instance
+ */
+ defineProperty(proto, 'z', {
+ get: function () {
+ return this.array[2];
+ },
+ set: function (value) {
+ this.array[2] = value;
+ this._dirty = true;
+ }
+ });
+}
+
+
+// Supply methods that are not in place
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.add = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].add(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+
+/**
+ * @param {clay.Vector3} out
+ * @param {number} x
+ * @param {number} y
+ * @param {number} z
+ * @return {clay.Vector3}
+ */
+Vector3.set = function(out, x, y, z) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].set(out.array, x, y, z);
+ out._dirty = true;
+};
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.copy = function(out, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].copy(out.array, b.array);
+ out._dirty = true;
+ return out;
+};
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.cross = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].cross(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+
+/**
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+Vector3.dist = function(a, b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].distance(a.array, b.array);
+};
+
+/**
+ * @function
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+Vector3.distance = Vector3.dist;
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.div = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].divide(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+
+/**
+ * @function
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.divide = Vector3.div;
+
+/**
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+Vector3.dot = function(a, b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].dot(a.array, b.array);
+};
+
+/**
+ * @param {clay.Vector3} a
+ * @return {number}
+ */
+Vector3.len = function(b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].length(b.array);
+};
+
+// Vector3.length = Vector3.len;
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @param {number} t
+ * @return {clay.Vector3}
+ */
+Vector3.lerp = function(out, a, b, t) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].lerp(out.array, a.array, b.array, t);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.min = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].min(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.max = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].max(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.mul = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].multiply(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @function
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.multiply = Vector3.mul;
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @return {clay.Vector3}
+ */
+Vector3.negate = function(out, a) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].negate(out.array, a.array);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @return {clay.Vector3}
+ */
+Vector3.normalize = function(out, a) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].normalize(out.array, a.array);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {number} scale
+ * @return {clay.Vector3}
+ */
+Vector3.random = function(out, scale) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].random(out.array, scale);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {number} scale
+ * @return {clay.Vector3}
+ */
+Vector3.scale = function(out, a, scale) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scale(out.array, a.array, scale);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @param {number} scale
+ * @return {clay.Vector3}
+ */
+Vector3.scaleAndAdd = function(out, a, b, scale) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].scaleAndAdd(out.array, a.array, b.array, scale);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+Vector3.sqrDist = function(a, b) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrDist(a.array, b.array);
+};
+/**
+ * @function
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {number}
+ */
+Vector3.squaredDistance = Vector3.sqrDist;
+/**
+ * @param {clay.Vector3} a
+ * @return {number}
+ */
+Vector3.sqrLen = function(a) {
+ return __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].sqrLen(a.array);
+};
+/**
+ * @function
+ * @param {clay.Vector3} a
+ * @return {number}
+ */
+Vector3.squaredLength = Vector3.sqrLen;
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.sub = function(out, a, b) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].subtract(out.array, a.array, b.array);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @function
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Vector3} b
+ * @return {clay.Vector3}
+ */
+Vector3.subtract = Vector3.sub;
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {Matrix3} m
+ * @return {clay.Vector3}
+ */
+Vector3.transformMat3 = function(out, a, m) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat3(out.array, a.array, m.array);
+ out._dirty = true;
+ return out;
+};
+
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Matrix4} m
+ * @return {clay.Vector3}
+ */
+Vector3.transformMat4 = function(out, a, m) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformMat4(out.array, a.array, m.array);
+ out._dirty = true;
+ return out;
+};
+/**
+ * @param {clay.Vector3} out
+ * @param {clay.Vector3} a
+ * @param {clay.Quaternion} q
+ * @return {clay.Vector3}
+ */
+Vector3.transformQuat = function(out, a, q) {
+ __WEBPACK_IMPORTED_MODULE_0__glmatrix_vec3__["a" /* default */].transformQuat(out.array, a.array, q.array);
+ out._dirty = true;
+ return out;
+};
+
+function clamp(val, min, max) {
+ return val < min ? min : (val > max ? max : val);
+}
+var atan2 = Math.atan2;
+var asin = Math.asin;
+var abs = Math.abs;
+/**
+ * Convert quaternion to euler angle
+ * Quaternion must be normalized
+ * From three.js
+ */
+Vector3.eulerFromQuat = function (out, q, order) {
+ out._dirty = true;
+ q = q.array;
+
+ var target = out.array;
+ var x = q[0], y = q[1], z = q[2], w = q[3];
+ var x2 = x * x;
+ var y2 = y * y;
+ var z2 = z * z;
+ var w2 = w * w;
+
+ var order = (order || 'XYZ').toUpperCase();
+
+ switch (order) {
+ case 'XYZ':
+ target[0] = atan2(2 * (x * w - y * z), (w2 - x2 - y2 + z2));
+ target[1] = asin(clamp(2 * (x * z + y * w), - 1, 1));
+ target[2] = atan2(2 * (z * w - x * y), (w2 + x2 - y2 - z2));
+ break;
+ case 'YXZ':
+ target[0] = asin(clamp(2 * (x * w - y * z), - 1, 1));
+ target[1] = atan2(2 * (x * z + y * w), (w2 - x2 - y2 + z2));
+ target[2] = atan2(2 * (x * y + z * w), (w2 - x2 + y2 - z2));
+ break;
+ case 'ZXY':
+ target[0] = asin(clamp(2 * (x * w + y * z), - 1, 1));
+ target[1] = atan2(2 * (y * w - z * x), (w2 - x2 - y2 + z2));
+ target[2] = atan2(2 * (z * w - x * y), (w2 - x2 + y2 - z2));
+ break;
+ case 'ZYX':
+ target[0] = atan2(2 * (x * w + z * y), (w2 - x2 - y2 + z2));
+ target[1] = asin(clamp(2 * (y * w - x * z), - 1, 1));
+ target[2] = atan2(2 * (x * y + z * w), (w2 + x2 - y2 - z2));
+ break;
+ case 'YZX':
+ target[0] = atan2(2 * (x * w - z * y), (w2 - x2 + y2 - z2));
+ target[1] = atan2(2 * (y * w - x * z), (w2 + x2 - y2 - z2));
+ target[2] = asin(clamp(2 * (x * y + z * w), - 1, 1));
+ break;
+ case 'XZY':
+ target[0] = atan2(2 * (x * w + y * z), (w2 - x2 + y2 - z2));
+ target[1] = atan2(2 * (x * z + y * w), (w2 + x2 - y2 - z2));
+ target[2] = asin(clamp(2 * (z * w - x * y), - 1, 1));
+ break;
+ default:
+ console.warn('Unkown order: ' + order);
+ }
+ return out;
+};
+
+/**
+ * Convert rotation matrix to euler angle
+ * from three.js
+ */
+Vector3.eulerFromMat3 = function (out, m, order) {
+ // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
+ var te = m.array;
+ var m11 = te[0], m12 = te[3], m13 = te[6];
+ var m21 = te[1], m22 = te[4], m23 = te[7];
+ var m31 = te[2], m32 = te[5], m33 = te[8];
+ var target = out.array;
+
+ var order = (order || 'XYZ').toUpperCase();
+
+ switch (order) {
+ case 'XYZ':
+ target[1] = asin(clamp(m13, -1, 1));
+ if (abs(m13) < 0.99999) {
+ target[0] = atan2(-m23, m33);
+ target[2] = atan2(-m12, m11);
+ }
+ else {
+ target[0] = atan2(m32, m22);
+ target[2] = 0;
+ }
+ break;
+ case 'YXZ':
+ target[0] = asin(-clamp(m23, -1, 1));
+ if (abs(m23) < 0.99999) {
+ target[1] = atan2(m13, m33);
+ target[2] = atan2(m21, m22);
+ }
+ else {
+ target[1] = atan2(-m31, m11);
+ target[2] = 0;
+ }
+ break;
+ case 'ZXY':
+ target[0] = asin(clamp(m32, -1, 1));
+ if (abs(m32) < 0.99999) {
+ target[1] = atan2(-m31, m33);
+ target[2] = atan2(-m12, m22);
+ }
+ else {
+ target[1] = 0;
+ target[2] = atan2(m21, m11);
+ }
+ break;
+ case 'ZYX':
+ target[1] = asin(-clamp(m31, -1, 1));
+ if (abs(m31) < 0.99999) {
+ target[0] = atan2(m32, m33);
+ target[2] = atan2(m21, m11);
+ }
+ else {
+ target[0] = 0;
+ target[2] = atan2(-m12, m22);
+ }
+ break;
+ case 'YZX':
+ target[2] = asin(clamp(m21, -1, 1));
+ if (abs(m21) < 0.99999) {
+ target[0] = atan2(-m23, m22);
+ target[1] = atan2(-m31, m11);
+ }
+ else {
+ target[0] = 0;
+ target[1] = atan2(m13, m33);
+ }
+ break;
+ case 'XZY':
+ target[2] = asin(-clamp(m12, -1, 1));
+ if (abs(m12) < 0.99999) {
+ target[0] = atan2(m32, m22);
+ target[1] = atan2(m13, m11);
+ }
+ else {
+ target[0] = atan2(-m23, m33);
+ target[1] = 0;
+ }
+ break;
+ default:
+ console.warn('Unkown order: ' + order);
+ }
+ out._dirty = true;
+
+ return out;
+};
+
+Object.defineProperties(Vector3, {
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ POSITIVE_X: {
+ get: function () {
+ return new Vector3(1, 0, 0);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ NEGATIVE_X: {
+ get: function () {
+ return new Vector3(-1, 0, 0);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ POSITIVE_Y: {
+ get: function () {
+ return new Vector3(0, 1, 0);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ NEGATIVE_Y: {
+ get: function () {
+ return new Vector3(0, -1, 0);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ POSITIVE_Z: {
+ get: function () {
+ return new Vector3(0, 0, 1);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ */
+ NEGATIVE_Z: {
+ get: function () {
+ return new Vector3(0, 0, -1);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ UP: {
+ get: function () {
+ return new Vector3(0, 1, 0);
+ }
+ },
+ /**
+ * @type {clay.Vector3}
+ * @readOnly
+ * @memberOf clay.Vector3
+ */
+ ZERO: {
+ get: function () {
+ return new Vector3();
+ }
+ }
+});
+
+/* harmony default export */ __webpack_exports__["a"] = (Vector3);
+
+
+/***/ }),
+/* 4 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core_Base__ = __webpack_require__(7);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_Cache__ = __webpack_require__(57);
+/**
+ * Base class for all textures like compressed texture, texture2d, texturecube
+ * TODO mapping
+ */
+
+
+
+
+/**
+ * @constructor
+ * @alias clay.Texture
+ * @extends clay.core.Base
+ */
+var Texture = __WEBPACK_IMPORTED_MODULE_0__core_Base__["a" /* default */].extend( /** @lends clay.Texture# */ {
+ /**
+ * Texture width, readonly when the texture source is image
+ * @type {number}
+ */
+ width: 512,
+ /**
+ * Texture height, readonly when the texture source is image
+ * @type {number}
+ */
+ height: 512,
+ /**
+ * Texel data type.
+ * Possible values:
+ * + {@link clay.Texture.UNSIGNED_BYTE}
+ * + {@link clay.Texture.HALF_FLOAT}
+ * + {@link clay.Texture.FLOAT}
+ * + {@link clay.Texture.UNSIGNED_INT_24_8_WEBGL}
+ * + {@link clay.Texture.UNSIGNED_INT}
+ * @type {number}
+ */
+ type: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_BYTE,
+ /**
+ * Format of texel data
+ * Possible values:
+ * + {@link clay.Texture.RGBA}
+ * + {@link clay.Texture.DEPTH_COMPONENT}
+ * + {@link clay.Texture.DEPTH_STENCIL}
+ * @type {number}
+ */
+ format: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGBA,
+ /**
+ * Texture wrap. Default to be REPEAT.
+ * Possible values:
+ * + {@link clay.Texture.CLAMP_TO_EDGE}
+ * + {@link clay.Texture.REPEAT}
+ * + {@link clay.Texture.MIRRORED_REPEAT}
+ * @type {number}
+ */
+ wrapS: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].REPEAT,
+ /**
+ * Texture wrap. Default to be REPEAT.
+ * Possible values:
+ * + {@link clay.Texture.CLAMP_TO_EDGE}
+ * + {@link clay.Texture.REPEAT}
+ * + {@link clay.Texture.MIRRORED_REPEAT}
+ * @type {number}
+ */
+ wrapT: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].REPEAT,
+ /**
+ * Possible values:
+ * + {@link clay.Texture.NEAREST}
+ * + {@link clay.Texture.LINEAR}
+ * + {@link clay.Texture.NEAREST_MIPMAP_NEAREST}
+ * + {@link clay.Texture.LINEAR_MIPMAP_NEAREST}
+ * + {@link clay.Texture.NEAREST_MIPMAP_LINEAR}
+ * + {@link clay.Texture.LINEAR_MIPMAP_LINEAR}
+ * @type {number}
+ */
+ minFilter: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR,
+ /**
+ * Possible values:
+ * + {@link clay.Texture.NEAREST}
+ * + {@link clay.Texture.LINEAR}
+ * @type {number}
+ */
+ magFilter: __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR,
+ /**
+ * If enable mimap.
+ * @type {boolean}
+ */
+ useMipmap: true,
+
+ /**
+ * Anisotropic filtering, enabled if value is larger than 1
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/EXT_texture_filter_anisotropic
+ * @type {number}
+ */
+ anisotropic: 1,
+ // pixelStorei parameters, not available when texture is used as render target
+ // http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml
+ /**
+ * If flip in y axis for given image source
+ * @type {boolean}
+ * @default true
+ */
+ flipY: true,
+
+ /**
+ * A flag to indicate if texture source is sRGB
+ */
+ sRGB: true,
+ /**
+ * @type {number}
+ * @default 4
+ */
+ unpackAlignment: 4,
+ /**
+ * @type {boolean}
+ * @default false
+ */
+ premultiplyAlpha: false,
+
+ /**
+ * Dynamic option for texture like video
+ * @type {boolean}
+ */
+ dynamic: false,
+
+ NPOT: false,
+
+ // PENDING
+ // Init it here to avoid deoptimization when it's assigned in application dynamically
+ __used: 0
+
+}, function () {
+ this._cache = new __WEBPACK_IMPORTED_MODULE_2__core_Cache__["a" /* default */]();
+},
+/** @lends clay.Texture.prototype */
+{
+
+ getWebGLTexture: function (renderer) {
+ var _gl = renderer.gl;
+ var cache = this._cache;
+ cache.use(renderer.__uid__);
+
+ if (cache.miss('webgl_texture')) {
+ // In a new gl context, create new texture and set dirty true
+ cache.put('webgl_texture', _gl.createTexture());
+ }
+ if (this.dynamic) {
+ this.update(renderer);
+ }
+ else if (cache.isDirty()) {
+ this.update(renderer);
+ cache.fresh();
+ }
+
+ return cache.get('webgl_texture');
+ },
+
+ bind: function () {},
+ unbind: function () {},
+
+ /**
+ * Mark texture is dirty and update in the next frame
+ */
+ dirty: function () {
+ if (this._cache) {
+ this._cache.dirtyAll();
+ }
+ },
+
+ update: function (renderer) {},
+
+ // Update the common parameters of texture
+ updateCommon: function (renderer) {
+ var _gl = renderer.gl;
+ _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, this.flipY);
+ _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.premultiplyAlpha);
+ _gl.pixelStorei(_gl.UNPACK_ALIGNMENT, this.unpackAlignment);
+
+ // Use of none-power of two texture
+ // http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences
+ if (this.format === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_COMPONENT) {
+ this.useMipmap = false;
+ }
+
+ var sRGBExt = renderer.getGLExtension('EXT_sRGB');
+ // Fallback
+ if (this.format === Texture.SRGB && !sRGBExt) {
+ this.format = Texture.RGB;
+ }
+ if (this.format === Texture.SRGB_ALPHA && !sRGBExt) {
+ this.format = Texture.RGBA;
+ }
+
+ this.NPOT = !this.isPowerOfTwo();
+ },
+
+ getAvailableWrapS: function () {
+ if (this.NPOT) {
+ return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE;
+ }
+ return this.wrapS;
+ },
+ getAvailableWrapT: function () {
+ if (this.NPOT) {
+ return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE;
+ }
+ return this.wrapT;
+ },
+ getAvailableMinFilter: function () {
+ var minFilter = this.minFilter;
+ if (this.NPOT || !this.useMipmap) {
+ if (minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_NEAREST ||
+ minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_LINEAR
+ ) {
+ return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST;
+ }
+ else if (minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR ||
+ minFilter === __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_NEAREST
+ ) {
+ return __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR;
+ }
+ else {
+ return minFilter;
+ }
+ }
+ else {
+ return minFilter;
+ }
+ },
+ getAvailableMagFilter: function () {
+ return this.magFilter;
+ },
+
+ nextHighestPowerOfTwo: function (x) {
+ --x;
+ for (var i = 1; i < 32; i <<= 1) {
+ x = x | x >> i;
+ }
+ return x + 1;
+ },
+ /**
+ * @param {clay.Renderer} renderer
+ */
+ dispose: function (renderer) {
+
+ var cache = this._cache;
+
+ cache.use(renderer.__uid__);
+
+ var webglTexture = cache.get('webgl_texture');
+ if (webglTexture){
+ renderer.gl.deleteTexture(webglTexture);
+ }
+ cache.deleteContext(renderer.__uid__);
+
+ },
+ /**
+ * Test if image of texture is valid and loaded.
+ * @return {boolean}
+ */
+ isRenderable: function () {},
+
+ /**
+ * Test if texture size is power of two
+ * @return {boolean}
+ */
+ isPowerOfTwo: function () {}
+});
+
+Object.defineProperty(Texture.prototype, 'width', {
+ get: function () {
+ return this._width;
+ },
+ set: function (value) {
+ this._width = value;
+ }
+});
+Object.defineProperty(Texture.prototype, 'height', {
+ get: function () {
+ return this._height;
+ },
+ set: function (value) {
+ this._height = value;
+ }
+});
+
+/* DataType */
+
+/**
+ * @type {number}
+ */
+Texture.BYTE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].BYTE;
+/**
+ * @type {number}
+ */
+Texture.UNSIGNED_BYTE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_BYTE;
+/**
+ * @type {number}
+ */
+Texture.SHORT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].SHORT;
+/**
+ * @type {number}
+ */
+Texture.UNSIGNED_SHORT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_SHORT;
+/**
+ * @type {number}
+ */
+Texture.INT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].INT;
+/**
+ * @type {number}
+ */
+Texture.UNSIGNED_INT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].UNSIGNED_INT;
+/**
+ * @type {number}
+ */
+Texture.FLOAT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].FLOAT;
+/**
+ * @type {number}
+ */
+Texture.HALF_FLOAT = 0x8D61;
+
+/**
+ * UNSIGNED_INT_24_8_WEBGL for WEBGL_depth_texture extension
+ * @type {number}
+ */
+Texture.UNSIGNED_INT_24_8_WEBGL = 34042;
+
+/* PixelFormat */
+/**
+ * @type {number}
+ */
+Texture.DEPTH_COMPONENT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_COMPONENT;
+/**
+ * @type {number}
+ */
+Texture.DEPTH_STENCIL = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].DEPTH_STENCIL;
+/**
+ * @type {number}
+ */
+Texture.ALPHA = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].ALPHA;
+/**
+ * @type {number}
+ */
+Texture.RGB = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGB;
+/**
+ * @type {number}
+ */
+Texture.RGBA = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].RGBA;
+/**
+ * @type {number}
+ */
+Texture.LUMINANCE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LUMINANCE;
+/**
+ * @type {number}
+ */
+Texture.LUMINANCE_ALPHA = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LUMINANCE_ALPHA;
+
+/**
+ * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/
+ * @type {number}
+ */
+Texture.SRGB = 0x8C40;
+/**
+ * @see https://www.khronos.org/registry/webgl/extensions/EXT_sRGB/
+ * @type {number}
+ */
+Texture.SRGB_ALPHA = 0x8C42;
+
+/* Compressed Texture */
+Texture.COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
+Texture.COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
+Texture.COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
+Texture.COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
+
+/* TextureMagFilter */
+/**
+ * @type {number}
+ */
+Texture.NEAREST = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST;
+/**
+ * @type {number}
+ */
+Texture.LINEAR = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR;
+
+/* TextureMinFilter */
+/**
+ * @type {number}
+ */
+Texture.NEAREST_MIPMAP_NEAREST = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_NEAREST;
+/**
+ * @type {number}
+ */
+Texture.LINEAR_MIPMAP_NEAREST = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_NEAREST;
+/**
+ * @type {number}
+ */
+Texture.NEAREST_MIPMAP_LINEAR = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].NEAREST_MIPMAP_LINEAR;
+/**
+ * @type {number}
+ */
+Texture.LINEAR_MIPMAP_LINEAR = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].LINEAR_MIPMAP_LINEAR;
+
+/* TextureWrapMode */
+/**
+ * @type {number}
+ */
+Texture.REPEAT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].REPEAT;
+/**
+ * @type {number}
+ */
+Texture.CLAMP_TO_EDGE = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].CLAMP_TO_EDGE;
+/**
+ * @type {number}
+ */
+Texture.MIRRORED_REPEAT = __WEBPACK_IMPORTED_MODULE_1__core_glenum__["a" /* default */].MIRRORED_REPEAT;
+
+
+/* harmony default export */ __webpack_exports__["a"] = (Texture);
+
+
+/***/ }),
+/* 5 */
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
+
+"use strict";
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__Texture__ = __webpack_require__(4);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_glenum__ = __webpack_require__(11);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__core_vendor__ = __webpack_require__(14);
+/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__math_util__ = __webpack_require__(73);
+
+
+
+
+var isPowerOfTwo = __WEBPACK_IMPORTED_MODULE_3__math_util__["a" /* default */].isPowerOfTwo;
+
+function nearestPowerOfTwo(val) {
+ return Math.pow(2, Math.round(Math.log(val) / Math.LN2));
+}
+function convertTextureToPowerOfTwo(texture, canvas) {
+ // var canvas = document.createElement('canvas');
+ var width = nearestPowerOfTwo(texture.width);
+ var height = nearestPowerOfTwo(texture.height);
+ canvas = canvas || document.createElement('canvas');
+ canvas.width = width;
+ canvas.height = height;
+ var ctx = canvas.getContext('2d');
+ ctx.drawImage(texture.image, 0, 0, width, height);
+
+ return canvas;
+}
+
+/**
+ * @constructor clay.Texture2D
+ * @extends clay.Texture
+ *
+ * @example
+ * ...
+ * var mat = new clay.Material({
+ * shader: clay.shader.library.get('clay.phong', 'diffuseMap')
+ * });
+ * var diffuseMap = new clay.Texture2D();
+ * diffuseMap.load('assets/textures/diffuse.jpg');
+ * mat.set('diffuseMap', diffuseMap);
+ * ...
+ * diffuseMap.success(function () {
+ * // Wait for the diffuse texture loaded
+ * animation.on('frame', function (frameTime) {
+ * renderer.render(scene, camera);
+ * });
+ * });
+ */
+var Texture2D = __WEBPACK_IMPORTED_MODULE_0__Texture__["a" /* default */].extend(function () {
+ return /** @lends clay.Texture2D# */ {
+ /**
+ * @type {?HTMLImageElement|HTMLCanvasElemnet}
+ */
+ // TODO mark dirty when assigned.
+ image: null,
+ /**
+ * Pixels data. Will be ignored if image is set.
+ * @type {?Uint8Array|Float32Array}
+ */
+ pixels: null,
+ /**
+ * @type {Array. ');
+ // 声明变量
+ var mydl = srcInput.next().children('dl');
+
+ // 获取数据
+ $.post(
+ "/srcteacher",
+ {
+ "str":val,
+ },
+ function(data,status){
+
+ if($.isEmptyObject(data))
+ {
+ return true;
+ }
+
+ for (var i = data.length - 1; i >= 0; i--) {
+ mydl.append('