diff --git a/application/admin/controller/school/classes/ClassesLib.php b/application/admin/controller/school/classes/ClassesLib.php
index dfce4f2..6ae2ec3 100644
--- a/application/admin/controller/school/classes/ClassesLib.php
+++ b/application/admin/controller/school/classes/ClassesLib.php
@@ -33,7 +33,7 @@ class ClassesLib extends Backend
     protected $model = null;
 
     //不用审核允许修改的字段
-    protected $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"];
+    protected $no_auth_fields = ["user_id","teacher_id","classes_type","classes_cate_ids","classes_label_ids","self_label_tag",'headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"];
 
     //更新数据是否需要触发审核开关
     protected $need_auth = false;
@@ -57,7 +57,8 @@ class ClassesLib extends Backend
         $this->view->assign("newList", $this->model->getNewList());
         $this->view->assign("selfhotList", $this->model->getSelfhotList());
 
-
+        $this->view->assign("classesTypeList", $this->model->getClassesTypeList());
+        $this->view->assign("classesTypeListJson", json_encode($this->model->getClassesTypeList(), JSON_UNESCAPED_UNICODE));
 
 
         $this->view->assign("specStatusList", (new \app\admin\model\school\classes\ClassesSpec)->getStatusList());
@@ -102,8 +103,14 @@ class ClassesLib extends Backend
 				$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
 				$row->getRelation('admin')->visible(['nickname']);
             }
+           $rows = $list->items();
+           $types = \app\admin\model\school\classes\Type::column("name", 'id');
 
-            $result = array("total" => $list->total(), "rows" => $list->items());
+            foreach ($rows as $k=>&$v){
+                $v["classes_type_name"] = $types[$v["classes_type"]] ?? "无" ;
+            }
+
+            $result = array("total" => $list->total(), "rows" => $rows);
 
             return json($result);
         }
@@ -473,18 +480,23 @@ class ClassesLib extends Backend
                 if(isset($v["id"]) && $v["id"]){
                      \app\common\model\school\classes\ClassesSpec::update((new \app\common\model\school\classes\ClassesSpec)->checkAssemblyParameters($v));
                  }else{
+
                      \app\common\model\school\classes\ClassesSpec::create((new \app\common\model\school\classes\ClassesSpec)->checkAssemblyParameters($v));
                  }
 
            }
            //删除规格
              foreach ($delete_spec_ids as $k=>$delete_spec){
+
+                  (new \app\common\model\school\classes\ClassesSpec)->updateCheck($delete_spec["id"]);
+
                  $delete_spec->delete();
              }
 
                //因为是批量添加,所有规格重新进行检测,防止出现时间重叠
                     $specss = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row["id"])->select();
             foreach ($specss as $k=>$specs){
+
                         $params =$specs;
                         (new \app\common\model\school\classes\ClassesSpec)->specCheck($params,null,$specs);
              }
diff --git a/application/admin/controller/school/classes/Evaluate.php b/application/admin/controller/school/classes/Evaluate.php
new file mode 100644
index 0000000..79413d4
--- /dev/null
+++ b/application/admin/controller/school/classes/Evaluate.php
@@ -0,0 +1,81 @@
+model = new \app\admin\model\school\classes\Evaluate;
+        parent::_initialize();
+
+        $this->view->assign("statusList", $this->model->getStatusList());
+        $this->view->assign("topList", $this->model->getTopList());
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $list = $this->model
+                    ->with(['user','lib','classesorder','manystore','shop','teacher'])
+                    ->where($where)
+                    ->order($sort, $order)
+                    ->paginate($limit);
+
+            foreach ($list as $row) {
+                
+                $row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
+				$row->getRelation('lib')->visible(['title','headimage']);
+				$row->getRelation('classesorder')->visible(['order_no']);
+				$row->getRelation('manystore')->visible(['nickname']);
+				$row->getRelation('shop')->visible(['name','logo']);
+				$row->getRelation('teacher')->visible(['name','head_image']);
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+}
diff --git a/application/admin/controller/school/classes/Teacher.php b/application/admin/controller/school/classes/Teacher.php
index 23a77bd..319dd80 100644
--- a/application/admin/controller/school/classes/Teacher.php
+++ b/application/admin/controller/school/classes/Teacher.php
@@ -78,7 +78,7 @@ class Teacher extends Backend
 
             foreach ($list as $row) {
                 
-                $row->getRelation('user')->visible(['nickname','realname','avatar']);
+                $row->getRelation('user')->visible(['nickname','realname','avatar','mobile']);
 				$row->getRelation('manystore')->visible(['nickname']);
 				$row->getRelation('shop')->visible(['name','logo','image','address_city','province','city','district','address','address_detail']);
             }
@@ -256,6 +256,14 @@ class Teacher extends Backend
         }
 
 
+        //添加用户机构认证
+        try {
+           \app\common\model\manystore\UserAuth::auth(0,$params["shop_id"],$params["user_id"],0,'admin',$this->auth->id);
+        }catch (\Exception $e){
+
+        }
+
+
         //如果开启了检测用户授权,则检测用户是否授权
         if(config("site.shop_auth_user_check")){
            if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
@@ -309,6 +317,13 @@ class Teacher extends Backend
         if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
             $params[$this->dataLimitField] = $this->auth->id;
         }
