diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index a932297..491ca7e 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -38,7 +38,7 @@ class Index extends Backend //不用审核允许修改的字段 - protected $no_auth_fields = [ "name",'image','images','address_city','province',"city","district","address","address_detail", + protected $no_auth_fields = [ "yyzzdm","yyzz_images","front_idcard_image", "reverse_idcard_image","name",'image','images','address_city','province',"city","district","address","address_detail", "longitude","latitude","content","desc" ]; @@ -221,9 +221,9 @@ class Index extends Backend protected function updateCheck($id,$params=[],$shop=[],$row=null){ if($shop && $row){ - if(!$this->no_auth_fields_check($shop,$row)){ +// if(!$this->no_auth_fields_check($shop,$row)){ return true; - } +// } } // 课程存在未完成订单则不允许操作 diff --git a/application/admin/controller/school/classes/ClassesLib.php b/application/admin/controller/school/classes/ClassesLib.php index 0219e96..7d3f27a 100644 --- a/application/admin/controller/school/classes/ClassesLib.php +++ b/application/admin/controller/school/classes/ClassesLib.php @@ -56,6 +56,12 @@ class ClassesLib extends Backend $this->view->assign("hotList", $this->model->getHotList()); $this->view->assign("newList", $this->model->getNewList()); $this->view->assign("selfhotList", $this->model->getSelfhotList()); + + + + + $this->view->assign("specStatusList", (new \app\admin\model\school\classes\ClassesSpec)->getStatusList()); + } @@ -205,144 +211,37 @@ class ClassesLib extends Backend protected function update_check(&$params,$row=null) { + try { + $classesLib = new \app\common\model\school\classes\ClassesLib(); + $classesLib->no_auth_fields = $this->no_auth_fields; + $classesLib->need_auth = $this->need_auth; + $classesLib->have_auth = $this->have_auth; + $classesLib->classesCheck($params,$shop_id=null,$row); + $this->need_auth = $classesLib->need_auth; + $this->have_auth = $classesLib->have_auth; - $shop_id = $params["shop_id"]; - $manystore = Manystore::where("shop_id",$shop_id)->find(); - if(!$manystore){ - $this->error("店铺不存在"); - } - if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))$this->error("对方的认证信息未完善,请您先去帮忙完善!"); - - - $params["manystore_id"] = $manystore["id"]; - - - //验证老师id - $teacher_id = $params['teacher_id']; - $teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find(); - if(!$teacher){ - $this->error("老师不存在"); - } - if(!$teacher["user_id"]){ - $this->error("当前老师没有前端用户!请换一个!"); - } - //老师与当前机构id不一致 - if($teacher["manystore_id"] != $manystore["id"]){ - $this->error("当前老师与当前机构不匹配,请换一个老师!"); + }catch (\Exception $e){ + $this->error($e->getMessage()); } - $params["user_id"] = $teacher["user_id"]; - - //课时必须大于等于1 - if($params["classes_num"] < 1) $this->error("课时必须大于等于1"); - if($params["price"] < 0) $this->error("售价必须大于0"); - - - //独立地点需传定位信息 - if($params["address_type"] == "2"){ - if(empty($params["address_city"]) - || empty($params["province"]) - || empty($params["city"]) - || empty($params["district"]) - || empty($params["longitude"]) - || empty($params["latitude"]) - || empty($params["address"]) - || empty($params["address_detail"]) - ) $this->error("独立地点需传定位信息"); - - }else{ - //地址取机构的 - $shop = ManystoreShop::where("id",$shop_id)->find(); - if(!$shop){ - $this->error("店铺不存在"); - } - if(empty($shop["address_city"]) - || empty($shop["province"]) - || empty($shop["city"]) - || empty($shop["district"]) - || empty($shop["longitude"]) - || empty($shop["latitude"]) - || empty($shop["address"]) - || empty($shop["address_detail"]) - ) $this->error("当前机构地址并未完善,请在机构处完善!"); - - - - $params["address_city"] = $shop["address_city"]; - $params["province"] = $shop["province"]; - $params["city"] = $shop["city"]; - $params["district"] = $shop["district"]; - $params["longitude"] = $shop["longitude"]; - $params["latitude"] = $shop["latitude"]; - $params["address"] = $shop["address"]; - $params["address_detail"] = $shop["address_detail"]; - //address -// var_dump($params); - } - //特有认证判断 $this->authClasses($params,$row); // var_dump($row);die; - //收费免费判断 - if($params["price"]==0){ - $params["feel"] = "1"; - }else{ - - //个人认证无法下付费课程 - $shop = ManystoreShop::where("id",$shop_id)->find(); - if($shop["type"]=="1"){ - $this->error("这个机构属于个人认证,无法发布付费课程!"); - } - - $params["feel"] = "0"; - } //更新 if($row){ - $this->have_auth = false; - if($this->need_auth){ - //判断更新的变动数据 - $this->no_auth_fields_check($params,$row); - - if($this->have_auth){ - $params['status'] = "3"; - $params['auth_status'] = "0"; - } - } - - $this->updateCheck($row->id,$params,$row); - - - //名称title不能与其他课程重复 - $check_title = $this->model->where('id','<>',$row["id"])->where('title',$params["title"])->find(); - if($check_title){ - $this->error("课程名称已存在或被其他机构占用,请更改!"); - } }else{ //新增 + //新增 $params["add_type"] = '2'; $params["add_id"] = $this->auth->id; - //名称title不能重复 - $check_title = $this->model->where('title',$params["title"])->find(); - if($check_title){ - $this->error("课程名称已存在或被其他机构占用,请更改!"); - } - } - - //如果是上架,判断是否拥有课时规格,没有则无法上架 - if($params["status"]=="1"){ - if(!$row)$this->error("新添加的课程请先至少添加一个课时规格后再上架!"); - //判断是否拥有课时规格,没有则无法上架 - $check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count(); - if(!$check_spec)$this->error("新添加的课程请先至少添加一个课时规格后再上架!"); - } } @@ -419,6 +318,74 @@ class ClassesLib extends Backend $this->success(); } + + /** + * 添加 + * + * @return string + * @throws \think\Exception + */ + public function addnew() + { + if (false === $this->request->isPost()) { + return $this->view->fetch(); + } + $params = $this->request->post('row/a'); + if (empty($params)) { + $this->error(__('Parameter %s can not be empty', '')); + } + $params = $this->preExcludeFields($params); + + if ($this->dataLimit && $this->dataLimitFieldAutoFill) { + $params[$this->dataLimitField] = $this->auth->id; + } + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException()->validate($validate); + } + $this->update_check($params,$row=null); + $result = $this->model->allowField(true)->save($params); + \app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]); + $this->update_classes($this->model["id"]); + + if($this->have_auth){ + //调用通过事件 + $data = ['classes' => $this->model]; + \think\Hook::listen('classes_auth_need_after', $data); + + } + + if($this->success_auth){ + //调用通过事件 + $data = ['classes' => $this->model]; + \think\Hook::listen('classes_auth_success_after', $data); + } + + + if($this->error_auth){ + //调用通过事件 + $data = ['classes' => $this->model]; + \think\Hook::listen('classes_auth_fail_after', $data); + + } + + + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + /** * 编辑 * diff --git a/application/admin/controller/school/classes/ClassesSpec.php b/application/admin/controller/school/classes/ClassesSpec.php index 3b7aff2..e64d9a0 100644 --- a/application/admin/controller/school/classes/ClassesSpec.php +++ b/application/admin/controller/school/classes/ClassesSpec.php @@ -133,80 +133,20 @@ class ClassesSpec extends Backend protected function update_check(&$params,$row=null) { - - - //开始和结束时间不能为空 - $start_time = $params["start_time"]; - $end_time = $params["end_time"]; - if(empty($start_time) || empty($end_time)){ - $this->error("请选择开始和结束时间"); - } - //转化时间戳 - $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){ - $this->error("结束时间不能小于开始时间"); + //限定人数必须大于0 + try { + (new \app\common\model\school\classes\ClassesSpec)->specCheck($params,$shop_id=null,$row); + }catch (\Exception $e){ + $this->error($e->getMessage()); } - //结束时间不能是已经过去的时间 - $now_time = time(); - if($end_time<=$now_time){ - $this->error("结束时间不能是已经过去的时间"); - } - - - $orderTimeTableName = $this->model->getWithAlisaName(); //修改 if($row){ - $this->updateCheck($row->id,$params,$row); - //规格名字不能一样(同课程下) - $spec_name = $params["name"]; - $classes_lib_id = $params["classes_lib_id"]; - $spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find(); - if($spec_name_exist){ - $this->error("该课程下已存在该课时规格名称,请重新输入"); - } - //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行) - $spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) { - //兩個時間區間重合 存在任意交集 都不行 - $query->where("start_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}"); - $query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}"); - }) - ->where("classes_lib_id",$classes_lib_id) - ->where("id","<>",$row->id)->find(); - - if($spec_time_exist){ - $this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠"); - } - + $this->updateCheck($row->id,$params,$row); }else{ //新增 - //规格名字不能一样(同课程下) - $spec_name = $params["name"]; - $classes_lib_id = $params["classes_lib_id"]; - $spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find(); - if($spec_name_exist){ - $this->error("该课程下已存在该课时规格名称,请重新输入"); - } - //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行) - $spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) { - //兩個時間區間重合 存在任意交集 都不行 - $query->where("start_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}"); - $query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}"); - }) - ->where("classes_lib_id",$classes_lib_id) - ->find(); - - if($spec_time_exist){ - $this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠"); - } } diff --git a/application/admin/lang/zh-cn/manystore/index.php b/application/admin/lang/zh-cn/manystore/index.php index f068dfe..4075b06 100644 --- a/application/admin/lang/zh-cn/manystore/index.php +++ b/application/admin/lang/zh-cn/manystore/index.php @@ -26,8 +26,8 @@ return [ 'Yyzz_images' => '营业执照照片(个人认证不需要)', 'hidden' => '禁用', - 'Front_idcard_image' => '身份证正面', - 'Reverse_idcard_image' => '身份证反面', + 'Front_idcard_image' => '身份证人像面', + 'Reverse_idcard_image' => '身份证国徽面', 'Tel' => '服务电话', 'Content' => '详情', 'Status' => '账号状态', diff --git a/application/admin/lang/zh-cn/school/classes/classes_spec.php b/application/admin/lang/zh-cn/school/classes/classes_spec.php index 52a67ea..bde5a6e 100644 --- a/application/admin/lang/zh-cn/school/classes/classes_spec.php +++ b/application/admin/lang/zh-cn/school/classes/classes_spec.php @@ -3,9 +3,10 @@ return [ 'Classes_lib_id' => '课程id', 'Name' => '规格名', + 'Time' => '课时开始结束时间', 'Start_time' => '开始时间', 'End_time' => '结束时间', - 'Limit_num' => '本课时限定人数(0不限制)', + 'Limit_num' => '本课时限定人数', 'Sign_num' => '已报名人数', 'Verification_num' => '已核销人数', 'Status' => '状态', diff --git a/application/admin/view/school/classes/classes_lib/add.html b/application/admin/view/school/classes/classes_lib/add.html index d1f237d..aeecd8c 100644 --- a/application/admin/view/school/classes/classes_lib/add.html +++ b/application/admin/view/school/classes/classes_lib/add.html @@ -267,36 +267,36 @@ -
- -
- -
- {foreach name="statusList" item="vo"} - - {/foreach} -
+ + + + + + + + + -
-
-
- -
- -
- {foreach name="authStatusList" item="vo"} - - {/foreach} -
+ + + + + + + + + + + -
-
-
- -
- -
-
+ + + + + + + + diff --git a/application/admin/view/school/classes/classes_lib/addnew.html b/application/admin/view/school/classes/classes_lib/addnew.html new file mode 100644 index 0000000..d82d644 --- /dev/null +++ b/application/admin/view/school/classes/classes_lib/addnew.html @@ -0,0 +1,419 @@ +
+ + + + + + + +
+ +
+ + + + + + (没找到机构则点击按钮创建机构后重新下拉框选机构) + {:__('Add')} + + +
+
+ + + + + + +
+ +
+ + + + + (没找到讲师则点击按钮创建讲师后重新下拉框选讲师) + {:__('Add')} + + +
+
+ +
+ +
+ + + + (没找到分类则点击按钮创建分类后重新下拉框选分类) + {:__('Add')} + + +
+
+
+ +
+ + + + (没找到标签则点击按钮创建标签后重新下拉框选标签) + {:__('Add')} + + + +
+
+
+ +
+ +
+
+ + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + + (填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数) +
      +
      + + + + + + +
      + +
      + + + + + + + + + + + + + +
      规格名开始结束时间限定人数上架状态
      追加
      + (每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,后续有变更将触发审核机制!) + + +
      +
      + + + + + + + +
      + +
      +
      + {foreach name="addressTypeList" item="vo"} + + {/foreach} + ( 如果选独立位置需填写具体位置信息! ) +
      +
      +
      + + + + +
      +
      + +
      +
      + +
      + + + +
      +
      +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      + +
      + +
      +
      + +
      + + +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + + ( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! ) +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
      + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + + + +
      +
      +
      + +
      + + + +
      +
      + +
      diff --git a/application/admin/view/school/classes/classes_lib/edit.html b/application/admin/view/school/classes/classes_lib/edit.html index 5598bfb..8125c1b 100644 --- a/application/admin/view/school/classes/classes_lib/edit.html +++ b/application/admin/view/school/classes/classes_lib/edit.html @@ -177,6 +177,8 @@
      + (填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数) +
      @@ -264,12 +266,12 @@ -
      - -
      - -
      -
      + + + + + + diff --git a/application/admin/view/school/classes/classes_lib/index.html b/application/admin/view/school/classes/classes_lib/index.html index 364a02e..13df2e4 100644 --- a/application/admin/view/school/classes/classes_lib/index.html +++ b/application/admin/view/school/classes/classes_lib/index.html @@ -21,6 +21,10 @@ {:__('Add')} + + + {:__('新版添加')}(开发中) + {:__('Edit')} {:__('Delete')} diff --git a/application/admin/view/school/classes/classes_spec/add.html b/application/admin/view/school/classes/classes_spec/add.html index 1133042..3cfab6f 100644 --- a/application/admin/view/school/classes/classes_spec/add.html +++ b/application/admin/view/school/classes/classes_spec/add.html @@ -9,25 +9,34 @@
      - +
      + +
      - +
      - -
      -
      -
      - -
      - +
      + + + + + + + + + + + + +
      - +
      diff --git a/application/admin/view/school/classes/classes_spec/edit.html b/application/admin/view/school/classes/classes_spec/edit.html index 35af5d8..4dc27af 100644 --- a/application/admin/view/school/classes/classes_spec/edit.html +++ b/application/admin/view/school/classes/classes_spec/edit.html @@ -9,25 +9,34 @@
      - +
      -
      - + +
      +
      - -
      -
      -
      - -
      - +
      + + + + + + + + + + + + + +
      - +
      diff --git a/application/api/controller/school/Classes.php b/application/api/controller/school/Classes.php index 2b625d7..be1ae26 100644 --- a/application/api/controller/school/Classes.php +++ b/application/api/controller/school/Classes.php @@ -111,10 +111,12 @@ class Classes extends Base * @ApiRoute(/api/school/classes/people) * @ApiMethod(GET) * @ApiParams(name = "id", type = "int",required=true,description = "课程id") + * @ApiParams(name = "have_real", type = "int",required=true,description = "是否只查真實的 1是 0否") * @ApiReturn({ unpaid_user_data 参与中 paid_user_data 已报名 }) */ public function people(){ $id = $this->request->get('id/d',''); + $have_real = $this->request->get('have_real/d',''); $user_id = 0; $user = $this->auth->getUser();//登录用户 if($user)$user_id = $user['id']; @@ -123,7 +125,7 @@ class Classes extends Base } try { - $res = $this->model->virtualParticipants($id,$user_id); + $res = $this->model->virtualParticipants($id,$user_id,$have_real); } catch (\Exception $e){ // Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); diff --git a/application/api/controller/school/worker/Order.php b/application/api/controller/school/worker/Order.php index a7cebae..39129cb 100644 --- a/application/api/controller/school/worker/Order.php +++ b/application/api/controller/school/worker/Order.php @@ -49,6 +49,7 @@ class Order extends Base try { $res = OrderModel::getDetail($id,$this->classes_lib_ids); + if(!$res)throw new \Exception('您无操作权限!',40003); } catch (\Exception $e){ // Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); diff --git a/application/common/model/BaseModel.php b/application/common/model/BaseModel.php index 1e705b3..b029151 100644 --- a/application/common/model/BaseModel.php +++ b/application/common/model/BaseModel.php @@ -23,6 +23,12 @@ class BaseModel extends Model //更新数据是否需要触发审核开关 public $have_auth = false; + //更新数据是否需要触发审核开关 + public $need_auth = false; + + + public $success_auth = false; + public $error_auth = false; diff --git a/application/common/model/dyqc/ManystoreShop.php b/application/common/model/dyqc/ManystoreShop.php index aa5f1a0..925f266 100644 --- a/application/common/model/dyqc/ManystoreShop.php +++ b/application/common/model/dyqc/ManystoreShop.php @@ -368,7 +368,7 @@ class ManystoreShop extends BaseModel * * @throws \think\exception\DbException */ -public function getDefaultPassword($type,$user_id,$params){ +public static function getDefaultPassword($type,$user_id,$params){ $user = User::get($user_id); $defaultPassword = null; switch ($type) { diff --git a/application/common/model/school/Message.php b/application/common/model/school/Message.php index d11421a..2899263 100644 --- a/application/common/model/school/Message.php +++ b/application/common/model/school/Message.php @@ -314,7 +314,8 @@ class Message extends BaseModel ]; $alisa = (new self)->getWithAlisaName(); - $sort = "field({$alisa}.type,'1','2') asc,{$alisa}.weigh desc,{$alisa}.id desc"; + $sort = "{$alisa}.weigh desc,{$alisa}.id desc"; +// $sort = "field({$alisa}.type,'1','2') asc,{$alisa}.weigh desc,{$alisa}.id desc"; $serch_where = ["to_id"=>$to_id,'platform'=>"user",'status'=>$status,'keywords'=>$keywords,"mini_type"=>$mini_type,"type"=>$type]; // if($type)$serch_where['type'] = $type; return (new self)->getBaseList($serch_where, $page, $limit,$sort,$with_field); diff --git a/application/common/model/school/classes/ClassesLib.php b/application/common/model/school/classes/ClassesLib.php index 80d5053..4452ea5 100644 --- a/application/common/model/school/classes/ClassesLib.php +++ b/application/common/model/school/classes/ClassesLib.php @@ -7,6 +7,7 @@ use app\common\model\BaseModel; use app\common\model\dyqc\ManystoreShop; use app\common\model\school\classes\lib\Spec; use app\common\model\User; +use app\manystore\model\Manystore; use think\Model; use traits\model\SoftDelete; @@ -260,6 +261,21 @@ class ClassesLib extends BaseModel + + public function setImagesAttr($value, $data) + { + $imagesArray = $value; + if (!empty($value) && is_array($value)) { + //转成逗号拼接字符串 + $imagesArray = implode(',', $value); + } + return $imagesArray; + } + + + + + public function manystore() { return $this->belongsTo('app\admin\model\Manystore', 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0); @@ -345,7 +361,7 @@ class ClassesLib extends BaseModel * @param $id * */ - public function virtualParticipants($id,$user_id=0){ + public function virtualParticipants($id,$user_id=0,$have_real=false){ //虚拟用户生成数量 $v_num = 10; $unpaid_user_data = $paid_user_data = []; @@ -415,7 +431,7 @@ $user_unpaid_order = $user_paid_order =null; //计算需要生成的虚拟用户数量 $v_num = $v_num - count($user_ids); if($v_num<0)$v_num =0; - if($v_num){ + if($v_num && !$have_real){ $unpaid_user = VirtualUser::where("classes_lib_id",$id)->where("jointype",'1')->order("time desc")->limit($v_num)->select(); $unpaid_user_data = array_merge($unpaid_user_data,$unpaid_user); } @@ -443,7 +459,7 @@ $user_unpaid_order = $user_paid_order =null; $v_num = 10; $v_num = $v_num - count($user_ids); if($v_num<0)$v_num =0; - if($v_num){ + if($v_num && !$have_real){ $unpaid_user = VirtualUser::where("classes_lib_id",$id)->where("havetype",'1')->order("time desc")->limit($v_num)->select(); $paid_user_data = array_merge($paid_user_data,$unpaid_user); } @@ -758,7 +774,7 @@ $user_unpaid_order = $user_paid_order =null; foreach ($order as $row){ $update = $classes_lib->toArray(); - $update_data = $row->checkAssemblyParameters($update,["id","createtime","updatetime"]); + $update_data = $row->checkAssemblyParameters($update,["id","status","auth_status","createtime","updatetime"]); $row->save($update_data); } //同步更新订单课时信息 @@ -767,7 +783,7 @@ $user_unpaid_order = $user_paid_order =null; $hourorders = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec->id)->select(); foreach ($hourorders as $hourorder){ $update = $spec->toArray(); - $update_data = $hourorder->checkAssemblyParameters($update,["id","createtime","updatetime"]); + $update_data = $hourorder->checkAssemblyParameters($update,["id","status","auth_status","createtime","updatetime"]); $hourorder->save($update_data); } } @@ -797,6 +813,9 @@ $user_unpaid_order = $user_paid_order =null; + + + /**设置收藏 * @param $id * @param int $user_id @@ -847,5 +866,169 @@ $user_unpaid_order = $user_paid_order =null; } + protected function updateCheck($id,$params=[],$row=null){ + if($params && $row){ + + if(!$this->no_auth_fields_check($params,$row)){ + return true; + } + } + + // 课程存在未完成订单则不允许操作 + $order = Order::where("classes_lib_id",$id)->where("status","in","0,3")->find(); + if($order)$this->error("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!"); + // 课程存在售后订单则不允许操作 + } + + + + +//不用审核允许修改的字段 + public $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"]; + + + public function classesCheck(&$params,$shop_id=null,$row=null) + { + $params["auth_status"] = $params["auth_status"] ?? '0'; + $params["status"] = $params["status"] ?? '3'; + + + + $manystore = Manystore::where("shop_id",$shop_id)->find(); + if(!$manystore){ + throw new \Exception("店铺不存在"); + } + if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))throw new \Exception("对方的认证信息未完善,请您先去帮忙完善!"); + + + $params["manystore_id"] = $manystore["id"]; + + + //验证老师id + $teacher_id = $params['teacher_id']; + $teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find(); + if(!$teacher){ + throw new \Exception("老师不存在"); + } + if(!$teacher["user_id"]){ + throw new \Exception("当前老师没有前端用户!请换一个!"); + } + //老师与当前机构id不一致 + if($teacher["manystore_id"] != $manystore["id"]){ + throw new \Exception("当前老师与当前机构不匹配,请换一个老师!"); + } + + + $params["user_id"] = $teacher["user_id"]; + + //课时必须大于等于1 + if($params["classes_num"] < 1) throw new \Exception("课时必须大于等于1"); + if($params["price"] < 0) throw new \Exception("售价必须大于0"); + + + //独立地点需传定位信息 + if($params["address_type"] == "2"){ + if(empty($params["address_city"]) + || empty($params["province"]) + || empty($params["city"]) + || empty($params["district"]) + || empty($params["longitude"]) + || empty($params["latitude"]) + || empty($params["address"]) + || empty($params["address_detail"]) + ) throw new \Exception("独立地点需传定位信息"); + + }else{ + //地址取机构的 + $shop = ManystoreShop::where("id",$shop_id)->find(); + if(!$shop){ + throw new \Exception("店铺不存在"); + } + if(empty($shop["address_city"]) + || empty($shop["province"]) + || empty($shop["city"]) + || empty($shop["district"]) + || empty($shop["longitude"]) + || empty($shop["latitude"]) + || empty($shop["address"]) + || empty($shop["address_detail"]) + ) throw new \Exception("当前机构地址并未完善,请在机构处完善!"); + + + + $params["address_city"] = $shop["address_city"]; + $params["province"] = $shop["province"]; + $params["city"] = $shop["city"]; + $params["district"] = $shop["district"]; + $params["longitude"] = $shop["longitude"]; + $params["latitude"] = $shop["latitude"]; + $params["address"] = $shop["address"]; + $params["address_detail"] = $shop["address_detail"]; + //address +// var_dump($params); + } + +; + + //收费免费判断 + if($params["price"]==0){ + $params["feel"] = "1"; + }else{ + + //个人认证无法下付费课程 + $shop = ManystoreShop::where("id",$shop_id)->find(); + if($shop["type"]=="1"){ + throw new \Exception("这个机构属于个人认证,无法发布付费课程!"); + } + + $params["feel"] = "0"; + } + + + //更新 + if($row){ + $this->have_auth = false; + if($this->need_auth){ + //判断更新的变动数据 + $this->no_auth_fields_check($params,$row); + + if($this->have_auth){ + $params['status'] = "3"; + $params['auth_status'] = "0"; + } + } + + $this->updateCheck($row->id,$params,$row); + + + //名称title不能与其他课程重复 + $check_title = self::where('id','<>',$row["id"])->where('title',$params["title"])->find(); + if($check_title){ + throw new \Exception("课程名称已存在或被其他机构占用,请更改!"); + } + + + }else{ + //新增 + + //名称title不能重复 + $check_title = $this->model->where('title',$params["title"])->find(); + if($check_title){ + throw new \Exception("课程名称已存在或被其他机构占用,请更改!"); + } + } + + //如果是上架,判断是否拥有课时规格,没有则无法上架 + if($params["status"]=="1" && empty($params["spec"])){ + if(!$row)throw new \Exception("新添加的课程请先至少添加一个课时规格后再上架!"); + //判断是否拥有课时规格,没有则无法上架 + $check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count(); + if(!$check_spec)throw new \Exception("新添加的课程请先至少添加一个课时规格后再上架!"); + + } + + } + + } diff --git a/application/common/model/school/classes/ClassesSpec.php b/application/common/model/school/classes/ClassesSpec.php index ca032fb..7099501 100644 --- a/application/common/model/school/classes/ClassesSpec.php +++ b/application/common/model/school/classes/ClassesSpec.php @@ -85,4 +85,119 @@ class ClassesSpec extends BaseModel { return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0); } + + + protected function specupdateCheck($id,$params=[],$row=null){ + if($params && $row){ + + if(!$this->no_auth_fields_check($params,$row)){ + return true; + } + } + + // 课程存在售后订单则不允许操作 + $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("存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!"); + } + + + public function specCheck(&$params,$shop_id=null,$row=null) + { + + //限定人数必须大于0 + $limit_num = $params["limit_num"]; + if($limit_num<=0){ + throw new \Exception("限定人数必须大于0"); + } + + + +//开始和结束时间不能为空 + $time = $params["time"]; + if(empty($time))throw new \Exception("请选择开始和结束时间"); + $split_line = " - "; + $time_arr = explode($split_line,$time); + $params["start_time"] = $time_arr[0]; + $params["end_time"] = $time_arr[1]; + unset($params["time"]); + + $start_time = $params["start_time"]; + $end_time = $params["end_time"]; + + if(empty($start_time) || empty($end_time)){ + throw new \Exception("请选择开始和结束时间"); + } + //转化时间戳 + $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("结束时间不能小于开始时间"); + } + + //结束时间不能是已经过去的时间 + $now_time = time(); + if($end_time<=$now_time){ + throw new \Exception("结束时间不能是已经过去的时间"); + } + + + $orderTimeTableName = (new ClassesSpec)->getWithAlisaName(); + //修改 + if($row){ + $this->specupdateCheck($row->id,$params,$row); + + //规格名字不能一样(同课程下) + $spec_name = $params["name"]; + $classes_lib_id = $params["classes_lib_id"]; + $spec_name_exist = ClassesSpec::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find(); + if($spec_name_exist){ + throw new \Exception("该课程下已存在该课时规格名称,请重新输入"); + } + + //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行) + $spec_time_exist = ClassesSpec::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) { + //兩個時間區間重合 存在任意交集 都不行 + $query->where("start_time BETWEEN {$start_time} AND {$end_time}"); + $query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}"); + $query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}"); + $query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}"); + }) + ->where("classes_lib_id",$classes_lib_id) + ->where("id","<>",$row->id)->find(); + + if($spec_time_exist){ + throw new \Exception("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠"); + } + + }else{ + + //规格名字不能一样(同课程下) + $spec_name = $params["name"]; + $classes_lib_id = $params["classes_lib_id"]; + $spec_name_exist = ClassesSpec::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find(); + if($spec_name_exist){ + throw new \Exception("该课程下已存在该课时规格名称,请重新输入"); + } + + //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行) + $spec_time_exist = ClassesSpec::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) { + //兩個時間區間重合 存在任意交集 都不行 + $query->where("start_time BETWEEN {$start_time} AND {$end_time}"); + $query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}"); + $query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}"); + $query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}"); + }) + ->where("classes_lib_id",$classes_lib_id) + ->find(); + + if($spec_time_exist){ + throw new \Exception("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠"); + } + + } + + + } + } diff --git a/application/common/model/school/classes/order/Detail.php b/application/common/model/school/classes/order/Detail.php index 3ef622f..56166ab 100644 --- a/application/common/model/school/classes/order/Detail.php +++ b/application/common/model/school/classes/order/Detail.php @@ -8,5 +8,41 @@ class Detail extends Model { // 表名 protected $name = 'school_classes_order_detail'; + + + + public function setImagesAttr($value, $data) + { + $imagesArray = $value; + if (!empty($value) && is_array($value)) { + //转成逗号拼接字符串 + $imagesArray = implode(',', $value); + } + return $imagesArray; + } + + + + + public function getHeadimageAttr($value, $data) + { + if (!empty($value)) return cdnurl($value, true); + } + + + public function getImagesAttr($value, $data) + { + $imagesArray = []; + if (!empty($value)) { + $imagesArray = explode(',', $value); + foreach ($imagesArray as &$v) { + $v = cdnurl($v, true); + } + return $imagesArray; + } + return $imagesArray; + } + + } diff --git a/application/common/model/school/classes/order/Order.php b/application/common/model/school/classes/order/Order.php index 106ded5..97b3da5 100644 --- a/application/common/model/school/classes/order/Order.php +++ b/application/common/model/school/classes/order/Order.php @@ -924,12 +924,14 @@ class Order extends BaseModel $lib->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","in",["-1","0"])->count(); $lib->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","=","3")->count(); $lib->save(); + + } //检测订单完成状态 self::statisticsAndUpdateOrderFinish($order->id); - - + //将课程信息和课时信息同步到所有已下单的订单信息中 + ClassesLib::orderInfoSync($order["classes_lib_id"]); return $order; } diff --git a/application/common/model/school/classes/order/OrderDetail.php b/application/common/model/school/classes/order/OrderDetail.php index 2572b54..df9bfb4 100644 --- a/application/common/model/school/classes/order/OrderDetail.php +++ b/application/common/model/school/classes/order/OrderDetail.php @@ -31,7 +31,30 @@ class OrderDetail extends BaseModel 'type_text', 'address_type_text' ]; - + + + + + + public function getHeadimageAttr($value, $data) + { + if (!empty($value)) return cdnurl($value, true); + } + + + public function getImagesAttr($value, $data) + { + $imagesArray = []; + if (!empty($value)) { + $imagesArray = explode(',', $value); + foreach ($imagesArray as &$v) { + $v = cdnurl($v, true); + } + return $imagesArray; + } + return $imagesArray; + } + public function getAddTypeList() @@ -74,6 +97,16 @@ class OrderDetail extends BaseModel } + public function setImagesAttr($value, $data) + { + $imagesArray = $value; + if (!empty($value) && is_array($value)) { + //转成逗号拼接字符串 + $imagesArray = implode(',', $value); + } + return $imagesArray; + } + public function classorder() diff --git a/application/manystore/controller/school/classes/ClassesLib.php b/application/manystore/controller/school/classes/ClassesLib.php index 36f63e4..0b24f3c 100644 --- a/application/manystore/controller/school/classes/ClassesLib.php +++ b/application/manystore/controller/school/classes/ClassesLib.php @@ -56,6 +56,11 @@ class ClassesLib extends ManystoreBase $this->view->assign("newList", $this->model->getNewList()); $this->view->assign("selfhotList", $this->model->getSelfhotList()); + + + $this->view->assign("specStatusList", (new \app\manystore\model\school\classes\ClassesSpec)->getStatusList()); + + } public function import() @@ -197,97 +202,29 @@ class ClassesLib extends ManystoreBase protected function update_check(&$params,$row=null) { - unset($params["auth_status"]); - if(!isset($params['status']))$params['status'] = "3"; + $shop_id = SHOP_ID; - $manystore = Manystore::where("shop_id",$shop_id)->find(); - if(!$manystore){ - $this->error("店铺不存在"); - } - $params["manystore_id"] = $manystore["id"]; - if(!(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_id))$this->error("您的认证信息未完善,请您先去完善!"); - //验证老师id - $teacher_id = $params['teacher_id']; - $teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find(); - if(!$teacher){ - $this->error("老师不存在"); - } - if(!$teacher["user_id"]){ - $this->error("当前老师没有前端用户!请换一个!"); - } - //老师与当前机构id不一致 - if($teacher["manystore_id"] != $manystore["id"]){ - $this->error("当前老师与当前机构不匹配,请换一个老师!"); + + try { + $classesLib = new \app\common\model\school\classes\ClassesLib(); + $classesLib->no_auth_fields = $this->no_auth_fields; + $classesLib->need_auth = $this->need_auth; + $classesLib->have_auth = $this->have_auth; + $classesLib->classesCheck($params,$shop_id,$row); + + $this->need_auth = $classesLib->need_auth; + $this->have_auth = $classesLib->have_auth; + + + + }catch (\Exception $e){ + $this->error($e->getMessage()); } - $params["user_id"] = $teacher["user_id"]; - //课时必须大于等于1 - if($params["classes_num"] < 1) $this->error("课时必须大于等于1"); - //售价必须大于0 - if($params["price"] < 0) $this->error("售价必须大于0"); - - - //独立地点需传定位信息 - if($params["address_type"] == "2"){ - if(empty($params["address_city"]) - || empty($params["province"]) - || empty($params["city"]) - || empty($params["district"]) - || empty($params["longitude"]) - || empty($params["address"]) - || empty($params["address_detail"]) - || empty($params["latitude"])) $this->error("独立地点需传定位信息"); - - }else{ - //地址取机构的 - $shop = ManystoreShop::where("id",$shop_id)->find(); - if(!$shop){ - $this->error("店铺不存在"); - } - - if(empty($shop["address_city"]) - || empty($shop["province"]) - || empty($shop["city"]) - || empty($shop["district"]) - || empty($shop["longitude"]) - || empty($shop["address"]) - || empty($shop["address_detail"]) - || empty($shop["latitude"])) $this->error("当前机构地址并未完善!请去【个人资料】完善信息"); - - - //地址取机构的 - $shop = ManystoreShop::where("id",$shop_id)->find(); - if(!$shop){ - $this->error("店铺不存在"); - } - $params["address_city"] = $shop["address_city"]; - $params["province"] = $shop["province"]; - $params["city"] = $shop["city"]; - $params["district"] = $shop["district"]; - $params["longitude"] = $shop["longitude"]; - $params["latitude"] = $shop["latitude"]; - $params["address"] = $shop["address"]; - $params["address_detail"] = $shop["address_detail"]; - - } - //收费免费判断 - if($params["price"]==0){ - $params["feel"] = "1"; - }else{ - //个人认证无法下付费课程 - $shop = ManystoreShop::where("id",$shop_id)->find(); - if($shop["type"]=="1"){ - $this->error("当前属于个人认证,无法发布付费课程!"); - } - - - $params["feel"] = "0"; - } - //特有认证判断 // $this->authClasses($params,$row); // var_dump($row);die; @@ -298,19 +235,6 @@ class ClassesLib extends ManystoreBase $this->error("平台下架审核的课程无法上架!"); } - $this->have_auth = false; - if($this->need_auth){ - //判断更新的变动数据 - $this->no_auth_fields_check($params,$row); - - if($this->have_auth){ - $params['status'] = "3"; - $params['auth_status'] = 0; - $params["reason"] = ""; - } - } - - $this->updateCheck($row->id,$params,$row); //如果是审核失败,提交后自动更新成审核中 if($row['auth_status'] == 2){ @@ -320,12 +244,6 @@ class ClassesLib extends ManystoreBase } - //名称title不能与其他课程重复 - $check_title = $this->model->where('id','<>',$row["id"])->where('title',$params["title"])->find(); - if($check_title){ - $this->error("课程名称已存在或被其他机构占用,请更改!"); - } - }else{ //新增(需审核) $params["add_type"] = '1'; @@ -333,23 +251,10 @@ class ClassesLib extends ManystoreBase $params['status'] = "3";//平台下架 $params['auth_status'] = 0; - //名称title不能重复 - $check_title = $this->model->where('title',$params["title"])->find(); - if($check_title){ - $this->error("课程名称已存在或被其他机构占用,请更改!"); - } + $this->have_auth = true; } - //如果是上架,判断是否拥有课时规格,没有则无法上架 - if($params["status"]=="1"){ - if(!$row)$this->error("新添加的课程请先至少添加一个课时规格后再上架!"); - //判断是否拥有课时规格,没有则无法上架 - $check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count(); - if(!$check_spec)$this->error("新添加的课程请先至少添加一个课时规格后再上架!"); - - } - @@ -360,6 +265,73 @@ class ClassesLib extends ManystoreBase } + + /** + * 添加 + * + * @return string + * @throws \think\Exception + */ + public function addnew() + { + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + $params = $this->preExcludeFields($params); + + if($this->storeIdFieldAutoFill && STORE_ID ){ + $params['store_id'] = STORE_ID; + } + + if($this->shopIdAutoCondition && SHOP_ID){ + $params['shop_id'] = SHOP_ID; + } + + $result = false; + Db::startTrans(); + try { + //是否采用模型验证 + if ($this->modelValidate) { + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate; + $this->model->validateFailException(true)->validate($validate); + } + $this->update_check($params,$row=null); + $result = $this->model->allowField(true)->save($params); + \app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]); + $this->update_classes($this->model["id"]); + if($this->have_auth){ + //调用通过事件 + $data = ['classes' => $this->model]; + \think\Hook::listen('classes_auth_need_after', $data); + + } + + + Db::commit(); + } catch (ValidateException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (PDOException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result !== false) { + $this->success(); + } else { + $this->error(__('No rows were inserted')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + return $this->view->fetch(); + } + + + /** * 添加 * diff --git a/application/manystore/controller/school/classes/ClassesSpec.php b/application/manystore/controller/school/classes/ClassesSpec.php index a412d26..66b9402 100644 --- a/application/manystore/controller/school/classes/ClassesSpec.php +++ b/application/manystore/controller/school/classes/ClassesSpec.php @@ -133,86 +133,17 @@ class ClassesSpec extends ManystoreBase protected function update_check(&$params,$row=null) { - $shop_id = SHOP_ID; - $manystore = Manystore::where("shop_id", $shop_id)->find(); - if (!$manystore) { - $this->error("店铺不存在"); + + try { + (new \app\common\model\school\classes\ClassesSpec)->specCheck($params,SHOP_ID,$row); + }catch (\Exception $e){ + $this->error($e->getMessage()); } - //开始和结束时间不能为空 - $start_time = $params["start_time"]; - $end_time = $params["end_time"]; - if(empty($start_time) || empty($end_time)){ - $this->error("请选择开始和结束时间"); - } - //转化时间戳 - $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){ - $this->error("结束时间不能小于开始时间"); - } - - //结束时间不能是已经过去的时间 - $now_time = time(); - if($end_time<=$now_time){ - $this->error("结束时间不能是已经过去的时间"); - } - - - $orderTimeTableName = $this->model->getWithAlisaName(); //修改 if($row){ $this->updateCheck($row->id,$params,$row); - - //规格名字不能一样(同课程下) - $spec_name = $params["name"]; - $classes_lib_id = $params["classes_lib_id"]; - $spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find(); - if($spec_name_exist){ - $this->error("该课程下已存在该课时规格名称,请重新输入"); - } - - //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行) - $spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) { - //兩個時間區間重合 存在任意交集 都不行 - $query->where("start_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}"); - $query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}"); - }) - ->where("classes_lib_id",$classes_lib_id) - ->where("id","<>",$row->id)->find(); - - if($spec_time_exist){ - $this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠"); - } - }else{ - - //规格名字不能一样(同课程下) - $spec_name = $params["name"]; - $classes_lib_id = $params["classes_lib_id"]; - $spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find(); - if($spec_name_exist){ - $this->error("该课程下已存在该课时规格名称,请重新输入"); - } - - //同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行) - $spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) { - //兩個時間區間重合 存在任意交集 都不行 - $query->where("start_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}"); - $query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}"); - $query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}"); - }) - ->where("classes_lib_id",$classes_lib_id) - ->find(); - - if($spec_time_exist){ - $this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠"); - } - } diff --git a/application/manystore/lang/zh-cn/general/profile.php b/application/manystore/lang/zh-cn/general/profile.php index c32b746..6a7b1ff 100644 --- a/application/manystore/lang/zh-cn/general/profile.php +++ b/application/manystore/lang/zh-cn/general/profile.php @@ -8,8 +8,8 @@ return [ 'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线', 'Please input length nickname' => '昵称请最多填写10个字符', - 'Front_idcard_image' => '身份证正面', - 'Reverse_idcard_image' => '身份证反面', + 'Front_idcard_image' => '身份证人像面', + 'Reverse_idcard_image' => '身份证国徽面', 'Auth_time' => '审核时间', 'Admin_id' => '审核管理员id', 'Type' => '认证类型', diff --git a/application/manystore/lang/zh-cn/school/classes/classes_spec.php b/application/manystore/lang/zh-cn/school/classes/classes_spec.php index 2d3e0a3..bfbacd6 100644 --- a/application/manystore/lang/zh-cn/school/classes/classes_spec.php +++ b/application/manystore/lang/zh-cn/school/classes/classes_spec.php @@ -3,9 +3,10 @@ return [ 'Classes_lib_id' => '课程id', 'Name' => '规格名', + 'Time' => '课时开始结束时间', 'Start_time' => '开始时间', 'End_time' => '结束时间', - 'Limit_num' => '本课时限定人数(0不限制)', + 'Limit_num' => '本课时限定人数', 'Sign_num' => '已报名人数', 'Verification_num' => '已核销人数', 'Status' => '状态', diff --git a/application/manystore/view/school/classes/classes_lib/add.html b/application/manystore/view/school/classes/classes_lib/add.html index 2b02ba3..d5f3993 100644 --- a/application/manystore/view/school/classes/classes_lib/add.html +++ b/application/manystore/view/school/classes/classes_lib/add.html @@ -240,12 +240,12 @@ -
      - -
      - -
      -
      + + + + + + diff --git a/application/manystore/view/school/classes/classes_lib/addnew.html b/application/manystore/view/school/classes/classes_lib/addnew.html new file mode 100644 index 0000000..37c9603 --- /dev/null +++ b/application/manystore/view/school/classes/classes_lib/addnew.html @@ -0,0 +1,415 @@ +
      + + + + + + + + + + + + + + + + + + + +
      + +
      + + +

      + (没找到讲师则点击按钮创建讲师后重新下拉框选讲师) + {:__('Add')} + +
      + +
      +
      + +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + + + + + + + + + + + + + + + + + + +
      + +
      + +
      +
      +
      + +
      +
      + +
      + + +
      + +
      +
        +
        +
        +
        + +
        +
        + +
        + + +
        + +
        +
          +
          +
          +
          + +
          + + + +
          +
          +
          + +
          + + (填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数) +
          +
          + + + + +
          + +
          + + + + + + + + + + + + + +
          规格名开始结束时间限定人数上架状态
          追加
          + (每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,后续有变更将触发审核机制!) + + +
          +
          + + + + + + + + + + + +
          + +
          +
          + {foreach name="addressTypeList" item="vo"} + + {/foreach} + ( 如果选独立位置需填写具体位置信息! ) +
          +
          +
          + + + + +
          +
          + +
          +
          + +
          + + + +
          +
          +
          + +
          +
          + +
          +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          + +
          + +
          +
          + +
          + + +
          + +
          + +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          + + + + + + + + + + + + + + + + + + + + + + + + + +
          + +
          + + ( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! ) +
          +
          + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
          + +
          + + + +
          +
          + +
          + \ No newline at end of file diff --git a/application/manystore/view/school/classes/classes_lib/edit.html b/application/manystore/view/school/classes/classes_lib/edit.html index 311a9b3..51d2157 100644 --- a/application/manystore/view/school/classes/classes_lib/edit.html +++ b/application/manystore/view/school/classes/classes_lib/edit.html @@ -159,6 +159,8 @@
          + (填写几节意味着客户购买课程后能预约上课核销几次,即购买本课程的课程节数) +
          @@ -246,12 +248,12 @@ -
          - -
          - -
          -
          + + + + + + @@ -271,19 +273,19 @@ -
          - -
          - -
          -
          + + + + + + -
          - -
          - -
          -
          + + + + + + diff --git a/application/manystore/view/school/classes/classes_lib/index.html b/application/manystore/view/school/classes/classes_lib/index.html index 3b07afe..b4defc2 100644 --- a/application/manystore/view/school/classes/classes_lib/index.html +++ b/application/manystore/view/school/classes/classes_lib/index.html @@ -28,6 +28,10 @@
          {:__('Add')} + + + {:__('新版添加')}(开发中) + {:__('Edit')} {:__('Delete')} diff --git a/application/manystore/view/school/classes/classes_spec/add.html b/application/manystore/view/school/classes/classes_spec/add.html index 9bea2a8..f41c16b 100644 --- a/application/manystore/view/school/classes/classes_spec/add.html +++ b/application/manystore/view/school/classes/classes_spec/add.html @@ -9,25 +9,37 @@
          - +
          -
          - + + + + +
          +
          - -
          -
          -
          - -
          - +
          + + + + + + + + + + + + + +
          - +
          diff --git a/application/manystore/view/school/classes/classes_spec/edit.html b/application/manystore/view/school/classes/classes_spec/edit.html index 6e7d90c..0bd36a4 100644 --- a/application/manystore/view/school/classes/classes_spec/edit.html +++ b/application/manystore/view/school/classes/classes_spec/edit.html @@ -9,25 +9,34 @@
          - +
          + +
          - +
          - -
          -
          -
          - -
          - +
          + + + + + + + + + + + + +
          - +
          diff --git a/public/assets/js/backend/school/classes/classes_lib.js b/public/assets/js/backend/school/classes/classes_lib.js index 858afe6..5a89925 100644 --- a/public/assets/js/backend/school/classes/classes_lib.js +++ b/public/assets/js/backend/school/classes/classes_lib.js @@ -7,6 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin extend: { index_url: 'school/classes/classes_lib/index' + location.search, add_url: 'school/classes/classes_lib/add'+ location.search, + addnew_url: 'school/classes/classes_lib/addnew'+ location.search, edit_url: 'school/classes/classes_lib/edit'+ location.search, del_url: 'school/classes/classes_lib/del', multi_url: 'school/classes/classes_lib/multi', @@ -203,6 +204,26 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin ] ] }); + $(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 = ['95%','95%']; + 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]")); // 为表格绑定事件 Table.api.bindevent(table); @@ -266,12 +287,47 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // 为表格绑定事件 Table.api.bindevent(table); + + }, add: function () { Controller.api.bindevent(); generrate.setOfflineType($("input:radio[name='row[address_type]']").val()); }, + addnew: function () { + + + //因为日期选择框不会触发change事件,导致无法刷新textarea,所以加上判断 + $(document).on("dp.change", "#add-form .datetimerange", function () { + $(this).parent().prev().find("input").trigger("change"); + }); + + $(document).on("dp.change", "#add-form .datetimepicker", function () { + $(this).parent().prev().find("input").trigger("change"); + }); + + $(document).on("fa.event.appendfieldlist", "#add-form .btn-append", function (e, obj) { + // Form.api.bindevent($("form[role=form]")); + // // //绑定动态下拉组件 + Form.events.selectpage(obj); + // // //绑定日期组件 + Form.events.daterangepicker(obj); + Form.events.datetimepicker(obj); + // // Form.events.datetimerange(obj); + // Form.api.bindevent(this); + // //绑定上传组件 + // Form.events.faupload(obj); + + // //上传成功回调事件,变更按钮的背景 + // $(".upload-image", obj).data("upload-success", function (data) { + // $(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')"); + // }) + }); + + generrate.setOfflineType($("input:radio[name='row[address_type]']").val()); + Controller.api.bindevent(); + }, edit: function () { Controller.api.bindevent(); }, @@ -317,7 +373,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var width = $(this).attr('data-width'); var height = $(this).attr('data-height'); // var ids = $(this).attr('data-id'); - var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%']; + var area = ['95%','95%']; var options = { shadeClose: false, shade: [0.3, '#393D49'], @@ -341,6 +397,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var generrate = { listen:function () { this.offlineListen(); + this.priceListen(); }, offlineListen:function () { var that = this; @@ -360,6 +417,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin break; } }, + priceListen:function () { + $('#spec').bind('input propertychange', function(){ + var length = $("#spec").val().length; + console.log(length); + }); + } } diff --git a/public/assets/js/manystore/school/classes/classes_lib.js b/public/assets/js/manystore/school/classes/classes_lib.js index 049d482..46a513e 100644 --- a/public/assets/js/manystore/school/classes/classes_lib.js +++ b/public/assets/js/manystore/school/classes/classes_lib.js @@ -7,6 +7,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin extend: { index_url: 'school/classes/classes_lib/index' + location.search, add_url: 'school/classes/classes_lib/add'+ location.search, + addnew_url: 'school/classes/classes_lib/addnew'+ location.search, edit_url: 'school/classes/classes_lib/edit'+ location.search, del_url: 'school/classes/classes_lib/del', multi_url: 'school/classes/classes_lib/multi', @@ -202,6 +203,29 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin ] }); + + $(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 = ['95%','95%']; + 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]")); + + // 为表格绑定事件 Table.api.bindevent(table); }, @@ -264,8 +288,45 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // 为表格绑定事件 Table.api.bindevent(table); + + + }, + addnew: function () { + + + //因为日期选择框不会触发change事件,导致无法刷新textarea,所以加上判断 + $(document).on("dp.change", "#add-form .datetimerange", function () { + $(this).parent().prev().find("input").trigger("change"); + }); + + $(document).on("dp.change", "#add-form .datetimepicker", function () { + $(this).parent().prev().find("input").trigger("change"); + }); + + $(document).on("fa.event.appendfieldlist", "#add-form .btn-append", function (e, obj) { + // Form.api.bindevent($("form[role=form]")); + // // //绑定动态下拉组件 + Form.events.selectpage(obj); + // // //绑定日期组件 + Form.events.daterangepicker(obj); + Form.events.datetimepicker(obj); + // // Form.events.datetimerange(obj); + // Form.api.bindevent(this); + // //绑定上传组件 + // Form.events.faupload(obj); + + // //上传成功回调事件,变更按钮的背景 + // $(".upload-image", obj).data("upload-success", function (data) { + // $(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')"); + // }) + }); + + + generrate.setOfflineType($("input:radio[name='row[address_type]']").val()); + Controller.api.bindevent(); + }, add: function () { Controller.api.bindevent(); generrate.setOfflineType($("input:radio[name='row[address_type]']").val()); @@ -314,8 +375,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var width = $(this).attr('data-width'); var height = $(this).attr('data-height'); // var ids = $(this).attr('data-id'); - var area = [$(window).width() > 800 ? (width?width:'800px') : '95%', $(window).height() > 600 ? (height?height:'600px') : '95%']; - var options = { + var area = ['95%','95%']; + var options = { shadeClose: false, shade: [0.3, '#393D49'], area: area, @@ -336,6 +397,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var generrate = { listen:function () { this.offlineListen(); + this.priceListen(); }, offlineListen:function () { var that = this; @@ -355,6 +417,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin break; } }, + priceListen:function () { + $('#spec').bind('input propertychange', function(){ + var length = $("#spec").val().length; + console.log(length); + }); + } } var classes_spec_url = function (row,dom) {