diff --git a/addons/shopro/controller/zy/Base.php b/addons/shopro/controller/zy/Base.php new file mode 100644 index 0000000..17eea28 --- /dev/null +++ b/addons/shopro/controller/zy/Base.php @@ -0,0 +1,75 @@ +request->param(); + if (isset($params['name'])) { + $this->model->where('name', 'like', '%' . $params['name'] . '%'); + } + $res = $this->model->select(); + + + $this->success('获取成功', $res); + } + + public function add() + { + $result = false; + $params = $this->request->param(); + Db::startTrans(); + try { + $result = $this->model->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException | PDOException | Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + + public function update() + { + $result = false; + $params = $this->request->param(); + $model = $this->model->get($params['id']); + if (empty($model)) { + $this->error(__('No rows were found')); + } + Db::startTrans(); + try { + $result = $model->allowField(true)->save($params); + Db::commit(); + } catch (ValidateException | PDOException | Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } + if ($result === false) { + $this->error(__('No rows were inserted')); + } + $this->success(); + } + + public function view() + { + $model = $this->model->get($this->request->param('id')); + if (empty($model)) { + $this->error(__('No rows were found')); + } + $this->success($model); + } +} diff --git a/addons/shopro/controller/zy/Club.php b/addons/shopro/controller/zy/Club.php new file mode 100644 index 0000000..60e1e02 --- /dev/null +++ b/addons/shopro/controller/zy/Club.php @@ -0,0 +1,30 @@ +model = new \app\admin\model\zy\Club; + parent::__construct(); + } + + public function index() + { + $params = $this->request->param(); + $model = $this->model; + if (isset($params['name'])) { + $model->where('name', 'like', '%' . $params['name'] . '%'); + } + $res = $model->select(); + + $this->success('获取成功', $res); + } +} diff --git a/addons/shopro/controller/zy/Gym.php b/addons/shopro/controller/zy/Gym.php index c8fc870..8f10ec4 100644 --- a/addons/shopro/controller/zy/Gym.php +++ b/addons/shopro/controller/zy/Gym.php @@ -2,24 +2,25 @@ namespace addons\shopro\controller\zy; -use think\Db; -use think\Exception; -use app\admin\model\zy\Stadium; -use think\exception\PDOException; -use addons\shopro\controller\Common; -use think\exception\ValidateException; -class Gym extends Common + +class Gym extends Base { // protected $noNeedLogin = ['index']; protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function __construct() + { + $this->model = new \app\admin\model\zy\Stadium; + parent::__construct(); + } + public function index() { $params = $this->request->param(); - $model = Stadium::where('status', 1); + $model = $this->model->where('status', 1); if (isset($params['name'])) { $model->where('name', 'like', '%' . $params['name'] . '%'); } @@ -28,53 +29,4 @@ class Gym extends Common $this->success('获取成功', $res); } - - public function add() - { - $result = false; - $params = $this->request->param(); - Db::startTrans(); - try { - $result = (new Stadium)->allowField(true)->save($params); - Db::commit(); - } catch (ValidateException | PDOException | Exception $e) { - Db::rollback(); - $this->error($e->getMessage()); - } - if ($result === false) { - $this->error(__('No rows were inserted')); - } - $this->success(); - } - - public function update() - { - $result = false; - $params = $this->request->param(); - $model = Stadium::get($params['id']); - if (empty($model)) { - $this->error(__('No rows were found')); - } - Db::startTrans(); - try { - $result = $model->allowField(true)->save($params); - Db::commit(); - } catch (ValidateException | PDOException | Exception $e) { - Db::rollback(); - $this->error($e->getMessage()); - } - if ($result === false) { - $this->error(__('No rows were inserted')); - } - $this->success(); - } - - public function view() - { - $model = Stadium::get($this->request->param('id')); - if (empty($model)) { - $this->error(__('No rows were found')); - } - $this->success($model); - } } diff --git a/addons/shopro/controller/zy/Tags.php b/addons/shopro/controller/zy/Tags.php index 02ed7d5..dccd55f 100644 --- a/addons/shopro/controller/zy/Tags.php +++ b/addons/shopro/controller/zy/Tags.php @@ -23,10 +23,7 @@ class Tags extends Common $model->where('group', $params['group']); } $res = $model->select(); - foreach ($res as &$value) { - $value['content_json'] = array_values(json_decode($value['content_json'] ?? '[]', true)); - } - + $this->success('获取成功', $res); } } diff --git a/application/admin/controller/zy/Club.php b/application/admin/controller/zy/Club.php new file mode 100644 index 0000000..48e52e2 --- /dev/null +++ b/application/admin/controller/zy/Club.php @@ -0,0 +1,71 @@ +model = new \app\admin\model\zy\Club; + + } + + + + /** + * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法 + * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑 + * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改 + */ + + + /** + * 查看 + */ + public function index() + { + //当前是否为关联查询 + $this->relationSearch = true; + //设置过滤方法 + $this->request->filter(['strip_tags', 'trim']); + if ($this->request->isAjax()) { + //如果发送的来源是Selectpage,则转发到Selectpage + if ($this->request->request('keyField')) { + return $this->selectpage(); + } + list($where, $sort, $order, $offset, $limit) = $this->buildparams(); + + $list = $this->model + ->with(['user']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/lang/zh-cn/zy/club.php b/application/admin/lang/zh-cn/zy/club.php new file mode 100644 index 0000000..75ef4e6 --- /dev/null +++ b/application/admin/lang/zh-cn/zy/club.php @@ -0,0 +1,26 @@ + '球馆', + 'Name' => '俱乐部名称', + 'Sub_name' => '简称', + 'Logo' => 'logo', + 'City' => '常住地', + 'Blurb' => '简介', + 'Join_type' => '入会方式', + 'Img' => '图片', + 'President' => '会长', + 'Admin_ids' => '管理员', + 'Tags' => '标签', + 'Is_public' => '是否公开', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + + 'Join_type0' => '开放加入,无需审核', + 'Join_type1' => '开放申请,审核加入', + 'Join_type2' => '会员邀请,无需审核', + 'Join_type3' => '会员邀请,审核加入', + 'Join_type4' => '仅管理员邀请,无需审核', + 'Is_public0' => '否', + 'Is_public1' => '是', +]; diff --git a/application/admin/lang/zh-cn/zy/tags.php b/application/admin/lang/zh-cn/zy/tags.php index 543219e..983c47f 100644 --- a/application/admin/lang/zh-cn/zy/tags.php +++ b/application/admin/lang/zh-cn/zy/tags.php @@ -3,7 +3,7 @@ return [ 'Type' => '标签类型', 'Group' => '标签分组', - 'Content_json' => '标签内容', + 'Content' => '标签内容', 'Choose' => '选择方式', 'Create_time' => '创建时间', 'Update_time' => '修改时间', diff --git a/application/admin/model/zy/Club.php b/application/admin/model/zy/Club.php new file mode 100644 index 0000000..508c176 --- /dev/null +++ b/application/admin/model/zy/Club.php @@ -0,0 +1,44 @@ +belongsTo('app\admin\model\User', 'president', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/zy/Club.php b/application/admin/validate/zy/Club.php new file mode 100644 index 0000000..928a0d1 --- /dev/null +++ b/application/admin/validate/zy/Club.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/zy/club/add.html b/application/admin/view/zy/club/add.html new file mode 100644 index 0000000..85446ce --- /dev/null +++ b/application/admin/view/zy/club/add.html @@ -0,0 +1,114 @@ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+
+ +
+ + +
+ +
+ +
+
+
+ +
+
+
+
+
+ +
+ +
+
+
+ +
+ {:build_radios('row[join_type]', ['0'=>__('Join_type0'), '1'=>__('Join_type1'), '2'=>__('Join_type2'), + '3'=>__('Join_type3'), '4'=>__('Join_type4')],0)} +
+
+
+ +
+
+ +
+ + +
+ +
+
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + {:build_radios('row[is_public]', ['1'=>__('Is_public1'), '0'=>__('Is_public0')],1)} +
    +
    + + +
    \ No newline at end of file diff --git a/application/admin/view/zy/club/edit.html b/application/admin/view/zy/club/edit.html new file mode 100644 index 0000000..ed5c066 --- /dev/null +++ b/application/admin/view/zy/club/edit.html @@ -0,0 +1,120 @@ +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
    + + +
    + +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + {:build_radios('row[join_type]', ['0'=>__('Join_type0'), '1'=>__('Join_type1'), '2'=>__('Join_type2'), + '3'=>__('Join_type3'), '4'=>__('Join_type4')],$row['join_type'])} +
    +
    +
    + +
    +
    + +
    + + +
    + +
    +
      +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + +
      +
      +
      + +
      + {:build_radios('row[is_public]', ['1'=>__('Is_public1'), '0'=>__('Is_public0')],$row['is_public'])} +
      +
      + + +
      \ No newline at end of file diff --git a/application/admin/view/zy/club/index.html b/application/admin/view/zy/club/index.html new file mode 100644 index 0000000..17807ab --- /dev/null +++ b/application/admin/view/zy/club/index.html @@ -0,0 +1,29 @@ +
      + {:build_heading()} + +
      +
      +
      + +
      + +
      +
      +
      diff --git a/application/admin/view/zy/stadium/edit.html b/application/admin/view/zy/stadium/edit.html index 0ddb151..5082e6d 100644 --- a/application/admin/view/zy/stadium/edit.html +++ b/application/admin/view/zy/stadium/edit.html @@ -93,7 +93,7 @@
      - {:build_radios('row[status]', ['1'=>__('Status0'), '0'=>__('Status1')], $row['status'])} + {:build_radios('row[status]', ['1'=>__('Status1'), '0'=>__('Status0')], $row['status'])}
      diff --git a/application/admin/view/zy/tags/add.html b/application/admin/view/zy/tags/add.html index 2668073..38485b6 100644 --- a/application/admin/view/zy/tags/add.html +++ b/application/admin/view/zy/tags/add.html @@ -20,21 +20,10 @@ {:build_radios('row[choose]', ['0'=>__('Multiple'), '1'=>__('Single')])} -
      - +
      - -
      -
      - {:__('Key')} - {:__('Value')} -
      -
      {:__('Append')}
      - -
      - - +
      - +
      - -
      -
      - {:__('Key')} - {:__('Value')} -
      -
      {:__('Append')}
      - -
      - - +