diff --git a/application/admin/controller/manystore/ShopLog.php b/application/admin/controller/manystore/ShopLog.php new file mode 100644 index 0000000..a41538e --- /dev/null +++ b/application/admin/controller/manystore/ShopLog.php @@ -0,0 +1,73 @@ +model = new \app\admin\model\manystore\ShopLog; + $this->view->assign("typeList", $this->model->getTypeList()); + $this->view->assign("statusList", $this->model->getStatusList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['shop','user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('shop')->visible(['name']); + $row->getRelation('user')->visible(['nickname','mobile','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/manystore/UserAuth.php b/application/admin/controller/manystore/UserAuth.php new file mode 100644 index 0000000..731de21 --- /dev/null +++ b/application/admin/controller/manystore/UserAuth.php @@ -0,0 +1,72 @@ +model = new \app\admin\model\manystore\UserAuth; + $this->view->assign("statusList", $this->model->getStatusList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['shop','user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('shop')->visible(['name']); + $row->getRelation('user')->visible(['nickname','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/school/Message.php b/application/admin/controller/school/Message.php new file mode 100644 index 0000000..3726907 --- /dev/null +++ b/application/admin/controller/school/Message.php @@ -0,0 +1,76 @@ +model = new \app\admin\model\school\Message; + $this->view->assign("platformList", $this->model->getPlatformList()); + $this->view->assign("operTypeList", $this->model->getOperTypeList()); + $this->view->assign("toTypeList", $this->model->getToTypeList()); + $this->view->assign("statusList", $this->model->getStatusList()); + $this->view->assign("miniTypeList", $this->model->getMiniTypeList()); + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['admin','user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('admin')->visible(['nickname','avatar']); + $row->getRelation('user')->visible(['nickname','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/school/classes/ClassesSpec.php b/application/admin/controller/school/classes/ClassesSpec.php index 9cf5910..fe3644e 100644 --- a/application/admin/controller/school/classes/ClassesSpec.php +++ b/application/admin/controller/school/classes/ClassesSpec.php @@ -3,6 +3,16 @@ namespace app\admin\controller\school\classes; use app\common\controller\Backend; +use app\common\model\school\classes\Order; +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; /** * 机构课程课时规格 @@ -21,6 +31,9 @@ class ClassesSpec extends Backend protected $qSwitch = true; protected $qFields = ["classes_lib_id"]; + protected $no_auth_fields = ['name','limit_num','status','weigh']; + protected $have_auth = false; + public function _initialize() { @@ -73,4 +86,211 @@ class ClassesSpec extends Backend return $this->view->fetch(); } + protected function no_auth_fields_check($params,$row){ + + foreach ($params as $k=>$v){ + + //说明数值有变动 + //$params[$k] 去掉两端空格 + $params[$k] = trim($v); + + if($row[$k]!=$params[$k]){ + //当修改参数不在允许修改的字段中 + if(!in_array($k,$this->no_auth_fields)){ + + $this->have_auth = true;break; + + } + } + + } + + return $this->have_auth; + + } + + protected function update_classes($classes_lib_id){ + //更新课程规格库存 + //所有课时加起来 + \app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id); + } + + + protected function updateCheck($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)$this->error("存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!"); + } + + + protected function update_check(&$params,$row=null) + { + + //修改 + if($row){ + $this->updateCheck($row->id,$params,$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); + $this->update_classes($this->model["classes_lib_id"]); + 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_classes($row["classes_lib_id"]); + 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(); + $datas = []; + foreach ($list as $item) { + $this->updateCheck($item->id); + $datas[] = $item->classes_lib_id; + } + + + $count = 0; + Db::startTrans(); + try { + foreach ($list as $item) { + $count += $item->delete(); + } + foreach ($datas as $classes_lib_id) { + $this->update_classes($classes_lib_id); + } + + 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/lang/zh-cn/manystore/shop_log.php b/application/admin/lang/zh-cn/manystore/shop_log.php new file mode 100644 index 0000000..b4f27cc --- /dev/null +++ b/application/admin/lang/zh-cn/manystore/shop_log.php @@ -0,0 +1,45 @@ + 'ID', + 'Shop_id' => '机构店铺id', + 'User_id' => '机构前端用户', + 'Name' => '店铺名称', + 'Logo' => '品牌LOGO', + 'Image' => '封面图', + 'Images' => '店铺环境照片', + 'Address_city' => '城市选择', + 'Province' => '省编号', + 'City' => '市编号', + 'District' => '县区编号', + 'Address' => '店铺地址', + 'Address_detail' => '店铺详细地址', + 'Longitude' => '经度', + 'Latitude' => '纬度', + 'Yyzzdm' => '营业执照', + 'Yyzz_images' => '营业执照照片', + 'Front_idcard_image' => '法人身份证正面', + 'Reverse_idcard_image' => '法人身份证反面', + 'Tel' => '服务电话', + 'Content' => '店铺详情', + 'Type' => '类型', + 'Type 1' => '个人', + 'Type 2' => '机构', + 'Desc' => '申请备注', + 'Status' => '审核状态', + 'Status 0' => '待审核', + 'Set status to 0' => '设为待审核', + 'Status 1' => '审核通过', + 'Set status to 1' => '设为审核通过', + 'Status 2' => '审核失败', + 'Set status to 2' => '设为审核失败', + 'Reason' => '审核不通过原因', + 'Auth_time' => '审核时间', + 'Admin_id' => '审核管理员id', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'Shop.name' => '店铺名称', + 'User.nickname' => '昵称', + 'User.mobile' => '手机号', + 'User.avatar' => '头像' +]; diff --git a/application/admin/lang/zh-cn/manystore/user_auth.php b/application/admin/lang/zh-cn/manystore/user_auth.php new file mode 100644 index 0000000..35be48f --- /dev/null +++ b/application/admin/lang/zh-cn/manystore/user_auth.php @@ -0,0 +1,19 @@ + '机构shopid', + 'User_id' => '授权用户', + 'Status' => '授权状态', + 'Status 0' => '待确认', + 'Set status to 0'=> '设为待确认', + 'Status 1' => '通过', + 'Set status to 1'=> '设为通过', + 'Status 2' => '拒绝', + 'Set status to 2'=> '设为拒绝', + 'Auth_time' => '授权确认时间', + 'Createtime' => '发起时间', + 'Update_time' => '修改时间', + 'Shop.name' => '店铺名称', + 'User.nickname' => '昵称', + 'User.avatar' => '头像' +]; 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 48ad08f..372c5ef 100644 --- a/application/admin/lang/zh-cn/school/classes/classes_lib.php +++ b/application/admin/lang/zh-cn/school/classes/classes_lib.php @@ -81,5 +81,8 @@ return [ 'User.realname' => '真实姓名', 'User.mobile' => '手机号', 'User.avatar' => '头像', - 'Admin.nickname' => '昵称' + 'Admin.nickname' => '昵称', + 'Limit_num' => '总限定人数', + 'Sign_num' => '总已报名人数', + 'Verification_num' => '总已核销人数', ]; diff --git a/application/admin/lang/zh-cn/school/message.php b/application/admin/lang/zh-cn/school/message.php new file mode 100644 index 0000000..d2c0e84 --- /dev/null +++ b/application/admin/lang/zh-cn/school/message.php @@ -0,0 +1,44 @@ + '消息平台', + 'Platform admin' => '总后台', + 'Platform user' => '用户端', + 'Platform shop' => '机构后台', + 'Oper_type' => '发送人类型', + 'Oper_type admin' => '管理员', + 'Oper_type user' => '用户', + 'Oper_type system' => '系统', + 'Oper_type shop' => '机构', + 'Oper_id' => '发送人id(没有为0)', + 'To_type' => '接收人类型', + 'To_type admin' => '管理员', + 'To_type user' => '用户', + 'To_type system' => '系统', + 'To_type shop' => '机构', + 'To_id' => '接收人id(全部为0)', + 'Status' => '消息总类型', + 'Status system' => '系统消息', + 'Set status to system' => '设为系统消息', + 'Status classes' => '课程消息', + 'Set status to classes' => '设为课程消息', + 'Status order' => '订单消息', + 'Set status to order' => '设为订单消息', + 'Mini_type' => '小消息类型', + 'Mini_type order_notice' => '课程订单通知', + 'Mini_type classes_auth' => '课程报名审核', + 'Mini_type classes_apply' => '课程上新审核', + 'Mini_type shop_apply' => '机构审核', + 'Mini_type classes_order_notice' => '课时预约', + 'Mini_type user_auth' => '机构授权用户信息', + 'Mini_type aftercare' => '售后服务', + 'Mini_type other' => '其他', + 'Title' => '消息标题', + 'Desc' => '消息内容', + 'Params' => '消息额外参数(json)', + 'Createtime' => '创建时间', + 'Admin.nickname' => '昵称', + 'Admin.avatar' => '头像', + 'User.nickname' => '昵称', + 'User.avatar' => '头像' +]; diff --git a/application/admin/model/manystore/Shop.php b/application/admin/model/manystore/Shop.php new file mode 100644 index 0000000..3876822 --- /dev/null +++ b/application/admin/model/manystore/Shop.php @@ -0,0 +1,12 @@ + __('Type 1'), '2' => __('Type 2')]; + } + + public function getStatusList() + { + return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); + $list = $this->getTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getAuthTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['auth_time']) ? $data['auth_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getCreateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getUpdateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setAuthTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setCreateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setUpdateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function shop() + { + return $this->belongsTo('Shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/model/manystore/UserAuth.php b/application/admin/model/manystore/UserAuth.php new file mode 100644 index 0000000..2578452 --- /dev/null +++ b/application/admin/model/manystore/UserAuth.php @@ -0,0 +1,83 @@ + __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getAuthTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['auth_time']) ? $data['auth_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getUpdateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setAuthTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setUpdateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function shop() + { + return $this->belongsTo('Shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/model/school/Message.php b/application/admin/model/school/Message.php new file mode 100644 index 0000000..45e1393 --- /dev/null +++ b/application/admin/model/school/Message.php @@ -0,0 +1,119 @@ + __('Platform admin'), 'user' => __('Platform user'), 'shop' => __('Platform shop')]; + } + + public function getOperTypeList() + { + return ['admin' => __('Oper_type admin'), 'user' => __('Oper_type user'), 'system' => __('Oper_type system'), 'shop' => __('Oper_type shop')]; + } + + public function getToTypeList() + { + return ['admin' => __('To_type admin'), 'user' => __('To_type user'), 'system' => __('To_type system'), 'shop' => __('To_type shop')]; + } + + public function getStatusList() + { + return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order')]; + } + + public function getMiniTypeList() + { + return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')]; + } + + + public function getPlatformTextAttr($value, $data) + { + $value = $value ?: ($data['platform'] ?? ''); + $valueArr = explode(',', $value); + $list = $this->getPlatformList(); + return implode(',', array_intersect_key($list, array_flip($valueArr))); + } + + + public function getOperTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['oper_type']) ? $data['oper_type'] : ''); + $list = $this->getOperTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getToTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['to_type']) ? $data['to_type'] : ''); + $list = $this->getToTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getMiniTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['mini_type']) ? $data['mini_type'] : ''); + $list = $this->getMiniTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + protected function setPlatformAttr($value) + { + return is_array($value) ? implode(',', $value) : $value; + } + + + public function admin() + { + return $this->belongsTo('app\admin\model\Admin', 'oper_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'to_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/manystore/ShopLog.php b/application/admin/validate/manystore/ShopLog.php new file mode 100644 index 0000000..d3f37db --- /dev/null +++ b/application/admin/validate/manystore/ShopLog.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/manystore/UserAuth.php b/application/admin/validate/manystore/UserAuth.php new file mode 100644 index 0000000..642eb2a --- /dev/null +++ b/application/admin/validate/manystore/UserAuth.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/school/Message.php b/application/admin/validate/school/Message.php new file mode 100644 index 0000000..25e98ec --- /dev/null +++ b/application/admin/validate/school/Message.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/manystore/shop_log/add.html b/application/admin/view/manystore/shop_log/add.html new file mode 100644 index 0000000..16a77f2 --- /dev/null +++ b/application/admin/view/manystore/shop_log/add.html @@ -0,0 +1,223 @@ +
+ +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      +
      + +
      + + +
      + +
      +
        +
        +
        +
        + +
        +
        + +
        + + +
        + +
        +
          +
          +
          +
          + +
          +
          + +
          + + +
          + +
          +
            +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            + + + +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            + {foreach name="statusList" item="vo"} + + {/foreach} +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            +
            + +
            diff --git a/application/admin/view/manystore/shop_log/edit.html b/application/admin/view/manystore/shop_log/edit.html new file mode 100644 index 0000000..271f9bb --- /dev/null +++ b/application/admin/view/manystore/shop_log/edit.html @@ -0,0 +1,223 @@ +
            + +
            + +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            + +
            +
            +
            + +
            +
            + +
            + + +
            + +
            +
              +
              +
              +
              + +
              +
              + +
              + + +
              + +
              +
                +
                +
                +
                + +
                +
                +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                + +
                +
                +
                + +
                +
                + +
                + + +
                + +
                +
                  +
                  +
                  +
                  + +
                  +
                  + +
                  + + +
                  + +
                  +
                    +
                    +
                    +
                    + +
                    +
                    + +
                    + + +
                    + +
                    +
                      +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      + {foreach name="statusList" item="vo"} + + {/foreach} +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      + +
                      diff --git a/application/admin/view/manystore/shop_log/index.html b/application/admin/view/manystore/shop_log/index.html new file mode 100644 index 0000000..120850d --- /dev/null +++ b/application/admin/view/manystore/shop_log/index.html @@ -0,0 +1,46 @@ +
                      + +
                      + {:build_heading(null,FALSE)} + +
                      + + +
                      +
                      +
                      +
                      +
                      + + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + +
                      + +
                      +
                      +
                      + +
                      +
                      +
                      diff --git a/application/admin/view/manystore/user_auth/add.html b/application/admin/view/manystore/user_auth/add.html new file mode 100644 index 0000000..a111e11 --- /dev/null +++ b/application/admin/view/manystore/user_auth/add.html @@ -0,0 +1,45 @@ +
                      + +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      + {foreach name="statusList" item="vo"} + + {/foreach} +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      + + + + + + + +
                      diff --git a/application/admin/view/manystore/user_auth/edit.html b/application/admin/view/manystore/user_auth/edit.html new file mode 100644 index 0000000..c9afde6 --- /dev/null +++ b/application/admin/view/manystore/user_auth/edit.html @@ -0,0 +1,45 @@ +
                      + +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      + {foreach name="statusList" item="vo"} + + {/foreach} +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      + + + + + + + +
                      diff --git a/application/admin/view/manystore/user_auth/index.html b/application/admin/view/manystore/user_auth/index.html new file mode 100644 index 0000000..4cdc7b0 --- /dev/null +++ b/application/admin/view/manystore/user_auth/index.html @@ -0,0 +1,46 @@ +
                      + +
                      + {:build_heading(null,FALSE)} + +
                      + + +
                      +
                      +
                      +
                      +
                      + + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + +
                      + +
                      +
                      +
                      + +
                      +
                      +
                      diff --git a/application/admin/view/school/classes/teacher/add.html b/application/admin/view/school/classes/teacher/add.html index b5bb5ed..c7def35 100644 --- a/application/admin/view/school/classes/teacher/add.html +++ b/application/admin/view/school/classes/teacher/add.html @@ -15,7 +15,7 @@
                      - +
                      diff --git a/application/admin/view/school/classes/teacher/edit.html b/application/admin/view/school/classes/teacher/edit.html index 7b4aa0b..c32fb0b 100644 --- a/application/admin/view/school/classes/teacher/edit.html +++ b/application/admin/view/school/classes/teacher/edit.html @@ -15,7 +15,7 @@
                      - +
                      diff --git a/application/admin/view/school/message/add.html b/application/admin/view/school/message/add.html new file mode 100644 index 0000000..f390dda --- /dev/null +++ b/application/admin/view/school/message/add.html @@ -0,0 +1,99 @@ +
                      + +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      + {foreach name="statusList" item="vo"} + + {/foreach} +
                      + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      + +
                      diff --git a/application/admin/view/school/message/edit.html b/application/admin/view/school/message/edit.html new file mode 100644 index 0000000..ac5abe5 --- /dev/null +++ b/application/admin/view/school/message/edit.html @@ -0,0 +1,99 @@ +
                      + +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      + {foreach name="statusList" item="vo"} + + {/foreach} +
                      + +
                      +
                      +
                      + +
                      + + + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      + +
                      diff --git a/application/admin/view/school/message/index.html b/application/admin/view/school/message/index.html new file mode 100644 index 0000000..b01b74d --- /dev/null +++ b/application/admin/view/school/message/index.html @@ -0,0 +1,46 @@ +
                      + +
                      + {:build_heading(null,FALSE)} + +
                      + + +
                      +
                      +
                      +
                      +
                      + + {:__('Add')} + {:__('Edit')} + {:__('Delete')} + + + + + +
                      + +
                      +
                      +
                      + +
                      +
                      +
                      diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 70bc9d9..cac98cb 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -6,6 +6,7 @@ use addons\xilufitness\services\login\LoginService; use app\common\controller\Api; use app\common\library\Ems; use app\common\library\Sms; +use app\common\model\dyqc\ManystoreShop; use fast\Random; use think\Cache; use think\Config; @@ -164,6 +165,8 @@ class User extends Api //是否有核销按钮展示权 $data['have_auth'] = \app\common\model\User::verificationAuth($this->auth->id); $data['have_teacher'] = \app\common\model\User::teacherAuth($this->auth->id); + //机构认证信息 + $data['shop_auth_info'] = ManystoreShop::getAuthInfo($this->auth->id); $data['user_info']["avatar"] = $data['user_info']["avatar"]? cdnurl($data['user_info']["avatar"],true):$data['user_info']["avatar"]; $this->success('调用成功',$data); diff --git a/application/api/controller/school/Classes.php b/application/api/controller/school/Classes.php index 5b49014..6d2fe30 100644 --- a/application/api/controller/school/Classes.php +++ b/application/api/controller/school/Classes.php @@ -2,7 +2,10 @@ namespace app\api\controller\school; +use app\common\model\school\classes\Cate; use app\common\model\school\classes\ClassesLib; +use app\common\model\school\classes\Label; +use app\common\model\school\SearchCity; use think\Cache; use think\Log; @@ -11,7 +14,7 @@ use think\Log; */ class Classes extends Base { - protected $noNeedLogin = ["detail",'people','spec']; + protected $noNeedLogin = ["detail",'people','spec','label_list','cate_list',"index","classes_list"]; protected $noNeedRight = '*'; protected $model = null; @@ -29,8 +32,42 @@ class Classes extends Base //判断登录用户是否是员工 } + + /** + * @ApiTitle(课程查询参数接口) + * @ApiSummary(课程查询参数接口) + * @ApiRoute(/api/school/classes/index) + * @ApiMethod(GET) + * @ApiReturn({ + + * + *}) + */ public function index() { + //距离查询参数 + //展示的城市 + //展示的查询距离 + $distance_config = config("site.search_distance_list"); + $distance_config_data = []; + foreach ($distance_config as $k=>$v){ + //组成类似sql二维数组 + $distance_config_data[] = ['distance'=>$k,'distance_name'=>$v]; + + } + + $distance_city = SearchCity::order("id desc")->select(); + foreach ($distance_city as $k=>&$v){ + //字符串按斜杠分割后,取数值最后一个元素(切记:分割后数组长度不是等长) + $v["address_city"] = explode("/",$v["address_city"]); + $v["address_city"] = $v["address_city"][count($v["address_city"])-1]; + } + + $cate = Cate::showList(1, 20,"","-1"); + + $label = Label::showList(1, 20,""); + + $this->success('获取成功', compact('distance_config_data',"distance_city","cate" ,"label" )); } @@ -116,4 +153,171 @@ class Classes extends Base } + /** + * @ApiTitle( 课程分类列表) + * @ApiSummary(课程分类列表) + * @ApiRoute(/api/school/classes/cate_list) + * @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 = "hot", type = "string",required=false,description = "状态搜索条件:-1=全部分类,0=非热门分类,1=热门分类") + * @ApiReturn({ + * + *}) + */ + public function cate_list() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $page = $this->request->get('page/d', 0); //页数 + $limit = $this->request->get('limit/d', 0); //条数 + $keywords = $this->request->get('keywords/s', ''); //搜索关键字 + $hot = $this->request->get('hot/s', '-1'); //搜索关键字 +// $type = $this->request->get('type/s', ''); //筛选学员和教练单 + + try{ + //当前申请状态 + $res = Cate::showList($page, $limit,$keywords,$hot); +// if($user_id =='670153'){ +// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql()); +// } + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + + /** + * @ApiTitle( 课程标签列表) + * @ApiSummary(课程标签列表) + * @ApiRoute(/api/school/classes/label_list) + * @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 = "条数") + * @ApiReturn({ + * + *}) + */ + public function label_list() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $page = $this->request->get('page/d', 0); //页数 + $limit = $this->request->get('limit/d', 0); //条数 + $keywords = $this->request->get('keywords/s', ''); //搜索关键字 +// $type = $this->request->get('type/s', ''); //筛选学员和教练单 + + try{ + //当前申请状态 + $res = Label::showList($page, $limit,$keywords); +// if($user_id =='670153'){ +// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql()); +// } + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', $res); + } + + + + + + + + /** + * @ApiTitle( 通用课程大索索列表) + * @ApiSummary(通用课程大索索列表) + * @ApiRoute(/api/school/classes/classes_list) + * @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 = "user_id", type = "int",required=false,description = "主讲师用户id") + * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id") + * @ApiParams(name = "teacher_id", type = "int",required=false,description = "老师id") + * @ApiParams(name = "classes_cate_ids", type = "string",required=false,description = "平台课程分类ids") + * @ApiParams(name = "classes_label_ids", type = "string",required=false,description = "平台课程热门标签ids") + * @ApiParams(name = "self_label_tag", type = "string",required=false,description = "机构特色标签") + * @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索") + * @ApiParams(name = "type", type = "string",required=false,description = "地点类型:out=户外,in=室内") + * @ApiParams(name = "address_type", type = "string",required=false,description = "地址类型:1=按机构,2=独立位置") + * @ApiParams(name = "province", type = "string",required=false,description = "省编号") + * @ApiParams(name = "city", type = "string",required=false,description = "市编号") + * @ApiParams(name = "district", type = "string",required=false,description = "县区编号") + * @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 状态: 1=上架,2=下架,3=平台下架") + * @ApiParams(name = "recommend", type = "string",required=false,description = "平台推荐:0=否,1=是") + * @ApiParams(name = "hot", type = "string",required=false,description = "平台热门:0=否,1=是") + * @ApiParams(name = "new", type = "string",required=false,description = "平台最新:0=否,1=是") + * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是") + * @ApiParams(name = "feel", type = "string",required=false,description = "是否免费:0=否,1=是") + * @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序推薦優先,distance=距离优先,hot=熱門优先,new=平台最新优先,selfhot=机构热门优先,sale=銷量优先") + * @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)") + * @ApiParams(name = "latitude", type = "string",required=false,description = "latitude") + * @ApiParams(name = "longitude", type = "string",required=false,description = "longitude") + * @ApiReturn({ + * + *}) + */ + public function classes_list() + { + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + $params =[]; + $params["page"] = $this->request->get('page/d', 1); //页数 + $params["limit"] = $this->request->get('limit/d', 10); //条数 + $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字 + $params["user_id"] = $this->request->get('user_id/d', ''); //主讲师用户id + $params["shop_id"] = $this->request->get('shop_id/d', ''); //机构店铺id + $params["teacher_id"] = $this->request->get('teacher_id/d', ''); //机构店铺id + $params["classes_cate_ids"] = $this->request->get('classes_cate_ids/s', ''); //机构店铺id + $params["classes_label_ids"] = $this->request->get('classes_label_ids/s', ''); //机构店铺id + $params["self_label_tag"] = $this->request->get('self_label_tag/s', ''); //机构店铺id + $params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id + $params["type"] = $this->request->get('type/s', ''); //机构店铺id + $params["address_type"] = $this->request->get('address_type/s', ''); //机构店铺id + $params["province"] = $this->request->get('province/s', ''); //机构店铺id + + $params["city"] = $this->request->get('city/s', ''); //机构店铺id + $params["district"] = $this->request->get('district/s', ''); //机构店铺id + $params["status"] = $this->request->get('status/s', ''); //机构店铺id + $params["recommend"] = $this->request->get('recommend/s', ''); //机构店铺id + $params["hot"] = $this->request->get('hot/s', ''); //机构店铺id + $params["new"] = $this->request->get('new/s', ''); //机构店铺id + $params["selfhot"] = $this->request->get('selfhot/s', ''); //机构店铺id + $params["feel"] = $this->request->get('feel/s', ''); //机构店铺id + + $params["order"] = $this->request->get('order/s', ''); //机构店铺id + $params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id + + + $params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id + $params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id + +// $type = $this->request->get('type/s', ''); //筛选学员和教练单 + + try{ + //当前申请状态 + $res = ClassesLib::getVaildList($params); +// if($user_id =='670153'){ +// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql()); +// } + }catch (\Exception $e){ + + $this->error($e->getMessage()); + } + $this->success('查询成功', ["list"=>$res]); + } + + + + } \ No newline at end of file diff --git a/application/api/controller/school/Shop.php b/application/api/controller/school/Shop.php index 681190a..c37062d 100644 --- a/application/api/controller/school/Shop.php +++ b/application/api/controller/school/Shop.php @@ -57,4 +57,108 @@ class Shop extends Base + + + /** 机构申请 + * @ApiTitle( 机构申请) + * @ApiSummary(机构申请) + * @ApiRoute(/api/school/shop/shopapply) + * @ApiMethod(POST) + * @ApiParams(name = "name", type = "string",required=true,description = "机构名称") + * @ApiParams(name = "tel", type = "string",required=false,description = "服务电话(非必填)") + * @ApiParams(name = "desc", type = "string",required=false,description = "申请备注(非必填)") + * @ApiParams(name = "front_idcard_image", type = "string",required=true,description = "法人身份证正面") + * @ApiParams(name = "reverse_idcard_image", type = "string",required=true,description = "法人身份证反面") + * @ApiParams(name = "images", type = "string",required=true,description = "机构环境照片(多个逗号拼接)") + * @ApiParams(name = "yyzz_images", type = "string",required=true,description = "营业执照照片(多个逗号拼接)") + * @ApiReturn({ + * + *}) + */ + public function shopapply(){ + $params=[]; + $params["name"] = $this->request->post('name/s',''); + $params["tel"] = $this->request->post('tel/s',''); + $params["desc"] = $this->request->post('desc/s',''); + $params["front_idcard_image"] = $this->request->post('front_idcard_image/s',''); + $params["reverse_idcard_image"] = $this->request->post('reverse_idcard_image/s',''); + + $params["images"] = $this->request->post('images/s',''); + $params["yyzz_images"] = $this->request->post('yyzz_images/s',''); + + if(empty($id)){ + $this->error(__('缺少必要参数')); + } + $type = "2"; + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + try { + $res = $this->model->apply($type,$user_id,$params,true,true); + } catch (\Exception $e){ +// Log::log($e->getMessage()); + $this->error($e->getMessage(),['errcode'=>$e->getCode()]); + } + $this->success('获取成功', ['detail' => $res]); + } + + + + /** 个人申请 + * @ApiTitle( 个人申请) + * @ApiSummary(个人申请) + * @ApiRoute(/api/school/shop/userapply) + * @ApiMethod(POST) + * @ApiParams(name = "name", type = "string",required=true,description = "姓名") + * @ApiParams(name = "tel", type = "string",required=false,description = "服务电话(非必填)") + * @ApiParams(name = "desc", type = "string",required=false,description = "申请备注(非必填)") + * @ApiParams(name = "front_idcard_image", type = "string",required=true,description = "身份证正面") + * @ApiParams(name = "reverse_idcard_image", type = "string",required=true,description = "身份证反面") + * @ApiReturn({ + * + *}) + */ + public function userapply(){ + $params=[]; + $params["name"] = $this->request->post('name/s',''); + $params["tel"] = $this->request->post('tel/s',''); + $params["desc"] = $this->request->post('desc/s',''); + $params["front_idcard_image"] = $this->request->post('front_idcard_image/s',''); + $params["reverse_idcard_image"] = $this->request->post('reverse_idcard_image/s',''); + +// if(empty($id)){ +// $this->error(__('缺少必要参数')); +// } + $type = "1"; + $user_id = 0; + $user = $this->auth->getUser();//登录用户 + if($user)$user_id = $user['id']; + try { + $res = $this->model->apply($type,$user_id,$params,true,true); + } catch (\Exception $e){ +// Log::log($e->getMessage()); + $this->error($e->getMessage(),['errcode'=>$e->getCode()]); + } + $this->success('获取成功', ['detail' => $res]); + } + + + /** + * @ApiTitle(机构申请状态) + * @ApiSummary(机构申请状态) + * @ApiRoute(/api/school/shop/auth_info) + * @ApiMethod(GET) + */ + public function auth_info(){ + + try { + $res = ManystoreShop::getAuthInfo($this->auth->id); + } catch (\Exception $e){ +// Log::log($e->getMessage()); + $this->error($e->getMessage(),['errcode'=>$e->getCode()]); + } + $this->success('获取成功', $res); + } + + } \ No newline at end of file diff --git a/application/common.php b/application/common.php index 7a3c4a8..cec1e4e 100644 --- a/application/common.php +++ b/application/common.php @@ -570,3 +570,11 @@ if (!function_exists('de_code')) { return $num; } } + + + +if (!function_exists('getDistanceBuilder')) { + function getDistanceBuilder($lat, $lng) { + return "ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((". matchLatLng($lat) . " * PI() / 180 - latitude * PI() / 180) / 2), 2) + COS(". matchLatLng($lat). " * PI() / 180) * COS(latitude * PI() / 180) * POW(SIN((". matchLatLng($lng). " * PI() / 180 - longitude * PI() / 180) / 2), 2))) * 1000) AS distance"; + } +} diff --git a/application/common/controller/ManystoreBase.php b/application/common/controller/ManystoreBase.php index 3e5188a..e48f0ea 100644 --- a/application/common/controller/ManystoreBase.php +++ b/application/common/controller/ManystoreBase.php @@ -120,6 +120,8 @@ class ManystoreBase extends Controller + + protected function checkAssemblyParameters(){ if(!$this->qSwitch)return false; //得到所有get参数 diff --git a/application/common/hooks.php b/application/common/hooks.php new file mode 100644 index 0000000..de55ef9 --- /dev/null +++ b/application/common/hooks.php @@ -0,0 +1,90 @@ + [ // 订单创建前 + 'app\\common\\listener\\classesorder\\OrderHook' + ], + 'classes_order_create_after' => [ // 订单创建后 + 'app\\common\\listener\\classesorder\\OrderHook' + ], + 'classes_order_payed_after' => [ // 订单支付成功 + 'app\\common\\listener\\classesorder\\OrderHook' + ], + 'classes_order_cancel_after' => [ // 订单取消后 + 'addons\\shopro\\listener\\classesorder\\OrderHook' + ], + + 'classes_order_finish_after' => [ // 订单完成后 + 'app\\common\\listener\\classesorder\\OrderHook' + ], + +// + // app\common\listener\classesorder + + // 订单取消 +// 'order_cancel_before' => [ // 订单取消前 +// ], +// 'order_cancel_after' => [ // 订单取消后 +// 'addons\\shopro\\listener\\order\\Invalid' +// ], + +]; + + +//课时订单事件钩子 +$hourHooks = [ + // 订单创建 + 'classeshour_order_create_before' => [ // 订单创建前 + 'app\\common\\listener\\classeshourorder\\OrderHook' + ], + 'classeshour_order_create_after' => [ // 订单创建后 + 'app\\common\\listener\\classeshourorder\\OrderHook' + ], + 'classeshour_order_update_after' => [ // 订单变更课时后 + 'app\\common\\listener\\classeshourorder\\OrderHook' + ], + 'classeshour_order_auth_success_after' => [ // 订单审核通过后 + 'app\\common\\listener\\classeshourorder\\OrderHook' + ], + 'classeshour_order_auth_fail_after' => [ // 订单审核失败后 + 'app\\common\\listener\\classeshourorder\\OrderHook' + ], + 'classeshour_order_finish_after' => [ // 订单核销完成后 + 'app\\common\\listener\\classeshourorder\\OrderHook' + ], + 'classeshour_order_cancel_after' => [ // 订单取消后 + 'addons\\shopro\\listener\\classeshourorder\\OrderHook' + ], +]; + + + +//机构审核事件钩子 +$manystoreHooks = [ + // 订单创建 + 'shop_create_after' => [ // 机构账号创建成功后(审核之前) + 'app\\common\\listener\\manystore\\ShopHook' + ], + 'shop_apply_after' => [ // 机构账号提交审核申请后 + 'app\\common\\listener\\manystore\\ShopHook' + ], + 'shop_auth_success_after' => [ // 机构审核通过后 + 'app\\common\\listener\\manystore\\ShopHook' + ], + 'shop_auth_fail_after' => [ // 机构审核失败后 + 'app\\common\\listener\\manystore\\ShopHook' + ], +]; + + + + +// +//if (file_exists(ROOT_PATH . 'addons/shopro/listener/commission')) { +// $defaultHooks = array_merge_recursive($defaultHooks, $commissionHooks); +//} +$defaultHooks = array_merge_recursive($defaultHooks, $hourHooks); +$defaultHooks = array_merge_recursive($defaultHooks, $manystoreHooks); + +return $defaultHooks; diff --git a/application/common/listener/classeshourorder/OrderHook.php b/application/common/listener/classeshourorder/OrderHook.php index 99e1869..d585354 100644 --- a/application/common/listener/classeshourorder/OrderHook.php +++ b/application/common/listener/classeshourorder/OrderHook.php @@ -17,12 +17,35 @@ class OrderHook } + // 订单变更课时后 + public function classeshourOrderUpdateAfter(&$params) + { + + } + + + + + // 订单审核通过后 + public function classeshourOrderAuthSuccessAfter(&$params) + { + + } + + // 订单审核失败后 + public function classeshourOrderAuthFailAfter(&$params) + { + + } + + // 订单核销完成后 + public function classeshourOrderFinishAfter(&$params) + { + + } + + -// // 订单支付成功后 -// public function classeshourOrderPayedAfter(&$params) -// { -// -// } // 订单取消成功后 public function classeshourOrderCancelAfter(&$params) diff --git a/application/common/listener/classesorder/OrderHook.php b/application/common/listener/classesorder/OrderHook.php index 0abda58..4d667c9 100644 --- a/application/common/listener/classesorder/OrderHook.php +++ b/application/common/listener/classesorder/OrderHook.php @@ -30,5 +30,11 @@ class OrderHook } + // 订单完成后 + public function classesOrderFinishAfter(&$params) + { + + } + } \ No newline at end of file diff --git a/application/common/listener/manystore/ShopHook.php b/application/common/listener/manystore/ShopHook.php new file mode 100644 index 0000000..c46f2e8 --- /dev/null +++ b/application/common/listener/manystore/ShopHook.php @@ -0,0 +1,36 @@ +where("status","1")->find(); - //如果存在申请单,则直接更新这个单的状态 - //如果不存在则创建一个新单 + // $order = self::getHaveCancelOrder($order_no); @@ -269,21 +281,24 @@ class ManystoreShop extends BaseModel $res = true; try{ //事务逻辑 -// //更新订单取消状态 -// $order = Order::updateCancel($order); -// //插入订单取消日志 -// if(!$user_id ||$order["user_id"] !=$user_id ){ -// OrderLog::log($order['id'],"[员工代操作]课时预约单取消成功,课时已原路退回",$oper_type ?: 'user', $oper_id ?: $order['user_id']); -// }else{ -// OrderLog::log($order['id'],"课时预约单取消成功,课时已原路退回",$oper_type ?: 'user', $oper_id ?: $order['user_id']); -// } -// -// //调用订单取消事件 -// $data = ['order' => $order]; -// \think\Hook::listen('classeshour_order_cancel_after', $data); -// //执行课时数更新 -// $res1 = \app\common\model\school\classes\order\Order::statisticsAndUpdateClassesNumber($order['classes_order_id']); - + //得到申请单(没有则创建) + $shop = ManystoreShop::where( 'user_id',$user_id)->find(); + //如果存在申请单,则直接更新这个单的状态 + //如果不存在则创建一个新单 + if(!$shop){ + //创建申请单 + $shop = $this->creatShop($type,$user_id,$params); + } + //更新申请单状态为审核中 + $shop['status']= '0'; + //清空审核时间 + $shop['reason']= ''; + $shop['auth_time']= 0; + $shop["admin_id"] = 0; + $shop->save(); + //调用订单事件 + $data = ['shop' => $shop]; + \think\Hook::listen('shop_apply_after', $data); if($trans){ self::commitTrans(); @@ -297,6 +312,169 @@ class ManystoreShop extends BaseModel return $res; } + /** 机构后台默认密码获取 + * @param $type + * @param $user_id + * @param $params + * + * @throws \think\exception\DbException + */ +public function getDefaultPassword($type,$user_id,$params){ + $user = User::get($user_id); + $defaultPassword = null; + switch ($type) { + case '1': //个人 + //手机号 + 个人id生成的code + $defaultPassword = $user["mobile"].en_code($user['id']); +// $rule = [ +// 'name' => 'require', +// 'tel' => 'require|number', +//// 'desc' => 'require', +// 'front_idcard_image' => 'require', +// 'reverse_idcard_image' => 'require', +// ]; +// $rule_msg = [ +// 'name.require' => '姓名必须填写', +// 'tel.require' => '服务电话必须填写', +// 'tel.number' => '服务电话必须是数字', +//// 'desc.require' => '申请备注必须填写', +// 'front_idcard_image.require' => '身份证正面必须上传', +// 'reverse_idcard_image.require' => '身份证反面必须上传', +// ]; + break; + case '2': //机构 + $defaultPassword = $user["mobile"].en_code($user['id']); +// $rule = [ +// 'name' => 'require', +// 'tel' => 'require|number', +//// 'desc' => 'require', +// 'front_idcard_image' => 'require', +// 'reverse_idcard_image' => 'require', +// 'images' => 'require', +// 'yyzz_images' => 'require', +// ]; + +// $rule_msg = [ +// 'name.require' => '机构名称必须填写', +// 'tel.require' => '服务电话必须填写', +// 'tel.number' => '服务电话必须是数字', +//// 'desc.require' => '申请备注必须填写', +// 'front_idcard_image.require' => '法人身份证正面必须上传', +// 'reverse_idcard_image.require' => '法人身份证反面必须上传', +// 'images.require' => '机构环境照片必须上传', +// 'yyzz_images.require' => '营业执照照片必须上传', +// ]; + + break; + } + return $defaultPassword; +} + + + +public function creatShop($type,$user_id,$params){ + + + //商家附表 + $shop = (new self); + $shop_info = $shop->allowField(true)->save($params); + if($shop_info === false){ + throw new \Exception($shop->getError()); + } + //账号主表 + $manystore_params = [ + "nickname" => $params["name"], + ]; + $manystore_params["username"] = $params["tel"] ?: self::$pinyin->permalink($manystore_params["nickname"]); + $manystore_params["email"] = $manystore_params["username"] . "@xx.com"; + + $manystore_params['password'] = self::getDefaultPassword($type,$user_id,$params); + + $manystore_params['shop_id'] = $shop->id; + $manystore_params['salt'] = Random::alnum(); + $manystore_params['password'] = md5(md5($manystore_params['password']) . $manystore_params['salt']); + $manystore_params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。 + $manystore_params['is_main'] = 1; + $model = new Manystore(); + + $result = $model->allowField(true)->save($manystore_params); + if ($result === false) { + throw new \Exception($model->getError()); + } + + + $manystoreAuthGroupModel = new ManystoreAuthGroup(); + $group = []; + + switch ($type) { + case '1': //个人 + $group['name'] = '个人认证类型'; + $group['rules'] = '*'; + break; + case '2': //机构 + $group['name'] = '机构认证类型'; + $group['rules'] = '*'; + break; + } + + $group['shop_id'] = $shop->id; + $group['createtime'] = time(); + $group['updatetime'] = time(); + $group_id = $manystoreAuthGroupModel->insertGetId($group); + if(!$group_id){ + $this->error('添加失败'); + } + + $manystoreAuthGroupAccessModel = new ManystoreAuthGroupAccess(); + $group_access = []; + $group_access['uid'] = $model->id; + $group_access['group_id'] = $group_id; + + $manystoreAuthGroupAccessModel->insert($group_access); + + + //调用订单事件 + $data = ['shop' => $shop]; + \think\Hook::listen('shop_create_after', $data); + + + return $shop; +} + + + /** 机耕申请状态查询 + * + */ +public static function getAuthInfo($user_id){ + $auth_status = '-1'; //-1=未申请,0=待审核,1=审核通过,2=审核失败 + $shop_id = 0; + $type = '1'; + $reason =""; //失败原因 + //得到申请单 + $apply_info = self::where("user_id",$user_id)->where("status","1")->find(); + if(!$apply_info)$apply_info = self::where("user_id",$user_id)->find(); + //不存在说明未申请,直接返回 + if(!$apply_info){ + return compact('auth_status','shop_id','reason','apply_info',"type"); + } + $type = $apply_info['type']; + //从申请单取到申请状态 + $auth_status = $apply_info['status']; + //如果是审核失败,取失败原因 + if($auth_status == '2'){ + $reason = $apply_info['reason']; + } + //如果是申请成功,取店铺id + if($auth_status == '1'){ + $shop_id = $apply_info['shop_id']; + } + + + return compact('auth_status','shop_id','reason','apply_info',"type"); +} + + + diff --git a/application/common/model/manystore/Shop.php b/application/common/model/manystore/Shop.php new file mode 100644 index 0000000..8a7918c --- /dev/null +++ b/application/common/model/manystore/Shop.php @@ -0,0 +1,12 @@ + __('Type 1'), '2' => __('Type 2')]; + } + + public function getStatusList() + { + return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); + $list = $this->getTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getAuthTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['auth_time']) ? $data['auth_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getCreateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getUpdateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setAuthTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setCreateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setUpdateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function shop() + { + return $this->belongsTo('Shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/common/model/manystore/UserAuth.php b/application/common/model/manystore/UserAuth.php new file mode 100644 index 0000000..1175860 --- /dev/null +++ b/application/common/model/manystore/UserAuth.php @@ -0,0 +1,83 @@ + __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getAuthTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['auth_time']) ? $data['auth_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getUpdateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setAuthTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setUpdateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function shop() + { + return $this->belongsTo('Shop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/common/model/school/Message.php b/application/common/model/school/Message.php new file mode 100644 index 0000000..5719707 --- /dev/null +++ b/application/common/model/school/Message.php @@ -0,0 +1,152 @@ + __('Platform admin'), 'user' => __('Platform user'), 'shop' => __('Platform shop')]; + } + + public function getOperTypeList() + { + return ['admin' => __('Oper_type admin'), 'user' => __('Oper_type user'), 'system' => __('Oper_type system'), 'shop' => __('Oper_type shop')]; + } + + public function getToTypeList() + { + return ['admin' => __('To_type admin'), 'user' => __('To_type user'), 'system' => __('To_type system'), 'shop' => __('To_type shop')]; + } + + public function getStatusList() + { + return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order')]; + } + + public function getMiniTypeList() + { + return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')]; + } + + + public function getPlatformTextAttr($value, $data) + { + $value = $value ?: ($data['platform'] ?? ''); + $valueArr = explode(',', $value); + $list = $this->getPlatformList(); + return implode(',', array_intersect_key($list, array_flip($valueArr))); + } + + + public function getOperTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['oper_type']) ? $data['oper_type'] : ''); + $list = $this->getOperTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getToTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['to_type']) ? $data['to_type'] : ''); + $list = $this->getToTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getMiniTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['mini_type']) ? $data['mini_type'] : ''); + $list = $this->getMiniTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + protected function setPlatformAttr($value) + { + return is_array($value) ? implode(',', $value) : $value; + } + + + public function admin() + { + return $this->belongsTo('app\admin\model\Admin', 'oper_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\admin\model\User', 'to_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + /** 发送站内信 + * @param $title 站内信标题 + * @param $desc 内容 + * @param $mini_type 消息子类型 + * @param $to_id 接收者id + * @param $to_type 接收者类型 + * @param $status 消息大类型 + * @param $platform 发送平台 + * @param $params 额外参数 + * @param $oper_id 发送人id + * @param $oper_type 发送人类型 + * + */ + public static function send($title,$desc,$mini_type,$to_id,$to_type="user",$status="system",$platform="user",$params=[],$oper_id=0,$oper_type="system"){ + $data = [ + 'title' => $title, + 'desc' => $desc, + 'params' => json_encode($params), + 'platform' => $platform, + 'oper_id' => $oper_id, + 'oper_type' => $oper_type, + 'to_id' => $to_id, + 'to_type' => $to_type, + 'status' => $status, + 'mini_type' => $mini_type, + ]; + $message = new self(); + $message->save($data); + return $message; + } + + +} diff --git a/application/common/model/school/SearchCity.php b/application/common/model/school/SearchCity.php new file mode 100644 index 0000000..091caaf --- /dev/null +++ b/application/common/model/school/SearchCity.php @@ -0,0 +1,40 @@ +alias($alisa); + } + if ($alisa) $alisa = $alisa . '.'; + $tableFields = (new static)->getTableFields(); + foreach ($tableFields as $fields) + { + if(in_array($fields, ['status',"hot"]))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'])) $model = $model->where("{$alisa}status", 'in', $whereData['status']); + if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}id|{$alisa}name", 'Like', "%{$whereData['keywords']}%"); + if (isset($whereData['time'])&&$whereData['time']){ + $model = $model->time($whereData['time']); + } + + if (isset($whereData['hot'])) $model = $model->where("{$alisa}hot", 'in', $whereData['hot']); + + return $model; + } + + + public static function showList($page, $limit,$keywords,$hot=null){ + $field = ['*']; + + + $sort = "field(hot,'1','0') asc,weigh desc,id desc"; + $serch_where = ['keywords'=>$keywords,"status"=>"1"]; + if($hot==="0" || $hot==="1"){ + $serch_where['hot'] = $hot; + } + + return (new self)->getBaseList($serch_where, $page, $limit,$sort,$field); + } + + + + } diff --git a/application/common/model/school/classes/ClassesLib.php b/application/common/model/school/classes/ClassesLib.php index db6eae7..84e8555 100644 --- a/application/common/model/school/classes/ClassesLib.php +++ b/application/common/model/school/classes/ClassesLib.php @@ -41,8 +41,27 @@ class ClassesLib extends BaseModel 'recommend_text', 'hot_text', 'new_text', - 'selfhot_text' + 'selfhot_text', + 'distance_text', ]; + + public function getDistanceTextAttr($value, $data) { + $distance_text = ''; + $distance = $data['distance'] ?? 0; + + switch (true) { + case $distance >= 1000; + $distance_text = round(($distance / 1000), 2) . 'km'; + break; + default : + $distance_text = $distance . 'm'; + break; + + } + + return $distance_text; + } + protected static function init() @@ -187,6 +206,8 @@ class ClassesLib extends BaseModel + + public function getHeadimageAttr($value, $data) { if (!empty($value)) return cdnurl($value, true); @@ -389,4 +410,180 @@ class ClassesLib extends BaseModel return $this->classes_lib_ids; } + + /** + * 获取所有课程列表 + */ + public static function getVaildList($params) { + extract($params); + $a = (new self)->getWithAlisaName().'.'; + // 查询自提点 + if(isset($status) && in_array($status, ['1','2','3'])){ + $selfetch = self::with(['teacher']); + }else{ + $selfetch = self::with(['teacher'])->where($a.'status', '1')->where("{$a}auth_status",1); + } + + + $order = $order?? 'normal'; + $per_page = $params['page'] ?? 10; + + + $field = "{$a}id,{$a}shop_id,{$a}user_id,{$a}teacher_id,{$a}classes_cate_ids,{$a}classes_label_ids,{$a}self_label_tag,{$a}title,{$a}headimage,{$a}type,{$a}classes_date_text,{$a}classes_time_text,{$a}virtual_num,{$a}sale,{$a}price,{$a}underline_price,{$a}virtual_collect,{$a}status,{$a}auth_status,{$a}weigh,{$a}recommend,{$a}hot,{$a}new,{$a}selfhot,{$a}createtime,{$a}virtual_people,{$a}feel,{$a}limit_num,{$a}sign_num,{$a}verification_num"; + + //得到距离 + if (isset($latitude) && isset($longitude) && $latitude && $longitude) { + $field .= ', '.getDistanceBuilder($latitude, $longitude); + }else{ + $field .= ', 0 as distance'; + } + + //得到每个 + + + $selfetch = $selfetch->field($field); + if (isset($keyword) && $keyword) { + $selfetch = $selfetch->where("{$a}title|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keyword . '%'); + } + + if (isset($manystore_id) && $manystore_id) { + $selfetch = $selfetch->where("{$a}manystore_id", 'in', ''.$manystore_id); + } + + if (isset($shop_id) && $shop_id) { + $selfetch = $selfetch->where("{$a}shop_id", 'in', ''.$shop_id); + } + + if (isset($user_id) && $user_id) { + $selfetch = $selfetch->where("{$a}user_id", 'in', ''.$user_id); + } + + if (isset($teacher_id) && $teacher_id) { + $selfetch = $selfetch->where("{$a}teacher_id", 'in', ''.$teacher_id); + } + + if (isset($type) && $type) { + $selfetch = $selfetch->where("{$a}type", 'in', ''.$type); + } + + if (isset($address_type) && $address_type) { + $selfetch = $selfetch->where("{$a}address_type", 'in', ''.$address_type); + } + + + if (isset($recommend) && $recommend) { + $selfetch = $selfetch->where("{$a}recommend", 'in', ''.$recommend); + } + + + if (isset($hot) && $hot) { + $selfetch = $selfetch->where("{$a}hot", 'in', ''.$hot); + } + + + if (isset($new) && $new) { + $selfetch = $selfetch->where("{$a}new", 'in', ''.$new); + } + + if (isset($feel) && $feel) { + $selfetch = $selfetch->where("{$a}feel", 'in', ''.$feel); + } + + + + //区域搜索 + if (isset($province) && $province) { + $selfetch = $selfetch->where("{$a}province", 'in', ''.$province); + } + + + if (isset($city) && $city) { + $selfetch = $selfetch->where("{$a}city", 'in', ''.$city); + } + + if (isset($district) && $district) { + $selfetch = $selfetch->where("{$a}district", 'in', ''.$district); + } + + + + + + + + + if (isset($self_label_tag) && $self_label_tag) { + $self_label_tag = implode("|",explode(',',$self_label_tag)); + $selfetch = $selfetch->whereRaw(" {$a}self_label_tag REGEXP '({$self_label_tag})'"); + } + + + + + if (isset($classes_cate_ids) && $classes_cate_ids) { + $classes_cate_ids = implode("|",explode(',',$classes_cate_ids)); + $selfetch = $selfetch->whereRaw(" {$a}classes_cate_ids REGEXP '({$classes_cate_ids})'"); + } + + if (isset($classes_label_ids) && $classes_label_ids) { + $classes_label_ids = implode("|",explode(',',$classes_label_ids)); + $selfetch = $selfetch->whereRaw(" {$a}classes_label_ids REGEXP '({$classes_label_ids})'"); + } + + + + //排序 + switch ($order) { + case "normal": //综合排序(推薦優先) + $selfetch = $selfetch->order("{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc"); + break; + case "distance": //距离优先 权重 + $selfetch = $selfetch->order("distance asc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc"); + break; + case "hot": //熱門优先 + $selfetch = $selfetch->order("{$a}hot desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc"); + break; + + case "new": //平台最新优先 + $selfetch = $selfetch->order("{$a}new desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc"); + break; + case "selfhot": //机构热门优先 + $selfetch = $selfetch->order("{$a}selfhot desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc"); + break; + + case "sale": //銷量优先 + $selfetch = $selfetch->order("{$a}sale desc,{$a}verification_num desc,{$a}sign_num desc,{$a}recommend desc,{$a}weigh desc"); + break; + + + default: + throw new \Exception("不支持的排序类型"); + } + + if(isset($nearby) && $nearby) { + $selfetch = $selfetch->having("distance <= {$nearby}"); + } + + + + + $selfetch = $selfetch->paginate($per_page); + //额外附加数据 + + return $selfetch; + } + + + public static function update_classes($classes_lib_id){ + //更新课程规格库存 + $classes_lib = self::get($classes_lib_id); + if($classes_lib){ + //所有课时加起来 + $classes_lib->limit_num = ClassesSpec::where("classes_lib_id",$classes_lib_id)->sum( "limit_num"); + $classes_lib->save(); + } + } + + + } diff --git a/application/common/model/school/classes/Label.php b/application/common/model/school/classes/Label.php index b41857e..6fad75d 100644 --- a/application/common/model/school/classes/Label.php +++ b/application/common/model/school/classes/Label.php @@ -2,10 +2,11 @@ namespace app\common\model\school\classes; +use app\common\model\BaseModel; use think\Model; use traits\model\SoftDelete; -class Label extends Model +class Label extends BaseModel { use SoftDelete; @@ -55,5 +56,53 @@ class Label extends Model + /**得到基础条件 + * @param $status + * @param null $model + * @param string $alisa + */ + public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false) + { + + if (!$model) { + $model = new static; + if ($alisa&&!$with) $model = $model->alias($alisa); + } + if ($alisa) $alisa = $alisa . '.'; + $tableFields = (new static)->getTableFields(); + foreach ($tableFields as $fields) + { + if(in_array($fields, ['status']))continue; +// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + + if (isset($whereData[$fields]) && $whereData[$fields]){ + if(is_array($whereData[$fields])){ + $model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]); + }else{ + $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]); + } + + } + + + } + if (isset($whereData['status'])) $model = $model->where("{$alisa}status", 'in', $whereData['status']); + if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}id|{$alisa}name", 'Like', "%{$whereData['keywords']}%"); + if (isset($whereData['time'])&&$whereData['time']){ + $model = $model->time($whereData['time']); + } + return $model; + } + + + public static function showList($page, $limit,$keywords){ + $field = ['*']; + $sort = "weigh desc,id desc"; + $serch_where = ['keywords'=>$keywords,"status"=>"1"]; + return (new self)->getBaseList($serch_where, $page, $limit,$sort,$field); + } + + + } diff --git a/application/common/model/school/classes/hourorder/Order.php b/application/common/model/school/classes/hourorder/Order.php index ac6b43c..d3d42df 100644 --- a/application/common/model/school/classes/hourorder/Order.php +++ b/application/common/model/school/classes/hourorder/Order.php @@ -446,14 +446,13 @@ class Order extends BaseModel if(!$classesOrder)throw new \Exception("订单不存在!"); //代下单时将下单人修正成课程下单人,不影响后续判断 $user_id = $classesOrder["user_id"]; - //用户操作权限检测 self::checkOptionAuth($classes_order_id,$param["help_user_id"],$param["help_type"]); - } + //默认校验订单是否已创建 if($check){ //判断订单是否已创建 @@ -461,6 +460,7 @@ class Order extends BaseModel if($order_info) throw new \Exception("订单已生成,如需重新下单请退出页面重新进入!"); if(!$classes_lib_spec_id)throw new \Exception("请选择您要预约的课时信息!"); } + //校验订单参数 //更新最近次数后进行验证 \app\common\model\school\classes\order\Order::statisticsAndUpdateClassesNumber($classes_order_id); @@ -483,7 +483,7 @@ class Order extends BaseModel //判断课时信息 if($classes_lib_spec_id){ - self::checkLibSpec($user_id,$detail["classes_lib_id"],$classes_lib_spec_id); + self::checkLibSpec($user_id,$detail["classes_lib_id"],$classes_lib_spec_id,true); } @@ -800,7 +800,7 @@ class Order extends BaseModel * @throws \think\db\exception\ModelNotFoundException * @throws \think\exception\DbException */ - public static function checkLibSpec($user_id,$classes_lib_id,$classes_lib_spec_id){ + public static function checkLibSpec($user_id,$classes_lib_id,$classes_lib_spec_id,$add=false,$order=null){ if(!$classes_lib_spec_id || !$classes_lib_id)throw new \Exception("缺少必要信息!"); $classes_lib_spec_info = ClassesSpec::where('id',$classes_lib_spec_id) @@ -816,6 +816,31 @@ class Order extends BaseModel ->where('user_id',$user_id) ->find(); if($order_info) throw new \Exception("该课时已预约,请勿重复预约!"); + + //新增或更换课时时判断 + //是否达成限制人数 + //允许人数为0说明不限制 + if($classes_lib_spec_info['limit_num'] > 0){ + //得到当前课时已参与人数 + $sign_num = self::where("classes_lib_spec_id",$classes_lib_spec_id)->where("status","in",["-1","0"])->count(); + + if($add){ + //订单新增课时 + //判断是否达到限制人数 + if($sign_num >= $classes_lib_spec_info['limit_num']){ + throw new \Exception("该课时已满,请选择其他课时!"); + } + + }else{ + //订单更换课时 + //判断是否达到限制人数 + if($sign_num >= $classes_lib_spec_info['limit_num']){ + throw new \Exception("该课时已满,请选择其他课时!"); + } + + } + } + } @@ -1116,7 +1141,7 @@ class Order extends BaseModel //用户操作权限检测 self::checkOptionAuth($order['classes_order_id'],$user_id ?: $oper_id,$oper_type); } - self::checkLibSpec($order['user_id'],$order["classes_lib_id"],$classes_lib_spec_id); + //判断逻辑 if($trans){ @@ -1124,6 +1149,15 @@ class Order extends BaseModel } $res = true; try{ + //执行课时数更新 + $res1 = \app\common\model\school\classes\order\Order::statisticsAndUpdateClassesNumber($order['classes_order_id']); + + if($classes_lib_spec_id == $order["classes_lib_spec_id"])throw new \Exception("请勿重复提交!"); + + + self::checkLibSpec($order['user_id'],$order["classes_lib_id"],$classes_lib_spec_id,false,$res1); + + //事务逻辑 //更新订单状态 diff --git a/application/common/model/school/classes/order/Order.php b/application/common/model/school/classes/order/Order.php index f032ea5..4b37e65 100644 --- a/application/common/model/school/classes/order/Order.php +++ b/application/common/model/school/classes/order/Order.php @@ -899,7 +899,7 @@ class Order extends BaseModel $lib = $order->lib; if($lib){ $lib->sale = self::where("classes_lib_id",$lib["id"])->where("status","<>","-3")->count(); - $lib->save(); + //遍历课程课时规格,更新课时统计数据 $specs = $lib->specs; if($specs){ @@ -912,6 +912,10 @@ 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(); } //检测订单完成状态 diff --git a/application/manystore/controller/manystore/ShopLog.php b/application/manystore/controller/manystore/ShopLog.php new file mode 100644 index 0000000..bf7a84e --- /dev/null +++ b/application/manystore/controller/manystore/ShopLog.php @@ -0,0 +1,76 @@ +model = new \app\manystore\model\manystore\ShopLog; + $this->view->assign("typeList", $this->model->getTypeList()); + $this->view->assign("statusList", $this->model->getStatusList()); + } + + public function import() + { + parent::import(); + } + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['manystoreshop','user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('manystoreshop')->visible(['name']); + $row->getRelation('user')->visible(['nickname','mobile','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/manystore/controller/manystore/UserAuth.php b/application/manystore/controller/manystore/UserAuth.php new file mode 100644 index 0000000..139a15b --- /dev/null +++ b/application/manystore/controller/manystore/UserAuth.php @@ -0,0 +1,75 @@ +model = new \app\manystore\model\manystore\UserAuth; + $this->view->assign("statusList", $this->model->getStatusList()); + } + + public function import() + { + parent::import(); + } + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['manystoreshop','user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('manystoreshop')->visible(['name']); + $row->getRelation('user')->visible(['nickname','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/manystore/controller/school/Message.php b/application/manystore/controller/school/Message.php new file mode 100644 index 0000000..6dec056 --- /dev/null +++ b/application/manystore/controller/school/Message.php @@ -0,0 +1,79 @@ +model = new \app\manystore\model\school\Message; + $this->view->assign("platformList", $this->model->getPlatformList()); + $this->view->assign("operTypeList", $this->model->getOperTypeList()); + $this->view->assign("toTypeList", $this->model->getToTypeList()); + $this->view->assign("statusList", $this->model->getStatusList()); + $this->view->assign("miniTypeList", $this->model->getMiniTypeList()); + } + + public function import() + { + parent::import(); + } + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['admin','user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('admin')->visible(['nickname','avatar']); + $row->getRelation('user')->visible(['nickname','avatar']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/manystore/controller/school/classes/ClassesSpec.php b/application/manystore/controller/school/classes/ClassesSpec.php index 3a5c0db..c8887ac 100644 --- a/application/manystore/controller/school/classes/ClassesSpec.php +++ b/application/manystore/controller/school/classes/ClassesSpec.php @@ -3,6 +3,12 @@ namespace app\manystore\controller\school\classes; use app\common\controller\ManystoreBase; +use app\common\model\User; +use app\manystore\model\Manystore; +use think\Db; +use think\Exception; +use think\exception\PDOException; +use think\exception\ValidateException; /** * 机构课程课时规格 @@ -21,6 +27,12 @@ class ClassesSpec extends ManystoreBase protected $qSwitch = true; protected $qFields = ["classes_lib_id"]; + + protected $no_auth_fields = ['name','limit_num','status','weigh']; + protected $have_auth = false; + + + public function _initialize() { $this->model = new \app\manystore\model\school\classes\ClassesSpec; @@ -75,4 +87,234 @@ class ClassesSpec extends ManystoreBase return $this->view->fetch(); } + + protected function update_classes($classes_lib_id){ + \app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id); + } + + + protected function no_auth_fields_check($params,$row){ + + foreach ($params as $k=>$v){ + + //说明数值有变动 + //$params[$k] 去掉两端空格 + $params[$k] = trim($v); + + if($row[$k]!=$params[$k]){ + //当修改参数不在允许修改的字段中 + if(!in_array($k,$this->no_auth_fields)){ + + $this->have_auth = true;break; + + } + } + + } + + return $this->have_auth; + + } + + protected function updateCheck($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)$this->error("存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!"); + } + + + protected function update_check(&$params,$row=null) + { + + $shop_id = SHOP_ID; + $manystore = Manystore::where("shop_id", $shop_id)->find(); + if (!$manystore) { + $this->error("店铺不存在"); + } + + //修改 + if($row){ + $this->updateCheck($row->id,$params,$row); + + }else{ + + } + + + } + + + + /** + * 添加 + * + * @return string + * @throws \think\Exception + */ + public function add() + { + 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); + $this->update_classes($this->model["classes_lib_id"]); + + 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(); + } + + /** + * 编辑 + */ + public function edit($ids = null) + { + if($this->shopIdAutoCondition){ + $this->model->where(array('shop_id'=>SHOP_ID)); + } + $row = $this->model->where(array('id'=>$ids))->find(); + if (!$row) { + $this->error(__('No Results were found')); + } + + if ($this->request->isPost()) { + $params = $this->request->post("row/a"); + if ($params) { + $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(true)->validate($validate); + } + $this->update_check($params,$row); + + + $result = $row->allowField(true)->save($params); + $this->update_classes($row["classes_lib_id"]); + + 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 updated')); + } + } + $this->error(__('Parameter %s can not be empty', '')); + } + + + $user = User::where("id", $row["user_id"])->find(); +// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单"); + $row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile + $this->view->assign("row", $row); + return $this->view->fetch(); + } + + /** + * 删除 + */ + public function del($ids = "") + { + if (!$this->request->isPost()) { + $this->error(__("Invalid parameters")); + } + $ids = $ids ? $ids : $this->request->post("ids"); + if ($ids) { + $pk = $this->model->getPk(); + if($this->shopIdAutoCondition){ + $this->model->where(array('shop_id'=>SHOP_ID)); + } + $list = $this->model->where($pk, 'in', $ids)->select(); + $datas = []; + foreach ($list as $item) { + $this->updateCheck($item->id); + $datas[] = $item->classes_lib_id; + } + $count = 0; + Db::startTrans(); + try { + foreach ($list as $k => $v) { + $count += $v->delete(); + } + foreach ($datas as $classes_lib_id) { + $this->update_classes($classes_lib_id); + } + + + Db::commit(); + } catch (PDOException $e) { + Db::rollback(); + $this->error($e->getMessage()); + } catch (Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($count) { + $this->success(); + } else { + $this->error(__('No rows were deleted')); + } + } + $this->error(__('Parameter %s can not be empty', 'ids')); + } + + } diff --git a/application/manystore/lang/zh-cn/manystore/shop_log.php b/application/manystore/lang/zh-cn/manystore/shop_log.php new file mode 100644 index 0000000..70ee8c4 --- /dev/null +++ b/application/manystore/lang/zh-cn/manystore/shop_log.php @@ -0,0 +1,42 @@ + 'ID', + 'Shop_id' => '机构店铺id', + 'User_id' => '机构前端用户', + 'Name' => '店铺名称', + 'Logo' => '品牌LOGO', + 'Image' => '封面图', + 'Images' => '店铺环境照片', + 'Address_city' => '城市选择', + 'Province' => '省编号', + 'City' => '市编号', + 'District' => '县区编号', + 'Address' => '店铺地址', + 'Address_detail' => '店铺详细地址', + 'Longitude' => '经度', + 'Latitude' => '纬度', + 'Yyzzdm' => '营业执照', + 'Yyzz_images' => '营业执照照片', + 'Front_idcard_image' => '法人身份证正面', + 'Reverse_idcard_image' => '法人身份证反面', + 'Tel' => '服务电话', + 'Content' => '店铺详情', + 'Type' => '类型', + 'Type 1' => '个人', + 'Type 2' => '机构', + 'Desc' => '申请备注', + 'Status' => '审核状态', + 'Status 0' => '待审核', + 'Status 1' => '审核通过', + 'Status 2' => '审核失败', + 'Reason' => '审核不通过原因', + 'Auth_time' => '审核时间', + 'Admin_id' => '审核管理员id', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'Manystoreshop.name' => '店铺名称', + 'User.nickname' => '昵称', + 'User.mobile' => '手机号', + 'User.avatar' => '头像' +]; diff --git a/application/manystore/lang/zh-cn/manystore/user_auth.php b/application/manystore/lang/zh-cn/manystore/user_auth.php new file mode 100644 index 0000000..221acd5 --- /dev/null +++ b/application/manystore/lang/zh-cn/manystore/user_auth.php @@ -0,0 +1,16 @@ + '机构shopid', + 'User_id' => '授权用户', + 'Status' => '授权状态', + 'Status 0' => '待确认', + 'Status 1' => '通过', + 'Status 2' => '拒绝', + 'Auth_time' => '授权确认时间', + 'Createtime' => '发起时间', + 'Update_time' => '修改时间', + 'Manystoreshop.name' => '店铺名称', + 'User.nickname' => '昵称', + 'User.avatar' => '头像' +]; diff --git a/application/manystore/lang/zh-cn/school/classes/classes_lib.php b/application/manystore/lang/zh-cn/school/classes/classes_lib.php index c65923a..90a7ca7 100644 --- a/application/manystore/lang/zh-cn/school/classes/classes_lib.php +++ b/application/manystore/lang/zh-cn/school/classes/classes_lib.php @@ -79,5 +79,8 @@ return [ 'User.mobile' => '手机号', 'User.avatar' => '头像', 'Admin.nickname' => '昵称', - 'Admin.avatar' => '头像' + 'Admin.avatar' => '头像', + 'Limit_num' => '总限定人数', + 'Sign_num' => '总已报名人数', + 'Verification_num' => '总已核销人数', ]; diff --git a/application/manystore/lang/zh-cn/school/message.php b/application/manystore/lang/zh-cn/school/message.php new file mode 100644 index 0000000..28e437e --- /dev/null +++ b/application/manystore/lang/zh-cn/school/message.php @@ -0,0 +1,41 @@ + '消息平台', + 'Platform admin' => '总后台', + 'Platform user' => '用户端', + 'Platform shop' => '机构后台', + 'Oper_type' => '发送人类型', + 'Oper_type admin' => '管理员', + 'Oper_type user' => '用户', + 'Oper_type system' => '系统', + 'Oper_type shop' => '机构', + 'Oper_id' => '发送人id', + 'To_type' => '接收人类型', + 'To_type admin' => '管理员', + 'To_type user' => '用户', + 'To_type system' => '系统', + 'To_type shop' => '机构', + 'To_id' => '接收人id', + 'Status' => '消息总类型', + 'Status system' => '系统消息', + 'Status classes' => '课程消息', + 'Status order' => '订单消息', + 'Mini_type' => '小消息类型', + 'Mini_type order_notice' => '课程订单通知', + 'Mini_type classes_auth' => '课程报名审核', + 'Mini_type classes_apply' => '课程上新审核', + 'Mini_type shop_apply' => '机构审核', + 'Mini_type classes_order_notice' => '课时预约', + 'Mini_type user_auth' => '机构授权用户信息', + 'Mini_type aftercare' => '售后服务', + 'Mini_type other' => '其他', + 'Title' => '消息标题', + 'Desc' => '消息内容', + 'Params' => '消息额外参数(json)', + 'Createtime' => '创建时间', + 'Admin.nickname' => '昵称', + 'Admin.avatar' => '头像', + 'User.nickname' => '昵称', + 'User.avatar' => '头像' +]; diff --git a/application/manystore/model/manystore/ShopLog.php b/application/manystore/model/manystore/ShopLog.php new file mode 100644 index 0000000..fbe465d --- /dev/null +++ b/application/manystore/model/manystore/ShopLog.php @@ -0,0 +1,110 @@ + __('Type 1'), '2' => __('Type 2')]; + } + + public function getStatusList() + { + return ['0' => __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['type']) ? $data['type'] : ''); + $list = $this->getTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getAuthTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['auth_time']) ? $data['auth_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getCreateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['create_time']) ? $data['create_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getUpdateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setAuthTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setCreateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setUpdateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function manystoreshop() + { + return $this->belongsTo('app\manystore\model\ManystoreShop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\manystore\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/manystore/model/manystore/UserAuth.php b/application/manystore/model/manystore/UserAuth.php new file mode 100644 index 0000000..905e401 --- /dev/null +++ b/application/manystore/model/manystore/UserAuth.php @@ -0,0 +1,83 @@ + __('Status 0'), '1' => __('Status 1'), '2' => __('Status 2')]; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getAuthTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['auth_time']) ? $data['auth_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + + public function getUpdateTimeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['update_time']) ? $data['update_time'] : ''); + return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value; + } + + protected function setAuthTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + protected function setUpdateTimeAttr($value) + { + return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value); + } + + + public function manystoreshop() + { + return $this->belongsTo('app\manystore\model\ManystoreShop', 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\manystore\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/manystore/model/school/Message.php b/application/manystore/model/school/Message.php new file mode 100644 index 0000000..25ca69c --- /dev/null +++ b/application/manystore/model/school/Message.php @@ -0,0 +1,119 @@ + __('Platform admin'), 'user' => __('Platform user'), 'shop' => __('Platform shop')]; + } + + public function getOperTypeList() + { + return ['admin' => __('Oper_type admin'), 'user' => __('Oper_type user'), 'system' => __('Oper_type system'), 'shop' => __('Oper_type shop')]; + } + + public function getToTypeList() + { + return ['admin' => __('To_type admin'), 'user' => __('To_type user'), 'system' => __('To_type system'), 'shop' => __('To_type shop')]; + } + + public function getStatusList() + { + return ['system' => __('Status system'), 'classes' => __('Status classes'), 'order' => __('Status order')]; + } + + public function getMiniTypeList() + { + return ['order_notice' => __('Mini_type order_notice'), 'classes_auth' => __('Mini_type classes_auth'), 'classes_apply' => __('Mini_type classes_apply'), 'shop_apply' => __('Mini_type shop_apply'), 'classes_order_notice' => __('Mini_type classes_order_notice'), 'user_auth' => __('Mini_type user_auth'), 'aftercare' => __('Mini_type aftercare'), 'other' => __('Mini_type other')]; + } + + + public function getPlatformTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['platform']) ? $data['platform'] : ''); + $valueArr = explode(',', $value); + $list = $this->getPlatformList(); + return implode(',', array_intersect_key($list, array_flip($valueArr))); + } + + + public function getOperTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['oper_type']) ? $data['oper_type'] : ''); + $list = $this->getOperTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getToTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['to_type']) ? $data['to_type'] : ''); + $list = $this->getToTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getStatusTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['status']) ? $data['status'] : ''); + $list = $this->getStatusList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + + public function getMiniTypeTextAttr($value, $data) + { + $value = $value ? $value : (isset($data['mini_type']) ? $data['mini_type'] : ''); + $list = $this->getMiniTypeList(); + return isset($list[$value]) ? $list[$value] : ''; + } + + protected function setPlatformAttr($value) + { + return is_array($value) ? implode(',', $value) : $value; + } + + + public function admin() + { + return $this->belongsTo('app\manystore\model\Admin', 'oper_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function user() + { + return $this->belongsTo('app\manystore\model\User', 'to_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/manystore/validate/manystore/ShopLog.php b/application/manystore/validate/manystore/ShopLog.php new file mode 100644 index 0000000..d286d4e --- /dev/null +++ b/application/manystore/validate/manystore/ShopLog.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/manystore/validate/manystore/UserAuth.php b/application/manystore/validate/manystore/UserAuth.php new file mode 100644 index 0000000..af82a2a --- /dev/null +++ b/application/manystore/validate/manystore/UserAuth.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/manystore/validate/school/Message.php b/application/manystore/validate/school/Message.php new file mode 100644 index 0000000..e5fc7dd --- /dev/null +++ b/application/manystore/validate/school/Message.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/manystore/view/manystore/shop_log/add.html b/application/manystore/view/manystore/shop_log/add.html new file mode 100644 index 0000000..b2714d7 --- /dev/null +++ b/application/manystore/view/manystore/shop_log/add.html @@ -0,0 +1,224 @@ +
                      + +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      + +
                      +
                      +
                      + +
                      +
                      + +
                      + + +
                      + +
                      +
                        +
                        +
                        +
                        + +
                        +
                        + +
                        + + +
                        + +
                        +
                          +
                          +
                          +
                          + +
                          +
                          +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          + +
                          +
                          +
                          + +
                          +
                          + +
                          + + +
                          + +
                          +
                            +
                            +
                            +
                            + +
                            +
                            + +
                            + + +
                            + +
                            +
                              +
                              +
                              +
                              + +
                              +
                              + +
                              + + +
                              + +
                              +
                                +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + + + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                + {foreach name="statusList" item="vo"} + + {/foreach} +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                + +
                                diff --git a/application/manystore/view/manystore/shop_log/edit.html b/application/manystore/view/manystore/shop_log/edit.html new file mode 100644 index 0000000..fcd7965 --- /dev/null +++ b/application/manystore/view/manystore/shop_log/edit.html @@ -0,0 +1,224 @@ +
                                + +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                + +
                                +
                                +
                                + +
                                +
                                + +
                                + + +
                                + +
                                +
                                  +
                                  +
                                  +
                                  + +
                                  +
                                  + +
                                  + + +
                                  + +
                                  +
                                    +
                                    +
                                    +
                                    + +
                                    +
                                    +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    + +
                                    +
                                    +
                                    + +
                                    +
                                    + +
                                    + + +
                                    + +
                                    +
                                      +
                                      +
                                      +
                                      + +
                                      +
                                      + +
                                      + + +
                                      + +
                                      +
                                        +
                                        +
                                        +
                                        + +
                                        +
                                        + +
                                        + + +
                                        + +
                                        +
                                          +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          + {foreach name="statusList" item="vo"} + + {/foreach} +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          + +
                                          diff --git a/application/manystore/view/manystore/shop_log/index.html b/application/manystore/view/manystore/shop_log/index.html new file mode 100644 index 0000000..f584dc1 --- /dev/null +++ b/application/manystore/view/manystore/shop_log/index.html @@ -0,0 +1,44 @@ +
                                          + +
                                          + {:build_heading(null,FALSE)} + +
                                          + + + +
                                          diff --git a/application/manystore/view/manystore/user_auth/add.html b/application/manystore/view/manystore/user_auth/add.html new file mode 100644 index 0000000..7bb14ca --- /dev/null +++ b/application/manystore/view/manystore/user_auth/add.html @@ -0,0 +1,40 @@ +
                                          + +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          + {foreach name="statusList" item="vo"} + + {/foreach} +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          + +
                                          diff --git a/application/manystore/view/manystore/user_auth/edit.html b/application/manystore/view/manystore/user_auth/edit.html new file mode 100644 index 0000000..72960e5 --- /dev/null +++ b/application/manystore/view/manystore/user_auth/edit.html @@ -0,0 +1,40 @@ +
                                          + +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          + {foreach name="statusList" item="vo"} + + {/foreach} +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          + +
                                          diff --git a/application/manystore/view/manystore/user_auth/index.html b/application/manystore/view/manystore/user_auth/index.html new file mode 100644 index 0000000..a58de8c --- /dev/null +++ b/application/manystore/view/manystore/user_auth/index.html @@ -0,0 +1,44 @@ +
                                          + +
                                          + {:build_heading(null,FALSE)} + +
                                          + + + +
                                          diff --git a/application/manystore/view/school/message/add.html b/application/manystore/view/school/message/add.html new file mode 100644 index 0000000..63ef5de --- /dev/null +++ b/application/manystore/view/school/message/add.html @@ -0,0 +1,100 @@ +
                                          + +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          + {foreach name="statusList" item="vo"} + + {/foreach} +
                                          + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          + +
                                          diff --git a/application/manystore/view/school/message/edit.html b/application/manystore/view/school/message/edit.html new file mode 100644 index 0000000..d3c96cd --- /dev/null +++ b/application/manystore/view/school/message/edit.html @@ -0,0 +1,100 @@ +
                                          + +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          + {foreach name="statusList" item="vo"} + + {/foreach} +
                                          + +
                                          +
                                          +
                                          + +
                                          + + + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          +
                                          + +
                                          + +
                                          +
                                          + +
                                          diff --git a/application/manystore/view/school/message/index.html b/application/manystore/view/school/message/index.html new file mode 100644 index 0000000..d6df9e4 --- /dev/null +++ b/application/manystore/view/school/message/index.html @@ -0,0 +1,44 @@ +
                                          + +
                                          + {:build_heading(null,FALSE)} + +
                                          + + + +
                                          diff --git a/public/assets/js/backend/manystore/shop_log.js b/public/assets/js/backend/manystore/shop_log.js new file mode 100644 index 0000000..30015f1 --- /dev/null +++ b/public/assets/js/backend/manystore/shop_log.js @@ -0,0 +1,82 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'manystore/shop_log/index' + location.search, + add_url: 'manystore/shop_log/add', + edit_url: 'manystore/shop_log/edit', + del_url: 'manystore/shop_log/del', + multi_url: 'manystore/shop_log/multi', + import_url: 'manystore/shop_log/import', + table: 'manystore_shop_log', + } + }); + + 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: 'shop_id', title: __('Shop_id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'logo', title: __('Logo'), operate: 'LIKE'}, + {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {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: 'yyzzdm', title: __('Yyzzdm'), operate: 'LIKE'}, + {field: 'yyzz_images', title: __('Yyzz_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, + {field: 'front_idcard_image', title: __('Front_idcard_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'reverse_idcard_image', title: __('Reverse_idcard_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'tel', title: __('Tel'), operate: 'LIKE'}, + {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, + {field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, + {field: 'reason', title: __('Reason'), operate: 'LIKE'}, + {field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'admin_id', title: __('Admin_id')}, + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'}, + {field: 'user.nickname', title: __('User.nickname'), 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} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/backend/manystore/user_auth.js b/public/assets/js/backend/manystore/user_auth.js new file mode 100644 index 0000000..1b5b2ef --- /dev/null +++ b/public/assets/js/backend/manystore/user_auth.js @@ -0,0 +1,59 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'manystore/user_auth/index' + location.search, + add_url: 'manystore/user_auth/add', + edit_url: 'manystore/user_auth/edit', + del_url: 'manystore/user_auth/del', + multi_url: 'manystore/user_auth/multi', + import_url: 'manystore/user_auth/import', + table: 'manystore_user_auth', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'shop_id', title: __('Shop_id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, + {field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'}, + {field: 'user.nickname', title: __('User.nickname'), 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} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + 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 83a3946..cd8da3c 100644 --- a/public/assets/js/backend/school/classes/classes_lib.js +++ b/public/assets/js/backend/school/classes/classes_lib.js @@ -115,6 +115,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'type', title: __('Type'), searchList: {"out":__('Type out'),"in":__('Type in')}, formatter: Table.api.formatter.normal}, {field: 'classes_num', title: __('Classes_num')}, + + {field: 'limit_num', title: __('Limit_num')}, + {field: 'sign_num', title: __('Sign_num')}, + {field: 'verification_num', title: __('Verification_num')}, + {field: 'address_type', title: __('Address_type'), searchList: {"1":__('Address_type 1'),"2":__('Address_type 2')}, formatter: Table.api.formatter.normal}, {field: 'sale', title: __('Sale')}, {field: 'price', title: __('Price'), operate:'BETWEEN'}, diff --git a/public/assets/js/backend/school/message.js b/public/assets/js/backend/school/message.js new file mode 100644 index 0000000..aaa3d68 --- /dev/null +++ b/public/assets/js/backend/school/message.js @@ -0,0 +1,67 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'school/message/index' + location.search, + add_url: 'school/message/add', + edit_url: 'school/message/edit', + del_url: 'school/message/del', + multi_url: 'school/message/multi', + import_url: 'school/message/import', + table: 'school_message', + } + }); + + 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: 'platform', title: __('Platform'), searchList: {"admin":__('Platform admin'),"user":__('Platform user'),"shop":__('Platform shop')}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label}, + {field: 'oper_type', title: __('Oper_type'), searchList: {"admin":__('Oper_type admin'),"user":__('Oper_type user'),"system":__('Oper_type system'),"shop":__('Oper_type shop')}, formatter: Table.api.formatter.normal}, + {field: 'oper_id', title: __('Oper_id')}, + {field: 'to_type', title: __('To_type'), searchList: {"admin":__('To_type admin'),"user":__('To_type user'),"system":__('To_type system'),"shop":__('To_type shop')}, formatter: Table.api.formatter.normal}, + {field: 'to_id', title: __('To_id')}, + {field: 'status', title: __('Status'), searchList: {"system":__('Status system'),"classes":__('Status classes'),"order":__('Status order')}, formatter: Table.api.formatter.status}, + {field: 'mini_type', title: __('Mini_type'), searchList: {"order_notice":__('Mini_type order_notice'),"classes_auth":__('Mini_type classes_auth'),"classes_apply":__('Mini_type classes_apply'),"shop_apply":__('Mini_type shop_apply'),"classes_order_notice":__('Mini_type classes_order_notice'),"user_auth":__('Mini_type user_auth'),"aftercare":__('Mini_type aftercare'),"other":__('Mini_type other')}, formatter: Table.api.formatter.normal}, + {field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'desc', title: __('Desc'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + // {field: 'params', title: __('Params'), 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: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'}, + {field: 'admin.avatar', title: __('Admin.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'user.nickname', title: __('User.nickname'), 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} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); diff --git a/public/assets/js/manystore/manystore/shop_log.js b/public/assets/js/manystore/manystore/shop_log.js new file mode 100644 index 0000000..3b041df --- /dev/null +++ b/public/assets/js/manystore/manystore/shop_log.js @@ -0,0 +1,80 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'manystore/shop_log/index' + location.search, + add_url: 'manystore/shop_log/add', + edit_url: 'manystore/shop_log/edit', + del_url: 'manystore/shop_log/del', + multi_url: 'manystore/shop_log/multi', + import_url: 'manystore/shop_log/import', + table: 'manystore_shop_log', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'shop_id', title: __('Shop_id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'name', title: __('Name'), operate: 'LIKE'}, + {field: 'logo', title: __('Logo'), operate: 'LIKE'}, + {field: 'image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'address_city', title: __('Address_city'), operate: 'LIKE'}, + {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: 'yyzzdm', title: __('Yyzzdm'), operate: 'LIKE'}, + {field: 'yyzz_images', title: __('Yyzz_images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images}, + {field: 'front_idcard_image', title: __('Front_idcard_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'reverse_idcard_image', title: __('Reverse_idcard_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'tel', title: __('Tel'), operate: 'LIKE'}, + {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal}, + {field: 'desc', title: __('Desc'), operate: 'LIKE'}, + {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, + {field: 'reason', title: __('Reason'), operate: 'LIKE'}, + {field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'admin_id', title: __('Admin_id')}, + {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'}, + {field: 'user.nickname', title: __('User.nickname'), 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} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); \ No newline at end of file diff --git a/public/assets/js/manystore/manystore/user_auth.js b/public/assets/js/manystore/manystore/user_auth.js new file mode 100644 index 0000000..4f5b6a2 --- /dev/null +++ b/public/assets/js/manystore/manystore/user_auth.js @@ -0,0 +1,59 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'manystore/user_auth/index' + location.search, + add_url: 'manystore/user_auth/add', + edit_url: 'manystore/user_auth/edit', + del_url: 'manystore/user_auth/del', + multi_url: 'manystore/user_auth/multi', + import_url: 'manystore/user_auth/import', + table: 'manystore_user_auth', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'shop_id', title: __('Shop_id')}, + {field: 'user_id', title: __('User_id')}, + {field: 'status', title: __('Status'), searchList: {"0":__('Status 0'),"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status}, + {field: 'auth_time', title: __('Auth_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, + {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'}, + {field: 'user.nickname', title: __('User.nickname'), 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} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); \ No newline at end of file diff --git a/public/assets/js/manystore/school/classes/classes_lib.js b/public/assets/js/manystore/school/classes/classes_lib.js index 24056b8..e75722f 100644 --- a/public/assets/js/manystore/school/classes/classes_lib.js +++ b/public/assets/js/manystore/school/classes/classes_lib.js @@ -115,6 +115,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {field: 'type', title: __('Type'), searchList: {"out":__('Type out'),"in":__('Type in')}, formatter: Table.api.formatter.normal}, {field: 'classes_num', title: __('Classes_num')}, + + {field: 'limit_num', title: __('Limit_num')}, + {field: 'sign_num', title: __('Sign_num')}, + {field: 'verification_num', title: __('Verification_num')}, + + + {field: 'address_type', title: __('Address_type'), searchList: {"1":__('Address_type 1'),"2":__('Address_type 2')}, formatter: Table.api.formatter.normal}, {field: 'sale', title: __('Sale')}, {field: 'price', title: __('Price'), operate:'BETWEEN'}, diff --git a/public/assets/js/manystore/school/message.js b/public/assets/js/manystore/school/message.js new file mode 100644 index 0000000..4f87d4c --- /dev/null +++ b/public/assets/js/manystore/school/message.js @@ -0,0 +1,65 @@ +define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { + + var Controller = { + index: function () { + // 初始化表格参数配置 + Table.api.init({ + extend: { + index_url: 'school/message/index' + location.search, + add_url: 'school/message/add', + edit_url: 'school/message/edit', + del_url: 'school/message/del', + multi_url: 'school/message/multi', + import_url: 'school/message/import', + table: 'school_message', + } + }); + + var table = $("#table"); + + // 初始化表格 + table.bootstrapTable({ + url: $.fn.bootstrapTable.defaults.extend.index_url, + pk: 'id', + sortName: 'id', + columns: [ + [ + {checkbox: true}, + {field: 'id', title: __('Id')}, + {field: 'platform', title: __('Platform'), searchList: {"admin":__('Platform admin'),"user":__('Platform user'),"shop":__('Platform shop')}, operate:'FIND_IN_SET', formatter: Table.api.formatter.label}, + {field: 'oper_type', title: __('Oper_type'), searchList: {"admin":__('Oper_type admin'),"user":__('Oper_type user'),"system":__('Oper_type system'),"shop":__('Oper_type shop')}, formatter: Table.api.formatter.normal}, + {field: 'oper_id', title: __('Oper_id')}, + {field: 'to_type', title: __('To_type'), searchList: {"admin":__('To_type admin'),"user":__('To_type user'),"system":__('To_type system'),"shop":__('To_type shop')}, formatter: Table.api.formatter.normal}, + {field: 'to_id', title: __('To_id')}, + {field: 'status', title: __('Status'), searchList: {"system":__('Status system'),"classes":__('Status classes'),"order":__('Status order')}, formatter: Table.api.formatter.status}, + {field: 'mini_type', title: __('Mini_type'), searchList: {"order_notice":__('Mini_type order_notice'),"classes_auth":__('Mini_type classes_auth'),"classes_apply":__('Mini_type classes_apply'),"shop_apply":__('Mini_type shop_apply'),"classes_order_notice":__('Mini_type classes_order_notice'),"user_auth":__('Mini_type user_auth'),"aftercare":__('Mini_type aftercare'),"other":__('Mini_type other')}, formatter: Table.api.formatter.normal}, + {field: 'title', title: __('Title'), operate: 'LIKE'}, + {field: 'desc', title: __('Desc'), operate: 'LIKE'}, + {field: 'params', title: __('Params'), operate: 'LIKE'}, + {field: 'createtime', title: __('Createtime')}, + {field: 'admin.nickname', title: __('Admin.nickname'), operate: 'LIKE'}, + {field: 'admin.avatar', title: __('Admin.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, + {field: 'user.nickname', title: __('User.nickname'), 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} + ] + ] + }); + + // 为表格绑定事件 + Table.api.bindevent(table); + }, + add: function () { + Controller.api.bindevent(); + }, + edit: function () { + Controller.api.bindevent(); + }, + api: { + bindevent: function () { + Form.api.bindevent($("form[role=form]")); + } + } + }; + return Controller; +}); \ No newline at end of file