From 758e1ffbf2f421aedc5df97bb0b39b81b6d8621e Mon Sep 17 00:00:00 2001 From: 15090180611 <215509543@qq.com> Date: Fri, 20 Dec 2024 18:14:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9C=E6=A0=A1=E5=AE=8C=E5=96=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../school/classes/ActivityDemo.php | 274 ++++++++++++++++++ .../controller/school/classes/ClassesLib.php | 6 +- application/admin/controller/user/User.php | 2 + .../zh-cn/school/classes/activity_demo.php | 32 ++ application/admin/model/User.php | 2 +- .../model/school/classes/ActivityDemo.php | 112 +++++++ .../validate/school/classes/ActivityDemo.php | 27 ++ .../validate/school/classes/ClassesLib.php | 21 +- .../school/classes/activity_demo/add.html | 203 +++++++++++++ .../school/classes/activity_demo/edit.html | 196 +++++++++++++ .../school/classes/activity_demo/index.html | 46 +++ .../classes/activity_demo/recyclebin.html | 25 ++ application/admin/view/user/user/index.html | 3 + application/api/controller/User.php | 20 +- .../api/controller/school/Activity.php | 104 +++++++ .../api/controller/school/worker/Common.php | 3 +- .../model/school/classes/ActivityDemo.php | 221 ++++++++++++++ .../model/school/classes/order/Order.php | 2 +- .../controller/school/classes/ClassesLib.php | 4 + .../manystore/controller/user/User.php | 3 +- .../manystore/lang/zh-cn/user/user.php | 2 + .../validate/school/classes/ClassesLib.php | 20 +- .../manystore/view/user/user/index.html | 3 + extend/bw/Common.php | 4 +- public/assets/js/backend/manystore/index.js | 3 +- .../backend/school/classes/activity_demo.js | 204 +++++++++++++ .../js/backend/school/classes/classes_lib.js | 21 ++ .../js/backend/school/classes/evaluate.js | 83 +++++- .../backend/school/classes/hourorder/order.js | 59 ++++ .../js/backend/school/classes/order/order.js | 44 ++- .../school/classes/order/service_order.js | 38 +++ .../js/backend/school/classes/teacher.js | 19 +- .../js/backend/school/classes/verification.js | 26 +- public/assets/js/backend/user/user.js | 2 +- .../js/manystore/school/classes/evaluate.js | 84 +++++- .../school/classes/hourorder/order.js | 36 +++ .../manystore/school/classes/order/order.js | 28 +- .../school/classes/order/service_order.js | 19 ++ public/assets/js/manystore/user/user.js | 1 + 39 files changed, 1977 insertions(+), 25 deletions(-) create mode 100644 application/admin/controller/school/classes/ActivityDemo.php create mode 100644 application/admin/lang/zh-cn/school/classes/activity_demo.php create mode 100644 application/admin/model/school/classes/ActivityDemo.php create mode 100644 application/admin/validate/school/classes/ActivityDemo.php create mode 100644 application/admin/view/school/classes/activity_demo/add.html create mode 100644 application/admin/view/school/classes/activity_demo/edit.html create mode 100644 application/admin/view/school/classes/activity_demo/index.html create mode 100644 application/admin/view/school/classes/activity_demo/recyclebin.html create mode 100644 application/api/controller/school/Activity.php create mode 100644 application/common/model/school/classes/ActivityDemo.php create mode 100644 public/assets/js/backend/school/classes/activity_demo.js diff --git a/application/admin/controller/school/classes/ActivityDemo.php b/application/admin/controller/school/classes/ActivityDemo.php new file mode 100644 index 0000000..7b2f813 --- /dev/null +++ b/application/admin/controller/school/classes/ActivityDemo.php @@ -0,0 +1,274 @@ +model = new \app\admin\model\school\classes\ActivityDemo; + parent::_initialize(); + $this->getCity(); + $this->view->assign("statusList", $this->model->getStatusList()); + $this->view->assign("itemStatusList", $this->model->getItemStatusList()); + $this->view->assign("sexList", $this->model->getSexList()); + //getItemStatusList + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + + + + + + protected function updateCheck($id,$params=[],$row=null){ + + // 课程存在售后订单则不允许操作 + } + + + protected function update_check(&$params,$row=null) + { + + +//开始和结束时间不能为空 + $time = $params["time"]; + + if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time); + $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("{$params["title"]}请选择开始和结束时间".$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("{$params["title"]}结束时间不能小于开始时间"); + } + + + + + + + //开始和结束时间不能为空 + $time = $params["sign_time"]; + + if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time); + $split_line = " - "; + $time_arr = explode($split_line,$time); + $params["sign_start_time"] = $time_arr[0] ; + $params["sign_end_time"] = $time_arr[1]; + unset($params["sign_time"]); + + $start_time = $params["sign_start_time"]; + $end_time = $params["sign_end_time"]; + + if(empty($start_time) || empty($end_time)){ + throw new \Exception("{$params["title"]}请选择开始和结束时间".$time); + } + //转化时间戳 + $start_time = $params["sign_start_time"] && !is_numeric($params["sign_start_time"]) ? strtotime($params["sign_start_time"]) : $params["sign_start_time"]; + $end_time = $params["sign_end_time"] && !is_numeric($params["sign_end_time"]) ? strtotime($params["sign_end_time"]) : $params["sign_end_time"]; + //结束时间不能小于开始时间 + if($end_time<=$start_time){ + throw new \Exception("{$params["title"]}结束时间不能小于开始时间"); + } + + + + + //修改 + if($row){ + + }else{ + //新增 + + } + + } + + + /** + * 添加 + * + * @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); + Db::commit(); + } catch (ValidateException|PDOException|Exception $e) { + Db::rollback(); + $this->error($e->getMessage().$e->getFile().$e->getLine()); + } + 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); + 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/ClassesLib.php b/application/admin/controller/school/classes/ClassesLib.php index f155f10..0eecd7d 100644 --- a/application/admin/controller/school/classes/ClassesLib.php +++ b/application/admin/controller/school/classes/ClassesLib.php @@ -29,7 +29,10 @@ class ClassesLib extends Backend protected $qSwitch = true; protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"]; - + /** + * 是否开启Validate验证 + */ + protected $modelValidate = true; /** * ClassesLib模型对象 @@ -508,6 +511,7 @@ class ClassesLib extends Backend 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); } diff --git a/application/admin/controller/user/User.php b/application/admin/controller/user/User.php index 371aa0c..12db2f0 100644 --- a/application/admin/controller/user/User.php +++ b/application/admin/controller/user/User.php @@ -27,6 +27,8 @@ class User extends Backend { parent::_initialize(); $this->model = new \app\admin\model\User; + $this->view->assign("genderListJson", json_encode($this->model->getGenderList(), JSON_UNESCAPED_UNICODE)); + } /** diff --git a/application/admin/lang/zh-cn/school/classes/activity_demo.php b/application/admin/lang/zh-cn/school/classes/activity_demo.php new file mode 100644 index 0000000..0bf0681 --- /dev/null +++ b/application/admin/lang/zh-cn/school/classes/activity_demo.php @@ -0,0 +1,32 @@ + '标题', + 'Headimage' => '头图', + 'Images' => '轮播图', + 'Address_city' => '城市选择', + 'Province' => '省编号', + 'City' => '市编号', + 'District' => '县区编号', + 'Address' => '活动地址', + 'Address_detail' => '活动详细地址', + 'Longitude' => '经度', + 'Latitude' => '纬度', + 'Start_time' => '活动开始时间', + 'End_time' => '活动结束时间', + 'Sign_start_time' => '报名开始时间', + 'Sign_end_time' => '报名结束时间', + 'Status' => '状态', + 'Status 1' => '报名中', + 'Set status to 1' => '设为报名中', + 'Status 2' => '已结束', + 'Set status to 2' => '设为已结束', + 'Price' => '报名费用', + 'People_num' => '活动人数', + 'Item' => '活动项目', + 'Content' => '活动详情', + 'Item_json' => '活动报名项目', + 'Createtime' => '创建时间', + 'Updatetime' => '修改时间', + 'Deletetime' => '删除时间' +]; diff --git a/application/admin/model/User.php b/application/admin/model/User.php index 4a8f0c7..1688bc3 100644 --- a/application/admin/model/User.php +++ b/application/admin/model/User.php @@ -59,7 +59,7 @@ class User extends Model public function getGenderList() { - return ['1' => __('Male'), '0' => __('Female')]; + return [ 1 => __('Male'), 0 => __('Female')]; } public function getStatusList() diff --git a/application/admin/model/school/classes/ActivityDemo.php b/application/admin/model/school/classes/ActivityDemo.php new file mode 100644 index 0000000..6b912a8 --- /dev/null +++ b/application/admin/model/school/classes/ActivityDemo.php @@ -0,0 +1,112 @@ + __('Status 1'), '2' => __('Status 2')]; + } + + public function getItemStatusList() + { + return ['1' => __('已满'), '2' => __('未满')]; + } + + public function getSexList() + { + return ['1' => __('男'), '2' => __('女'), '3' => __('男女不限')]; + } + + + + + + public function getStartTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getEndTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getSignStartTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['sign_start_time']) ? $data['sign_start_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getSignEndTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['sign_end_time']) ? $data['sign_end_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] : ''; + } + + protected function setStartTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setEndTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setSignStartTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setSignEndTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + +} diff --git a/application/admin/validate/school/classes/ActivityDemo.php b/application/admin/validate/school/classes/ActivityDemo.php new file mode 100644 index 0000000..b32f266 --- /dev/null +++ b/application/admin/validate/school/classes/ActivityDemo.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/school/classes/ClassesLib.php b/application/admin/validate/school/classes/ClassesLib.php index 1110853..93d0a60 100644 --- a/application/admin/validate/school/classes/ClassesLib.php +++ b/application/admin/validate/school/classes/ClassesLib.php @@ -10,18 +10,33 @@ class ClassesLib extends Validate * 验证规则 */ protected $rule = [ + 'title' => 'require|length:1,50|alphaNum', + // 'alphaNum' 是自定义的规则,用于过滤中文、数字和拼音字符 ]; /** * 提示消息 */ protected $message = [ + 'title.require' => '课程名不能为空', + 'title.length' => '课程名长度必须在1到50之间', + 'title.alphaNum' =>'课程名只允许中文、数字和拼音字符' ]; /** * 验证场景 */ protected $scene = [ - 'add' => [], - 'edit' => [], + 'add' => ["title"], + 'edit' => ["title"], ]; - + + // 自定义验证规则 + protected function alphaNum($value, $rule, $data = []) + { + $pattern = '/^[\x{4e00}-\x{9fa5}\d]+$/u'; // 正则表达式,匹配中文和数字 + if (preg_match($pattern, $value)) { + return true; + } else { + return false; + } + } } diff --git a/application/admin/view/school/classes/activity_demo/add.html b/application/admin/view/school/classes/activity_demo/add.html new file mode 100644 index 0000000..466a737 --- /dev/null +++ b/application/admin/view/school/classes/activity_demo/add.html @@ -0,0 +1,203 @@ +
+ +
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      + + + + +
      + +
      +
      + +
      + + + +
      +
      +
      + +
      +
      + +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      + +
      + +
      +
      + + +
      + +
      + +
      +
      + + +
      + +
      + +
      +
      + + + + + +
      + +
      + +
      + {foreach name="statusList" item="vo"} + + {/foreach} +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      + + +
      + +
      + + + + + + + + + + + + + + + + +
      活动项名开始结束时间限定人数年龄限制报名是否已满男女价格
      追加
      + + + +
      +
      + + + + + +
      diff --git a/application/admin/view/school/classes/activity_demo/edit.html b/application/admin/view/school/classes/activity_demo/edit.html new file mode 100644 index 0000000..bd51cf6 --- /dev/null +++ b/application/admin/view/school/classes/activity_demo/edit.html @@ -0,0 +1,196 @@ +
      + +
      + +
      + +
      +
      +
      + +
      +
      + +
      + + +
      + +
      +
        +
        +
        +
        + +
        +
        + +
        + + +
        + +
        +
          +
          +
          + + +
          + +
          +
          + +
          + + + +
          +
          +
          + +
          +
          + +
          +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          + +
          + +
          +
          + + + +
          + +
          + +
          +
          + +
          + +
          + +
          +
          + + +
          + +
          + +
          + {foreach name="statusList" item="vo"} + + {/foreach} +
          + +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          +
          + +
          + +
          +
          + + +
          + +
          + + + + + + + + + + + + + + + + +
          活动项名开始结束时间限定人数年龄限制报名是否已满男女价格
          追加
          + + + +
          +
          + + + +
          diff --git a/application/admin/view/school/classes/activity_demo/index.html b/application/admin/view/school/classes/activity_demo/index.html new file mode 100644 index 0000000..424de4e --- /dev/null +++ b/application/admin/view/school/classes/activity_demo/index.html @@ -0,0 +1,46 @@ +
          + +
          + {:build_heading(null,FALSE)} + +
          + + +
          +
          +
          +
          +
          + + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + {:__('Recycle bin')} +
          + +
          +
          +
          + +
          +
          +
          diff --git a/application/admin/view/school/classes/activity_demo/recyclebin.html b/application/admin/view/school/classes/activity_demo/recyclebin.html new file mode 100644 index 0000000..31c7015 --- /dev/null +++ b/application/admin/view/school/classes/activity_demo/recyclebin.html @@ -0,0 +1,25 @@ +
          + {:build_heading()} + +
          +
          +
          + +
          + +
          +
          +
          diff --git a/application/admin/view/user/user/index.html b/application/admin/view/user/user/index.html index 33dbe04..547b9ce 100644 --- a/application/admin/view/user/user/index.html +++ b/application/admin/view/user/user/index.html @@ -28,3 +28,6 @@ + diff --git a/application/api/controller/User.php b/application/api/controller/User.php index c9ea99d..9ee2b72 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -94,6 +94,8 @@ class User extends Api $this->error(__('Params error')); } $result = LoginService::getInstance(['mini_config' => $this->miniConfig])->decodeData($iv,$sessionKey,$encryptedData); + $info = empty($result["phoneNumber"]) ? ($result["purePhoneNumber"] ?? '' ) : $result["phoneNumber"]; + Cache::set('wechat_miniapp_core'.$info,"1",60); $this->success('',$result); } @@ -128,9 +130,20 @@ class User extends Api if(empty($code)){ $this->error(__('缺少code')); } + //手机号变必填 +// if(empty($extend['mobile'])){ +// $this->error(__('未传手机号')); +// } + + $wechat_mini_code = Cache::get("{$platform}_{$params['apptype']}_code".$code.$params['openid']); if(!$wechat_mini_code)$this->error("授权code已过期或已使用,请重新发起授权!",['errcode'=>30002]); + if($extend['mobile']){ + $wechat_mini_mobile = Cache::get("{$platform}_{$params['apptype']}_core".$extend['mobile']); + if(!$wechat_mini_mobile)$this->error("授权手机号已过期或已使用,请重新发起授权!",['errcode'=>30002]); + } + //推荐人:逻辑未实现 @@ -144,7 +157,12 @@ class User extends Api Log::log($e->getMessage()); $this->error($e->getMessage(),['errcode'=>$e->getCode()]); } - Cache::rm('wechat_mini_code'.$code.$params['openid']); + Cache::rm("{$platform}_{$params['apptype']}_code".$code.$params['openid']); + + if($extend['mobile']){ + Cache::rm("{$platform}_{$params['apptype']}_core".$extend['mobile']); + } + $this->success('获取成功', ['token' => $this->auth->getToken()]); } diff --git a/application/api/controller/school/Activity.php b/application/api/controller/school/Activity.php new file mode 100644 index 0000000..7d1d5ca --- /dev/null +++ b/application/api/controller/school/Activity.php @@ -0,0 +1,104 @@ +model = new ActivityDemo(); + parent::_initialize(); + + //判断登录用户是否是员工 + } + + + /** + * @ApiTitle( 活动demo数据详情) + * @ApiSummary(活动demo数据详情) + * @ApiMethod(GET) + * @ApiParams(name = "id", type = "int",required=true,description = "活动demo数据id") + * @ApiReturn({ + * + *}) + */ + public function demo_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( 活动demo数据列表(取决于搜索条件)) + * @ApiSummary(活动demo数据列表(取决于搜索条件)) + * @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 = "status", type = "string",required=false,description = "状态:1=报名中,2=已结束") + * @ApiReturn({ + * + *}) + */ + public function demo_list() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params=[]; + $page = $this->request->get('page/d', 0); //页数 + $limit = $this->request->get('limit/d', 0); //条数 + $params['keywords'] = $this->request->get('keywords/s', ''); //搜索关键字 + $params['status'] = $this->request->get('status/s', ''); //搜索关键字 + + + +// $type = $this->request->get('type/s', ''); //筛选学员和教练单 + + try{ + //当前申请状态 + $res = $this->model::allList($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); + } + + +} + diff --git a/application/api/controller/school/worker/Common.php b/application/api/controller/school/worker/Common.php index 5240600..c887444 100644 --- a/application/api/controller/school/worker/Common.php +++ b/application/api/controller/school/worker/Common.php @@ -8,6 +8,7 @@ use app\common\exception\UploadException; use app\common\library\Upload; use app\common\library\Virtual; use app\common\model\Area; +use app\common\model\ManystoreAttachment; use app\common\model\school\classes\ClassesLib; use app\common\model\Version; use fast\Random; @@ -189,7 +190,7 @@ class Common extends Base 'sha1' => $sha1, 'extparam' => json_encode($extparam), ); - $attachment = model("ManystoreAttachment"); + $attachment = new ManystoreAttachment; $attachment->data(array_filter($params)); $attachment->save(); \think\Hook::listen("upload_after", $attachment); diff --git a/application/common/model/school/classes/ActivityDemo.php b/application/common/model/school/classes/ActivityDemo.php new file mode 100644 index 0000000..448e021 --- /dev/null +++ b/application/common/model/school/classes/ActivityDemo.php @@ -0,0 +1,221 @@ + __('Status 1'), '2' => __('Status 2')]; + } + + public function getItemStatusList() + { + return ['1' => __('已满'), '2' => __('未满')]; + } + + public function getSexList() + { + return ['1' => __('男'), '2' => __('女'), '3' => __('男女不限')]; + } + + + + + + public function getStartTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getEndTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getSignStartTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['sign_start_time']) ? $data['sign_start_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getSignEndTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['sign_end_time']) ? $data['sign_end_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] : ''; + } + + protected function setStartTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setEndTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setSignStartTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setSignEndTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + + public function getItemJsonAttr($value, $data) + { + return $value === '' ? [] : json_decode($value, true); + } + + + + + 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 setImagesAttr($value, $data) + { + $imagesArray = $value; + if (!empty($value) && is_array($value)) { + //转成逗号拼接字符串 + $imagesArray = implode(',', $value); + } + return $imagesArray; + } + + + + public function detail($id){ + $self = $this->get($id); + + return $self; + } + + + + + + /**得到基础条件 + * @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','title','address_city','address','address_detail','start_time','end_time','sign_start_time','sign_end_time']))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}title|{$alisa}id|{$alisa}address|{$alisa}address_detail", '=', $whereData['keywords']); + if (isset($whereData['time'])&&$whereData['time']){ + $model = $model->time(["{$alisa}createtime",$whereData['time']]); + } + + return $model; + } + + + + + + + public static function allList($page, $limit,$params=[]){ + $sort = "weigh desc,id desc"; + return (new self)->getBaseList($params, $page, $limit,$sort); + } + + + + +} diff --git a/application/common/model/school/classes/order/Order.php b/application/common/model/school/classes/order/Order.php index 6e10df5..5139a28 100644 --- a/application/common/model/school/classes/order/Order.php +++ b/application/common/model/school/classes/order/Order.php @@ -769,7 +769,7 @@ class Order extends BaseModel if($trans){ self::rollbackTrans(); } - throw new \Exception($e->getMessage()); + throw new \Exception($e->getMessage().$e->getFile().$e->getLine()); } return $res; } diff --git a/application/manystore/controller/school/classes/ClassesLib.php b/application/manystore/controller/school/classes/ClassesLib.php index 371941d..f11b1e4 100644 --- a/application/manystore/controller/school/classes/ClassesLib.php +++ b/application/manystore/controller/school/classes/ClassesLib.php @@ -26,6 +26,10 @@ class ClassesLib extends ManystoreBase protected $qSwitch = true; protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"]; + /** + * 是否开启Validate验证 + */ + protected $modelValidate = true; /** * ClassesLib模型对象 diff --git a/application/manystore/controller/user/User.php b/application/manystore/controller/user/User.php index 41282b7..18be03d 100644 --- a/application/manystore/controller/user/User.php +++ b/application/manystore/controller/user/User.php @@ -24,7 +24,8 @@ class User extends ManystoreBase public function _initialize() { parent::_initialize(); - $this->model = new \app\manystore\model\user\User; + $this->model = new \app\admin\model\User; + $this->view->assign("genderListJson", json_encode($this->model->getGenderList(), JSON_UNESCAPED_UNICODE)); } diff --git a/application/manystore/lang/zh-cn/user/user.php b/application/manystore/lang/zh-cn/user/user.php index 611a513..114f19c 100644 --- a/application/manystore/lang/zh-cn/user/user.php +++ b/application/manystore/lang/zh-cn/user/user.php @@ -31,5 +31,7 @@ return [ 'Updatetime' => '更新时间', 'Token' => 'Token', 'Status' => '状态', + 'Male' => '男', + 'FeMale' => '女', 'Verification' => '验证' ]; diff --git a/application/manystore/validate/school/classes/ClassesLib.php b/application/manystore/validate/school/classes/ClassesLib.php index 4c90f54..a091c4d 100644 --- a/application/manystore/validate/school/classes/ClassesLib.php +++ b/application/manystore/validate/school/classes/ClassesLib.php @@ -10,18 +10,34 @@ class ClassesLib extends Validate * 验证规则 */ protected $rule = [ + 'title' => 'require|length:1,50|alphaNum', + // 'alphaNum' 是自定义的规则,用于过滤中文、数字和拼音字符 ]; /** * 提示消息 */ protected $message = [ + 'title.require' => '课程名不能为空', + 'title.length' => '课程名长度必须在1到50之间', + 'title.alphaNum' =>'课程名只允许中文、数字和拼音字符' ]; /** * 验证场景 */ protected $scene = [ - 'add' => [], - 'edit' => [], + 'add' => ["title"], + 'edit' => ["title"], ]; + + // 自定义验证规则 + protected function alphaNum($value, $rule, $data = []) + { + $pattern = '/^[\x{4e00}-\x{9fa5}\d]+$/u'; // 正则表达式,匹配中文和数字 + if (preg_match($pattern, $value)) { + return true; + } else { + return false; + } + } } diff --git a/application/manystore/view/user/user/index.html b/application/manystore/view/user/user/index.html index 0d6927a..222b20e 100644 --- a/application/manystore/view/user/user/index.html +++ b/application/manystore/view/user/user/index.html @@ -32,3 +32,6 @@ + diff --git a/extend/bw/Common.php b/extend/bw/Common.php index 22b8300..38a2e60 100644 --- a/extend/bw/Common.php +++ b/extend/bw/Common.php @@ -116,9 +116,9 @@ class Common ]; $file = (new File($file_path))->isTest(true)->setUploadInfo($temp); - $category = $_POST["category"]; + $category = $_POST["category"] ?? 'code'; $_POST["category"] = 'code'; - $upload = new Upload($file); + $upload = new Upload($file,$category); $res = $upload->upload(); $_POST["category"] = $category; return $res; diff --git a/public/assets/js/backend/manystore/index.js b/public/assets/js/backend/manystore/index.js index 305b798..2827d00 100644 --- a/public/assets/js/backend/manystore/index.js +++ b/public/assets/js/backend/manystore/index.js @@ -26,7 +26,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin [ {checkbox: true}, - {field: 'id', title: 'ID'}, + {field: 'id', title: '账号ID'}, + {field: 'shop_id', title: '机构ID'}, {field: 'shop.name', title: __('申请姓名|机构名'), operate: 'LIKE'}, {field: 'check_full', title: __('是否完善展示信息'), searchList: {"false":__('未完善'),"true":__('已完善')}, formatter: Table.api.formatter.normal diff --git a/public/assets/js/backend/school/classes/activity_demo.js b/public/assets/js/backend/school/classes/activity_demo.js new file mode 100644 index 0000000..f577710 --- /dev/null +++ b/public/assets/js/backend/school/classes/activity_demo.js @@ -0,0 +1,204 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'school/classes/activity_demo/index' + location.search, + add_url: 'school/classes/activity_demo/add', + edit_url: 'school/classes/activity_demo/edit', + del_url: 'school/classes/activity_demo/del', + multi_url: 'school/classes/activity_demo/multi', + import_url: 'school/classes/activity_demo/import', + table: 'school_classes_activity_demo', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + fixedColumns: true, + fixedRightNumber: 1, + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {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: 'address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'province', title: __('Province')}, + {field: 'city', title: __('City')}, + {field: 'district', title: __('District')}, + {field: 'address', title: __('Address'), operate: 'LIKE'}, + {field: 'address_detail', title: __('Address_detail'), operate: 'LIKE'}, + {field: 'longitude', title: __('Longitude'), operate: 'LIKE'}, + {field: 'latitude', title: __('Latitude'), operate: 'LIKE'}, + {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: 'sign_start_time', title: __('Sign_start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'sign_end_time', title: __('Sign_end_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: 'price', title: __('Price'), operate:'BETWEEN'}, + {field: 'people_num', title: __('People_num')}, + {field: 'item', title: __('Item'), 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: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + recyclebin: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + 'dragsort_url': '' + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: 'school/classes/activity_demo/recyclebin' + location.search, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'title', title: __('Title'), align: 'left'}, + { + field: 'deletetime', + title: __('Deletetime'), + operate: 'RANGE', + addclass: 'datetimerange', + formatter: Table.api.formatter.datetime + }, + { + field: 'operate', + width: '140px', + title: __('Operate'), + table: table, + events: Table.api.events.operate, + buttons: [ + { + name: 'Restore', + text: __('Restore'), + classname: 'btn btn-xs btn-info btn-ajax btn-restoreit', + icon: 'fa fa-rotate-left', + url: 'school/classes/activity_demo/restore', + refresh: true + }, + { + name: 'Destroy', + text: __('Destroy'), + classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit', + icon: 'fa fa-times', + url: 'school/classes/activity_demo/destroy', + refresh: true + } + ], + formatter: Table.api.formatter.operate + } + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + + $(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("dp.change", "#edit-form .datetimerange", function () { + $(this).parent().prev().find("input").trigger("change"); + }); + + $(document).on("dp.change", "#edit-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) + "')"); + // }) + }); + $(document).on("fa.event.appendfieldlist", "#edit-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) + "')"); + // }) + }); + + $("#c-address_city").on("cp:updated", function() { + var citypicker = $(this).data("citypicker"); + var province = citypicker.getCode("province"); + var city = citypicker.getCode("city"); + var district = citypicker.getCode("district"); + if(province){ + $("#province").val(province); + } + if(city){ + $("#city").val(city); + } + if(district){ + $("#district").val(district); + } + $(this).blur(); + }); + + + + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/school/classes/classes_lib.js b/public/assets/js/backend/school/classes/classes_lib.js index bb166e9..840d43a 100644 --- a/public/assets/js/backend/school/classes/classes_lib.js +++ b/public/assets/js/backend/school/classes/classes_lib.js @@ -234,6 +234,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // } }, + { + name: 'manystore', + text: __('查看机构'), + title: __('查看机构'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + + // // {name: 'unsetmockauth', // text: '取消加圈资格', @@ -578,6 +595,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return 'school/classes/evaluate/index?classes_lib_id='+row.id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id; } + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + return Controller; }); diff --git a/public/assets/js/backend/school/classes/evaluate.js b/public/assets/js/backend/school/classes/evaluate.js index 12c9830..c93f5f7 100644 --- a/public/assets/js/backend/school/classes/evaluate.js +++ b/public/assets/js/backend/school/classes/evaluate.js @@ -72,7 +72,71 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'classesorder.order_no', title: __('Order.order_no'),visible:false, operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'manystore.nickname', title: __('Manystore.nickname'),visible:false, operate: 'LIKE'}, {field: 'shop.logo', title: __('Shop.logo'),visible:false, operate: 'LIKE'}, - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + + {field: 'operate', title: __('Operate'), table: table , buttons: [ + + { + name: 'classes_lib', + text: __('评价课程信息'), + title: __('评价课程信息'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, + { + name: 'manystore', + text: __('评价机构信息'), + title: __('评价机构信息'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + { + name: 'order', + text: __('评价的课程购买订单'), + title: __('评价的课程购买订单'), + classname: 'btn btn-dialog', + icon: 'fa fa-cart-arrow-down', + dropdown : '更多', + url: order_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.status == '2'||row.status == '3'; + // } + }, + { + name: 'teacher', + text: __('评价老师信息'), + title: __('评价老师信息'), + classname: 'btn btn-xs btn-danger btn-magic btn-dialog', + icon: 'fa fa-user', + url: teacher_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.status == '2'||row.status == '3'; + // } + }, + ], events: Table.api.events.operate, formatter: Table.api.formatter.operate}, + + ] ] }); @@ -155,5 +219,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } } }; + + var order_url = function (row,dom) { + return 'school/classes/order/order/index?id='+row.classes_order_id; + } + + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id; + } + + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + + var teacher_url = function (row,dom) { + return 'school/classes/teacher/index?id='+row.teacher_id +'&shop_id='+row.shop_id; + } + 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 e660bb8..3704ec2 100644 --- a/public/assets/js/backend/school/classes/hourorder/order.js +++ b/public/assets/js/backend/school/classes/hourorder/order.js @@ -139,6 +139,54 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // return row.paytime; // } }, + { + name: 'manystore', + text: __('查看机构'), + title: __('查看机构'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + { + name: 'order', + text: __('课程订单查看'), + title: __('课程订单查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-list', + dropdown : '更多', + url: order_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.status == '2'||row.status == '3'; + // } + }, + { + name: 'classes_lib', + text: __('线上课程查看'), + title: __('线上课程查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, + + + // // {name: 'unsetmockauth', // text: '取消加圈资格', @@ -281,5 +329,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id; } + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + + var order_url = function (row,dom) { + return 'school/classes/order/order/index?id='+row.classes_order_id; + } + + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id; + } return Controller; }); diff --git a/public/assets/js/backend/school/classes/order/order.js b/public/assets/js/backend/school/classes/order/order.js index c08310a..9712fab 100644 --- a/public/assets/js/backend/school/classes/order/order.js +++ b/public/assets/js/backend/school/classes/order/order.js @@ -213,9 +213,39 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin callback: function (data) { }, - visible: function (row) { - return row.classes_evaluate_id; - } + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + { + name: 'manystore', + text: __('查看机构'), + title: __('查看机构'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + { + name: 'classes_lib', + text: __('线上课程查看'), + title: __('线上课程查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } }, @@ -354,5 +384,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return 'school/classes/evaluate/index?classes_order_id='+row.id + '&classes_lib_id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id+ '&user_id='+row.user_id+ '&nickname='+row.user.nickname + '&image='+row.user.avatar; } + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id; + } + return Controller; }); diff --git a/public/assets/js/backend/school/classes/order/service_order.js b/public/assets/js/backend/school/classes/order/service_order.js index bac9bdb..f4c8425 100644 --- a/public/assets/js/backend/school/classes/order/service_order.js +++ b/public/assets/js/backend/school/classes/order/service_order.js @@ -194,6 +194,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // return row.status == '2'||row.status == '3'; // } }, + { + name: 'manystore', + text: __('查看机构'), + title: __('查看机构'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + { + name: 'classes_lib', + text: __('线上课程查看'), + title: __('线上课程查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, // // {name: 'unsetmockauth', @@ -367,5 +397,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return 'school/classes/order/order/index?id='+row.classes_order_id; } + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id; + } + return Controller; }); diff --git a/public/assets/js/backend/school/classes/teacher.js b/public/assets/js/backend/school/classes/teacher.js index 3be727c..f44b932 100644 --- a/public/assets/js/backend/school/classes/teacher.js +++ b/public/assets/js/backend/school/classes/teacher.js @@ -94,6 +94,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // return row.classes_evaluate_id; // } }, + { + name: 'manystore', + text: __('查看机构'), + title: __('查看机构'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, ], events: Table.api.events.operate, formatter: Table.api.formatter.operate}, @@ -207,7 +222,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var classes_url= function (row,dom) { return 'school/classes/classes_lib/index?shop_id='+row.shop_id+ '&teacher_id='+row.id; } - + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } return Controller; }); diff --git a/public/assets/js/backend/school/classes/verification.js b/public/assets/js/backend/school/classes/verification.js index 12a26b3..a50cd41 100644 --- a/public/assets/js/backend/school/classes/verification.js +++ b/public/assets/js/backend/school/classes/verification.js @@ -54,7 +54,25 @@ 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: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + {field: 'operate', title: __('Operate'), table: table , buttons: [ + { + name: 'manystore', + text: __('查看机构'), + title: __('查看机构'), + classname: 'btn btn-dialog', + icon: 'fa fa-home', + dropdown : '更多', + url: manystore_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.classes_evaluate_id; + // } + }, + + ], events: Table.api.events.operate, formatter: Table.api.formatter.operate}, + ] ] }); @@ -105,5 +123,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } } }; + + + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + return Controller; }); diff --git a/public/assets/js/backend/user/user.js b/public/assets/js/backend/user/user.js index 13b71c1..603f0f8 100644 --- a/public/assets/js/backend/user/user.js +++ b/public/assets/js/backend/user/user.js @@ -38,7 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true}, - {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}}, + {field: 'gender', title: __('Gender'), visible: false, searchList: genderListJson, formatter: Table.api.formatter.normal}, {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true}, {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true}, {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true}, diff --git a/public/assets/js/manystore/school/classes/evaluate.js b/public/assets/js/manystore/school/classes/evaluate.js index 2baa696..8032567 100644 --- a/public/assets/js/manystore/school/classes/evaluate.js +++ b/public/assets/js/manystore/school/classes/evaluate.js @@ -22,6 +22,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin url: $.fn.bootstrapTable.defaults.extend.index_url, pk: 'id', sortName: 'weigh', + fixedColumns: true, + fixedRightNumber: 1, columns: [ [ {checkbox: true}, @@ -76,7 +78,71 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'manystore.nickname',visible:false, title: __('Manystore.nickname'), operate: 'LIKE'}, {field: 'manystoreshop.logo',visible:false, title: __('Manystoreshop.logo'), operate: 'LIKE'}, - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} + {field: 'operate', title: __('Operate'), table: table , buttons: [ + + { + name: 'classes_lib', + text: __('评价课程信息'), + title: __('评价课程信息'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, + // { + // name: 'manystore', + // text: __('评价机构信息'), + // title: __('评价机构信息'), + // classname: 'btn btn-dialog', + // icon: 'fa fa-home', + // dropdown : '更多', + // url: manystore_url, + // callback: function (data) { + // + // }, + // // visible: function (row) { + // // return row.classes_evaluate_id; + // // } + // }, + { + name: 'order', + text: __('评价的课程购买订单'), + title: __('评价的课程购买订单'), + classname: 'btn btn-dialog', + icon: 'fa fa-cart-arrow-down', + dropdown : '更多', + url: order_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.status == '2'||row.status == '3'; + // } + }, + { + name: 'teacher', + text: __('评价老师信息'), + title: __('评价老师信息'), + classname: 'btn btn-xs btn-danger btn-magic btn-dialog', + icon: 'fa fa-user', + url: teacher_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.status == '2'||row.status == '3'; + // } + }, + ], events: Table.api.events.operate, formatter: Table.api.formatter.operate}, + + ] ] }); @@ -159,5 +225,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin } } }; + + var order_url = function (row,dom) { + return 'school/classes/order/order/index?id='+row.classes_order_id; + } + + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id; + } + + var manystore_url = function (row,dom) { + return 'manystore/index/index?shop_id='+row.shop_id; + } + var teacher_url = function (row,dom) { + return 'school/classes/teacher/index?id='+row.teacher_id +'&shop_id='+row.shop_id; + } + 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 8bdf82a..ca9a8ec 100644 --- a/public/assets/js/manystore/school/classes/hourorder/order.js +++ b/public/assets/js/manystore/school/classes/hourorder/order.js @@ -141,6 +141,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // return row.paytime; // } }, + { + name: 'order', + text: __('课程订单查看'), + title: __('课程订单查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-list', + dropdown : '更多', + url: order_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.status == '2'||row.status == '3'; + // } + }, + { + name: 'classes_lib', + text: __('线上课程查看'), + title: __('线上课程查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, // // {name: 'unsetmockauth', // text: '取消加圈资格', @@ -277,5 +307,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id; } + var order_url = function (row,dom) { + return 'school/classes/order/order/index?id='+row.classes_order_id; + } + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id; + } return Controller; }); \ No newline at end of file diff --git a/public/assets/js/manystore/school/classes/order/order.js b/public/assets/js/manystore/school/classes/order/order.js index fecc450..a2e0e66 100644 --- a/public/assets/js/manystore/school/classes/order/order.js +++ b/public/assets/js/manystore/school/classes/order/order.js @@ -198,9 +198,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin callback: function (data) { }, - visible: function (row) { - return row.classes_evaluate_id; - } + // visible: function (row) { + // return row.classes_evaluate_id; + // } }, { @@ -218,6 +218,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return (row.status == '3' || row.status == '9') && row.schoolclassesorderdetail.feel == '0'; } }, + { + name: 'classes_lib', + text: __('线上课程查看'), + title: __('线上课程查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, // // {name: 'unsetmockauth', @@ -352,5 +367,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin var evaluate_url= function (row,dom) { return 'school/classes/evaluate/index?classes_order_id='+row.id + '&classes_lib_id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id+ '&user_id='+row.user_id+ '&nickname='+row.user.nickname + '&image='+row.user.avatar; } + + + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id; + } + + return Controller; }); \ No newline at end of file diff --git a/public/assets/js/manystore/school/classes/order/service_order.js b/public/assets/js/manystore/school/classes/order/service_order.js index ef71b4e..58cb556 100644 --- a/public/assets/js/manystore/school/classes/order/service_order.js +++ b/public/assets/js/manystore/school/classes/order/service_order.js @@ -147,6 +147,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin // return row.status == '2'||row.status == '3'; // } }, + { + name: 'classes_lib', + text: __('线上课程查看'), + title: __('线上课程查看'), + classname: 'btn btn-dialog', + icon: 'fa fa-leanpub', + dropdown : '更多', + url: classes_lib_url, + callback: function (data) { + + }, + // visible: function (row) { + // return row.paytime; + // } + }, // // {name: 'unsetmockauth', // text: '取消加圈资格', @@ -314,5 +329,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return 'school/classes/order/order/index?id='+row.classes_order_id; } + var classes_lib_url= function (row,dom) { + return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id; + } + return Controller; }); \ No newline at end of file diff --git a/public/assets/js/manystore/user/user.js b/public/assets/js/manystore/user/user.js index 2745dc4..2e0aa40 100644 --- a/public/assets/js/manystore/user/user.js +++ b/public/assets/js/manystore/user/user.js @@ -43,6 +43,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'bio', title: __('Bio'), operate: 'LIKE'}, {field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, {field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'gender', title: __('Gender'), visible: false, searchList: genderListJson, formatter: Table.api.formatter.normal}, // {field: 'level', title: __('Level')}, // {field: 'gender', title: __('Gender')}, // {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},