diff --git a/application/admin/controller/school/activity/Refund.php b/application/admin/controller/school/activity/Refund.php
new file mode 100644
index 0000000..71ee304
--- /dev/null
+++ b/application/admin/controller/school/activity/Refund.php
@@ -0,0 +1,37 @@
+model = new \app\admin\model\school\activity\Refund;
+
+ }
+
+
+
+ /**
+ * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+ * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+ * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+ */
+
+
+}
diff --git a/application/admin/lang/zh-cn/school/activity/activity.php b/application/admin/lang/zh-cn/school/activity/activity.php
index 2a4128b..2038dd4 100644
--- a/application/admin/lang/zh-cn/school/activity/activity.php
+++ b/application/admin/lang/zh-cn/school/activity/activity.php
@@ -74,5 +74,6 @@ return [
'User.mobile' => '手机号',
'User.avatar' => '头像',
'Admin.nickname' => '昵称',
- 'Admin.avatar' => '头像'
+ 'Admin.avatar' => '头像',
+ "Refund_id" => '退款策略',
];
diff --git a/application/admin/lang/zh-cn/school/activity/refund.php b/application/admin/lang/zh-cn/school/activity/refund.php
new file mode 100644
index 0000000..5d9e7b3
--- /dev/null
+++ b/application/admin/lang/zh-cn/school/activity/refund.php
@@ -0,0 +1,13 @@
+ '策略标题',
+ 'Desc' => '策略说明',
+ 'Refund_hour' => '退款小时',
+ 'Refund_scale' => '退款比例',
+ 'Weigh' => '权重',
+ 'Createtime' => '创建时间',
+ 'Updatetime' => '修改时间',
+ 'Deletetime' => '删除时间',
+
+];
diff --git a/application/admin/model/school/activity/Refund.php b/application/admin/model/school/activity/Refund.php
new file mode 100644
index 0000000..5b6af47
--- /dev/null
+++ b/application/admin/model/school/activity/Refund.php
@@ -0,0 +1,50 @@
+getPk();
+ $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+ }
+ });
+ }
+
+
+
+
+
+
+
+
+
+}
diff --git a/application/admin/validate/school/activity/Refund.php b/application/admin/validate/school/activity/Refund.php
new file mode 100644
index 0000000..ae53172
--- /dev/null
+++ b/application/admin/validate/school/activity/Refund.php
@@ -0,0 +1,27 @@
+ [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/application/admin/view/school/activity/activity/add.html b/application/admin/view/school/activity/activity/add.html
index e3167d2..1b56b41 100644
--- a/application/admin/view/school/activity/activity/add.html
+++ b/application/admin/view/school/activity/activity/add.html
@@ -46,6 +46,21 @@
+
+
+
+
diff --git a/application/admin/view/school/activity/activity/edit.html b/application/admin/view/school/activity/activity/edit.html
index f5cda40..7cb2c3d 100644
--- a/application/admin/view/school/activity/activity/edit.html
+++ b/application/admin/view/school/activity/activity/edit.html
@@ -49,6 +49,19 @@
+
+
diff --git a/application/admin/view/school/activity/refund/add.html b/application/admin/view/school/activity/refund/add.html
new file mode 100644
index 0000000..e6ebb8e
--- /dev/null
+++ b/application/admin/view/school/activity/refund/add.html
@@ -0,0 +1,39 @@
+
diff --git a/application/admin/view/school/activity/refund/edit.html b/application/admin/view/school/activity/refund/edit.html
new file mode 100644
index 0000000..f9cbc2a
--- /dev/null
+++ b/application/admin/view/school/activity/refund/edit.html
@@ -0,0 +1,39 @@
+
diff --git a/application/admin/view/school/activity/refund/index.html b/application/admin/view/school/activity/refund/index.html
new file mode 100644
index 0000000..6e13979
--- /dev/null
+++ b/application/admin/view/school/activity/refund/index.html
@@ -0,0 +1,29 @@
+
+ {:build_heading()}
+
+
+
diff --git a/application/admin/view/school/activity/refund/recyclebin.html b/application/admin/view/school/activity/refund/recyclebin.html
new file mode 100644
index 0000000..7e862e9
--- /dev/null
+++ b/application/admin/view/school/activity/refund/recyclebin.html
@@ -0,0 +1,25 @@
+
+ {:build_heading()}
+
+
+
diff --git a/application/api/controller/school/NewActivity.php b/application/api/controller/school/NewActivity.php
index 41dc0b6..a030f63 100644
--- a/application/api/controller/school/NewActivity.php
+++ b/application/api/controller/school/NewActivity.php
@@ -4,13 +4,14 @@ namespace app\api\controller\school;
use app\common\model\school\activity\Cate;
+use app\common\model\school\activity\Refund;
/**
* 新活动接口
*/
class NewActivity extends Base
{
- protected $noNeedLogin = ['cate_list',"activity_list","detail","add"];
+ protected $noNeedLogin = ['cate_list',"activity_list","detail","refund_list"];
protected $noNeedRight = '*';
protected $model = null;
@@ -240,6 +241,7 @@ class NewActivity extends Base
* @ApiSummary(活动添加)
* @ApiMethod(POST)
* @ApiParams(name = "cate_ids", type = "string",required=true,description = "平台分类ids 多值逗号拼接")
+ * @ApiParams(name = "refund_id", type = "int",required=true,description = "退款策略id")
* @ApiParams(name = "title", type = "string",required=true,description = "标题")
* @ApiParams(name = "sign_time", type = "string",required=true,description = "报名区间示例: 2025-04-08 00:01:00 - 2025-04-08 15:29:00")
* @ApiParams(name = "time", type = "string",required=true,description = "活动区间示例: 2025-04-09 00:01:00 - 2025-04-09 15:29:00")
@@ -262,6 +264,7 @@ class NewActivity extends Base
$params = [];
$params["user_id"] = $user_id; //老师id
$params["cate_ids"] = $this->request->post('cate_ids/s', ''); //课程标签
+ $params["refund_id"] = $this->request->post('refund_id/d', ''); //课程标签
$params["title"] = $this->request->post('title/s', ''); //老师id
$params["images"] = $this->request->post('images/s', ''); //老师id
@@ -293,5 +296,44 @@ class NewActivity extends Base
$this->success('添加成功', $res);
}
+
+
+
+
+
+ /**
+ * @ApiTitle( 退款策略列表)
+ * @ApiSummary(退款策略列表)
+ * @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 refund_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 = Refund::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);
+ }
+
}
diff --git a/application/common/model/school/activity/Activity.php b/application/common/model/school/activity/Activity.php
index 7c3a865..e667f34 100644
--- a/application/common/model/school/activity/Activity.php
+++ b/application/common/model/school/activity/Activity.php
@@ -428,6 +428,8 @@ class Activity extends BaseModel
'end_time' => 'require',
'sign_start_time' => 'require',
'sign_end_time' => 'require',
+ 'refund_id' => 'require',
+
];
@@ -461,13 +463,17 @@ class Activity extends BaseModel
'sign_start_time.require' => '报名开始时间必填',
'sign_end_time.require' => '报名结束时间必填',
-
+ 'refund_id.require' => '退款策略必填',
];
self::check($params,$rule,$rule_msg);
+ $refund_id = $params["refund_id"];
+ $refund = Refund::where("id",$refund_id) ->find();
-
+ if(!$refund){
+ throw new \Exception("退款策略不存在");
+ }
diff --git a/application/common/model/school/activity/Refund.php b/application/common/model/school/activity/Refund.php
new file mode 100644
index 0000000..2f97344
--- /dev/null
+++ b/application/common/model/school/activity/Refund.php
@@ -0,0 +1,107 @@
+getPk();
+ $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
+ }
+ });
+ }
+
+
+
+
+
+
+ /**得到基础条件
+ * @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',"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}title|{$alisa}desc", '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 = "weigh desc,id desc";
+ $serch_where = ['keywords'=>$keywords];
+// if($hot==="0" || $hot==="1"){
+// $serch_where['hot'] = $hot;
+// }
+
+ return (new self)->getBaseList($serch_where, $page, $limit,$sort,$field);
+ }
+
+
+
+
+
+}
diff --git a/public/assets/js/backend/school/activity/refund.js b/public/assets/js/backend/school/activity/refund.js
new file mode 100644
index 0000000..e13959d
--- /dev/null
+++ b/public/assets/js/backend/school/activity/refund.js
@@ -0,0 +1,118 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+ var Controller = {
+ index: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ index_url: 'school/activity/refund/index' + location.search,
+ add_url: 'school/activity/refund/add',
+ edit_url: 'school/activity/refund/edit',
+ del_url: 'school/activity/refund/del',
+ multi_url: 'school/activity/refund/multi',
+ import_url: 'school/activity/refund/import',
+ table: 'school_activity_refund',
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
+ pk: 'id',
+ sortName: 'weigh',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {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: 'refund_hour', title: __('Refund_hour')},
+ {field: 'refund_scale', title: __('Refund_scale'), operate:'BETWEEN'},
+ {field: 'weigh', title: __('Weigh'), operate: false},
+ {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+ recyclebin: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ 'dragsort_url': ''
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: 'school/activity/refund/recyclebin' + location.search,
+ pk: 'id',
+ sortName: 'id',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'title', title: __('Title'), align: 'left'},
+ {
+ field: 'deletetime',
+ title: __('Deletetime'),
+ operate: 'RANGE',
+ addclass: 'datetimerange',
+ formatter: Table.api.formatter.datetime
+ },
+ {
+ field: 'operate',
+ width: '140px',
+ title: __('Operate'),
+ table: table,
+ events: Table.api.events.operate,
+ buttons: [
+ {
+ name: 'Restore',
+ text: __('Restore'),
+ classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
+ icon: 'fa fa-rotate-left',
+ url: 'school/activity/refund/restore',
+ refresh: true
+ },
+ {
+ name: 'Destroy',
+ text: __('Destroy'),
+ classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
+ icon: 'fa fa-times',
+ url: 'school/activity/refund/destroy',
+ refresh: true
+ }
+ ],
+ formatter: Table.api.formatter.operate
+ }
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+
+ add: function () {
+ Controller.api.bindevent();
+ },
+ edit: function () {
+ Controller.api.bindevent();
+ },
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ }
+ }
+ };
+ return Controller;
+});