diff --git a/add.sql b/add.sql index c2b2256..b33b26b 100644 --- a/add.sql +++ b/add.sql @@ -31,4 +31,9 @@ CREATE TABLE `zy_sign_set` ( PRIMARY KEY (`id`) USING BTREE, KEY `type` (`last`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='签到设置'; --- 已执行 2025-06-16 \ No newline at end of file + +ALTER TABLE `zy_sign_set` +ADD COLUMN `status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0禁用,1启用)' AFTER `coupon2_id`; + +DROP TABLE IF EXISTS `zy_sign`; +-- 已执行 2025-06-16 diff --git a/application/admin/controller/zy/sign/Record.php b/application/admin/controller/zy/sign/Record.php new file mode 100644 index 0000000..e6b9acd --- /dev/null +++ b/application/admin/controller/zy/sign/Record.php @@ -0,0 +1,71 @@ +model = new \app\admin\model\zy\sign\Record; + + } + + + + /** + * 默认生成的控制器所继承的父类中有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) { + + $row->getRelation('user')->visible(['username']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/controller/zy/sign/SignSet.php b/application/admin/controller/zy/sign/SignSet.php new file mode 100644 index 0000000..ae85d6d --- /dev/null +++ b/application/admin/controller/zy/sign/SignSet.php @@ -0,0 +1,72 @@ +model = new \app\admin\model\zy\sign\SignSet; + + } + + + + /** + * 默认生成的控制器所继承的父类中有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(['coupon1','coupon2']) + ->where($where) + ->order($sort, $order) + ->paginate($limit); + + foreach ($list as $row) { + + $row->getRelation('coupon1')->visible(['name']); + $row->getRelation('coupon2')->visible(['name']); + } + + $result = array("total" => $list->total(), "rows" => $list->items()); + + return json($result); + } + return $this->view->fetch(); + } + +} diff --git a/application/admin/lang/zh-cn/zy/sign/record.php b/application/admin/lang/zh-cn/zy/sign/record.php new file mode 100644 index 0000000..600347d --- /dev/null +++ b/application/admin/lang/zh-cn/zy/sign/record.php @@ -0,0 +1,10 @@ + '用户id', + 'Date' => '签到日期', + 'Last' => '已持续天数', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'User.username' => '用户名' +]; diff --git a/application/admin/lang/zh-cn/zy/sign/sign_set.php b/application/admin/lang/zh-cn/zy/sign/sign_set.php new file mode 100644 index 0000000..1f8cd4f --- /dev/null +++ b/application/admin/lang/zh-cn/zy/sign/sign_set.php @@ -0,0 +1,13 @@ + '连续天数', + 'Chance1' => '概率1', + 'Coupon1_id' => '券1', + 'Chance2' => '概率2', + 'Coupon2_id' => '券2', + 'Status' => '状态(0禁用,1启用)', + 'Create_time' => '创建时间', + 'Update_time' => '修改时间', + 'Coupon.name' => '名称' +]; diff --git a/application/admin/model/zy/sign/Record.php b/application/admin/model/zy/sign/Record.php new file mode 100644 index 0000000..c24ba79 --- /dev/null +++ b/application/admin/model/zy/sign/Record.php @@ -0,0 +1,44 @@ +belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/model/zy/sign/SignSet.php b/application/admin/model/zy/sign/SignSet.php new file mode 100644 index 0000000..95f0e1b --- /dev/null +++ b/application/admin/model/zy/sign/SignSet.php @@ -0,0 +1,50 @@ +belongsTo('app\admin\model\shopro\Coupon', 'coupon1_id', 'id', [], 'LEFT')->setEagerlyType(0); + } + + + public function coupon2() + { + return $this->belongsTo('app\admin\model\shopro\Coupon', 'coupon2_id', 'id', [], 'LEFT')->setEagerlyType(0); + } +} diff --git a/application/admin/validate/zy/sign/Record.php b/application/admin/validate/zy/sign/Record.php new file mode 100644 index 0000000..9311540 --- /dev/null +++ b/application/admin/validate/zy/sign/Record.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/validate/zy/sign/SignSet.php b/application/admin/validate/zy/sign/SignSet.php new file mode 100644 index 0000000..1e6233e --- /dev/null +++ b/application/admin/validate/zy/sign/SignSet.php @@ -0,0 +1,27 @@ + [], + 'edit' => [], + ]; + +} diff --git a/application/admin/view/zy/sign/record/add.html b/application/admin/view/zy/sign/record/add.html new file mode 100644 index 0000000..4bf97f0 --- /dev/null +++ b/application/admin/view/zy/sign/record/add.html @@ -0,0 +1,39 @@ +
diff --git a/application/admin/view/zy/sign/record/edit.html b/application/admin/view/zy/sign/record/edit.html new file mode 100644 index 0000000..cd8ab3e --- /dev/null +++ b/application/admin/view/zy/sign/record/edit.html @@ -0,0 +1,39 @@ + diff --git a/application/admin/view/zy/sign/record/index.html b/application/admin/view/zy/sign/record/index.html new file mode 100644 index 0000000..e16f879 --- /dev/null +++ b/application/admin/view/zy/sign/record/index.html @@ -0,0 +1,29 @@ +