退款策略加表
This commit is contained in:
parent
1adac352bd
commit
db825bbcf5
37
application/admin/controller/school/activity/Refund.php
Normal file
37
application/admin/controller/school/activity/Refund.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\controller\school\activity;
|
||||||
|
|
||||||
|
use app\common\controller\Backend;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 活动退款策略
|
||||||
|
*
|
||||||
|
* @icon fa fa-circle-o
|
||||||
|
*/
|
||||||
|
class Refund extends Backend
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refund模型对象
|
||||||
|
* @var \app\admin\model\school\activity\Refund
|
||||||
|
*/
|
||||||
|
protected $model = null;
|
||||||
|
|
||||||
|
public function _initialize()
|
||||||
|
{
|
||||||
|
parent::_initialize();
|
||||||
|
$this->model = new \app\admin\model\school\activity\Refund;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
|
||||||
|
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
|
||||||
|
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -74,5 +74,6 @@ return [
|
|||||||
'User.mobile' => '手机号',
|
'User.mobile' => '手机号',
|
||||||
'User.avatar' => '头像',
|
'User.avatar' => '头像',
|
||||||
'Admin.nickname' => '昵称',
|
'Admin.nickname' => '昵称',
|
||||||
'Admin.avatar' => '头像'
|
'Admin.avatar' => '头像',
|
||||||
|
"Refund_id" => '退款策略',
|
||||||
];
|
];
|
||||||
|
13
application/admin/lang/zh-cn/school/activity/refund.php
Normal file
13
application/admin/lang/zh-cn/school/activity/refund.php
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Title' => '策略标题',
|
||||||
|
'Desc' => '策略说明',
|
||||||
|
'Refund_hour' => '退款小时',
|
||||||
|
'Refund_scale' => '退款比例',
|
||||||
|
'Weigh' => '权重',
|
||||||
|
'Createtime' => '创建时间',
|
||||||
|
'Updatetime' => '修改时间',
|
||||||
|
'Deletetime' => '删除时间',
|
||||||
|
|
||||||
|
];
|
50
application/admin/model/school/activity/Refund.php
Normal file
50
application/admin/model/school/activity/Refund.php
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\model\school\activity;
|
||||||
|
|
||||||
|
use think\Model;
|
||||||
|
use traits\model\SoftDelete;
|
||||||
|
|
||||||
|
class Refund extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
use SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名
|
||||||
|
protected $name = 'school_activity_refund';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = 'integer';
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = 'createtime';
|
||||||
|
protected $updateTime = 'updatetime';
|
||||||
|
protected $deleteTime = 'deletetime';
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected static function init()
|
||||||
|
{
|
||||||
|
self::afterInsert(function ($row) {
|
||||||
|
if (!$row['weigh']) {
|
||||||
|
$pk = $row->getPk();
|
||||||
|
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
27
application/admin/validate/school/activity/Refund.php
Normal file
27
application/admin/validate/school/activity/Refund.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\admin\validate\school\activity;
|
||||||
|
|
||||||
|
use think\Validate;
|
||||||
|
|
||||||
|
class Refund extends Validate
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 验证规则
|
||||||
|
*/
|
||||||
|
protected $rule = [
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* 提示消息
|
||||||
|
*/
|
||||||
|
protected $message = [
|
||||||
|
];
|
||||||
|
/**
|
||||||
|
* 验证场景
|
||||||
|
*/
|
||||||
|
protected $scene = [
|
||||||
|
'add' => [],
|
||||||
|
'edit' => [],
|
||||||
|
];
|
||||||
|
|
||||||
|
}
|
@ -46,6 +46,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Refund_id')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-refund_id" data-rule="required" data-source="school/activity/refund/index" data-field="title" class="form-control selectpage" name="row[refund_id]" type="text" value="">
|
||||||
|
<span style="color: red">
|
||||||
|
|
||||||
|
(没找到退款策略则点击按钮创建退款策略后重新下拉框选退款策略)
|
||||||
|
<a data-url="school/activity/refund/index" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('school/activity/refund/index')?'':'hide'}" title="退款策略" ><i class="fa fa-plus"></i> 创建新退款策略</a>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- <div class="form-group">-->
|
<!-- <div class="form-group">-->
|
||||||
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>-->
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>-->
|
||||||
|
@ -49,6 +49,19 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Refund_id')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-refund_id" data-rule="required" data-source="school/activity/refund/index" data-field="title" class="form-control selectpage" name="row[refund_id]" type="text" value="{$row.refund_id|htmlentities}">
|
||||||
|
<span style="color: red">
|
||||||
|
|
||||||
|
(没找到退款策略则点击按钮创建退款策略后重新下拉框选退款策略)
|
||||||
|
<a data-url="school/activity/refund/index" href="javascript:;" class="btn btn-success btn-changeuser {:$auth->check('school/activity/refund/index')?'':'hide'}" title="退款策略" ><i class="fa fa-plus"></i> 创建新退款策略</a>
|
||||||
|
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- <div class="form-group">-->
|
<!-- <div class="form-group">-->
|
||||||
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>-->
|
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>-->
|
||||||
|
39
application/admin/view/school/activity/refund/add.html
Normal file
39
application/admin/view/school/activity/refund/add.html
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-title" class="form-control" name="row[title]" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-desc" class="form-control" name="row[desc]" type="text">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Refund_hour')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-refund_hour" class="form-control" name="row[refund_hour]" type="number">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Refund_scale')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-refund_scale" class="form-control" step="0.01" name="row[refund_scale]" type="number">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
39
application/admin/view/school/activity/refund/edit.html
Normal file
39
application/admin/view/school/activity/refund/edit.html
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-title" class="form-control" name="row[title]" type="text" value="{$row.title|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Desc')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-desc" class="form-control" name="row[desc]" type="text" value="{$row.desc|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Refund_hour')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-refund_hour" class="form-control" name="row[refund_hour]" type="number" value="{$row.refund_hour|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Refund_scale')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-refund_scale" class="form-control" step="0.01" name="row[refund_scale]" type="number" value="{$row.refund_scale|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
29
application/admin/view/school/activity/refund/index.html
Normal file
29
application/admin/view/school/activity/refund/index.html
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
{:build_heading()}
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/activity/refund/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('school/activity/refund/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
|
||||||
|
<a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('school/activity/refund/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('school/activity/refund/recyclebin')?'':'hide'}" href="school/activity/refund/recyclebin" title="{:__('Recycle bin')}"><i class="fa fa-recycle"></i> {:__('Recycle bin')}</a>
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
|
||||||
|
data-operate-edit="{:$auth->check('school/activity/refund/edit')}"
|
||||||
|
data-operate-del="{:$auth->check('school/activity/refund/del')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,25 @@
|
|||||||
|
<div class="panel panel-default panel-intro">
|
||||||
|
{:build_heading()}
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="myTabContent" class="tab-content">
|
||||||
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
<div class="widget-body no-padding">
|
||||||
|
<div id="toolbar" class="toolbar">
|
||||||
|
{:build_toolbar('refresh')}
|
||||||
|
<a class="btn btn-info btn-multi btn-disabled disabled {:$auth->check('school/activity/refund/restore')?'':'hide'}" href="javascript:;" data-url="school/activity/refund/restore" data-action="restore"><i class="fa fa-rotate-left"></i> {:__('Restore')}</a>
|
||||||
|
<a class="btn btn-danger btn-multi btn-disabled disabled {:$auth->check('school/activity/refund/destroy')?'':'hide'}" href="javascript:;" data-url="school/activity/refund/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
|
||||||
|
<a class="btn btn-success btn-restoreall {:$auth->check('school/activity/refund/restore')?'':'hide'}" href="javascript:;" data-url="school/activity/refund/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
|
||||||
|
<a class="btn btn-danger btn-destroyall {:$auth->check('school/activity/refund/destroy')?'':'hide'}" href="javascript:;" data-url="school/activity/refund/destroy" title="{:__('Destroy all')}"><i class="fa fa-times"></i> {:__('Destroy all')}</a>
|
||||||
|
</div>
|
||||||
|
<table id="table" class="table table-striped table-bordered table-hover"
|
||||||
|
data-operate-restore="{:$auth->check('school/activity/refund/restore')}"
|
||||||
|
data-operate-destroy="{:$auth->check('school/activity/refund/destroy')}"
|
||||||
|
width="100%">
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -4,13 +4,14 @@ namespace app\api\controller\school;
|
|||||||
|
|
||||||
|
|
||||||
use app\common\model\school\activity\Cate;
|
use app\common\model\school\activity\Cate;
|
||||||
|
use app\common\model\school\activity\Refund;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新活动接口
|
* 新活动接口
|
||||||
*/
|
*/
|
||||||
class NewActivity extends Base
|
class NewActivity extends Base
|
||||||
{
|
{
|
||||||
protected $noNeedLogin = ['cate_list',"activity_list","detail","add"];
|
protected $noNeedLogin = ['cate_list',"activity_list","detail","refund_list"];
|
||||||
protected $noNeedRight = '*';
|
protected $noNeedRight = '*';
|
||||||
|
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
@ -240,6 +241,7 @@ class NewActivity extends Base
|
|||||||
* @ApiSummary(活动添加)
|
* @ApiSummary(活动添加)
|
||||||
* @ApiMethod(POST)
|
* @ApiMethod(POST)
|
||||||
* @ApiParams(name = "cate_ids", type = "string",required=true,description = "平台分类ids 多值逗号拼接")
|
* @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 = "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 = "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")
|
* @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 = [];
|
||||||
$params["user_id"] = $user_id; //老师id
|
$params["user_id"] = $user_id; //老师id
|
||||||
$params["cate_ids"] = $this->request->post('cate_ids/s', ''); //课程标签
|
$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["title"] = $this->request->post('title/s', ''); //老师id
|
||||||
$params["images"] = $this->request->post('images/s', ''); //老师id
|
$params["images"] = $this->request->post('images/s', ''); //老师id
|
||||||
@ -293,5 +296,44 @@ class NewActivity extends Base
|
|||||||
$this->success('添加成功', $res);
|
$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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,6 +428,8 @@ class Activity extends BaseModel
|
|||||||
'end_time' => 'require',
|
'end_time' => 'require',
|
||||||
'sign_start_time' => 'require',
|
'sign_start_time' => 'require',
|
||||||
'sign_end_time' => 'require',
|
'sign_end_time' => 'require',
|
||||||
|
'refund_id' => 'require',
|
||||||
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -461,13 +463,17 @@ class Activity extends BaseModel
|
|||||||
'sign_start_time.require' => '报名开始时间必填',
|
'sign_start_time.require' => '报名开始时间必填',
|
||||||
'sign_end_time.require' => '报名结束时间必填',
|
'sign_end_time.require' => '报名结束时间必填',
|
||||||
|
|
||||||
|
'refund_id.require' => '退款策略必填',
|
||||||
];
|
];
|
||||||
|
|
||||||
self::check($params,$rule,$rule_msg);
|
self::check($params,$rule,$rule_msg);
|
||||||
|
|
||||||
|
$refund_id = $params["refund_id"];
|
||||||
|
$refund = Refund::where("id",$refund_id) ->find();
|
||||||
|
|
||||||
|
if(!$refund){
|
||||||
|
throw new \Exception("退款策略不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
107
application/common/model/school/activity/Refund.php
Normal file
107
application/common/model/school/activity/Refund.php
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\common\model\school\activity;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use think\Model;
|
||||||
|
use traits\model\SoftDelete;
|
||||||
|
|
||||||
|
class Refund extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
use SoftDelete;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 表名
|
||||||
|
protected $name = 'school_activity_refund';
|
||||||
|
|
||||||
|
// 自动写入时间戳字段
|
||||||
|
protected $autoWriteTimestamp = 'integer';
|
||||||
|
|
||||||
|
// 定义时间戳字段名
|
||||||
|
protected $createTime = 'createtime';
|
||||||
|
protected $updateTime = 'updatetime';
|
||||||
|
protected $deleteTime = 'deletetime';
|
||||||
|
|
||||||
|
// 追加属性
|
||||||
|
protected $append = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
protected static function init()
|
||||||
|
{
|
||||||
|
self::afterInsert(function ($row) {
|
||||||
|
if (!$row['weigh']) {
|
||||||
|
$pk = $row->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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
118
public/assets/js/backend/school/activity/refund.js
Normal file
118
public/assets/js/backend/school/activity/refund.js
Normal file
@ -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;
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user