+        try {
+           $this->update_check($params,$row=null);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
+
         $result = false;
         Db::startTrans();
         try {
@@ -358,6 +373,14 @@ class Teacher extends Backend
             $this->error(__('Parameter %s can not be empty', ''));
         }
         $params = $this->preExcludeFields($params);
+
+        try {
+            $this->update_check($params,$row);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
+
         $result = false;
         Db::startTrans();
         try {
diff --git a/application/admin/controller/school/classes/Verification.php b/application/admin/controller/school/classes/Verification.php
index 4f9694e..5e9f7b3 100644
--- a/application/admin/controller/school/classes/Verification.php
+++ b/application/admin/controller/school/classes/Verification.php
@@ -107,6 +107,14 @@ class Verification extends Backend
             $this->error("用户不存在");
         }
 
+
+                //添加用户机构认证
+        try {
+           \app\common\model\manystore\UserAuth::auth(0,$shop_id,$user["id"],0,'admin',$this->auth->id);
+        }catch (\Exception $e){
+//          $this->error($e->getMessage());
+        }
+
        if(config("site.shop_auth_user_check")){
            if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
         }
@@ -158,6 +166,13 @@ class Verification extends Backend
             $params[$this->dataLimitField] = $this->auth->id;
         }
         $result = false;
+        try {
+            $this->update_check($params,$row=null);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
+
         Db::startTrans();
         try {
             //是否采用模型验证
@@ -206,6 +221,13 @@ class Verification extends Backend
             $this->error(__('Parameter %s can not be empty', ''));
         }
         $params = $this->preExcludeFields($params);
+
+        try {
+            $this->update_check($params,$row);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
         $result = false;
         Db::startTrans();
         try {
diff --git a/application/admin/controller/school/classes/hourorder/Order.php b/application/admin/controller/school/classes/hourorder/Order.php
index e0d105b..781eca5 100644
--- a/application/admin/controller/school/classes/hourorder/Order.php
+++ b/application/admin/controller/school/classes/hourorder/Order.php
@@ -72,7 +72,7 @@ class Order extends Backend
                 $row->getRelation('classesorder')->visible(['order_no']);
 				$row->getRelation('spec')->visible(['name']);
 				$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
-				$row->getRelation('detail')->visible(['title','headimage']);
+				$row->getRelation('detail')->visible(['title','headimage','feel']);
 				$row->getRelation('lib')->visible(['title']);
             }
 
diff --git a/application/admin/controller/school/classes/order/Order.php b/application/admin/controller/school/classes/order/Order.php
index 1c66271..c43a9ed 100644
--- a/application/admin/controller/school/classes/order/Order.php
+++ b/application/admin/controller/school/classes/order/Order.php
@@ -66,7 +66,7 @@ class Order extends Backend
 				$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
 				$row->getRelation('shop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
 				$row->getRelation('lib')->visible(['title','headimage']);
-				$row->getRelation('detail')->visible(['title','headimage']);
+				$row->getRelation('detail')->visible(['title','headimage',"feel"]);
 				$row->getRelation('admin')->visible(['nickname','avatar']);
             }
 
@@ -92,7 +92,7 @@ class Order extends Backend
                 if(isset($param['ids']))$ids = $param['ids'];
                 //设置模拟资格
                 $model = (new \app\common\model\school\classes\order\Order);
-                $model->cancel($ids,0,true,'admin',$this->auth->id,true);;
+                $model->cancel($ids,0,true,'admin',$this->auth->id,true);
 
 
             }catch (\Exception $e){
diff --git a/application/admin/lang/zh-cn/manystore/index.php b/application/admin/lang/zh-cn/manystore/index.php
index 2e7d4a5..713b15d 100644
--- a/application/admin/lang/zh-cn/manystore/index.php
+++ b/application/admin/lang/zh-cn/manystore/index.php
@@ -23,7 +23,7 @@ return [
     'Address_detail' => '详细地址',
     'Longitude'      => '经度',
     'Latitude'       => '纬度',
-    'Yyzzdm'         => '营业执照号(个人认证不需要)',
+    'Yyzzdm'         => '企业统一信用代码(个人认证不需要)',
     'Yyzz_images'    => '营业执照照片(个人认证不需要)',
     'hidden'  => '禁用',
 
diff --git a/application/admin/lang/zh-cn/school/classes/classes_lib.php b/application/admin/lang/zh-cn/school/classes/classes_lib.php
index 5216d0c..447c165 100644
--- a/application/admin/lang/zh-cn/school/classes/classes_lib.php
+++ b/application/admin/lang/zh-cn/school/classes/classes_lib.php
@@ -4,8 +4,12 @@ return [
     'Manystore_id'        => '机构账号id',
     'Shop_id'             => '机构店铺id',
     'User_id'             => '主讲师用户id',
-    'Classes_cate_ids'             => '平台课程分类',
-    'Classes_label_ids'            => '平台课程热门标签',
+    'Classes_cate_ids'             => '标签',
+    'Classes_label_ids'            => '热门',
+
+        'Start_time'       => '开始时间',
+    'End_time'         => '结束时间',
+
     'Self_label_tag'      => '机构特色标签',
     'Add_type'            => '添加人类型',
     'Add_type 1'          => '机构',
@@ -17,7 +21,7 @@ return [
     'Type'                => '地点类型',
     'Type out'            => '户外',
     'Type in'             => '室内',
-    'Classes_num'         => '多少节课',
+    'Classes_num'         => '核销次数',
     'Address_type'        => '地址类型',
     'Address_type 1'      => '按机构',
     'Address_type 2'      => '独立位置',
diff --git a/application/admin/lang/zh-cn/school/classes/evaluate.php b/application/admin/lang/zh-cn/school/classes/evaluate.php
new file mode 100644
index 0000000..2824325
--- /dev/null
+++ b/application/admin/lang/zh-cn/school/classes/evaluate.php
@@ -0,0 +1,40 @@
+ '评价用户id',
+    'Classes_lib_id'     => '课程id',
+    'Classes_order_id'   => '课程订单id',
+    'Manystore_id'       => '机构账号id',
+    'Shop_id'            => '机构店铺id',
+    'Teacher_id'         => '老师id',
+    'Image'              => '评价人头像',
+    'Nickname'           => '评价人昵称',
+    'Classes_star'       => '课程评分',
+    'Teacher_star'       => '讲师评分',
+    'Shop_star'          => '教师环境',
+    'Message_text'       => '评价内容',
+    'Evaluate_time'      => '评价时间',
+    'Status'             => '状态',
+    'Status 1'           => '上架',
+    'Set status to 1'    => '设为上架',
+    'Status 2'           => '下架',
+    'Set status to 2'    => '设为下架',
+    'Top'                => '是否置顶',
+    'Top 0'              => '否',
+    'Top 1'              => '是',
+    'Weigh'              => '权重',
+    'Createtime'         => '创建时间',
+    'Updatetime'         => '修改时间',
+    'User.nickname'      => '昵称',
+    'User.realname'      => '真实姓名',
+    'User.mobile'        => '手机号',
+    'User.avatar'        => '头像',
+    'Lib.title'          => '标题',
+    'Lib.headimage'      => '头图',
+    'Order.order_no'     => '订单号',
+    'Manystore.nickname' => '昵称',
+    'Shop.name'          => '店铺名称',
+    'Shop.logo'          => '品牌LOGO',
+    'Teacher.name'       => '教师名',
+    'Teacher.head_image' => '教师头像'
+];
diff --git a/application/admin/lang/zh-cn/school/classes/order/order_detail.php b/application/admin/lang/zh-cn/school/classes/order/order_detail.php
index 954cb2a..4d0d227 100644
--- a/application/admin/lang/zh-cn/school/classes/order/order_detail.php
+++ b/application/admin/lang/zh-cn/school/classes/order/order_detail.php
@@ -5,8 +5,8 @@ return [
     'Manystore_id'        => '机构账号id',
     'Shop_id'             => '机构店铺id',
     'User_id'             => '主讲师用户id',
-    'Classes_cate_ids'    => '平台课程分类ids',
-    'Classes_label_ids'   => '平台课程类型ids',
+    'Classes_cate_ids'    => '标签',
+    'Classes_label_ids'   => '热门',
     'Self_label_tag'      => '机构特色标签',
     'Add_type'            => '添加人类型',
     'Add_type 1'          => '机构',
diff --git a/application/admin/model/school/classes/ClassesLib.php b/application/admin/model/school/classes/ClassesLib.php
index 6b3bba2..a729d8f 100644
--- a/application/admin/model/school/classes/ClassesLib.php
+++ b/application/admin/model/school/classes/ClassesLib.php
@@ -71,6 +71,10 @@ class ClassesLib extends Model
         });
     }
 
+    public function getClassesTypeList(){
+         return \app\admin\model\school\classes\Type::column("name", 'id');
+    }
+
     
     public function getAddTypeList()
     {
diff --git a/application/admin/model/school/classes/Evaluate.php b/application/admin/model/school/classes/Evaluate.php
new file mode 100644
index 0000000..84e161f
--- /dev/null
+++ b/application/admin/model/school/classes/Evaluate.php
@@ -0,0 +1,120 @@
+getPk();
+                $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+            }
+        });
+    }
+
+    
+    public function getStatusList()
+    {
+        return ['1' => __('Status 1'), '2' => __('Status 2')];
+    }
+
+    public function getTopList()
+    {
+        return ['0' => __('Top 0'), '1' => __('Top 1')];
+    }
+
+
+    public function getEvaluateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['evaluate_time']) ? $data['evaluate_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getTopTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['top']) ? $data['top'] : '');
+        $list = $this->getTopList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+    protected function setEvaluateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+    public function user()
+    {
+        return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function lib()
+    {
+        return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function classesorder()
+    {
+        return $this->belongsTo(\app\common\model\school\classes\order\Order::class, 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function manystore()
+    {
+        return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function shop()
+    {
+        return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function teacher()
+    {
+        return $this->belongsTo(Teacher::class, 'teacher_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}
diff --git a/application/admin/validate/school/classes/Evaluate.php b/application/admin/validate/school/classes/Evaluate.php
new file mode 100644
index 0000000..0ad7ed2
--- /dev/null
+++ b/application/admin/validate/school/classes/Evaluate.php
@@ -0,0 +1,27 @@
+ [],
+        'edit' => [],
+    ];
+    
+}
diff --git a/application/admin/view/manystore/index/add.html b/application/admin/view/manystore/index/add.html
index ec66c5d..1d870b6 100644
--- a/application/admin/view/manystore/index/add.html
+++ b/application/admin/view/manystore/index/add.html
@@ -26,7 +26,7 @@
                             
         
         
-            
+            
 
             
                                     (没找到类型则点击按钮创建类型后重新下拉框选类型)
@@ -84,11 +57,42 @@
     
 
 
+    
+    
+
+
+
+
+
+
 
     
 
@@ -185,7 +189,7 @@
                 
                 
             
-            
(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,后续有变更将触发审核机制!)
+            
(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)
             
             
diff --git a/application/admin/view/school/classes/evaluate/add.html b/application/admin/view/school/classes/evaluate/add.html
new file mode 100644
index 0000000..7b90d3b
--- /dev/null
+++ b/application/admin/view/school/classes/evaluate/add.html
@@ -0,0 +1,125 @@
+
diff --git a/application/admin/view/school/classes/evaluate/edit.html b/application/admin/view/school/classes/evaluate/edit.html
new file mode 100644
index 0000000..dab0b5f
--- /dev/null
+++ b/application/admin/view/school/classes/evaluate/edit.html
@@ -0,0 +1,125 @@
+
diff --git a/application/admin/view/school/classes/evaluate/index.html b/application/admin/view/school/classes/evaluate/index.html
new file mode 100644
index 0000000..6f6789d
--- /dev/null
+++ b/application/admin/view/school/classes/evaluate/index.html
@@ -0,0 +1,46 @@
+
+    
+    
+        {:build_heading(null,FALSE)}
+        
+    
+
+
+    
+
diff --git a/application/admin/view/school/classes/teacher/edit.html b/application/admin/view/school/classes/teacher/edit.html
index c870409..74577b6 100644
--- a/application/admin/view/school/classes/teacher/edit.html
+++ b/application/admin/view/school/classes/teacher/edit.html
@@ -48,7 +48,7 @@
     
     
diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php
index 5406445..993926a 100644
--- a/application/api/controller/Index.php
+++ b/application/api/controller/Index.php
@@ -3,8 +3,12 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
+use app\common\library\Sqlscript;
+use app\common\library\Virtual;
 use app\common\model\school\Area;
 use app\common\model\style\HomeImages;
+use think\Db;
+use think\exception\PDOException;
 
 /**
  * 首页接口
@@ -15,11 +19,19 @@ class Index extends Api
     protected $noNeedRight = ['*'];
 
     /**
-     * 首页
+     * 执行sql脚本
      *
      */
     public function index()
     {
+        Db::startTrans();
+        try {
+           Sqlscript::importClasses(1,1000);
+            Db::commit();
+        } catch (PDOException|\Exception $e) {
+            Db::rollback();
+            $this->error($e->getMessage().$e->getFile().$e->getLine());
+        }
         $this->success('请求成功');
     }
 
@@ -69,7 +81,7 @@ class Index extends Api
 //            "site_logo"=>cdnurl(config('site.logo'), true),
             "site_beian"=>config('site.beian'),
             "site_version"=>''.config('site.version'),
-            "site_city"=>config('site.the_city'),
+            "site_city"=> Virtual::getNowCity(),
             "site_timezone"=>config('site.timezone'),
         ];
         $upload_config = config('upload');
diff --git a/application/api/controller/User.php b/application/api/controller/User.php
index 84c5996..50ed9f3 100644
--- a/application/api/controller/User.php
+++ b/application/api/controller/User.php
@@ -297,7 +297,7 @@ class User extends Api
      * @ApiParams (name="username", type="string", required=true, description="用户名")
      * @ApiParams (name="nickname", type="string", required=true, description="昵称")
      * @ApiParams (name="realname", type="string", required=true, description="姓名")
-     * @ApiParams (name="gender", type="string", required=true, description="性别:0女 1男")
+     * @ApiParams (name="gender", type="int", required=true, description="性别:0女 1男")
      * @ApiParams (name="birthday", type="string", required=true, description="出生日期:日期字符串 比如”1995-9-20")
      * @ApiParams (name="work", type="string", required=true, description="职业")
      * @ApiParams (name="bio", type="string", required=true, description="个人简介")
@@ -337,7 +337,7 @@ class User extends Api
         if($avatar!==null && in_array('avatar', $update_fields))$user->avatar = $avatar;
         if(in_array('realname', $update_fields))$user->realname = $realname;
         if(in_array('gender', $update_fields)){
-            if(!in_array($gender, [1,2]))$this->error(__('请输入正确的性别!'));
+            if(!in_array($gender, [1,0]))$this->error(__('请输入正确的性别!'));
             $user->gender = $gender;
         }
         if(in_array('birthday', $update_fields))$user->birthday = $birthday;
diff --git a/application/api/controller/school/Classes.php b/application/api/controller/school/Classes.php
index b8b5367..4a055ba 100644
--- a/application/api/controller/school/Classes.php
+++ b/application/api/controller/school/Classes.php
@@ -302,7 +302,10 @@ class Classes extends Base
      * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
      * @ApiParams(name = "page", type = "string",required=true,description = "页数")
      * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
+     * @ApiParams(name = "start_time", type = "int",required=false,description = "开始时间10位秒级时间戳")
+     * @ApiParams(name = "end_time", type = "int",required=false,description = "结束时间10位秒级时间戳")
      * @ApiParams(name = "has_shop", type = "int",required=false,description = "是否查机构")
+     * @ApiParams(name = "is_expire", type = "int",required=false,description = "是否查过期:1只查过期,2只查不过期,0全查")
      * @ApiParams(name = "user_id", type = "int",required=false,description = "主讲师用户id")
      * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
      * @ApiParams(name = "teacher_id", type = "int",required=false,description = "老师id")
@@ -364,6 +367,9 @@ class Classes extends Base
         $params["selfhot"] =  $this->request->get('selfhot/s', ''); //机构店铺id
         $params["feel"] =  $this->request->get('feel/s', ''); //机构店铺id
 
+        $params["is_expire"] =  $this->request->get('is_expire/d', 0); //机构店铺id
+
+
         $params["order"] =  $this->request->get('order/s', ''); //机构店铺id
         $params["nearby"] =  $this->request->get('nearby/s', ''); //机构店铺id
  $params["has_shop"] =  $this->request->get('has_shop/d', ''); //主讲师用户id
@@ -371,6 +377,11 @@ class Classes extends Base
         $params["latitude"] =  $this->request->get('latitude/s', ''); //机构店铺id
         $params["longitude"] =  $this->request->get('longitude/s', ''); //机构店铺id
 
+
+        $params["start_time"] =  $this->request->get('start_time/d', ''); //主讲师用户id
+        $params["end_time"] =  $this->request->get('end_time/d', ''); //机构店铺id
+
+
 //        $type =  $this->request->get('type/s', ''); //筛选学员和教练单
 
         try{
diff --git a/application/api/controller/school/Evaluate.php b/application/api/controller/school/Evaluate.php
new file mode 100644
index 0000000..783da12
--- /dev/null
+++ b/application/api/controller/school/Evaluate.php
@@ -0,0 +1,200 @@
+model = new \app\common\model\school\classes\Evaluate;
+        parent::_initialize();
+
+        //判断登录用户是否是员工
+    }
+
+
+
+
+
+    /**
+     * @ApiTitle( 评价列表接口)
+     * @ApiSummary(我的评价列表接口)
+     * @ApiMethod(GET)
+     * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
+     * @ApiParams(name = "page", type = "string",required=true,description = "页数")
+     * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
+     * @ApiParams(name = "my", type = "string",required=false,description = "是否查我的评价(需登录)")
+     * @ApiParams(name = "classes_lib_id", type = "string",required=false,description = "课程id")
+     * @ApiParams(name = "classes_order_id", type = "string",required=false,description = "课程订单id")
+     * @ApiParams(name = "shop_id", type = "string",required=false,description = "机构店铺id")
+     * @ApiParams(name = "teacher_id", type = "string",required=false,description = "老师id")
+     * @ApiParams(name = "time", type = "string",required=false,description = "复合时间查询:today今天,week本周,month本月,year本年,yesterday昨天,last year上一年,last week上周,last month上個月,lately7最近7天 , lately30最近30天,按开始时间区间查传值格式:Y/m/d H:M:S-Y/m/d H:M:S")
+     *
+     * @ApiReturn({
+     *
+     *})
+     */
+    public function evaluate_list()
+    {
+        $user_id = 0;
+        $user = $this->auth->getUser();//登录用户
+        if($user)$user_id = $user['id'];
+
+        $params = [];
+        $my  =  $this->request->get('my/d', 0); //我的评价
+        if($my && $user_id){
+            $params['user_id'] = $user_id;
+        }
+        $page  =  $this->request->get('page/d', 0); //页数
+        $limit =  $this->request->get('limit/d', 0); //条数
+        $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
+        $params["classes_lib_id"] = $this->request->get('classes_lib_id/d', ''); //搜索关键字
+        $params["classes_order_id"] =  $this->request->get('classes_order_id/d', ''); //搜索关键字
+        $params["shop_id"] =  $this->request->get('shop_id/d', ''); //时间
+        $params["teacher_id"] =  $this->request->get('teacher_id/d', ''); //时间
+        $params["time"] =  $this->request->get('time/s', ''); //时间
+
+        try{
+            //当前申请状态
+            $res = $this->model::evaluateList($page, $limit,$params);
+//            if($user_id =='670153'){
+//               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
+//            }
+        }catch (\Exception $e){
+
+            $this->error($e->getMessage());
+        }
+        $this->success('查询成功', $res);
+    }
+
+
+
+    /**
+     * @ApiTitle( 评价详情)
+     * @ApiSummary(评价详情)
+     * @ApiMethod(GET)
+     * @ApiParams(name = "id", type = "int",required=true,description = "评价id")
+     * @ApiReturn({
+     *
+     *})
+     */
+    public function detail(){
+        $id = $this->request->get('id/d','');
+
+        if(empty($id)){
+            $this->error(__('缺少必要参数'));
+        }
+
+        try {
+            $res =  $this->model::detail($id);
+        } catch (\Exception $e){
+//            Log::log($e->getMessage());
+            $this->error($e->getMessage(),['errcode'=>$e->getCode()]);
+        }
+        $this->success('获取成功', ['detail' => $res]);
+    }
+
+
+
+
+    /**
+     * @ApiTitle( 发起课程反馈)
+     * @ApiSummary(发起课程反馈)
+     * @ApiMethod(POST)
+     * @ApiParams(name = "order_no", type = "string",required=false,description = "课程订单id")
+     * @ApiParams(name = "message_text", type = "string",required=true,description = "评价内容")
+     * @ApiParams(name = "classes_star", type = "float",required=true,description = "课程评分:只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5")
+     * @ApiParams(name = "teacher_star", type = "float",required=false,description = "讲师评分:只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5")
+     * @ApiParams(name = "shop_star", type = "float",required=false,description = "教师环境:只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5")
+     * @ApiReturn({
+     *
+     *})
+     */
+    public function evaluate()
+    {
+        $user_id = 0;
+        $user = $this->auth->getUser();//登录用户
+        if($user)$user_id = $user['id'];
+
+
+        $order_no  =  $this->request->post('order_no/s', 0); //页数
+        $message_text =  $this->request->post('message_text/s', 0); //
+        $classes_star = $this->request->post('classes_star/f', 5);
+        $teacher_star = $this->request->post('teacher_star/f', 5);
+        $shop_star = $this->request->post('shop_star/f', 5);
+
+        try{
+            //当前申请状态
+            $res = $this->model::evaluate($order_no,$message_text,$classes_star,$teacher_star,$shop_star,$user_id,true,'user',$user_id,true);
+//            if($user_id =='670153'){
+//               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
+//            }
+        }catch (\Exception $e){
+
+            $this->error($e->getMessage());
+        }
+        $this->success('反馈成功', $res);
+    }
+
+
+
+    /**
+     * @ApiTitle( 课程反馈更新)
+     * @ApiSummary(课程反馈更新)
+     * @ApiMethod(POST)
+     * @ApiParams(name = "order_no", type = "string",required=false,description = "课程订单id")
+     * @ApiParams(name = "message_text", type = "string",required=true,description = "评价内容")
+     * @ApiParams(name = "classes_star", type = "float",required=true,description = "课程评分:只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5")
+     * @ApiParams(name = "teacher_star", type = "float",required=false,description = "讲师评分:只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5")
+     * @ApiParams(name = "shop_star", type = "float",required=false,description = "教师环境:只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5")
+     * @ApiReturn({
+     *
+     *})
+     */
+    public function evaluate_update()
+    {
+        $user_id = 0;
+        $user = $this->auth->getUser();//登录用户
+        if($user)$user_id = $user['id'];
+
+
+        $order_no  =  $this->request->post('order_no/s', 0); //页数
+        $message_text =  $this->request->post('message_text/s', 0); //
+        $classes_star = $this->request->post('classes_star/f', 5);
+        $teacher_star = $this->request->post('teacher_star/f', 5);
+        $shop_star = $this->request->post('shop_star/f', 5);
+
+        try{
+            //当前申请状态
+            $res = $this->model::evaluateUpdate($order_no,$message_text,$classes_star,$teacher_star,$shop_star,$user_id,true,'user',$user_id,true);
+//            if($user_id =='670153'){
+//               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
+//            }
+        }catch (\Exception $e){
+
+            $this->error($e->getMessage());
+        }
+        $this->success('反馈成功', $res);
+    }
+
+
+
+
+}
+
diff --git a/application/api/controller/school/Order.php b/application/api/controller/school/Order.php
index 2f230de..5a87ee0 100644
--- a/application/api/controller/school/Order.php
+++ b/application/api/controller/school/Order.php
@@ -66,6 +66,7 @@ class Order extends Base
      * @ApiMethod(POST)
      * @ApiParams(name = "classes_lib_id", type = "int",required=true,description = "课程id")
      * @ApiParams(name = "order_no", type = "string",required=false,description = "缓存key")
+     * @ApiParams(name = "classes_lib_spec_id", type = "int",required=true,description = "想同时约的课时id")
      * @ApiParams(name = "is_compute", type = "int",required=false,description = "是否重新计算并更新缓存 默认传1")
      * @ApiReturn({
      *
@@ -76,8 +77,15 @@ class Order extends Base
         $user = $this->auth->getUser();//登录用户
         if($user)$user_id = $user['id'];
         $classes_lib_id =  $this->request->post('classes_lib_id/d', 0); //课程id
+        $classes_lib_spec_id =  $this->request->post('classes_lib_spec_id/d', 0); //想同时约的课时id
 //        $param  =  urldecode($this->request->post('param/s', "{}")); //参数
-        $param  =  []; //参数
+        $param  = [];
+        if($classes_lib_spec_id){
+            $param  =  [
+            "classes_lib_spec_id"=>$classes_lib_spec_id
+            ];
+        }
+         //参数
         $order_no  =  $this->request->post('order_no/s', ''); //订单号
         $is_compute =  $this->request->post('is_compute/d', 1); //是否重新计算并更新缓存
        try{
@@ -157,6 +165,7 @@ class Order extends Base
      * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
      * @ApiParams(name = "status", type = "string",required=false,description = "状态搜索条件:-3=已取消,0=待支付,3=使用中,6=已退款,9=已完成")
      * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
+     * @ApiParams(name = "has_evaluate", type = "int",required=false,description = "是否评价:默认0全部 ,1查已评价 2查未评价")
      * @ApiReturn({
      *
      *})
@@ -171,11 +180,13 @@ class Order extends Base
         $keywords =  $this->request->get('keywords/s', ''); //搜索关键字
         $status =  $this->request->get('status/s', ''); //搜索关键字
         $classes_lib_id =  $this->request->get('classes_lib_id/s', ''); //搜索关键字
+
+        $has_evaluate =  $this->request->get('has_evaluate/d', 0); //搜索关键字
 //        $type =  $this->request->get('type/s', ''); //筛选学员和教练单
 
         try{
             //当前申请状态
-            $res = $this->model::allList($user_id,$page, $limit,$keywords,$status,$classes_lib_id);
+            $res = $this->model::allList($user_id,$page, $limit,$keywords,$status,$classes_lib_id,$has_evaluate);
 //            if($user_id =='670153'){
 //               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
 //            }
diff --git a/application/api/controller/school/Shop.php b/application/api/controller/school/Shop.php
index 086d145..73bbb7f 100644
--- a/application/api/controller/school/Shop.php
+++ b/application/api/controller/school/Shop.php
@@ -70,11 +70,30 @@ class Shop extends Base
      * @ApiParams(name = "front_idcard_image", type = "string",required=true,description = "法人身份证正面")
      * @ApiParams(name = "reverse_idcard_image", type = "string",required=true,description = "法人身份证反面")
      * @ApiParams(name = "images", type = "string",required=true,description = "机构环境照片(多个逗号拼接)")
+     * @ApiParams(name = "yyzzdm", type = "string",required=true,description = "社会统一信用代码")
      * @ApiParams(name = "yyzz_images", type = "string",required=true,description = "营业执照照片(多个逗号拼接)")
      * @ApiParams(name = "address", type = "string",required=true,description = "店铺地址")
      * @ApiParams(name = "address_detail", type = "string",required=true,description = "店铺详细地址")
      * @ApiParams(name = "longitude", type = "string",required=true,description = "经度")
      * @ApiParams(name = "latitude", type = "string",required=true,description = "纬度")
+     * @ApiParams(name = "province", type = "int",required=true,description = "省编号")
+     * @ApiParams(name = "city", type = "int",required=true,description = "市编号")
+     * @ApiParams(name = "district", type = "int",required=true,description = "县区编号")
+     *
+     * @ApiParams(name = "establish_time", type = "int",required=true,description = "成立时间10位秒级时间戳")
+     * @ApiParams(name = "people", type = "int",required=true,description = "员工人数")
+     * @ApiParams(name = "legal_entity", type = "string",required=true,description = "法人姓名")
+     * @ApiParams(name = "gender", type = "int",required=true,description = "法人性别:0=女,1=男")
+     * @ApiParams(name = "nation", type = "string",required=true,description = "法人民族")
+     * @ApiParams(name = "out_look", type = "string",required=true,description = "法人政治面貌")
+     * @ApiParams(name = "birthtime", type = "int",required=true,description = "法人出生日期10位秒级时间戳")
+     * @ApiParams(name = "native_place", type = "string",required=true,description = "法人籍贯")
+     * @ApiParams(name = "card_number", type = "string",required=true,description = "法人身份证号码")
+     * @ApiParams(name = "diploma", type = "string",required=true,description = "法人学历")
+     * @ApiParams(name = "post", type = "string",required=true,description = "法人职务")
+     * @ApiParams(name = "social_position", type = "string",required=true,description = "法人社会职务")
+     *
+     *
      * @ApiReturn({
      *
      *})
@@ -89,6 +108,8 @@ class Shop extends Base
 
         $params["images"] = $this->request->post('images/s','');
         $params["yyzz_images"] = $this->request->post('yyzz_images/s','');
+        $params["yyzzdm"] = $this->request->post('yyzzdm/s','');
+
 
                 $params["address"] = $this->request->post('address/s','');
         $params["address_detail"] = $this->request->post('address_detail/s','');
@@ -97,6 +118,29 @@ class Shop extends Base
 
 
 
+
+          $params["province"] = $this->request->post('province/d','');
+          $params["city"] = $this->request->post('city/d','');
+          $params["district"] = $this->request->post('district/d','');
+
+
+
+          $params["establish_time"] = $this->request->post('establish_time/d','');
+          $params["people"] = $this->request->post('people/d','');
+          $params["legal_entity"] = $this->request->post('legal_entity/s','');
+          $params["gender"] = $this->request->post('gender/d','');
+          $params["nation"] = $this->request->post('nation/s','');
+          $params["out_look"] = $this->request->post('out_look/s','');
+          $params["birthtime"] = $this->request->post('birthtime/d','');
+          $params["native_place"] = $this->request->post('native_place/s','');
+          $params["card_number"] = $this->request->post('card_number/s','');
+          $params["diploma"] = $this->request->post('diploma/s','');
+          $params["post"] = $this->request->post('post/s','');
+          $params["social_position"] = $this->request->post('social_position/s','');
+
+
+
+
 //        if(empty($id)){
 //            $this->error(__('缺少必要参数'));
 //        }
@@ -125,6 +169,22 @@ class Shop extends Base
      * @ApiParams(name = "desc", type = "string",required=false,description = "申请备注(非必填)")
      * @ApiParams(name = "front_idcard_image", type = "string",required=true,description = "身份证正面")
      * @ApiParams(name = "reverse_idcard_image", type = "string",required=true,description = "身份证反面")
+     * @ApiParams(name = "address", type = "string",required=true,description = "地址")
+     * @ApiParams(name = "address_detail", type = "string",required=true,description = "详细地址")
+     * @ApiParams(name = "longitude", type = "string",required=true,description = "经度")
+     * @ApiParams(name = "latitude", type = "string",required=true,description = "纬度")
+     * @ApiParams(name = "province", type = "int",required=true,description = "省编号")
+     * @ApiParams(name = "city", type = "int",required=true,description = "市编号")
+     * @ApiParams(name = "district", type = "int",required=true,description = "县区编号")
+     * @ApiParams(name = "gender", type = "int",required=true,description = "个人性别:0=女,1=男")
+     * @ApiParams(name = "nation", type = "string",required=true,description = "个人民族")
+     * @ApiParams(name = "out_look", type = "string",required=true,description = "个人政治面貌")
+     * @ApiParams(name = "birthtime", type = "int",required=true,description = "个人出生日期10位秒级时间戳")
+     * @ApiParams(name = "native_place", type = "string",required=true,description = "个人籍贯")
+     * @ApiParams(name = "card_number", type = "string",required=true,description = "个人身份证号码")
+     * @ApiParams(name = "diploma", type = "string",required=true,description = "个人学历")
+     * @ApiParams(name = "post", type = "string",required=true,description = "个人职务")
+     * @ApiParams(name = "social_position", type = "string",required=true,description = "个人社会职务")
      * @ApiReturn({
      *
      *})
@@ -137,6 +197,33 @@ class Shop extends Base
         $params["front_idcard_image"] = $this->request->post('front_idcard_image/s','');
         $params["reverse_idcard_image"] = $this->request->post('reverse_idcard_image/s','');
 
+
+                        $params["address"] = $this->request->post('address/s','');
+        $params["address_detail"] = $this->request->post('address_detail/s','');
+                $params["longitude"] = $this->request->post('longitude/s','');
+        $params["latitude"] = $this->request->post('latitude/s','');
+
+
+          $params["province"] = $this->request->post('province/d','');
+          $params["city"] = $this->request->post('city/d','');
+          $params["district"] = $this->request->post('district/d','');
+
+
+
+          $params["establish_time"] = $this->request->post('establish_time/d','');
+          $params["people"] = $this->request->post('people/d','');
+          $params["legal_entity"] = $this->request->post('legal_entity/s','');
+          $params["gender"] = $this->request->post('gender/d','');
+          $params["nation"] = $this->request->post('nation/s','');
+          $params["out_look"] = $this->request->post('out_look/s','');
+          $params["birthtime"] = $this->request->post('birthtime/d','');
+          $params["native_place"] = $this->request->post('native_place/s','');
+          $params["card_number"] = $this->request->post('card_number/s','');
+          $params["diploma"] = $this->request->post('diploma/s','');
+          $params["post"] = $this->request->post('post/s','');
+          $params["social_position"] = $this->request->post('social_position/s','');
+
+
 //        if(empty($id)){
 //            $this->error(__('缺少必要参数'));
 //        }
diff --git a/application/common/hooks.php b/application/common/hooks.php
index 64d0ef6..c192ab6 100644
--- a/application/common/hooks.php
+++ b/application/common/hooks.php
@@ -19,6 +19,14 @@ $defaultHooks = [
      'app\\common\\listener\\classesorder\\OrderHook'
   ],
 
+    'classes_order_evaluate_after'=> [        // 订单评价后
+        'app\\common\\listener\\classesorder\\OrderHook'
+    ],
+
+    'classes_order_evaluate_update_after'=> [        // 订单评价修改后
+        'app\\common\\listener\\classesorder\\OrderHook'
+    ],
+
 //
    // app\common\listener\classesorder
 
diff --git a/application/common/library/Sqlscript.php b/application/common/library/Sqlscript.php
new file mode 100644
index 0000000..c6d253f
--- /dev/null
+++ b/application/common/library/Sqlscript.php
@@ -0,0 +1,124 @@
+page($page,$limit)->select();
+
+       //默认机构id
+            $manystore_id = 2;
+            $shop_id = 2;
+            $user_id = 25;
+            $teacher_id = 8;
+
+       foreach ($kechengs as $k=>$v){
+               $classes_cate_ids = Cate::where( "name",$v["gongyi"])->value("id");
+               if(!$classes_cate_ids)$classes_cate_ids="";
+$classes_label_ids = "";
+$classes_type = Type::where( "name",$v["kecheng_type"])->value("id");
+$add_type = "2";
+$add_id = 0;
+$title = $v["name"];
+$headimage = $v["img"];
+if(!$headimage)continue;
+$images = Db::table("kecheng_img")->where("ke_id",$v["id"])->column("path");
+$images = implode(",",$images);
+$type = "in";
+$classes_num = 1;
+$address_type = "2";
+// "address_city": "河南省/洛阳市",
+//        "province": "河南省",
+//        "city": "洛阳市",
+//        "area": null,
+//        "province_code": 410000,
+//        "city_code": 410300,
+//        "area_code": 0
+   $address_city = "河南省/洛阳市"."/".$v["district"];
+   $address = $v["district"];
+   $address_detail = $v["shangkedidian"];
+   $province  = 410000;
+   $city = 410300;
+   $district = Area::where( "name","like","%".$v["district"]."%")
+       ->where("level",3)
+       ->where("pid",$city)
+       ->value("id");
+   $longitude = $v["longitude"];
+   $latitude = $v["latitude"];
+   //html解码
+   $content =  html_entity_decode($v["blurb"]);
+   $notice = html_entity_decode($v["experience"]);
+   $price = 0;
+   $status = "1";
+   $weigh = 0;
+   $recommend = ''.($v["por"] ?:0);
+   $hot = ''.($v["hot"] ?:0);
+   $new = ''.($v["top"] ?:0);
+   $auth_status = 1;
+   $feel = "1";
+   //如果不存在开始和结束时间
+    //随机生成个至少过去一个月的开始和结束时间, 结束时间至少过去一个月
+       if(!$v["start_time"]||!$v["end_time"]){
+           $v["start_time"] = time()-rand(2592000,2592000*10);
+           $v["end_time"] = rand($v["start_time"]+24536,$v["start_time"] + time()-$v["start_time"]);
+       }
+
+
+
+
+   //开始时间和结束时间如果是毫秒级时间戳,截取成秒级
+     $v["start_time"] = substr($v["start_time"],0,10);
+     $v["end_time"] = substr($v["end_time"],0,10);
+
+    $spec = [
+        "classes_lib_id"=>0,
+        "name"=>"单课时默认课时",
+        "start_time"=>$v["start_time"],
+        "end_time"=>$v["end_time"],
+        "limit_num"=>100,
+        "status"=>"1",
+        "weigh"=>0
+    ];
+    $classes_lib = ClassesLib::where("title",$title)->find();
+        if(!$classes_lib){
+              $classes_lib = ClassesLib::create(compact("feel","auth_status","manystore_id", "shop_id", "user_id", "teacher_id",  "classes_cate_ids","classes_label_ids","classes_type","add_type","add_id","title","headimage","images","type","classes_num","address_type","address_city","address","address_detail","province","city","district","longitude","latitude","content","notice","price","status","weigh","recommend","hot","new"));
+        $spec["classes_lib_id"] = $classes_lib->id;
+        $spec = ClassesSpec::create($spec);
+//        \app\common\model\school\classes\ClassesLib::add_virtual_init($classes_lib->id);
+         \app\common\model\school\classes\ClassesLib::update_classes($classes_lib->id);
+        }else{
+            $classes_lib->save(compact("feel","auth_status","manystore_id", "shop_id", "user_id", "teacher_id",  "classes_cate_ids","classes_label_ids","classes_type","add_type","add_id","title","headimage","images","type","classes_num","address_type","address_city","address","address_detail","province","city","district","longitude","latitude","content","notice","price","status","weigh","recommend","hot","new"));
+            $spec["classes_lib_id"] = $classes_lib->id;
+            $ClassesSpec = ClassesSpec::where("classes_lib_id",$classes_lib->id)->find();
+            if($ClassesSpec){
+                 ClassesSpec::where("classes_lib_id",$classes_lib->id)->update($spec);
+            }else{
+                  ClassesSpec::create($spec);
+            }
+
+
+//             \app\common\model\school\classes\ClassesLib::add_virtual_init($classes_lib->id);
+         \app\common\model\school\classes\ClassesLib::update_classes($classes_lib->id);
+        }
+
+       }
+    }
+
+
+
+}
\ No newline at end of file
diff --git a/application/common/listener/classesorder/OrderHook.php b/application/common/listener/classesorder/OrderHook.php
index 92a082f..a452ddc 100644
--- a/application/common/listener/classesorder/OrderHook.php
+++ b/application/common/listener/classesorder/OrderHook.php
@@ -1,5 +1,6 @@
  $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
+
+        $detail = $order->detail;
+        if(!$user_id ||$order["user_id"] !=$user_id ){
+            $desc = "[系统操作]课程{$detail["title"]}订单反馈成功";
+        }else{
+            $desc = "课程{$detail["title"]}订单反馈成功";
+        }
+
+        $title = "课程订单已反馈";
+        $mini_type = "order_notice";
+        $to_type="user";
+        $to_id = $order["user_id"];
+        $status ="classes";
+        $platform="user";
+        $oper_id=0;
+        $oper_type="system";
+        $params=[
+            "event"=>"classes_order_evaluate_after",
+            "order_id"=>$order["id"],
+            "order_no"=>$order["order_no"],
+        ];
+        Message::$event_name = $params["event"];
+        Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
+
+        Evaluate::evaluateStatistics($classes_evaluate->id);
+    }
+
+
+
+
+    // 订单评价更新后
+    public function classesOrderEvaluateUpdateAfter(&$params)
+    {
+        ['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
+
+        $detail = $order->detail;
+        if(!$user_id ||$order["user_id"] !=$user_id ){
+            $desc = "[系统操作]课程{$detail["title"]}订单反馈更新成功";
+        }else{
+            $desc = "课程{$detail["title"]}订单反馈更新成功";
+        }
+
+        $title = "课程订单已修改反馈";
+        $mini_type = "order_notice";
+        $to_type="user";
+        $to_id = $order["user_id"];
+        $status ="classes";
+        $platform="user";
+        $oper_id=0;
+        $oper_type="system";
+        $params=[
+            "event"=>"classes_order_evaluate_update_after",
+            "order_id"=>$order["id"],
+            "order_no"=>$order["order_no"],
+        ];
+        Message::$event_name = $params["event"];
+        Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
+        Evaluate::evaluateStatistics($classes_evaluate->id);
+    }
+
+
+
+
+
+
 }
\ No newline at end of file
diff --git a/application/common/model/BaseModel.php b/application/common/model/BaseModel.php
index 4735c09..af19744 100644
--- a/application/common/model/BaseModel.php
+++ b/application/common/model/BaseModel.php
@@ -88,7 +88,7 @@ class BaseModel extends Model
             if($row[$k]!=$params[$k]){
                 //当修改参数不在允许修改的字段中
                 if(!in_array($k,$this->no_auth_fields)){
-//                     var_dump($row[$k],$params[$k]);
+//                     var_dump($k,$row[$k],$params[$k]);
                     $this->have_auth = true;break;
 
                 }
diff --git a/application/common/model/dyqc/ManystoreShop.php b/application/common/model/dyqc/ManystoreShop.php
index 8111126..5ca54b1 100644
--- a/application/common/model/dyqc/ManystoreShop.php
+++ b/application/common/model/dyqc/ManystoreShop.php
@@ -3,6 +3,7 @@
 namespace app\common\model\dyqc;
 
 use app\common\model\BaseModel;
+use app\common\model\school\Area;
 use app\common\model\school\classes\ClassesLib;
 use app\common\model\school\classes\Teacher;
 use app\common\model\User;
@@ -262,6 +263,11 @@ class ManystoreShop extends BaseModel
             //验证参数
             //$type 1=个人,2=机构
             if(!in_array($type,['1','2']))throw new \Exception("类型参数错误");
+
+            if(!in_array($params['gender'],[0,1]))throw new \Exception("年龄参数错误");
+
+
+
             //switch不同类型type做不同验证
             //未传手机号则默认用户手机号
             if(empty($params['tel'])) $params['tel'] = $user['mobile'];
@@ -274,6 +280,26 @@ class ManystoreShop extends BaseModel
 //                    'desc' => 'require',
                     'front_idcard_image' => 'require',
                     'reverse_idcard_image' => 'require',
+
+                    'address' => 'require',
+//                    'address_detail' => 'require',
+                     'longitude' => 'require',
+                     'latitude' => 'require',
+                     'province' => 'require',
+                     'city' => 'require',
+                     'district' => 'require',
+
+                        'gender'=> 'require',
+                        'nation'=> 'require',
+                        'out_look'=> 'require',
+                        'birthtime'=> 'require',
+                        'native_place'=> 'require',
+                        'card_number'=> 'require',
+
+
+
+
+
                     ];
                    $rule_msg = [
                     'name.require' => '姓名必须填写',
@@ -282,6 +308,22 @@ class ManystoreShop extends BaseModel
 //                    'desc.require' => '申请备注必须填写',
                     'front_idcard_image.require' => '身份证正面必须上传',
                     'reverse_idcard_image.require' => '身份证反面必须上传',
+                     'address.require' => '地址必填',
+//                     'address_detail.require' => '详细地址必填',
+                     'longitude.require' => '经度必填',
+                     'latitude.require' => '纬度必填',
+                     'province.require' => '省编号必填',
+                     'city.require' => '市编号必填',
+                     'district.require' => '县区编号必填',
+
+
+                        'gender.require'=> '个人性别必填',
+                        'nation.require'=> '个人民族必填',
+                        'out_look.require'=> '个人政治面貌必填',
+                        'birthtime.require'=> '个人出生日期必填',
+                        'native_place.require'=> '个人籍贯必填',
+                        'card_number.require'=> '个人身份证号码必填',
+
                    ];
                     break;
                 case '2': //机构
@@ -294,34 +336,73 @@ class ManystoreShop extends BaseModel
                         'reverse_idcard_image' => 'require',
                         'images' => 'require',
                         'yyzz_images' => 'require',
+                        'yyzzdm'  => 'require',
 
 
                          'address' => 'require',
-                         'address_detail' => 'require',
+//                         'address_detail' => 'require',
                          'longitude' => 'require',
                          'latitude' => 'require',
+                         'province' => 'require',
+                         'city' => 'require',
+                         'district' => 'require',
+
+//                        'establish_time' => 'require',
+//                        'people' => 'require',
+
+
+                        'gender'=> 'require',
+                        'nation'=> 'require',
+                        'out_look'=> 'require',
+                        'birthtime'=> 'require',
+                        'native_place'=> 'require',
+                        'card_number'=> 'require',
 
                     ];
 
                     $rule_msg = [
-                         'address.require' => '机构地址必填',
-                         'address_detail.require' => '机构详细地址必填',
+                         'address.require' => '地址必填',
+//                         'address_detail.require' => '详细地址必填',
                          'longitude.require' => '经度必填',
                          'latitude.require' => '纬度必填',
-                        'name.require' => '机构名称必须填写',
-                        'tel.require' => '服务电话必须填写',
-                        'tel.number' => '服务电话必须是数字',
+                         'province.require' => '省编号必填',
+                         'city.require' => '市编号必填',
+                         'district.require' => '县区编号必填',
+                         'name.require' => '机构名称必须填写',
+                         'tel.require' => '服务电话必须填写',
+                         'tel.number' => '服务电话必须是数字',
 //                    'desc.require' => '申请备注必须填写',
                         'front_idcard_image.require' => '法人身份证正面必须上传',
                         'reverse_idcard_image.require' => '法人身份证反面必须上传',
                         'images.require' => '机构环境照片必须上传',
                         'yyzz_images.require' => '营业执照照片必须上传',
+                        'yyzzdm.require'  => '企业统一信用代码必填',
+//                        'establish_time.require' => '成立时间必填',
+//                        'people.require' => '员工人数必填',
+
+
+                        'gender.require'=> '法人性别必填',
+                        'nation.require'=> '法人民族必填',
+                        'out_look.require'=> '法人政治面貌必填',
+                        'birthtime.require'=> '法人出生日期必填',
+                        'native_place.require'=> '法人籍贯必填',
+                        'card_number.require'=> '法人身份证号码必填',
+
                     ];
 
                     break;
             }
             self::check($params,$rule,$rule_msg);
+
         }
+          $province_name = Area::where("id" ,$params['province'])->value("name");
+            if(!$province_name) throw new \Exception("省份不存在");
+            $city_name = Area::where("id" ,$params['city'])->value("name");
+            if(!$city_name) throw new \Exception("市不存在");
+            $district_name = Area::where("id" ,$params['district'])->value("name");
+            if(!$district_name) throw new \Exception("区县不存在");
+            $params['address_city'] = $province_name."/".$city_name."/".$district_name;
+
         $params["type"] = $type;
 
 
diff --git a/application/common/model/school/classes/ClassesLib.php b/application/common/model/school/classes/ClassesLib.php
index 818768e..5bec3fd 100644
--- a/application/common/model/school/classes/ClassesLib.php
+++ b/application/common/model/school/classes/ClassesLib.php
@@ -326,7 +326,7 @@ class ClassesLib extends BaseModel
      * @throws \think\exception\DbException
      */
     public function detail($id,$user_id=0,$oper_type='user',$trans=false){
-        $self = $this->get($id,['shop','teacher']);
+        $self = $this->get($id,['shop','teacher','user']);
 
         //是否收藏
         $self['is_collect'] = 0;
@@ -334,7 +334,7 @@ class ClassesLib extends BaseModel
         $self['have_buy'] = 0;
         if($user_id){
             //判断是否收藏
-            $self['is_collect'] = Collect::where("user_id",$user_id)->where("classes_lib_id",$id)->count();
+            $self['is_collect'] = Collect::where("user_id",$user_id)->where("classes_lib_id",$id)->count() ? 1:0 ;
 
             //判断用户是否已报名
             $self['have_buy'] = \app\common\model\school\classes\order\Order::where("classes_lib_id",$id)
@@ -369,7 +369,7 @@ class ClassesLib extends BaseModel
         //
         $this->setViews($id,$user_id,$oper_type,$user_id,$trans);
 
-
+        $self->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
         //参与人数 = 虚拟人数 + 平台人数
         return $self;
     }
@@ -651,6 +651,29 @@ $user_unpaid_order = $user_paid_order =null;
             $selfetch = $selfetch->where("{$a}title|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keywords . '%');
         }
 
+
+        if(isset($start_time) && isset($end_time) && ($end_time || $start_time)) {
+           if($start_time){
+               $selfetch = $selfetch->where("{$a}start_time", '>=', $start_time);
+           }
+           if($end_time){
+               $selfetch = $selfetch->where("{$a}end_time", '<=', $end_time);
+           }
+        }
+
+        // is_expire 是否查过期:1只查过期,2只查不过期,0全查
+  if(isset($is_expire) && $is_expire) {
+      if($is_expire == 1){
+           $selfetch = $selfetch->where("{$a}end_time", '<', time());
+      }else{
+           $selfetch = $selfetch->where("{$a}end_time", '>=', time());
+      }
+
+  }
+
+
+
+
         if (isset($manystore_id) && $manystore_id) {
             $selfetch = $selfetch->where("{$a}manystore_id", 'in', ''.$manystore_id);
         }
@@ -995,12 +1018,14 @@ $user_unpaid_order = $user_paid_order =null;
 
 
 //不用审核允许修改的字段
-     public $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"];
+     public $no_auth_fields = ["user_id","teacher_id","classes_type","classes_cate_ids","classes_label_ids","self_label_tag",'headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"];
 
 
       public function classesCheck(&$params,$shop_id=null,$row=null)
     {
+//         if($row)$params["auth_status"] = $params["auth_status"] ?? $row["auth_status"];
          $params["auth_status"] = $params["auth_status"] ?? '0';
+
          $params["status"] = $params["status"] ?? '3';
          if(!$shop_id)$shop_id = $params["shop_id"] ?? 0;
 
@@ -1104,6 +1129,7 @@ $user_unpaid_order = $user_paid_order =null;
                $this->no_auth_fields_check($params,$row);
 
                 if($this->have_auth){
+
                     $params['status'] = "3";
                     $params['auth_status'] = "0";
                 }
@@ -1130,7 +1156,8 @@ $user_unpaid_order = $user_paid_order =null;
                 foreach ($spec as $k=>&$v){
                     $v["classes_lib_id"] = $row->id;
                     //先不进行判定,交给提交后再判定
-                    (new ClassesSpec)->specCheck($v,$shop_id,empty($v["id"])? null :  ClassesSpec::get($v["id"]),false);
+                     $classesSpec = new ClassesSpec;
+                    $classesSpec->specCheck($v,$shop_id,empty($v["id"])? null :  ClassesSpec::get($v["id"]),false);
 
                 }
                 $params["spec"] = $spec;
diff --git a/application/common/model/school/classes/ClassesSpec.php b/application/common/model/school/classes/ClassesSpec.php
index 66016e4..3794b09 100644
--- a/application/common/model/school/classes/ClassesSpec.php
+++ b/application/common/model/school/classes/ClassesSpec.php
@@ -107,7 +107,7 @@ class ClassesSpec extends BaseModel
 
         // 课程存在售后订单则不允许操作
         $order = \app\common\model\school\classes\hour\Order::where("classes_lib_spec_id",$id)->where("status","in","-1,0")->find();
-        if($order)throw new \Exception("存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!");
+        if($order)throw new \Exception("{$order['name']}存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!");
     }
 
 
@@ -117,14 +117,15 @@ class ClassesSpec extends BaseModel
                  //限定人数必须大于0
         $limit_num = $params["limit_num"];
         if($limit_num<=0){
-            throw new \Exception("限定人数必须大于0");
+            throw new \Exception("{$params["name"]}限定人数必须大于0");
         }
 
 
 
 //开始和结束时间不能为空
          $time = $params["time"];
-        if(empty($time))throw new \Exception("请选择开始和结束时间");
+
+        if(empty($time))throw new \Exception("{$params["name"]}请选择开始和结束时间".$time);
         $split_line = " - ";
         $time_arr = explode($split_line,$time);
         $params["start_time"] = $time_arr[0] ;
@@ -135,14 +136,14 @@ class ClassesSpec extends BaseModel
         $end_time = $params["end_time"];
 
         if(empty($start_time) || empty($end_time)){
-            throw new \Exception("请选择开始和结束时间");
+            throw new \Exception("{$params["name"]}请选择开始和结束时间".$time);
         }
         //转化时间戳
         $start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
         $end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
         //结束时间不能小于开始时间
         if($end_time<=$start_time){
-            throw new \Exception("结束时间不能小于开始时间");
+            throw new \Exception("{$params["name"]}结束时间不能小于开始时间");
         }
 
         //结束时间不能是已经过去的时间
@@ -151,6 +152,16 @@ class ClassesSpec extends BaseModel
 //            throw new \Exception("结束时间不能是已经过去的时间");
         }
 
+
+        //开始和结束时间必须是同一天
+        $start_time_date = date("Y-m-d",$start_time);
+        $end_time_date = date("Y-m-d",$end_time);
+        if($start_time_date!=$end_time_date){
+            throw new \Exception("{$params["name"]}开始和结束时间必须是同一天");
+        }
+
+
+
         $params["start_time"] = $start_time;
         $params["end_time"] = $end_time;
 
diff --git a/application/common/model/school/classes/Evaluate.php b/application/common/model/school/classes/Evaluate.php
new file mode 100644
index 0000000..9cebd58
--- /dev/null
+++ b/application/common/model/school/classes/Evaluate.php
@@ -0,0 +1,520 @@
+getPk();
+                $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+            }
+        });
+    }
+
+    
+    public function getStatusList()
+    {
+        return ['1' => __('Status 1'), '2' => __('Status 2')];
+    }
+
+    public function getTopList()
+    {
+        return ['0' => __('Top 0'), '1' => __('Top 1')];
+    }
+
+
+    public function getEvaluateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['evaluate_time']) ? $data['evaluate_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getTopTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['top']) ? $data['top'] : '');
+        $list = $this->getTopList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+    protected function setEvaluateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+    public function user()
+    {
+        return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function lib()
+    {
+        return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function classesorder()
+    {
+        return $this->belongsTo(\app\common\model\school\classes\order\Order::class, 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function manystore()
+    {
+        return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function shop()
+    {
+        return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function teacher()
+    {
+        return $this->belongsTo(Teacher::class, 'teacher_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function getImageAttr($value, $data)
+    {
+        if (!empty($value)) return cdnurl($value, true);
+    }
+
+
+    /**得到基础条件
+     * @param $status
+     * @param null $model
+     * @param string $alisa
+     */
+    public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false)
+    {
+
+        if (!$model) {
+            $model = new static;
+            if ($alisa&&!$with) $model = $model->alias($alisa);
+        }
+        if ($alisa) $alisa = $alisa . '.';
+        $tableFields = (new static)->getTableFields();
+        foreach ($tableFields as $fields)
+        {
+            if(in_array($fields, ['status']))continue;
+//            if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
+
+            if (isset($whereData[$fields]) && $whereData[$fields]){
+                if(is_array($whereData[$fields])){
+                    $model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]);
+                }else{
+                    $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
+                }
+
+            }
+
+
+        }
+        if (isset($whereData['status']) && $whereData['status']) $model = $model->where("{$alisa}status", 'in', $whereData['status']);
+        if (isset($whereData['not_status']) && $whereData['not_status']) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']);
+
+
+        if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}message_text|{$alisa}nickname", 'like', "%". $whereData['keywords']."%");
+        if (isset($whereData['time'])&&$whereData['time']){
+            $model = $model->time(["{$alisa}evaluate_time",$whereData['time']]);
+        }
+
+
+        return $model;
+    }
+
+
+
+
+    public static function evaluateList($page, $limit,$params=[]){
+        $with_field = [
+            'user'=>['nickname','mobile','avatar','realname'],
+            'base'=>['*'],
+            'shop'=>['name','logo'],
+            'lib'=>['title','headimage'],
+            'classesorder'=>['order_no'],
+            'teacher'=>['name',"head_image"],
+        ];
+
+        $alisa = (new self)->getWithAlisaName();
+        $sort = "{$alisa}.top desc,{$alisa}.weigh desc,{$alisa}.id desc";
+        $serch_where = ["status"=>'1'];
+        $serch_where = array_merge($serch_where,$params);
+        return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field);
+    }
+
+
+
+    /** 课程详情
+     * @param $id
+     * @throws \think\exception\DbException
+     */
+    public static function detail($id,$user_id=0,$oper_type='user',$trans=false){
+        $self = self::get($id,['user','shop',"lib",'teacher','classesorder']);
+
+        if($user_id){
+            if($self["user_id"] != $user_id) throw new \Exception("非法访问");
+        }
+
+        $self->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
+        $self->getRelation('shop')->visible(['name','logo']);
+        $self->getRelation('lib')->visible(['title','headimage']);
+        $self->getRelation('classesorder')->visible(['order_no']);
+        $self->getRelation('teacher')->visible(['name',"head_image"]);
+        //参与人数 = 虚拟人数 + 平台人数
+        return $self;
+    }
+
+
+
+    /** 课程反馈
+     * @param $order_no
+     * @param int $user_id
+     * @param bool $check
+     * @param bool $trans
+     * @return bool
+     * @throws \Exception
+     */
+    public static  function evaluate($order_no,$message_text="系统自动评价,默认给与好评",$classes_star=5,$teacher_star=5,$shop_star=5,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){
+
+        //得到可取消订单
+        $order = \app\common\model\school\classes\order\Order::getHaveEvaluateOrder($order_no);
+        if($check){
+            //用户操作权限检测
+            \app\common\model\school\classes\hourorder\Order::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type,true);
+        }
+
+        $detail = $order->detail;
+        $user = $order->user;
+        if(!$detail)throw new \Exception("课程详情不存在");
+        if(!$user)throw new \Exception("下单用户不存在");
+        //已提交不让提交
+        $self = self::where(['classes_order_id'=>$order['id'], "user_id"=>$order['user_id']])->find();
+        if($self) throw new \Exception("课程已评价,想修改请去修改");
+        //评价星级只能是数字0.5,1,1.5,2,2.5,3,3.5,4,4.5,5
+        $classes_star = round($classes_star,1);
+        $teacher_star = round($teacher_star,1);
+        $shop_star = round($shop_star,1);
+        if(!in_array($classes_star,[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5])) throw new \Exception("课程评价星级只能是数字,异常");
+        if(!in_array($teacher_star,[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5])) throw new \Exception("老师评价星级只能是数字,异常");
+        if(!in_array($shop_star,[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5])) throw new \Exception("上课环境星级只能是数字,异常");
+
+        $data = [
+            'user_id'=>$order['user_id'],
+            'classes_lib_id'=>$order['classes_lib_id'],
+            'classes_order_id'=>$order['id'],
+            'manystore_id'=>$order['manystore_id'],
+            'shop_id'=>$order['shop_id'],
+            'teacher_id' =>$detail['teacher_id'],
+            'image'=>$user["avatar"],
+            'nickname'=>$user["nickname"],
+            'evaluate_time'=>time(),
+            'status'=>'1',
+            'weigh'=>0,
+            'message_text'=>$message_text,
+            'classes_star'=>$classes_star,
+            'teacher_star'=>$teacher_star,
+            'shop_star'=>$shop_star,
+        ];
+
+
+        //判断逻辑
+        if($trans){
+            self::beginTrans();
+        }
+        $res = true;
+        try{
+            //事务逻辑
+            $classes_evaluate = self::create($data);
+            $classes_evaluate_id = $classes_evaluate->id;
+
+
+            //更新订单评价状态
+            $order = Order::updateEvaluate($order,$classes_evaluate_id);
+            //插入订单取消日志
+            if(!$user_id ||$order["user_id"] !=$user_id ){
+                OrderLog::log($order['id'],"[系统操作]课程订单评价成功",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
+            }else{
+                OrderLog::log($order['id'],"课程订单评价成功",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
+            }
+
+            //调用订单取消事件
+            $data = ['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
+            \think\Hook::listen('classes_order_evaluate_after', $data);
+            //执行课时数更新
+            $res1 = order::statisticsAndUpdateClassesNumber($order['id']);
+
+
+            if($trans){
+                self::commitTrans();
+            }
+        }catch (\Exception $e){
+            if($trans){
+                self::rollbackTrans();
+            }
+            throw new \Exception($e->getMessage());
+        }
+        return $res1;
+    }
+
+
+
+
+    /** 课程反馈修改
+     * @param $order_no
+     * @param int $user_id
+     * @param bool $check
+     * @param bool $trans
+     * @return bool
+     * @throws \Exception
+     */
+    public static  function evaluateUpdate($order_no,$message_text="系统自动评价,默认给与好评",$classes_star=5,$teacher_star=5,$shop_star=5,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){
+
+        //得到可取消订单
+        $order = \app\common\model\school\classes\order\Order::getHaveEvaluateOrder($order_no);
+        if($check){
+            //用户操作权限检测
+            \app\common\model\school\classes\hourorder\Order::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type,true);
+        }
+        $detail = $order->detail;
+        $user = $order->user;
+        if(!$detail)throw new \Exception("课程详情不存在");
+        if(!$user)throw new \Exception("下单用户不存在");
+        //已提交不让提交
+        $self = self::where(['classes_order_id'=>$order['id'], "user_id"=>$order['user_id']])->find();
+        if(!$self) throw new \Exception("课程未评价,请先去评价");
+
+        //超出评价修改次数
+        $classes_evaluate_number = config("site.classes_evaluate_number");
+        if($self['update_number'] >= $classes_evaluate_number){
+            throw new \Exception("已超过评价修改次数,无法继续修改");
+        }
+
+        $classes_star = round($classes_star,1);
+        $teacher_star = round($teacher_star,1);
+        $shop_star = round($shop_star,1);
+        if(!in_array($classes_star,[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5])) throw new \Exception("课程评价星级只能是数字,异常");
+        if(!in_array($teacher_star,[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5])) throw new \Exception("老师评价星级只能是数字,异常");
+        if(!in_array($shop_star,[0.5,1,1.5,2,2.5,3,3.5,4,4.5,5])) throw new \Exception("上课环境星级只能是数字,异常");
+
+
+        $data = [
+            'user_id'=>$order['user_id'],
+            'classes_lib_id'=>$order['classes_lib_id'],
+            'classes_order_id'=>$order['id'],
+            'manystore_id'=>$order['manystore_id'],
+            'shop_id'=>$order['shop_id'],
+            'teacher_id' =>$detail['teacher_id'],
+            'image'=>$user["avatar"],
+            'nickname'=>$user["nickname"],
+            'message_text'=>$message_text,
+            'classes_star'=>$classes_star,
+            'teacher_star'=>$teacher_star,
+            'shop_star'=>$shop_star,
+        ];
+
+
+
+        //判断逻辑
+        if($trans){
+            self::beginTrans();
+        }
+        $res = true;
+        try{
+            //修改次数+1
+            $data['update_number'] = $self['update_number'] + 1;
+            //事务逻辑
+            $self->save($data);
+
+            $classes_evaluate = $self;
+            $classes_evaluate_id = $self->id;
+
+
+            //更新订单评价状态
+            $order = Order::updateEvaluate($order,$classes_evaluate_id);
+            //插入订单取消日志
+            if(!$user_id ||$order["user_id"] !=$user_id ){
+                OrderLog::log($order['id'],"[系统操作]课程订单评价修改成功",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
+            }else{
+                OrderLog::log($order['id'],"课程订单评价修改成功",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
+            }
+
+            //调用订单取消事件
+            $data = ['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
+            \think\Hook::listen('classes_order_evaluate_update_after', $data);
+            //执行课时数更新
+            $res1 = order::statisticsAndUpdateClassesNumber($order['id']);
+
+
+            if($trans){
+                self::commitTrans();
+            }
+        }catch (\Exception $e){
+            if($trans){
+                self::rollbackTrans();
+            }
+            throw new \Exception($e->getMessage());
+        }
+        return $res1;
+    }
+
+
+
+
+
+
+    /** 课程评价统计
+     * @param $order_no
+     * @param int $user_id
+     * @param bool $check
+     * @param bool $trans
+     * @return bool
+     * @throws \Exception
+     */
+    public static  function evaluateStatistics($id,$trans=false){
+
+        $self = self::where(['id'=>$id])->find();
+        if(!$self) return false;
+
+
+        //判断逻辑
+        if($trans){
+            self::beginTrans();
+        }
+        $res = true;
+        try{
+            //统计老师评分
+            $teacher =  $self->teacher; //teacher_star
+            if($teacher){
+
+                //求所有评价平均值,最终值必须四舍五入在0.5,1,1.5,2,2.5,3,3.5,4,4.5,5
+              $count = self::where("teacher_id",$teacher['id'])->count();
+              if($count){
+                  $teacher_star = self::where("teacher_id",$teacher['id'])->avg("teacher_star");
+                  $teacher_star = round($teacher_star,1);
+                  //最终值必须在0.5,1,1.5,2,2.5,3,3.5,4,4.5,5 这几个数字中
+                  $teacher_star_arr = [0.5,1,1.5,2,2.5,3,3.5,4,4.5,5];
+                  //循环$teacher_star_arr 找到最接近的
+                  foreach ($teacher_star_arr as $k=>$v){
+                      if(abs($v-$teacher_star) < 0.5){
+                          $teacher_star = $v;
+                          break;
+                      }
+                  }
+              }else{
+                  $teacher_star = 5;
+              }
+                $teacher->save(['teacher_star'=>$teacher_star]);
+            }
+
+            $shop =  $self->shop; //shop_star
+            if($shop){
+                $count = self::where("shop_id",$shop['id'])->count();
+                if($count){
+                    $shop_star = self::where("shop_id",$shop['id'])->avg("shop_star");
+                    $shop_star = round($shop_star,1);
+                    //最终值必须在0.5,1,1.5,2,2.5,3,3.5,4,4.5,5 这几个数字中
+                    $shop_star_arr = [0.5,1,1.5,2,2.5,3,3.5,4,4.5,5];
+                   //循环$teacher_star_arr 找到最接近的
+                    foreach ($shop_star_arr as $k=>$v){
+                        if(abs($v-$shop_star) < 0.5){
+                            $shop_star = $v;
+                            break;
+                        }
+                    }
+                }else{
+                    $shop_star = 5;
+                }
+                $shop->save(['shop_star'=>$shop_star]);
+            }
+            $lib =  $self->lib; //classes_star
+            if($lib){
+                $count = self::where("classes_lib_id",$lib['id'])->count();
+                if($count){
+                    $classes_star = self::where("classes_lib_id",$lib['id'])->avg("classes_star");
+                    $classes_star = round($classes_star,1);
+                    //最终值必须在0.5,1,1.5,2,2.5,3,3.5,4,4.5,5 这几个数字中
+                    $classes_star_arr = [0.5,1,1.5,2,2.5,3,3.5,4,4.5,5];
+                    //循环$teacher_star_arr 找到最接近的
+                    foreach ($classes_star_arr as $k=>$v){
+                        if(abs($v-$classes_star) < 0.5){
+                            $classes_star = $v;
+                            break;
+                        }
+                    }
+
+                }else{
+                    $classes_star = 5;
+                }
+                $lib->save(['classes_star'=>$classes_star]);
+            }
+
+
+
+            if($trans){
+                self::commitTrans();
+            }
+        }catch (\Exception $e){
+            if($trans){
+                self::rollbackTrans();
+            }
+            throw new \Exception($e->getMessage());
+        }
+        return $self;
+    }
+
+
+
+
+
+
+}
diff --git a/application/common/model/school/classes/hourorder/Order.php b/application/common/model/school/classes/hourorder/Order.php
index 8f5c101..96e7feb 100644
--- a/application/common/model/school/classes/hourorder/Order.php
+++ b/application/common/model/school/classes/hourorder/Order.php
@@ -416,6 +416,16 @@ class Order extends BaseModel
         return Cache::rm($cacheNmae);
     }
 
+    /** 从是否有售后的角度判断是否可操作课时单
+     * @param $classes_order_id
+     * @return void
+     */
+    public static function serverCheck($classes_order_id){
+       $order = \app\common\model\school\classes\order\Order::where("id",$classes_order_id)->find();
+       if(!$order)throw new \Exception("课程单不存在!");
+       if($order["status"]!="3")throw new \Exception("当前课程单属于锁定状态,可能在售后或其他状态");
+    }
+
 
 
 
@@ -468,11 +478,11 @@ class Order extends BaseModel
      * @return bool
      */
     public  function orderVaild($user_id,$classes_order_id,$order_no,$classes_lib_spec_id, $param,$check=false){
-        if(!$user_id||!$classes_order_id)throw new \Exception("缺少必要参数");
+        if(!$user_id)throw new \Exception("缺少必要参数");
 
 
         //代下单检测是否有代下单权限
-        if(isset($param["help_user_id"]) && $param["help_user_id"]){
+        if(isset($param["help_user_id"]) && $param["help_user_id"] && $classes_order_id){
             if(!isset($param["help_type"]) || !$param["help_type"])throw new \Exception("请选择代下单类型!");
 
             //课程是否存在并上架
@@ -484,18 +494,20 @@ class Order extends BaseModel
             self::checkOptionAuth($classes_order_id,$param["help_user_id"],$param["help_type"]);
 
         }
-
+//        $user_id = $classesOrder["user_id"];
 
 
         //默认校验订单是否已创建
         if($check){
+            if(!$classes_order_id)throw new \Exception("缺少订单参数");
             //判断订单是否已创建
             $order_info = self::where(['order_no'=>$order_no])->find();
             if($order_info) throw new \Exception("订单已生成,如需重新下单请退出页面重新进入!");
             if(!$classes_lib_spec_id)throw new \Exception("请选择您要预约的课时信息!");
         }
 
-        //校验订单参数
+        if($classes_order_id){
+         //校验订单参数
         //更新最近次数后进行验证
         \app\common\model\school\classes\order\Order::statisticsAndUpdateClassesNumber($classes_order_id);
         //课程是否存在并上架
@@ -515,9 +527,13 @@ class Order extends BaseModel
         //售后中
         if($classesOrder['server_status']=="3") throw new \Exception("该课程单正在售后中,请勿操作!");
 
+        }
+
+
+
         //判断课时信息
         if($classes_lib_spec_id){
-            self::checkLibSpec($user_id,$detail["classes_lib_id"],$classes_lib_spec_id,true);
+            self::checkLibSpec($user_id,$detail["classes_lib_id"] ?? $param["classes_lib_id"] ,$classes_lib_spec_id,true);
         }
 
 
@@ -790,8 +806,10 @@ class Order extends BaseModel
      * @throws \Exception
      */
     public  function cancel($order_no,$user_id=0,$check=false,$oper_type='user',$oper_id=0,$trans=false){
+
         //得到可取消订单
         $order = self::getHaveCancelOrder($order_no);
+
         if($check){
             //用户操作权限检测
             self::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type);
@@ -817,6 +835,7 @@ class Order extends BaseModel
                 }
 
             }
+            self::serverCheck($order['classes_order_id']);
         }
 
         //判断逻辑
@@ -1204,6 +1223,9 @@ class Order extends BaseModel
         if($check){
             //用户操作权限检测
             self::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type);
+
+            self::serverCheck($order['classes_order_id']);
+
         }
         //审核状态字段检测
         $auth_status_arr = [1,2];//0=待审核,1=审核通过,2=审核失败
@@ -1322,6 +1344,9 @@ class Order extends BaseModel
         if($check){
             //用户操作权限检测
             self::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type);
+
+            self::serverCheck($order['classes_order_id']);
+
         }
 
         //判断逻辑
@@ -1382,6 +1407,8 @@ class Order extends BaseModel
         if($check){
             //用户操作权限检测
             self::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type);
+
+            self::serverCheck($order['classes_order_id']);
         }
 
 
diff --git a/application/common/model/school/classes/order/Order.php b/application/common/model/school/classes/order/Order.php
index d168e42..ce3cdce 100644
--- a/application/common/model/school/classes/order/Order.php
+++ b/application/common/model/school/classes/order/Order.php
@@ -8,6 +8,7 @@ use app\common\model\BaseModel;
 use app\common\model\dyqc\ManystoreShop;
 use app\common\model\school\classes\ClassesLib;
 use app\common\model\school\classes\ClassesSpec;
+use app\common\model\school\classes\Evaluate;
 use app\common\model\User;
 use bw\Common;
 use fast\Random;
@@ -204,6 +205,11 @@ class Order extends BaseModel
         return $this->belongsTo(ServiceOrder::class, 'classes_service_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
     }
 
+    public function evaluate()
+    {
+        return $this->hasOne(Evaluate::class, 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
 
 
     public function getCodeimageAttr($value, $data)
@@ -305,6 +311,8 @@ class Order extends BaseModel
 //            'text'           => $data['code'],
 //            'size'           => 200,
 //        ]);
+        //评价
+        $data->evaluate;
 
         return $data;
     }
@@ -367,8 +375,7 @@ class Order extends BaseModel
         try {
             //1订单执行创建
             $order = $this->createOrder($user_id,$orderInfo['classes_lib_id'],$order_no,$orderInfo['param'],$remark);
-            //5删除缓存
-            self::deleteOrderCache($user_id, $order_no);
+
 
             //如果是免费订单,则直接调用支付完成
             if ($order['totalprice'] == 0) {
@@ -376,6 +383,13 @@ class Order extends BaseModel
                 $this->paySuccess($order_no,['platform'=>"miniapp",'pay_type'=>'yue']);
             }
 
+
+
+            //5删除缓存
+            self::deleteOrderCache($user_id, $order_no);
+
+
+
             if ($trans) {
                 self::commitTrans();
             }
@@ -421,6 +435,21 @@ class Order extends BaseModel
         $res1->classes_order_detail_id = $orderDetail->id;
         $res1->save();
 
+
+        if($res1["classes_lib_spec_id"]){
+
+              //记录代下单人信息
+              $param  =  [
+                "classes_lib_spec_id" =>$res1["classes_lib_spec_id"],
+              ];
+
+            //课时是否合法判断
+            $res = (new \app\common\model\school\classes\hourorder\Order)->confirm($res1["user_id"],$res1['id'],null, $res1["classes_lib_spec_id"],$param, true);
+
+        }
+
+
+
         //记录订单日志
         OrderLog::log($res1['id'],"课程订单创建成功,等待【学员】支付",'user',$user_id);
         //7事件
@@ -463,13 +492,16 @@ class Order extends BaseModel
          $classes_lib_info = ClassesLib::where('id',$classes_lib_id)->find();
         if(!$classes_lib_info || $classes_lib_info['status']!='1') throw new \Exception("该课程不存在或已下架!");
 
+        //往期课程无法下单
+        $now_time = time();
+        if($classes_lib_info['end_time'] <= $now_time) throw new \Exception("该课程已过期,是往期课程,无法购买!");
                //执行免费课黑名单判断
          //免费课才进行判断
         if($classes_lib_info && $classes_lib_info['feel']=='1'){
              \app\common\model\school\classes\hourorder\Order::checkBlackList($user_id,true);
         }
          //免费课才进行判断(同個免費單只能买一次)
-         if($classes_lib_info && $classes_lib_info['feel']=='1'){
+        if($classes_lib_info && $classes_lib_info['feel']=='1'){
              \app\common\model\school\classes\hourorder\Order::checkOnlyone($user_id,$classes_lib_info,true);
         }
 
@@ -478,6 +510,25 @@ class Order extends BaseModel
         $user_info = User::where('id',$user_id)->find();
         if(!$user_info) throw new \Exception("用户不存在!");
 
+
+        $classes_lib_spec_id = $param['classes_lib_spec_id'] ?? null;
+          if($classes_lib_spec_id){
+              //没有订单id无法判断
+//              //记录代下单人信息
+//              $param = [
+//                "type" =>'2',
+//                "help_user_id" =>$user_id,
+//                "help_type" =>'admin',
+//                "classes_lib_id" =>$classes_lib_id
+//              ];
+//
+//
+//            //确认订单
+//               $res = (new \app\common\model\school\classes\hourorder\Order)->confirm($user_id,0,null, $classes_lib_spec_id,$param, true);
+              //只简单判断课程和课时
+               \app\common\model\school\classes\hourorder\Order::checkLibSpec($user_id,$classes_lib_id ,$classes_lib_spec_id,true);
+          }
+
         return true;
     }
 
@@ -514,6 +565,7 @@ class Order extends BaseModel
         $order_data["beforeprice"] = $classes_lib_info["price"];
         $order_data["totalprice"] = $classes_lib_info["price"];
         $order_data["payprice"] = $classes_lib_info["price"];
+        $order_data["classes_lib_spec_id"] = $param['classes_lib_spec_id'] ?? 0;
         $order_data["status"] = '0';
         $order_type = "multiple";
         //如果课程只存在一个规格,则订单类型为单课
@@ -521,9 +573,14 @@ class Order extends BaseModel
         if($classes_spec_count==1){
             $order_type = "single";
         }
+        $classes_lib_spec = null;
+          $classes_lib_spec_id = $param['classes_lib_spec_id'] ?? null;
+          if($classes_lib_spec_id){
+              $classes_lib_spec = ClassesSpec::get($classes_lib_spec_id);
+          }
 
 
-        return  compact('order_data','classes_lib_info','user_data','order_type');
+        return  compact('order_data','classes_lib_info','user_data','order_type',"classes_lib_spec");
     }
 
 
@@ -687,7 +744,24 @@ class Order extends BaseModel
             //不拆分订单,直接执行
             self::paySetData($order,$notify);
 
-            //如果是免费单且是单规格
+            //如果需要快捷预约
+            $classes_lib_spec_id = $order['classes_lib_spec_id'];
+              if($classes_lib_spec_id){
+              //记录代下单人信息
+              $param  =  [
+                "type" =>'2',
+                "help_user_id" =>$order["user_id"]  ,
+                "help_type" => 'admin',
+              ];
+
+            //确认订单
+               $res = (new \app\common\model\school\classes\hourorder\Order)->confirm($order["user_id"],$order['id'],null, $classes_lib_spec_id,$param, true);
+               $remark = "订单支付完成同时快捷预约一个课时";
+             //创建订单
+               $result = (new \app\common\model\school\classes\hourorder\Order)->cacheCreateOrder($res['order_no'], $order["user_id"],$remark);
+
+            }
+
 
             if($trans){
                 self::commitTrans();
@@ -794,7 +868,7 @@ class Order extends BaseModel
         $tableFields = (new static)->getTableFields();
         foreach ($tableFields as $fields)
         {
-            if(in_array($fields, ['status','classes_lib_id']))continue;
+            if(in_array($fields, ['status','classes_lib_id','has_evaluate']))continue;
 //            if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
 
             if (isset($whereData[$fields]) && $whereData[$fields]){
@@ -820,6 +894,21 @@ class Order extends BaseModel
         if (isset($whereData['classes_lib_ids']) && $whereData['classes_lib_ids']) $model = $model->where("{$alisa}classes_lib_id", 'in', $whereData['classes_lib_ids']);
         if (isset($whereData['classes_lib_id']) && $whereData['classes_lib_id']) $model = $model->where("{$alisa}classes_lib_id", 'in', $whereData['classes_lib_id']);
 
+        if (isset($whereData['has_evaluate'])&&$whereData['has_evaluate']){
+              //1查已评价 2查未评价
+            if($whereData['has_evaluate'] == 1){
+                //1查已评价
+                $model = $model->where("{$alisa}classes_evaluate_id", '<>', 0);
+            }else{
+                //2查未评价
+                $model = $model->whereExists(function ($query) use ($alisa) {
+                    $order_table_name = (new \app\common\model\school\classes\hourorder\Order())->getQuery()->getTable();
+                    $query->table($order_table_name)->where($order_table_name . '.classes_order_id=' . $alisa . 'id')->where('status', '=', '3');
+                });
+
+            }
+        }
+
         return $model;
     }
 
@@ -828,7 +917,7 @@ class Order extends BaseModel
 
 
 
-    public static function allList($user_id,$page, $limit,$keywords,$status,$classes_lib_id=[]){
+    public static function allList($user_id,$page, $limit,$keywords,$status,$classes_lib_id=[],$has_evaluate=0){
         $with_field = [
             'user'=>['nickname','mobile','avatar','realname'],
             'base'=>['*'],
@@ -842,7 +931,7 @@ class Order extends BaseModel
         $FINISH = '9';
         $alisa = (new self)->getWithAlisaName();
         $sort = "field({$alisa}.status,'{$NOPAY}','{$PAYED}','{$FINISH}','{$REFUND}','{$CANCEL}') asc,{$alisa}.id desc";
-        $serch_where = ['status'=>$status,'user_id'=>$user_id,'keywords'=>$keywords,"classes_lib_id"=>$classes_lib_id];
+        $serch_where = ['status'=>$status,'user_id'=>$user_id,'keywords'=>$keywords,"classes_lib_id"=>$classes_lib_id,"has_evaluate"=>$has_evaluate];
 //        if($type)$serch_where['type'] = $type;
         return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field);
     }
@@ -879,7 +968,7 @@ class Order extends BaseModel
 
 
 
-    public static function workList($page, $limit,$keywords,$status,$classes_lib_id=[],$classes_lib_ids=[]){
+    public static function workList($page, $limit,$keywords,$status,$classes_lib_id=[],$classes_lib_ids=[],$has_evaluate=0){
         $with_field = [
             'user'=>['nickname','mobile','avatar','realname'],
             'base'=>['*'],
@@ -968,6 +1057,8 @@ class Order extends BaseModel
         self::statisticsAndUpdateOrderFinish($order->id);
        //将课程信息和课时信息同步到所有已下单的订单信息中
         ClassesLib::orderInfoSync($order["classes_lib_id"]);
+
+        //如果有评价执行评价更新
         return $order;
     }
 
@@ -1028,10 +1119,35 @@ class Order extends BaseModel
      */
     public static function getHaveCancelOrder($order_no){
 //        $where = [self::STATUS_NOPAY,self::STATUS_PAYED];
-        $order = self::where('order_no|id|pay_no|code',$order_no)
-            ->where("status","in",['0'])
-            ->find();
+        $order = self::where('order_no|id|pay_no|code',$order_no)->find();
+        $detail = $order->detail;
+        if(!$detail) throw new \Exception("订单信息缺失!");
         if(!$order)throw new \Exception("只有待支付订单可取消,已支付请走售后申请,已取消请忽略!");
+        //非免费单进行中无法取消
+        if($detail["feel"] == "0" && $order['status'] != '0'){
+            throw new \Exception("只有待支付订单可取消,已支付请走售后申请,已取消请忽略!");
+        }
+        if($detail["feel"] == "1" &&  !in_array($order['status'],['0','3'])){
+            throw new \Exception("只有进行中订单可取消,已取消请忽重复取消!");
+        }
+
+        return $order;
+    }
+
+    /** 得到可评价订单
+     * @param $order_no
+     * @return array|bool|\PDOStatement|string|Model
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function getHaveEvaluateOrder($order_no){
+        $order = self::where('order_no|id|pay_no|code',$order_no)->whereExists(function ($query){
+            $self_order_table_name = (new \app\common\model\school\classes\hourorder\Order())->getQuery()->getTable();
+            $order_table_name = (new self())->getQuery()->getTable();
+            $query->table($order_table_name)->where($order_table_name . '.classes_order_id=' . $self_order_table_name . '.id')->where('status', '=', '3');
+        })->find();
+        if(!$order)throw new \Exception("只有一次核销之后订单可评价!");
 
         return $order;
     }
@@ -1053,6 +1169,21 @@ class Order extends BaseModel
     }
 
 
+    /**更新订单评价
+     * @param $order
+     * @return array|false|\PDOStatement|string|Model
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public static function updateEvaluate($order,$classes_evaluate_id){
+        if(is_string($order))$order = self::getHaveEvaluateOrder($order);
+        $order->classes_evaluate_id = $classes_evaluate_id;
+        $order->save();
+        return $order;
+    }
+
+
 
 
 
@@ -1072,9 +1203,15 @@ class Order extends BaseModel
             //用户操作权限检测
             \app\common\model\school\classes\hourorder\Order::checkOptionAuth($order['id'],$user_id ?: $oper_id,$oper_type);
 
+            //进行中,用户自己无法操作取消
+            if($order['status'] == '3' && $user_id == $order['user_id']){
+                throw new \Exception("您无权操作取消!请您联系机构操作!");
+            }
         }
 
-        //
+
+
+
 
         //判断逻辑
         if($trans){
@@ -1083,6 +1220,17 @@ class Order extends BaseModel
         $res = true;
         try{
             //事务逻辑
+             //有进行中的课时全部取消
+              //查询所有存在的课时单,进行批量取消
+            $hour_orders = \app\common\model\school\classes\hourorder\Order::where("classes_order_id",$order["id"])->
+             where("status","in",["-1","0"])->select();
+            foreach ($hour_orders as $hour_order){
+
+                (new \app\common\model\school\classes\hourorder\Order)->cancel($hour_order["id"],$hour_order["user_id"],false,'admin',0);
+            }
+
+
+
             //更新订单取消状态
             $order = Order::updateCancel($order);
             //插入订单取消日志
@@ -1106,7 +1254,7 @@ class Order extends BaseModel
             if($trans){
                 self::rollbackTrans();
             }
-            throw new \Exception($e->getMessage());
+            throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
         }
         return $res1;
     }
diff --git a/application/common/model/school/classes/order/ServiceOrder.php b/application/common/model/school/classes/order/ServiceOrder.php
index 6d96ed1..3a89f2a 100644
--- a/application/common/model/school/classes/order/ServiceOrder.php
+++ b/application/common/model/school/classes/order/ServiceOrder.php
@@ -491,6 +491,9 @@ class ServiceOrder extends BaseModel
         if($count > 0) throw new \Exception("该订单已存在正在进行中的售后单,请等待售后处理!");
 
 
+
+
+
         //用户存不存在
         $user_info = User::where('id',$user_id)->find();
         if(!$user_info) throw new \Exception("用户不存在!");
@@ -1448,7 +1451,15 @@ class ServiceOrder extends BaseModel
                    //插入订单日志
             ServiceOrderLog::log($order['id'],"[系统操作]课程订单售后系统退款已原路退回", 'admin', 0);
 
-           //执行课时数更新
+             //查询所有存在的课时单,进行批量取消
+            $hour_orders = \app\common\model\school\classes\hourorder\Order::where("classes_order_id",$order["classes_order_id"])->
+             where("status","in",["-1","0"])->select();
+            foreach ($hour_orders as $hour_order){
+                (new \app\common\model\school\classes\hourorder\Order)->cancel($hour_order["order_no"],$hour_order["user_id"],false,'admin',0);
+            }
+
+
+            //执行课时数更新
             $res1 = order::statisticsAndUpdateClassesNumber($order['classes_order_id']);
 
             //调用订单取消事件
diff --git a/application/manystore/controller/school/classes/ClassesLib.php b/application/manystore/controller/school/classes/ClassesLib.php
index 23a667c..7efeaaf 100644
--- a/application/manystore/controller/school/classes/ClassesLib.php
+++ b/application/manystore/controller/school/classes/ClassesLib.php
@@ -33,7 +33,7 @@ class ClassesLib extends ManystoreBase
     protected $model = null;
 
     //不用审核允许修改的字段
-    protected $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price","selfhot","price","classes_num"];
+    protected $no_auth_fields = ["classes_type","classes_cate_ids","classes_label_ids","self_label_tag",'headimage','images','notice','content',"virtual_num","virtual_collect","underline_price","selfhot","price","classes_num"];
 
     //更新数据是否需要触发审核开关
     protected $need_auth = true;
@@ -56,6 +56,9 @@ class ClassesLib extends ManystoreBase
         $this->view->assign("newList", $this->model->getNewList());
         $this->view->assign("selfhotList", $this->model->getSelfhotList());
 
+        $this->view->assign("classesTypeList", $this->model->getClassesTypeList());
+        $this->view->assign("classesTypeListJson", json_encode($this->model->getClassesTypeList(), JSON_UNESCAPED_UNICODE));
+
 
 
          $this->view->assign("specStatusList", (new \app\manystore\model\school\classes\ClassesSpec)->getStatusList());
@@ -107,7 +110,14 @@ class ClassesLib extends ManystoreBase
 				$row->getRelation('admin')->visible(['nickname','avatar']);
             }
 
-            $result = array("total" => $list->total(), "rows" => $list->items());
+             $rows = $list->items();
+             $types = \app\admin\model\school\classes\Type::column("name", 'id');
+
+            foreach ($rows as $k=>&$v){
+                $v["classes_type_name"] = $types[$v["classes_type"]] ?? "无" ;
+            }
+
+            $result = array("total" => $list->total(), "rows" => $rows);
 
             return json($result);
         }
@@ -472,6 +482,8 @@ class ClassesLib extends ManystoreBase
            }
            //删除规格
              foreach ($delete_spec_ids as $k=>$delete_spec){
+                   (new \app\common\model\school\classes\ClassesSpec)->updateCheck($delete_spec["id"]);
+
                  $delete_spec->delete();
              }
 
diff --git a/application/manystore/controller/school/classes/Evaluate.php b/application/manystore/controller/school/classes/Evaluate.php
new file mode 100644
index 0000000..ad5a4ef
--- /dev/null
+++ b/application/manystore/controller/school/classes/Evaluate.php
@@ -0,0 +1,85 @@
+model = new \app\manystore\model\school\classes\Evaluate;
+        parent::_initialize();
+        $this->view->assign("statusList", $this->model->getStatusList());
+        $this->view->assign("topList", $this->model->getTopList());
+    }
+
+    public function import()
+    {
+        parent::import();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+        //设置过滤方法
+        $this->request->filter(['strip_tags', 'trim']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $list = $this->model
+                    ->with(['user','schoolclasseslib','schoolclassesorder','manystore','manystoreshop','schoolteacher'])
+                    ->where($where)
+                    ->order($sort, $order)
+                    ->paginate($limit);
+
+            foreach ($list as $row) {
+                
+                $row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
+				$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
+				$row->getRelation('schoolclassesorder')->visible(['order_no']);
+				$row->getRelation('manystore')->visible(['nickname']);
+				$row->getRelation('manystoreshop')->visible(['name','logo']);
+				$row->getRelation('schoolteacher')->visible(['name','head_image']);
+            }
+
+            $result = array("total" => $list->total(), "rows" => $list->items());
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+}
diff --git a/application/manystore/controller/school/classes/Teacher.php b/application/manystore/controller/school/classes/Teacher.php
index 363b80b..fd92f03 100644
--- a/application/manystore/controller/school/classes/Teacher.php
+++ b/application/manystore/controller/school/classes/Teacher.php
@@ -101,9 +101,16 @@ class Teacher extends ManystoreBase
         }
         $params["manystore_id"] = $manystore["id"];
         $params["shop_id"] = $shop_id;
-        $user = User::where("nickname|realname|mobile", $params["user_id"])->find();
+        $user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
         if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
 
+
+                //添加用户机构认证
+        try {
+           \app\common\model\manystore\UserAuth::auth(0,$shop_id,$user["id"],0,'shop',$this->auth->id);
+        }catch (\Exception $e){
+
+        }
         //如果开启了检测用户授权,则检测用户是否授权
         if(config("site.shop_auth_user_check")){
            if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
@@ -156,6 +163,12 @@ class Teacher extends ManystoreBase
                     $params['shop_id'] = SHOP_ID;
                 }
 
+          try {
+             $this->update_check($params,$row=null);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
                 $result = false;
                 Db::startTrans();
                 try {
@@ -207,6 +220,14 @@ class Teacher extends ManystoreBase
             if ($params) {
                 $params = $this->preExcludeFields($params);
                 $result = false;
+
+                   try {
+             $this->update_check($params,$row);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
+
                 Db::startTrans();
                 try {
                     //是否采用模型验证
diff --git a/application/manystore/controller/school/classes/Verification.php b/application/manystore/controller/school/classes/Verification.php
index ec07577..70e7779 100644
--- a/application/manystore/controller/school/classes/Verification.php
+++ b/application/manystore/controller/school/classes/Verification.php
@@ -102,10 +102,15 @@ class Verification extends ManystoreBase
         }
         $params["manystore_id"] = $manystore["id"];
         $params["shop_id"] = $shop_id;
-        $user = User::where("nickname|realname|mobile", $params["user_id"])->find();
-        if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
+        $user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
+        if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单".$params["user_id"]);
 
 
+        try {
+           \app\common\model\manystore\UserAuth::auth(0,$shop_id,$user["id"],0,'shop',$this->auth->id);
+        }catch (\Exception $e){
+
+        }
                 //如果开启了检测用户授权,则检测用户是否授权
         if(config("site.shop_auth_user_check")){
            if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
@@ -156,6 +161,11 @@ class Verification extends ManystoreBase
                     $params['shop_id'] = SHOP_ID;
                 }
 
+                          try {
+             $this->update_check($params,$row=null);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
                 $result = false;
                 Db::startTrans();
                 try {
@@ -207,6 +217,14 @@ class Verification extends ManystoreBase
             if ($params) {
                 $params = $this->preExcludeFields($params);
                 $result = false;
+
+                          try {
+            $this->update_check($params,$row);
+        } catch (ValidateException|PDOException|Exception $e) {
+            $this->error($e->getMessage());
+        }
+
+
                 Db::startTrans();
                 try {
                     //是否采用模型验证
diff --git a/application/manystore/controller/school/classes/hourorder/Order.php b/application/manystore/controller/school/classes/hourorder/Order.php
index 1084f25..895eaef 100644
--- a/application/manystore/controller/school/classes/hourorder/Order.php
+++ b/application/manystore/controller/school/classes/hourorder/Order.php
@@ -73,7 +73,7 @@ class Order extends ManystoreBase
                 $row->getRelation('schoolclassesorder')->visible(['order_no']);
 				$row->getRelation('schoolclasseslibspec')->visible(['name']);
 				$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
-				$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage']);
+				$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage','feel']);
 				$row->getRelation('schoolclasseslib')->visible(['title']);
             }
 
diff --git a/application/manystore/controller/school/classes/order/Order.php b/application/manystore/controller/school/classes/order/Order.php
index e742407..dc14ec1 100644
--- a/application/manystore/controller/school/classes/order/Order.php
+++ b/application/manystore/controller/school/classes/order/Order.php
@@ -69,7 +69,7 @@ class Order extends ManystoreBase
 				$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
 				$row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
 				$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
-				$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage']);
+				$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage',"feel"]);
 				$row->getRelation('admin')->visible(['nickname','avatar']);
             }
 
@@ -97,7 +97,7 @@ class Order extends ManystoreBase
                 if(isset($param['ids']))$ids = $param['ids'];
                 //设置模拟资格
                 $model = (new \app\common\model\school\classes\order\Order);
-                $model->cancel($ids,0,true,'admin',$this->auth->id,true);;
+                $model->cancel($ids,0,true,'shop',$this->auth->id,true);;
 
 
             }catch (\Exception $e){
diff --git a/application/manystore/lang/zh-cn.php b/application/manystore/lang/zh-cn.php
index 3e60b07..650ac35 100644
--- a/application/manystore/lang/zh-cn.php
+++ b/application/manystore/lang/zh-cn.php
@@ -172,7 +172,7 @@ return [
     'Second group 2'                                        => '二级管理组2',
     'Third group 2'                                         => '三级管理组2',
     'Dashboard tips'                                        => '用于展示当前系统中的统计数据、统计报表及重要实时数据',
-    'Config tips'                                           => '可以在此增改系统的变量和分组,也可以自定义分组和变量,如果需要删除请从数据库中删除,获取方式config("manystore_config.$name")',
+    'Config tips'                                           => '提示:修改相关配置后,点击【确认】才会保存生效',
     'Category tips'                                         => '用于统一管理网站的所有分类,分类可进行无限级分类,分类类型请在常规管理->系统配置->字典配置中添加',
     'Attachment tips'                                       => '主要用于管理上传到服务器或第三方存储的数据',
     'Addon tips'                                            => '可在线安装、卸载、禁用、启用插件,同时支持添加本地插件。FastAdmin已上线插件商店 ,你可以发布你的免费或付费插件:
https://www.fastadmin.net/store.html',
diff --git a/application/manystore/lang/zh-cn/general/profile.php b/application/manystore/lang/zh-cn/general/profile.php
index 8a926e5..441b6e1 100644
--- a/application/manystore/lang/zh-cn/general/profile.php
+++ b/application/manystore/lang/zh-cn/general/profile.php
@@ -34,7 +34,7 @@ return [
     'Address_detail' => '详细地址',
     'Longitude'      => '经度',
     'Latitude'       => '纬度',
-    'Yyzzdm'         => '营业执照(个人认证不需要)',
+    'Yyzzdm'         => '企业统一信用代码(个人认证不需要)',
     'Yyzz_images'    => '营业执照照片(个人认证不需要)',
     'hidden'  => '禁用',
     'Tel'            => '服务电话',
diff --git a/application/manystore/lang/zh-cn/school/classes/classes_lib.php b/application/manystore/lang/zh-cn/school/classes/classes_lib.php
index 7983756..0ed1160 100644
--- a/application/manystore/lang/zh-cn/school/classes/classes_lib.php
+++ b/application/manystore/lang/zh-cn/school/classes/classes_lib.php
@@ -4,8 +4,13 @@ return [
     'Manystore_id'                 => '机构账号id',
     'Shop_id'                      => '机构店铺id',
     'User_id'                      => '主讲师用户id',
-    'Classes_cate_ids'             => '平台课程分类',
-    'Classes_label_ids'            => '平台课程热门标签',
+    'Classes_cate_ids'             => '标签',
+    'Classes_label_ids'            => '热门',
+
+        'Start_time'       => '开始时间',
+    'End_time'         => '结束时间',
+
+
     'Self_label_tag'               => '机构特色标签',
     'Add_type'                     => '添加人类型',
     'Add_type 1'                   => '机构',
diff --git a/application/manystore/lang/zh-cn/school/classes/evaluate.php b/application/manystore/lang/zh-cn/school/classes/evaluate.php
new file mode 100644
index 0000000..477941a
--- /dev/null
+++ b/application/manystore/lang/zh-cn/school/classes/evaluate.php
@@ -0,0 +1,38 @@
+ '评价用户id',
+    'Classes_lib_id'              => '课程id',
+    'Classes_order_id'            => '课程订单id',
+    'Manystore_id'                => '机构账号id',
+    'Shop_id'                     => '机构店铺id',
+    'Teacher_id'                  => '老师id',
+    'Image'                       => '评价人头像',
+    'Nickname'                    => '评价人昵称',
+    'Classes_star'                => '课程评分',
+    'Teacher_star'                => '讲师评分',
+    'Shop_star'                   => '教师环境',
+    'Message_text'                => '评价内容',
+    'Evaluate_time'               => '评价时间',
+    'Status'                      => '状态',
+    'Status 1'                    => '上架',
+    'Status 2'                    => '下架',
+    'Top'                         => '是否置顶',
+    'Top 0'                       => '否',
+    'Top 1'                       => '是',
+    'Weigh'                       => '权重',
+    'Createtime'                  => '创建时间',
+    'Updatetime'                  => '修改时间',
+    'User.nickname'               => '昵称',
+    'User.realname'               => '真实姓名',
+    'User.mobile'                 => '手机号',
+    'User.avatar'                 => '头像',
+    'Schoolclasseslib.title'      => '标题',
+    'Schoolclasseslib.headimage'  => '头图',
+    'Schoolclassesorder.order_no' => '订单号',
+    'Manystore.nickname'          => '昵称',
+    'Manystoreshop.name'          => '店铺名称',
+    'Manystoreshop.logo'          => '品牌LOGO',
+    'Schoolteacher.name'          => '教师名',
+    'Schoolteacher.head_image'    => '教师头像'
+];
diff --git a/application/manystore/lang/zh-cn/school/classes/order/order_detail.php b/application/manystore/lang/zh-cn/school/classes/order/order_detail.php
index 2680915..78b8dcf 100644
--- a/application/manystore/lang/zh-cn/school/classes/order/order_detail.php
+++ b/application/manystore/lang/zh-cn/school/classes/order/order_detail.php
@@ -5,8 +5,8 @@ return [
     'Manystore_id'                 => '机构账号id',
     'Shop_id'                      => '机构店铺id',
     'User_id'                      => '主讲师用户id',
-    'Classes_cate_ids'             => '平台课程分类ids',
-    'Classes_label_ids'            => '平台课程类型ids',
+    'Classes_cate_ids'             => '标签',
+    'Classes_label_ids'            => '热门',
     'Self_label_tag'               => '机构特色标签',
     'Add_type'                     => '添加人类型',
     'Add_type 1'                   => '机构',
diff --git a/application/manystore/model/school/classes/ClassesLib.php b/application/manystore/model/school/classes/ClassesLib.php
index ee04257..6541217 100644
--- a/application/manystore/model/school/classes/ClassesLib.php
+++ b/application/manystore/model/school/classes/ClassesLib.php
@@ -66,6 +66,12 @@ class ClassesLib extends Model
         });
     }
 
+
+    public function getClassesTypeList(){
+         return \app\admin\model\school\classes\Type::column("name", 'id');
+    }
+
+
     
     public function getAddTypeList()
     {
diff --git a/application/manystore/model/school/classes/Evaluate.php b/application/manystore/model/school/classes/Evaluate.php
new file mode 100644
index 0000000..aaaab7e
--- /dev/null
+++ b/application/manystore/model/school/classes/Evaluate.php
@@ -0,0 +1,118 @@
+getPk();
+            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+        });
+    }
+
+    
+    public function getStatusList()
+    {
+        return ['1' => __('Status 1'), '2' => __('Status 2')];
+    }
+
+    public function getTopList()
+    {
+        return ['0' => __('Top 0'), '1' => __('Top 1')];
+    }
+
+
+    public function getEvaluateTimeTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['evaluate_time']) ? $data['evaluate_time'] : '');
+        return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
+    }
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
+        $list = $this->getStatusList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+    public function getTopTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['top']) ? $data['top'] : '');
+        $list = $this->getTopList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+    protected function setEvaluateTimeAttr($value)
+    {
+        return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
+    }
+
+
+    public function user()
+    {
+        return $this->belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function schoolclasseslib()
+    {
+        return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function schoolclassesorder()
+    {
+        return $this->belongsTo(\app\common\model\school\classes\order\Order::class, 'classes_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function manystore()
+    {
+        return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function manystoreshop()
+    {
+        return $this->belongsTo(ManystoreShop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+
+
+    public function schoolteacher()
+    {
+        return $this->belongsTo(Teacher::class, 'teacher_id', 'id', [], 'LEFT')->setEagerlyType(0);
+    }
+}
diff --git a/application/manystore/validate/Manystore.php b/application/manystore/validate/Manystore.php
index c91b7b2..1a07818 100644
--- a/application/manystore/validate/Manystore.php
+++ b/application/manystore/validate/Manystore.php
@@ -12,7 +12,7 @@ class Manystore extends Validate
      */
     protected $rule = [
         'username' => 'require|regex:\w{3,12}|unique:manystore',
-        'nickname' => 'require|length:0,10|regex:/^[\x{4e00}-\x{9fa5}a-zA-Z0-9_-]+$/u',
+        'nickname' => 'require|length:0,30|regex:/^[\x{4e00}-\x{9fa5}a-zA-Z0-9_-]+$/u',
         'password' => 'require|regex:\S{32}',
         'email'    => 'require|email|unique:manystore,email',
     ];
diff --git a/application/manystore/validate/school/classes/Evaluate.php b/application/manystore/validate/school/classes/Evaluate.php
new file mode 100644
index 0000000..bd11e25
--- /dev/null
+++ b/application/manystore/validate/school/classes/Evaluate.php
@@ -0,0 +1,27 @@
+ [],
+        'edit' => [],
+    ];
+    
+}
diff --git a/application/manystore/view/general/profile/index.html b/application/manystore/view/general/profile/index.html
index 1223450..1dd6c47 100644
--- a/application/manystore/view/general/profile/index.html
+++ b/application/manystore/view/general/profile/index.html
@@ -78,7 +78,7 @@
                             
                                 
                                 
+                                       value="{$manystore.nickname|htmlentities}" data-rule="required;"/>
                             
                             
                                 
diff --git a/application/manystore/view/school/classes/classes_lib/addnew.html b/application/manystore/view/school/classes/classes_lib/addnew.html
index 89b9e46..910c6fc 100644
--- a/application/manystore/view/school/classes/classes_lib/addnew.html
+++ b/application/manystore/view/school/classes/classes_lib/addnew.html
@@ -32,38 +32,42 @@
         
     
 
+
+        
+
+
+
     
     
 
 
 
 
-         
 
 
 
     
     
@@ -158,7 +162,7 @@
                 
                 
             
-            
(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,后续有变更将触发审核机制!)
+            
(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)
             
             
\ No newline at end of file
diff --git a/application/manystore/view/school/classes/evaluate/add.html b/application/manystore/view/school/classes/evaluate/add.html
new file mode 100644
index 0000000..1732be3
--- /dev/null
+++ b/application/manystore/view/school/classes/evaluate/add.html
@@ -0,0 +1,120 @@
+
diff --git a/application/manystore/view/school/classes/evaluate/edit.html b/application/manystore/view/school/classes/evaluate/edit.html
new file mode 100644
index 0000000..f100fdc
--- /dev/null
+++ b/application/manystore/view/school/classes/evaluate/edit.html
@@ -0,0 +1,120 @@
+
diff --git a/application/manystore/view/school/classes/evaluate/index.html b/application/manystore/view/school/classes/evaluate/index.html
new file mode 100644
index 0000000..2e17b1e
--- /dev/null
+++ b/application/manystore/view/school/classes/evaluate/index.html
@@ -0,0 +1,44 @@
+
+    
+    
+        {:build_heading(null,FALSE)}
+        
+    
+
+
+    
+
diff --git a/application/manystore/view/school/classes/teacher/edit.html b/application/manystore/view/school/classes/teacher/edit.html
index 56e67b2..bfbe360 100644
--- a/application/manystore/view/school/classes/teacher/edit.html
+++ b/application/manystore/view/school/classes/teacher/edit.html
@@ -40,7 +40,7 @@
     
     
diff --git a/public/assets/js/backend/manystore/index.js b/public/assets/js/backend/manystore/index.js
index 8ea0c9c..991af8c 100644
--- a/public/assets/js/backend/manystore/index.js
+++ b/public/assets/js/backend/manystore/index.js
@@ -203,9 +203,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'shop.address_detail', title: __('Address_detail'), operate: 'LIKE',visible:false},
 
 
-                        {field: 'shop.yyzz_images', title: __('Yyzz_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
-                        {field: 'shop.front_idcard_image', title: __('身份证正面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'shop.reverse_idcard_image', title: __('身份证反面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        // {field: 'shop.yyzz_images', title: __('Yyzz_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+                        // {field: 'shop.front_idcard_image', title: __('身份证正面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        // {field: 'shop.reverse_idcard_image', title: __('身份证反面'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                         {field: 'shop.tel', title: __('Tel'), operate: 'LIKE'},
 
 
diff --git a/public/assets/js/backend/school/classes/classes_lib.js b/public/assets/js/backend/school/classes/classes_lib.js
index 6ffea08..0b45793 100644
--- a/public/assets/js/backend/school/classes/classes_lib.js
+++ b/public/assets/js/backend/school/classes/classes_lib.js
@@ -30,20 +30,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
                         {checkbox: true},
                         {field: 'operate', title: __('Operate'), table: table , buttons: [
-                                // {
-                                //     name: 'classes_spec',
-                                //     text: __('设置课程规格'),
-                                //     title: __('设置课程规格'),
-                                //     classname: 'btn btn-xs btn-danger btn-magic  btn-dialog',
-                                //     icon: 'fa fa-list',
-                                //     url: classes_spec_url,
-                                //     callback: function (data) {
-                                //
-                                //     },
-                                //     // visible: function (row) {
-                                //     //     return row.status == '2'||row.status == '3';
-                                //     // }
-                                // },
+                                {
+                                    name: 'classes_spec',
+                                    text: __('课时查看'),
+                                    title: __('课时查看'),
+                                    classname: 'btn btn-xs btn-danger btn-magic  btn-dialog',
+                                    icon: 'fa fa-list',
+                                    url: classes_spec_url,
+                                    callback: function (data) {
+
+                                    },
+                                    // visible: function (row) {
+                                    //     return row.status == '2'||row.status == '3';
+                                    // }
+                                },
                                 {
                                     name: 'virtual_user',
                                     text: __('设置虚拟参与者'),
@@ -135,6 +135,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
                         {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
 
+                        // {field: 'classes_type_name', title: __('类型'), operate: false},
+                        {field: 'classes_type', title: __('类型'), searchList: classesTypeListJson, formatter: Table.api.formatter.normal},
+
+
                         {field: 'classes_cate_title', title: __('Classes_cate_ids'), operate: false, formatter: Table.api.formatter.flag},
                         {field: 'classes_label_title', title: __('Classes_label_ids'), operate: false, formatter: Table.api.formatter.flag},
                         {field: 'classes_cate_ids', title: __('Classes_cate_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible:false},
@@ -144,6 +148,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                         {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+
+                        {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+
+
                         {field: 'reason', title: __('Reason'), operate: 'LIKE' },
                         {field: 'auth_time', title: __('Auth_time'), operate:'RANGE',visible:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
 
diff --git a/public/assets/js/backend/school/classes/evaluate.js b/public/assets/js/backend/school/classes/evaluate.js
new file mode 100644
index 0000000..f89a6aa
--- /dev/null
+++ b/public/assets/js/backend/school/classes/evaluate.js
@@ -0,0 +1,140 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'school/classes/evaluate/index' + location.search,
+                    add_url: 'school/classes/evaluate/add',
+                    edit_url: 'school/classes/evaluate/edit',
+                    del_url: 'school/classes/evaluate/del',
+                    multi_url: 'school/classes/evaluate/multi',
+                    import_url: 'school/classes/evaluate/import',
+                    table: 'school_classes_evaluate',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'user_id', title: __('User_id')},
+                        {field: 'classes_lib_id', title: __('Classes_lib_id')},
+                        {field: 'classes_order_id', title: __('Classes_order_id')},
+                        {field: 'manystore_id', title: __('Manystore_id')},
+                        {field: 'shop_id', title: __('Shop_id')},
+                        {field: 'teacher_id', title: __('Teacher_id')},
+                        {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'nickname', title: __('Nickname'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'classes_star', title: __('Classes_star'), operate:'BETWEEN'},
+                        {field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'},
+                        {field: 'shop_star', title: __('Shop_star'), operate:'BETWEEN'},
+                        {field: 'evaluate_time', title: __('Evaluate_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
+                        {field: 'top', title: __('Top'), searchList: {"0":__('Top 0'),"1":__('Top 1')}, formatter: Table.api.formatter.normal},
+                        {field: 'weigh', title: __('Weigh'), operate: false},
+                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
+                        {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
+                        {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
+                        {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'lib.title', title: __('Lib.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'lib.headimage', title: __('Lib.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'classesorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
+                        {field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
+                        {field: 'shop.logo', title: __('Shop.logo'), operate: 'LIKE'},
+                        {field: 'teacher.name', title: __('Teacher.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'teacher.head_image', title: __('Teacher.head_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+
+
+
+                $("#c-classes_order_id").data("params", function (obj) {
+                    //obj为SelectPage对象
+                    return {custom: {shop_id: $("#c-shop_id").val(),classes_lib_id: $("#c-classes_lib_id").val()}};
+                });
+
+
+                //老师必须是上面机构中的
+                $("#c-teacher_id").data("params", function (obj) {
+                    //obj为SelectPage对象
+                    return {custom: {shop_id: $("#c-shop_id").val(),classes_lib_id: $("#c-classes_lib_id").val()}};
+                });
+
+                $("#c-classes_lib_id").data("params", function (obj) {
+                    //obj为SelectPage对象
+                    return {custom: {shop_id: $("#c-shop_id").val()}};
+                });
+
+                //机构清除老师也要清除
+                $("#c-shop_id").change(function () {
+                    $("#c-teacher_id").selectPageClear();
+                    $("#c-classes_lib_id").selectPageClear();
+                    $("#c-classes_order_id").selectPageClear();
+                });
+
+                $("#c-classes_lib_id").change(function () {
+                    $("#c-teacher_id").selectPageClear();
+                    $("#c-classes_order_id").selectPageClear();
+                });
+
+                $("#c-user_id").change(function () {
+                    console.log(this);
+                });
+
+
+
+                $(document).on('click', '.btn-changeuser', function (event) {
+                    var url = $(this).attr('data-url');
+                    if(!url) return false;
+                    var title = $(this).attr('title');
+                    var width = $(this).attr('data-width');
+                    var height = $(this).attr('data-height');
+                    // var ids = $(this).attr('data-id');
+                    var area = ['98%','98%'];
+                    var options = {
+                        shadeClose: false,
+                        shade: [0.3, '#393D49'],
+                        area: area,
+                        callback:function(ret){//回调方法,需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
+                            Fast.api.close(ret);
+                        }
+                    };
+                    Fast.api.open(url,title,options);
+                });
+
+
+
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});
diff --git a/public/assets/js/backend/school/classes/hourorder/order.js b/public/assets/js/backend/school/classes/hourorder/order.js
index 46cffa6..462e6b4 100644
--- a/public/assets/js/backend/school/classes/hourorder/order.js
+++ b/public/assets/js/backend/school/classes/hourorder/order.js
@@ -119,6 +119,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             ], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
 
                         {field: 'id', title: __('Id')},
+                         {field: 'detail.feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
+
+
                         {field: 'status', title: __('Status'), searchList: {"-3":__('Status -3'),"-1":__('Status -1'),"0":__('Status 0'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
 
                         {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
@@ -126,6 +129,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
 
                         {field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
+                        {field: 'detail.title', title: __('Detail.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'detail.headimage', title: __('Detail.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
 
 
 
@@ -143,8 +148,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
                         {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
                         {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'detail.title', title: __('Detail.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'detail.headimage', title: __('Detail.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
 
 
 
diff --git a/public/assets/js/backend/school/classes/order/order.js b/public/assets/js/backend/school/classes/order/order.js
index 36fcd46..70f7768 100644
--- a/public/assets/js/backend/school/classes/order/order.js
+++ b/public/assets/js/backend/school/classes/order/order.js
@@ -45,10 +45,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                         return false;
                                     },
                                     visible: function (row) {
-                                        //显示条件 只能待入住订单
-                                        if(row.status == '0'){
+                                        //非免费订单只有未支付可取消
+                                        if(row.status == '0' && row.detail.feel == '0'){
                                             return true;
                                         }
+                                        //免费订单未支付和进行中都可取消
+                                        if((row.status == '0' || row.status == '3' )&& row.detail.feel == '1'){
+                                            return true;
+                                        }
+
                                         return false;
                                     }},
                                 {
@@ -76,7 +81,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
                                     },
                                     visible: function (row) {
-                                        return row.status == '3';
+                                        //只有付费订单有售后
+                                        return row.status == '3'  && row.detail.feel == '0';
                                     }
                                 },
 
@@ -155,6 +161,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'status', title: __('Status'), searchList: {"-3":__('Status -3'),"0":__('Status 0'),"3":__('Status 3'),"4":__('Status 4'),"6":__('Status 6'),"9":__('Status 9')}, formatter: Table.api.formatter.status},
 
                         {field: 'pay_no',visible:false, title: __('Pay_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+
+                       {field: 'detail.feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
+
                         {field: 'detail.title', title: __('Detail.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'detail.headimage', title: __('Detail.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
 
diff --git a/public/assets/js/backend/school/classes/order/order_detail.js b/public/assets/js/backend/school/classes/order/order_detail.js
index 9898ee6..2c08a0b 100644
--- a/public/assets/js/backend/school/classes/order/order_detail.js
+++ b/public/assets/js/backend/school/classes/order/order_detail.js
@@ -28,6 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
+                        {field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
                         {field: 'classes_num', title: __('Classes_num')},
                         {field: 'use_num', title: __('Use_num')},
                         {field: 'sub_num', title: __('Sub_num')},
diff --git a/public/assets/js/backend/school/classes/order/service_order_log.js b/public/assets/js/backend/school/classes/order/service_order_log.js
index 3b2cbd5..a23c2b7 100644
--- a/public/assets/js/backend/school/classes/order/service_order_log.js
+++ b/public/assets/js/backend/school/classes/order/service_order_log.js
@@ -28,6 +28,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
+                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+
                         {field: 'classes_service_order_id',visible:false, title: __('Classes_service_order_id')},
                         {field: 'classes_order_id',visible:false, title: __('Classes_order_id')},
                         {field: 'user_id',visible:false, title: __('User_id')},
@@ -41,8 +43,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'log_text', title: __('Log_text'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'oper_id', title: __('Oper_id')},
                         {field: 'oper_type', title: __('Oper_type'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                         {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         // {field: 'serviceorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         // {field: 'classesorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         // {field: 'classesorder.pay_no', title: __('Order.pay_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
diff --git a/public/assets/js/backend/school/classes/teacher.js b/public/assets/js/backend/school/classes/teacher.js
index 0193d26..b52b597 100644
--- a/public/assets/js/backend/school/classes/teacher.js
+++ b/public/assets/js/backend/school/classes/teacher.js
@@ -42,6 +42,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
                         {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
+                        {field: 'user.mobile', title: __('用户手机号'), operate: 'LIKE'},
                         {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
                         {field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
                         {field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
diff --git a/public/assets/js/manystore/school/classes/classes_lib.js b/public/assets/js/manystore/school/classes/classes_lib.js
index faa05ba..a0d2582 100644
--- a/public/assets/js/manystore/school/classes/classes_lib.js
+++ b/public/assets/js/manystore/school/classes/classes_lib.js
@@ -29,20 +29,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'operate', title: __('Operate'), table: table , buttons: [
-                                // {
-                                //     name: 'classes_spec',
-                                //     text: __('设置课程规格'),
-                                //     title: __('设置课程规格'),
-                                //     classname: 'btn btn-xs btn-danger btn-magic  btn-dialog',
-                                //     icon: 'fa fa-list',
-                                //     url: classes_spec_url,
-                                //     callback: function (data) {
-                                //
-                                //     },
-                                //     // visible: function (row) {
-                                //     //     return row.status == '2'||row.status == '3';
-                                //     // }
-                                // },
+                                {
+                                    name: 'classes_spec',
+                                    text: __('课时查看'),
+                                    title: __('课时查看'),
+                                    classname: 'btn btn-xs btn-danger btn-magic  btn-dialog',
+                                    icon: 'fa fa-list',
+                                    url: classes_spec_url,
+                                    callback: function (data) {
+
+                                    },
+                                    // visible: function (row) {
+                                    //     return row.status == '2'||row.status == '3';
+                                    // }
+                                },
                                 // {
                                 //     name: 'virtual_user',
                                 //     text: __('设置虚拟参与者'),
@@ -131,6 +131,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
 
 
+                        // {field: 'classes_type_name', title: __('类型'), operate: false},
+                       {field: 'classes_type', title: __('类型'), searchList: classesTypeListJson, formatter: Table.api.formatter.normal},
+
+
                         {field: 'classes_cate_title', title: __('Classes_cate_ids'), operate: false, formatter: Table.api.formatter.flag},
                         {field: 'classes_label_title', title: __('Classes_label_ids'), operate: false, formatter: Table.api.formatter.flag},
                         {field: 'classes_cate_ids', title: __('Classes_cate_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible:false},
@@ -140,6 +144,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                         {field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
                         {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+
+                       {field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+                        {field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+
+
+
                         {field: 'reason', title: __('Reason'), operate: 'LIKE' },
                         {field: 'auth_time', title: __('Auth_time'), operate:'RANGE',visible:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
 
diff --git a/public/assets/js/manystore/school/classes/evaluate.js b/public/assets/js/manystore/school/classes/evaluate.js
new file mode 100644
index 0000000..cda08c9
--- /dev/null
+++ b/public/assets/js/manystore/school/classes/evaluate.js
@@ -0,0 +1,144 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'school/classes/evaluate/index' + location.search,
+                    add_url: 'school/classes/evaluate/add',
+                    edit_url: 'school/classes/evaluate/edit',
+                    del_url: 'school/classes/evaluate/del',
+                    multi_url: 'school/classes/evaluate/multi',
+                    import_url: 'school/classes/evaluate/import',
+                    table: 'school_classes_evaluate',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'user_id', title: __('User_id')},
+                        {field: 'classes_lib_id', title: __('Classes_lib_id')},
+                        {field: 'classes_order_id', title: __('Classes_order_id')},
+                        {field: 'manystore_id', title: __('Manystore_id')},
+                        {field: 'shop_id', title: __('Shop_id')},
+                        {field: 'teacher_id', title: __('Teacher_id')},
+                        {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
+                        {field: 'classes_star', title: __('Classes_star'), operate:'BETWEEN'},
+                        {field: 'teacher_star', title: __('Teacher_star'), operate:'BETWEEN'},
+                        {field: 'shop_star', title: __('Shop_star'), operate:'BETWEEN'},
+                        {field: 'evaluate_time', title: __('Evaluate_time')},
+                        {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
+                        {field: 'top', title: __('Top'), searchList: {"0":__('Top 0'),"1":__('Top 1')}, formatter: Table.api.formatter.normal},
+                        {field: 'weigh', title: __('Weigh'), operate: false},
+                        {field: 'createtime', title: __('Createtime')},
+                        {field: 'updatetime', title: __('Updatetime')},
+                        {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
+                        {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
+                        {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
+                        {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'schoolclasseslib.title', title: __('Schoolclasseslib.title'), operate: 'LIKE'},
+                        {field: 'schoolclasseslib.headimage', title: __('Schoolclasseslib.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'schoolclassesorder.order_no', title: __('Schoolclassesorder.order_no'), operate: 'LIKE'},
+                        {field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
+                        {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
+                        {field: 'manystoreshop.logo', title: __('Manystoreshop.logo'), operate: 'LIKE'},
+                        {field: 'schoolteacher.name', title: __('Schoolteacher.name'), operate: 'LIKE'},
+                        {field: 'schoolteacher.head_image', title: __('Schoolteacher.head_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+
+
+
+
+
+                $("#c-classes_order_id").data("params", function (obj) {
+                    //obj为SelectPage对象
+                    return {custom: {shop_id: $("#c-shop_id").val(),classes_lib_id: $("#c-classes_lib_id").val()}};
+                });
+
+
+
+
+                //老师必须是上面机构中的
+                $("#c-teacher_id").data("params", function (obj) {
+                    //obj为SelectPage对象
+                    return {custom: {shop_id: $("#c-shop_id").val(),classes_lib_id: $("#c-classes_lib_id").val()}};
+                });
+
+                $("#c-classes_lib_id").data("params", function (obj) {
+                    //obj为SelectPage对象
+                    return {custom: {shop_id: $("#c-shop_id").val()}};
+                });
+
+                //机构清除老师也要清除
+                $("#c-shop_id").change(function () {
+                    $("#c-teacher_id").selectPageClear();
+                    $("#c-classes_lib_id").selectPageClear();
+                    $("#c-classes_order_id").selectPageClear();
+                });
+
+                $("#c-classes_lib_id").change(function () {
+                    $("#c-teacher_id").selectPageClear();
+                    $("#c-classes_order_id").selectPageClear();
+                });
+
+                $("#c-user_id").change(function () {
+                    console.log(this);
+                });
+
+
+
+
+
+                $(document).on('click', '.btn-changeuser', function (event) {
+                    var url = $(this).attr('data-url');
+                    if(!url) return false;
+                    var title = $(this).attr('title');
+                    var width = $(this).attr('data-width');
+                    var height = $(this).attr('data-height');
+                    // var ids = $(this).attr('data-id');
+                    var area = ['98%','98%'];
+                    var options = {
+                        shadeClose: false,
+                        shade: [0.3, '#393D49'],
+                        area: area,
+                        callback:function(ret){//回调方法,需要在本页面Controller中增加方法监听且调用Fast.api.close(ret)传递结果;
+                            Fast.api.close(ret);
+                        }
+                    };
+                    Fast.api.open(url,title,options);
+                });
+
+
+
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});
\ No newline at end of file
diff --git a/public/assets/js/manystore/school/classes/hourorder/order.js b/public/assets/js/manystore/school/classes/hourorder/order.js
index 489ff3a..b06ac3d 100644
--- a/public/assets/js/manystore/school/classes/hourorder/order.js
+++ b/public/assets/js/manystore/school/classes/hourorder/order.js
@@ -117,6 +117,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                             ], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
 
                         {field: 'id', title: __('Id')},
+                         {field: 'schoolclassesorderdetail.feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
+
+
                         {field: 'status', title: __('Status'), searchList: {"-3":__('Status -3'),"-1":__('Status -1'),"0":__('Status 0'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
 
 
@@ -126,6 +129,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
                         {field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
 
+                         {field: 'schoolclassesorderdetail.title', title: __('Schoolclassesorderdetail.title'), operate: 'LIKE'},
+                        {field: 'schoolclassesorderdetail.headimage', title: __('Schoolclassesorderdetail.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+
 
                         {field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
                         {field: 'classes_order_id',visible:false, title: __('Classes_order_id')},
@@ -139,8 +145,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
                         {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
                         {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
-                        {field: 'schoolclassesorderdetail.title',visible:false, title: __('Schoolclassesorderdetail.title'), operate: 'LIKE'},
-                        {field: 'schoolclassesorderdetail.headimage',visible:false, title: __('Schoolclassesorderdetail.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
 
 
 
diff --git a/public/assets/js/manystore/school/classes/order/order.js b/public/assets/js/manystore/school/classes/order/order.js
index bec7ef0..9a8d8e1 100644
--- a/public/assets/js/manystore/school/classes/order/order.js
+++ b/public/assets/js/manystore/school/classes/order/order.js
@@ -44,8 +44,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                         return false;
                                     },
                                     visible: function (row) {
-                                        //显示条件 只能待入住订单
-                                        if(row.status == '0'){
+                                        //非免费订单只有未支付可取消
+                                        if(row.status == '0' && row.schoolclassesorderdetail.feel == '0'){
+                                            return true;
+                                        }
+                                        //免费订单未支付和进行中都可取消
+                                        if((row.status == '0' || row.status == '3' )&& row.schoolclassesorderdetail.feel == '1'){
                                             return true;
                                         }
                                         return false;
@@ -139,8 +143,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'status', title: __('Status'), searchList: {"-3":__('Status -3'),"0":__('Status 0'),"3":__('Status 3'),"4":__('Status 4'),"6":__('Status 6'),"9":__('Status 9')}, formatter: Table.api.formatter.status},
 
                         {field: 'pay_no', title: __('Pay_no'), operate: 'LIKE',visible:false},
+
+                        {field: 'schoolclassesorderdetail.feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
                         {field: 'schoolclassesorderdetail.title', title: __('Schoolclassesorderdetail.title'), operate: 'LIKE'},
                         {field: 'schoolclassesorderdetail.headimage', title: __('Schoolclassesorderdetail.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
+
                         {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
                         {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
                         {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
diff --git a/public/assets/js/manystore/school/classes/order/order_detail.js b/public/assets/js/manystore/school/classes/order/order_detail.js
index 0a88f03..2608d71 100644
--- a/public/assets/js/manystore/school/classes/order/order_detail.js
+++ b/public/assets/js/manystore/school/classes/order/order_detail.js
@@ -26,6 +26,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
+                         {field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
                         {field: 'classes_num', title: __('Classes_num')},
                         {field: 'use_num', title: __('Use_num')},
                         {field: 'sub_num', title: __('Sub_num')},
diff --git a/public/assets/js/manystore/school/classes/order/service_order_log.js b/public/assets/js/manystore/school/classes/order/service_order_log.js
index e686f32..8ed8356 100644
--- a/public/assets/js/manystore/school/classes/order/service_order_log.js
+++ b/public/assets/js/manystore/school/classes/order/service_order_log.js
@@ -26,6 +26,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     [
                         {checkbox: true},
                         {field: 'id', title: __('Id')},
+                         {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+
                         {field: 'classes_service_order_id',visible:false, title: __('Classes_service_order_id')},
                         {field: 'classes_order_id',visible:false, title: __('Classes_order_id')},
                         {field: 'user_id',visible:false, title: __('User_id')},
@@ -39,8 +41,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                         {field: 'log_text', title: __('Log_text'), operate: 'LIKE'},
                         {field: 'oper_id', title: __('Oper_id')},
                         {field: 'oper_type', title: __('Oper_type'), operate: 'LIKE'},
-                        {field: 'createtime', title: __('Createtime')},
-                        {field: 'updatetime', title: __('Updatetime')},
+                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                         {field: 'schoolclassesserviceorder.order_no',visible:false, title: __('Schoolclassesserviceorder.order_no'), operate: 'LIKE'},
                         {field: 'schoolclassesorder.order_no',visible:false, title: __('Schoolclassesorder.order_no'), operate: 'LIKE'},
                         {field: 'schoolclassesorder.pay_no',visible:false, title: __('Schoolclassesorder.pay_no'), operate: 'LIKE'},