From 839555dd0f707423f8155f5710042c16a336588c Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Fri, 13 Dec 2024 18:37:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E9=A9=BB=E6=9C=BA=E6=9E=84=E5=AE=8C?= =?UTF-8?q?=E6=88=90,=E8=87=AA=E5=8A=A8=E5=B0=86=E7=94=B3=E8=AF=B7?= =?UTF-8?q?=E4=BA=BA=E7=BB=91=E5=AE=9A=E4=B8=BA=E8=AF=A5=E6=9C=BA=E6=9E=84?= =?UTF-8?q?=E7=9A=84=E8=80=81=E5=B8=88=20=E5=95=86=E5=AE=B6,=E5=8F=AF?= =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E5=8F=91=E8=B5=B7,=E5=B7=B2=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E8=AE=A2=E5=8D=95=E7=9A=84=E9=80=80=E6=AC=BE=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=20=E8=AF=BE=E7=A8=8B=E6=93=8D=E4=BD=9C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=88=E5=A2=9E=E5=8A=A0=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=EF=BC=89=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controller/manystore/Index.php | 37 +- .../controller/school/classes/ClassesLib.php | 8 + .../controller/school/classes/Evaluate.php | 213 ++++++++- .../controller/school/classes/order/Order.php | 2 +- .../admin/lang/zh-cn/manystore/index.php | 18 + .../lang/zh-cn/school/classes/classes_lib.php | 6 +- .../lang/zh-cn/school/classes/evaluate.php | 13 +- .../admin/model/school/classes/Evaluate.php | 10 +- .../admin/validate/manystore/Index.php | 6 +- .../admin/view/manystore/index/add.html | 176 ++++++-- .../admin/view/manystore/index/edit.html | 176 ++++++-- .../school/classes/classes_lib/index.html | 4 +- .../view/school/classes/evaluate/add.html | 69 ++- .../view/school/classes/evaluate/edit.html | 79 ++-- .../service_order/shop_confirmation.html | 4 +- application/api/controller/Index.php | 9 +- application/api/controller/User.php | 6 + application/api/controller/school/Classes.php | 3 + .../api/controller/school/worker/Classes.php | 222 +++++++++ .../controller/school/worker/ServiceOrder.php | 6 + application/common/hooks.php | 3 + application/common/library/Sqlscript.php | 8 +- .../common/listener/manystore/ShopHook.php | 4 + application/common/listener/user/UserHook.php | 13 +- application/common/model/BaseModel.php | 4 +- .../common/model/dyqc/ManystoreShop.php | 103 ++++- .../model/school/classes/ClassesLib.php | 424 +++++++++++++++++- .../model/school/classes/ClassesSpec.php | 3 +- .../common/model/school/classes/Evaluate.php | 11 +- .../model/school/classes/hourorder/Order.php | 19 +- .../model/school/classes/order/Order.php | 5 +- .../school/classes/order/ServiceOrder.php | 14 +- application/extra/upload.php | 4 +- .../manystore/controller/Dashboard.php | 3 + .../manystore/controller/general/Profile.php | 11 +- .../controller/school/classes/ClassesLib.php | 8 + .../controller/school/classes/Evaluate.php | 215 ++++++++- .../controller/school/classes/order/Order.php | 37 +- .../manystore/lang/zh-cn/general/profile.php | 18 +- .../lang/zh-cn/school/classes/classes_lib.php | 2 +- .../lang/zh-cn/school/classes/evaluate.php | 12 +- application/manystore/model/ManystoreShop.php | 27 ++ application/manystore/validate/Manystore.php | 12 +- .../manystore/view/dashboard/index.html | 2 + .../manystore/view/general/profile/index.html | 173 ++++++- .../school/classes/classes_lib/index.html | 5 +- .../view/school/classes/evaluate/index.html | 24 +- .../classes/order/order/after_sales.html | 21 + .../service_order/shop_confirmation.html | 4 +- public/assets/js/backend/manystore/index.js | 89 +++- .../js/backend/school/classes/classes_lib.js | 25 +- .../js/backend/school/classes/evaluate.js | 63 ++- .../js/backend/school/classes/order/order.js | 21 +- .../school/classes/order/service_order.js | 19 + .../js/backend/school/classes/teacher.js | 51 ++- public/assets/js/manystore/general/profile.js | 73 +++ .../manystore/school/classes/classes_lib.js | 28 +- .../js/manystore/school/classes/evaluate.js | 73 +-- .../manystore/school/classes/order/order.js | 43 ++ .../school/classes/order/service_order.js | 17 + .../js/manystore/school/classes/teacher.js | 54 ++- 61 files changed, 2530 insertions(+), 282 deletions(-) create mode 100644 application/api/controller/school/worker/Classes.php create mode 100644 application/manystore/view/school/classes/order/order/after_sales.html diff --git a/application/admin/controller/manystore/Index.php b/application/admin/controller/manystore/Index.php index 7da7b55..a32b36a 100644 --- a/application/admin/controller/manystore/Index.php +++ b/application/admin/controller/manystore/Index.php @@ -2,7 +2,11 @@ namespace app\admin\controller\manystore; +use app\admin\model\school\classes\ClassesLib; +use app\admin\model\school\classes\Teacher; +use app\admin\model\school\classes\Verification; use app\admin\model\User; +use app\common\model\manystore\Shop; use app\common\model\school\classes\Order; use app\manystore\model\Manystore; @@ -146,6 +150,12 @@ class Index extends Backend ->order($sort, $order) ->limit($offset, $limit) ->select(); + // $this->view->assign('check_full',(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_info->id)); + foreach ($list as $k => &$v){ + + $v["check_full"] = (new \app\common\model\dyqc\ManystoreShop)->checkFull($v["shop"]["id"]); + } + $result = array("total" => $total, "rows" => $list); @@ -231,6 +241,20 @@ class Index extends Backend $order = Order::where("manystore_id",$id)->where("status","in","0,3")->find(); if($order)throw new \Exception("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!"); // 课程存在售后订单则不允许操作 + //有课程不允许删 + $classesLib = ClassesLib::where("manystore_id",$id)->find(); + if($classesLib)throw new \Exception("请先删除课程后再删除机构!"); + //有老师不允许删 + $teacher = Teacher::where("manystore_id",$id)->find(); + if($teacher)throw new \Exception("请先删除老师后再删除机构!"); + //有核销员不允许删 + $verification = Verification::where("manystore_id",$id)->find(); + if($verification)throw new \Exception("请先删除核销员后再删除机构!"); + $shop_id = Manystore::where("id",$id)->value("shop_id"); + //有授权用户不允许删 + $auth = \app\common\model\manystore\UserAuth::where("shop_id",$shop_id)->find(); + if($auth)throw new \Exception("请先删除授权用户后再删除机构!"); + } @@ -245,7 +269,11 @@ class Index extends Backend if(!$shop["user_id"])throw new \Exception("认证用户不存在!"); $user = User::get($shop["user_id"]); if(!$user) throw new \Exception("认证用户不存在!"); - if($shop["address_city"] && !$shop["province"])throw new Exception("请选择所在城市"); + if($shop["address_city"] && !$shop["district"])throw new Exception("请选择所在城市"); + + //账号昵称和头像取用户的 + $params["nickname"] = $user["realname"] ?: $user["nickname"]; + $params["avatar"] = $user["avatar"] ?:"/assets/img/avatar.png"; @@ -340,7 +368,7 @@ class Index extends Backend $params['shop_id'] = $this->shopModel->id; $params['salt'] = Random::alnum(); $params['password'] = md5(md5($params['password']) . $params['salt']); - $params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。 + if(empty($params['avatar']))$params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。 $params['is_main'] = 1; $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); @@ -485,6 +513,11 @@ class Index extends Backend } $this->view->assign("row", $row); $this->view->assign("shop", $shop_info); + $this->view->assign('check_full',(new \app\common\model\dyqc\ManystoreShop)->checkFull($shop_info->id)); + $this->view->assign('check_full_msg',(new \app\common\model\dyqc\ManystoreShop)->checkFullMsg($shop_info->id)); + + + $this->view->assign("groupids", $groupids); return $this->view->fetch(); } diff --git a/application/admin/controller/school/classes/ClassesLib.php b/application/admin/controller/school/classes/ClassesLib.php index 6ae2ec3..94a47cf 100644 --- a/application/admin/controller/school/classes/ClassesLib.php +++ b/application/admin/controller/school/classes/ClassesLib.php @@ -4,6 +4,7 @@ namespace app\admin\controller\school\classes; use app\admin\model\dyqc\ManystoreShop; use app\common\controller\Backend; +use app\common\model\school\classes\lib\Spec; use app\common\model\school\classes\Order; use app\manystore\model\Manystore; use think\Db; @@ -211,6 +212,9 @@ class ClassesLib extends Backend $order = Order::where("classes_lib_id",$id)->where("status","in","0,3")->find(); if($order)$this->error("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!"); // 课程存在售后订单则不允许操作 + + + } @@ -571,6 +575,10 @@ class ClassesLib extends Backend Db::startTrans(); try { foreach ($list as $item) { + //删除课程规格 + Spec::where("classes_lib_id",$item->id)->delete(); + + $count += $item->delete(); } Db::commit(); diff --git a/application/admin/controller/school/classes/Evaluate.php b/application/admin/controller/school/classes/Evaluate.php index 79413d4..69b82ca 100644 --- a/application/admin/controller/school/classes/Evaluate.php +++ b/application/admin/controller/school/classes/Evaluate.php @@ -3,6 +3,16 @@ namespace app\admin\controller\school\classes; use app\common\controller\Backend; +use app\common\model\manystore\UserAuth; +use app\common\model\User; +use app\manystore\model\Manystore; +use think\Db; +use think\db\exception\DataNotFoundException; +use think\db\exception\ModelNotFoundException; +use think\Exception; +use think\exception\DbException; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 课程反馈管理 @@ -19,7 +29,7 @@ class Evaluate extends Backend protected $model = null; protected $qSwitch = true; - protected $qFields = ["user_id","classes_lib_id","classes_order_id","manystore_id","shop_id","teacher_id"]; + protected $qFields = ["user_id","classes_lib_id","classes_order_id","manystore_id","shop_id","teacher_id","image","nickname"]; public function _initialize() { @@ -78,4 +88,205 @@ class Evaluate extends Backend return $this->view->fetch(); } + + + protected function updateCheck($id,$params=[],$row=null){ + + // 课程存在售后订单则不允许操作 + } + + protected function update_after(&$row) + { + //重新统计总评分 + \app\common\model\school\classes\Evaluate::evaluateStatistics($row["id"]); + if($row["classes_order_id"]){ + $order = \app\common\model\school\classes\order\Order::get($row["classes_order_id"]); + if($order){ + if(!$order["classes_evaluate_id"])$order->save(["classes_evaluate_id"=>$row["classes_order_id"]]); + } + } + } + + + protected function update_check(&$params,$row=null) + { + + $shop_id = $params["shop_id"]; + $manystore = Manystore::where("shop_id",$shop_id)->find(); + if(!$manystore){ + $this->error("店铺不存在"); + } + //用户不存在 + $user_id = $params["user_id"]; + $user = User::where("id",$user_id)->find(); +// if(!$user){ +// $this->error("用户不存在"); +// } + $params["classes_star"] = bcdiv($params["classes_star"],10,1); + $params["teacher_star"] = bcdiv($params["teacher_star"],10,1); + $params["shop_star"] = bcdiv($params["shop_star"],10,1); + //修改 + if($row){ + + }else{ + //新增 + + } + + + + + + + + $params["manystore_id"] = $manystore["id"]; + } + + + /** + * 添加 + * + * @return string + * @throws \think\Exception + */ + public function add() + { + 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); + $this->update_after($this->model); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + + /** + * 编辑 + * + * @param $ids + * @return string + * @throws DbException + * @throws \think\Exception + */ + public function edit($ids = null) + { + $row = $this->model->get($ids); + if (!$row) { + $this->error(__('No Results were found')); + } + $adminIds = $this->getDataLimitAdminIds(); + if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) { + $this->error(__('You have no permission')); + } + if (false === $this->request->isPost()) { + $this->view->assign('row', $row); + 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); + + + + $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 . '.edit' : $name) : $this->modelValidate; + $row->validateFailException()->validate($validate); + } + $this->update_check($params,$row); + $result = $row->allowField(true)->save($params); + $this->update_after($row); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if (false === $result) { + $this->error(__('No rows were updated')); + } + $this->success(); + } + + /** + * 删除 + * + * @param $ids + * @return void + * @throws DbException + * @throws DataNotFoundException + * @throws ModelNotFoundException + */ + public function del($ids = null) + { + if (false === $this->request->isPost()) { + $this->error(__("Invalid parameters")); + } + $ids = $ids ?: $this->request->post("ids"); + if (empty($ids)) { + $this->error(__('Parameter %s can not be empty', 'ids')); + } + $pk = $this->model->getPk(); + $adminIds = $this->getDataLimitAdminIds(); + if (is_array($adminIds)) { + $this->model->where($this->dataLimitField, 'in', $adminIds); + } + $list = $this->model->where($pk, 'in', $ids)->select(); + foreach ($list as $item) { + $this->updateCheck($item->id); + } + + + $count = 0; + Db::startTrans(); + try { + foreach ($list as $item) { + $count += $item->delete(); + } + Db::commit(); + } catch (PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($count) { + $this->success(); + } + $this->error(__('No rows were deleted')); + } + + } diff --git a/application/admin/controller/school/classes/order/Order.php b/application/admin/controller/school/classes/order/Order.php index c43a9ed..447277a 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',"feel"]); + $row->getRelation('detail')->visible(['title','headimage',"feel","teacher_id"]); $row->getRelation('admin')->visible(['nickname','avatar']); } diff --git a/application/admin/lang/zh-cn/manystore/index.php b/application/admin/lang/zh-cn/manystore/index.php index 713b15d..4698ed7 100644 --- a/application/admin/lang/zh-cn/manystore/index.php +++ b/application/admin/lang/zh-cn/manystore/index.php @@ -9,6 +9,7 @@ return [ 'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线', 'Please input length nickname' => '昵称请最多填写10个字符', 'Loss_ratio' => '课程损耗比(百分制)', + "Login successful" => '机构后台已自动登录成功!', 'user_id' => '申请用户', 'Logo' => 'Logo', @@ -51,4 +52,21 @@ return [ 'Type 1' => '个人认证', 'Type 2' => '机构认证', 'Desc' => '申请备注', + + "Establish_time" => '成立时间', + "People" => '员工人数', + "Legal_entity" => '法人姓名', + "Gender" => '性别', + "Nation" => '民族', + "Out_look" => '政治面貌', + "Birthtime" => '出生日期', + "Native_place" => '籍贯', + "Card_number" => '身份证号码', + "Diploma" => '学历', + "Post" => '职务', + "Social_position" => '社会职务', + //Male'), '0'=>__('Female' + 'Male' => '男', + 'Female' => '女', + ]; 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 447c165..ef9bcd5 100644 --- a/application/admin/lang/zh-cn/school/classes/classes_lib.php +++ b/application/admin/lang/zh-cn/school/classes/classes_lib.php @@ -2,7 +2,7 @@ return [ 'Manystore_id' => '机构账号id', - 'Shop_id' => '机构店铺id', + 'Shop_id' => '机构id', 'User_id' => '主讲师用户id', 'Classes_cate_ids' => '标签', 'Classes_label_ids' => '热门', @@ -79,8 +79,8 @@ return [ 'Shop.province' => '省编号', 'Shop.city' => '市编号', 'Shop.district' => '县区编号', - 'Shop.address' => '店铺地址', - 'Shop.address_detail' => '店铺详细地址', + 'Shop.address' => '机构地址', + 'Shop.address_detail' => '机构详细地址', 'User.nickname' => '昵称', 'User.realname' => '真实姓名', 'User.mobile' => '手机号', diff --git a/application/admin/lang/zh-cn/school/classes/evaluate.php b/application/admin/lang/zh-cn/school/classes/evaluate.php index 2824325..909256c 100644 --- a/application/admin/lang/zh-cn/school/classes/evaluate.php +++ b/application/admin/lang/zh-cn/school/classes/evaluate.php @@ -1,12 +1,13 @@ '评价用户id', - 'Classes_lib_id' => '课程id', - 'Classes_order_id' => '课程订单id', - 'Manystore_id' => '机构账号id', - 'Shop_id' => '机构店铺id', - 'Teacher_id' => '老师id', + 'User_id' => '评价用户', + 'Add' => '添加虚拟反馈', + 'Classes_lib_id' => '课程', + 'Classes_order_id' => '课程订单', + 'Manystore_id' => '机构账号', + 'Shop_id' => '机构店铺', + 'Teacher_id' => '老师', 'Image' => '评价人头像', 'Nickname' => '评价人昵称', 'Classes_star' => '课程评分', diff --git a/application/admin/model/school/classes/Evaluate.php b/application/admin/model/school/classes/Evaluate.php index 84e161f..037c0fc 100644 --- a/application/admin/model/school/classes/Evaluate.php +++ b/application/admin/model/school/classes/Evaluate.php @@ -62,6 +62,12 @@ class Evaluate extends Model } + protected function setEvaluateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + public function getStatusTextAttr($value, $data) { $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); @@ -77,10 +83,6 @@ class Evaluate extends Model return isset($list[$value]) ? $list[$value] : ''; } - protected function setEvaluateTimeAttr($value) - { - return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); - } public function user() diff --git a/application/admin/validate/manystore/Index.php b/application/admin/validate/manystore/Index.php index 4552495..67cec26 100644 --- a/application/admin/validate/manystore/Index.php +++ b/application/admin/validate/manystore/Index.php @@ -33,15 +33,15 @@ class Index extends Validate * 验证场景 */ protected $scene = [ - 'add' => ['username', 'email', 'nickname', 'password'], - 'edit' => ['email', 'nickname', 'password'], + 'add' => ['username', 'email', 'password'], + 'edit' => ['email', 'password'], ]; public function __construct(array $rules = [], $message = [], $field = []) { $this->field = [ 'username' => __('Username'), - 'nickname' => __('Nickname'), +// 'nickname' => __('Nickname'), 'password' => __('Password'), 'email' => __('Email'), ]; diff --git a/application/admin/view/manystore/index/add.html b/application/admin/view/manystore/index/add.html index 1d870b6..7e786cb 100644 --- a/application/admin/view/manystore/index/add.html +++ b/application/admin/view/manystore/index/add.html @@ -23,12 +23,12 @@ -