1,修改逻辑免费课开始和结束时间有交叠无法下预约

2,修改逻辑课程添加课时时,如果开始结束时间和其他课时重叠应该拒绝
3,编写日历接口
4, 优化机构后台逻辑,添加时自动生成虚拟参与人数
5,机构端增加报名人查看
This commit is contained in:
15090180611 2024-11-21 18:03:23 +08:00
parent 35904ee8be
commit 63bf6801dc
41 changed files with 1452 additions and 164 deletions

View File

@ -54,11 +54,12 @@ class Message extends Backend
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$as = $this->model->getWithAlisaName();
$list = $this->model
->with(['admin','user'])
->where($where)
->order($sort, $order)
// ->order($sort, $order)
->order("{$as}.weigh DESC,{$as}.id DESC")
->paginate($limit);
foreach ($list as $row) {

View File

@ -105,6 +105,7 @@ class ClassesLib extends Backend
}
protected function authClasses(&$params,$row=null){
//审核失败需填写原因
if($params["auth_status"] == '2' && empty($params["reason"])){
@ -233,6 +234,10 @@ class ClassesLib extends Backend
$params["user_id"] = $teacher["user_id"];
//课时必须大于等于1
if($params["classes_num"] < 1) $this->error("课时必须大于等于1");
if($params["price"] < 0) $this->error("售价必须大于0");
//独立地点需传定位信息
if($params["address_type"] == "2"){
@ -322,8 +327,20 @@ class ClassesLib extends Backend
}
}
//如果是上架,判断是否拥有课时规格,没有则无法上架
if($params["status"]=="1"){
if(!$row)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count();
if(!$check_spec)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
}
}
protected function update_classes($classes_lib_id){
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
/**
@ -357,6 +374,31 @@ class ClassesLib extends Backend
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_need_after', $data);
}
if($this->success_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_success_after', $data);
}
if($this->error_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_fail_after', $data);
}
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
@ -406,7 +448,13 @@ class ClassesLib extends Backend
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
$this->update_classes($row["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $row];
\think\Hook::listen('classes_auth_need_after', $data);
}
if($this->success_auth){
//调用通过事件
@ -422,12 +470,7 @@ class ClassesLib extends Backend
}
// protected $have_auth = false;
if($this->have_auth){
//调用通过事件
$data = ['classes' => $row];
\think\Hook::listen('classes_auth_need_after', $data);
}

View File

@ -134,11 +134,79 @@ class ClassesSpec extends Backend
protected function update_check(&$params,$row=null)
{
//开始和结束时间不能为空
$start_time = $params["start_time"];
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
$this->error("请选择开始和结束时间");
}
//转化时间戳
$start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
$end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
$this->error("结束时间不能小于开始时间");
}
//结束时间不能是已经过去的时间
$now_time = time();
if($end_time<=$now_time){
$this->error("结束时间不能是已经过去的时间");
}
$orderTimeTableName = $this->model->getWithAlisaName();
//修改
if($row){
$this->updateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->where("id","<>",$row->id)->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}else{
//新增
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}

View File

@ -34,7 +34,9 @@ class VirtualUser extends Backend
$this->view->assign("havetypeList", $this->model->getHavetypeList());
}
protected function update_classes($classes_lib_id){
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
@ -81,6 +83,9 @@ class VirtualUser extends Backend
/**
* 添加
*
@ -113,6 +118,8 @@ class VirtualUser extends Backend
// $result = $this->model->allowField(true)->save($params);
if(!$params["classes_lib_id"])throw new Exception( "请选择课程");
$res = (new Virtual)->getVirtualUser($params["num"],$params["classes_lib_id"],$params["time"],true);
$this->update_classes($params["classes_lib_id"]);
$result = true;
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
@ -125,4 +132,57 @@ class VirtualUser extends Backend
$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);
}
$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();
}
}

View File

@ -2,10 +2,11 @@
namespace app\admin\model\school;
use app\common\model\BaseModel;
use think\Model;
class Message extends Model
class Message extends BaseModel
{

View File

@ -2,6 +2,7 @@
namespace app\admin\model\school\classes;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
@ -203,7 +204,7 @@ class ClassesLib extends Model
public function manystore()
{
return $this->belongsTo('app\admin\model\Manystore', 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
}

View File

@ -2,10 +2,11 @@
namespace app\admin\model\school\classes;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class ClassesSpec extends Model
class ClassesSpec extends BaseModel
{
use SoftDelete;

View File

@ -215,12 +215,12 @@
<textarea id="c-notice" class="form-control editor" rows="5" name="row[notice]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->

View File

@ -6,6 +6,45 @@
<!-- <input id="c-manystore_id" data-rule="required" data-source="manystore/index" data-field="id" class="form-control selectpage" name="row[manystore_id]" type="text" value="{$row.manystore_id|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="authStatusList" item="vo"}
<label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" type="radio" value="{$key}" {in name="key" value="$row.auth_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-reason" class="form-control" name="row[reason]" type="text" value="{$row.reason|htmlentities}">
</div>
</div>
<br> <br> <br>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -258,36 +297,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="authStatusList" item="vo"}
<label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" type="radio" value="{$key}" {in name="key" value="$row.auth_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-reason" class="form-control" name="row[reason]" type="text" value="{$row.reason|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Auth_time')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->

View File

@ -19,6 +19,27 @@
<input id="c-nickname" data-rule="required" class="form-control" name="row[nickname]" type="text" value="{$row.nickname|htmlentities}">
</div>
</div>
<div class="form-group">
<label for="c-realname" class="control-label col-xs-12 col-sm-2">{:__('真实姓名')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-realname" data-rule="required" class="form-control" name="row[realname]" type="text" value="{$row.realname|htmlentities}">
</div>
</div>
<div class="form-group">
<label for="c-work" class="control-label col-xs-12 col-sm-2">{:__('职业')}:</label>
<div class="col-xs-12 col-sm-4">
<input id="c-work" data-rule="required" class="form-control" name="row[work]" type="text" value="{$row.work|htmlentities}">
</div>
</div>
<div class="form-group">
<label for="c-password" class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
<div class="col-xs-12 col-sm-4">

View File

@ -19,7 +19,7 @@ use think\Hook;
*/
class Common extends Api
{
protected $noNeedLogin = ['init', 'captcha','virtualgenerate'];
protected $noNeedLogin = ['init', 'captcha','virtualgenerate','get_week_by_time'];
protected $noNeedRight = '*';
public function _initialize()
@ -193,4 +193,29 @@ class Common extends Api
$this->success('生成成功', $res);
}
/**
* @ApiTitle(通过时间点得到当前的星期数据)
* @ApiSummary(通过时间点得到当前的星期数据)
* @ApiRoute(/api/common/get_week_by_time)
* @ApiMethod(GET)
* @ApiParams(name="time",type="string",required=true,description="选择的时间点")
* @ApiReturn({ unpaid_user_data 参与中 paid_user_data 已报名 })
*/
public function get_week_by_time(){
$time = $this->request->get('time/s','');
if(empty($time)){
$this->error(__('缺少必要参数'));
}
try {
$res = (new Virtual)->getWeekByTime($time);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('生成成功', $res);
}
}

View File

@ -256,9 +256,9 @@ class ManystoreBase extends Controller
if($manystoreShop){
$url = Session::get('referer');
$url = $url ? $url : $this->request->url();
if($manystoreShop["status"] !=1) {
$this->error(__('账号正处于审核中,无法进行任何操作!!'), url('index/login', ['url' => $url]));
}
// if($manystoreShop["status"] !=1) {
// $this->error(__('账号正处于审核中,无法进行任何操作!!'), url('index/login', ['url' => $url]));
// }
$manystore = Manystore::where("id",$this->auth->id)->find();
if($manystore) {
if($manystore["status"]!="normal") $this->error(__('账号正处于审核中,无法进行任何操作!!'), url('index/login', ['url' => $url]));

View File

@ -79,6 +79,21 @@ $manystoreHooks = [
//课程审核事件钩子
$classesHooks = [
// 订单创建
'classes_auth_need_after' => [ // 课程审核提交
'app\\common\\listener\\classes\\ClassesHook'
],
'classes_auth_success_after' => [ // 课程审核通过后
'app\\common\\listener\\classes\\ClassesHook'
],
'classes_auth_fail_after' => [ // 课程审核失败后
'app\\common\\listener\\classes\\ClassesHook'
],
];
//
//if (file_exists(ROOT_PATH . 'addons/shopro/listener/commission')) {
@ -86,5 +101,6 @@ $manystoreHooks = [
//}
$defaultHooks = array_merge_recursive($defaultHooks, $hourHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $manystoreHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $classesHooks);
return $defaultHooks;

View File

@ -29,7 +29,7 @@ class Virtual
//mysql随机查询$num个数据
$virtualHead = VirtualHead::orderRaw("rand()")->limit($num)->select();
//随机获得$num个虚拟用户昵称和头像
foreach($virtualHead as $v) {
foreach($virtualHead as $k=>$v) {
$nickname = $this->getNickName();
$head = $v->head_image;
$r = rand(($time - 86400*7),$time);
@ -39,7 +39,7 @@ class Virtual
"head_image"=>$head,
"time"=>$r,
"jointype" => "1",
"havetype" => "".($r % 2)
"havetype" => "".($k % 2)
];
}
@ -48,7 +48,7 @@ class Virtual
}else{
$user_data=[];
foreach($users as $user) {
foreach($users as $k=> $user) {
$r = rand(($time - 86400*7),$time);
$user_data[] = [
"nickname"=>$user["nickname"],
@ -56,12 +56,31 @@ class Virtual
"classes_lib_id"=>$classes_lib_id,
"time"=>$r,
"jointype" => "1",
"havetype" => "".($r % 2)
"havetype" => $user["havetype"]
];
}
(new VirtualUser)->saveAll($user_data);
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
return $user_data;
}
}
public static function getWeekByTime($time){
$time = $time && !is_numeric($time) ? strtotime($time) : time();
//得到当前日期所在周几
$week = date("w",$time);
$week = $week == 0 ? '7' : $week;
$sub = 7 -$week;
$start_time = $time - ($sub*86400);
date("Y-m-d",$start_time);
return ;
}

View File

@ -8,92 +8,76 @@ class ClassesHook
// 机构账号提交审核申请后
public function shopApplyAfter(&$params)
// 课程审核提交
public function classesAuthNeedAfter(&$params)
{
["shop"=>$shop] = $params;
['classes' => $classes] = $params;
//课程推送给老师
$desc = "您的新课程{$classes['title']}已提交审核审核时间为1-3日内,请耐心等待审核结果";
//记录订单日志
$desc = "您申请的认证{$shop['name']}已提交审核审核时间为1-3日内,请耐心等待审核结果";
$title = "入驻申请提交";
$mini_type = "shop_apply";
$title = "新课程审核";
$mini_type = "classes_apply";
$to_type="user";
$to_id = $shop["user_id"];
$status ="system";
$to_id = $classes["user_id"];
$status ="classes";
$platform="user";
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"shop_create_after",
"shop_id"=>$shop["id"],
"desc"=>$shop["desc"],
"event"=>"classes_auth_need_after",
"classes_lib_id"=>$classes["id"],
];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
// 机构账号审核成功
public function shopAuthSuccessAfter(&$params)
// 课程审核通过
public function classesAuthSuccessAfter(&$params)
{
['shop' => $shop,"password"=>$password] = $params;
$user = $shop->user;
$mobile = $user['mobile'] ?? "";
$shop_backend_url = config("site.shop_backend_ur");
$desc = "您申请的认证:{$shop['name']}已审核通过,您可登录官方后台补充完其余资料,并开始发布课程<br>
后台地址是: {$shop_backend_url}<br>
账号是: {$shop['username']} 您的手机号 {$mobile}<br>
初始化密码是: {$password}<br>
";
['classes' => $classes] = $params;
$title = "入驻申请通过";
$mini_type = "shop_apply";
//课程推送给老师
$desc = "您的新课程{$classes['title']}已审核通过,可以在后台操作课程上架!";
$title = "新课程审核成功";
$mini_type = "classes_apply";
$to_type="user";
$to_id = $shop["user_id"];
$status ="system";
$to_id = $classes["user_id"];
$status ="classes";
$platform="user";
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"shop_auth_success_after",
"shop_id"=>$shop["id"],
"desc"=>$shop["desc"],
"event"=>"classes_auth_success_after",
"classes_lib_id"=>$classes["id"],
];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);
}
// 机构账号审核失败后
public function shopAuthFailAfter(&$params)
// 课程审核失败后
public function classesFailNeedAfter(&$params)
{
["shop"=>$shop] = $params;
['classes' => $classes] = $params;
//记录订单日志
//课程推送给老师
$desc = "您的新课程{$classes['title']}审核未通过,未通过原因为:{$classes['reason']},整改后,可以在后台重新提交!";
$desc = "您申请的认证{$shop['name']}审核未通过,未通过原因为:{$shop['reason']},如已整改,可重新发起申请";
$title = "入驻申请失败";
$mini_type = "shop_apply";
$title = "新课程审核不通过";
$mini_type = "classes_apply";
$to_type="user";
$to_id = $shop["user_id"];
$status ="system";
$to_id = $classes["user_id"];
$status ="classes";
$platform="user";
$oper_id=0;
$oper_type="system";
$params=[
"event"=>"shop_auth_fail_after",
"shop_id"=>$shop["id"],
"desc"=>$shop["desc"],
"event"=>"classes_auth_success_after",
"classes_lib_id"=>$classes["id"],
];
Message::send($title,$desc,$mini_type,$to_id,$to_type,$status,$platform,$params,$oper_id,$oper_type);

View File

@ -2,6 +2,7 @@
namespace app\common\model\school\classes;
use app\common\library\Virtual;
use app\common\model\BaseModel;
use app\common\model\dyqc\ManystoreShop;
use app\common\model\school\classes\lib\Spec;
@ -581,10 +582,36 @@ class ClassesLib extends BaseModel
if($classes_lib){
//所有课时加起来
$classes_lib->limit_num = ClassesSpec::where("classes_lib_id",$classes_lib_id)->sum( "limit_num");
//更新虚拟用户数据
//得到课程所有虚拟参与者数量
$virtual_people = VirtualUser::where("jointype",'1')->where("classes_lib_id",$classes_lib_id)->count();
//如果课程虚拟参与者字段 数量小于 虚拟参与者实际数量 ,则等于虚拟参与者实际数量
$classes_lib->virtual_people = $classes_lib->virtual_people < $virtual_people ? $virtual_people : $classes_lib->virtual_people;
//得到课程所有虚拟报名者数量
$virtual_num = VirtualUser::where("havetype",'1')->where("classes_lib_id",$classes_lib_id)->count();
//如果课程虚拟报名者字段 数量小于 虚拟报名者实际数量 ,则等于虚拟报名者实际数量 havetype
$classes_lib->virtual_num = $classes_lib->virtual_num < $virtual_num ? $virtual_num : $classes_lib->virtual_num;
$classes_lib->save();
}
}
public static function add_virtual_init($classes_lib_id){
//更新课程规格库存
$classes_lib = self::get($classes_lib_id);
if($classes_lib){
//如果课程虚拟参与者字300-2000随机
$classes_lib->virtual_people = mt_rand(300, 2000);
//如果课程虚拟报名者字段
$classes_lib->virtual_num = 0;
$classes_lib->save();
//生成20个虚拟参与者
(new Virtual())->getVirtualUser(20,$classes_lib_id,time(),true);
}
}
}

View File

@ -82,6 +82,6 @@ class ClassesSpec extends Model
public function lib()
{
return $this->belongsTo('Lib', 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo(ClassesLib::class, 'classes_lib_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -555,6 +555,9 @@ class Order extends BaseModel
$order_data["classes_order_detail_id"] = $detail["id"];
$order_data["classes_lib_id"] = $detail["classes_lib_id"];
$order_data["manystore_id"] = $detail["manystore_id"];
$order_data["shop_id"] = $detail["shop_id"];
$order_data["status"] = '-1';
@ -847,6 +850,61 @@ class Order extends BaseModel
}
}
//判断是否是免费课
$lib = $classes_lib_spec_info->lib;
if(!$lib){
throw new \Exception("该课时课程信息缺失!");
}
if($lib["price"] == 0){
//免费课开始和结束时间有交叠无法下预约
if(!config("site.free_time_overlap_check")){
//如果是免费课
//判断时间是否有交叠
$start_time = $classes_lib_spec_info['start_time'];
$end_time = $classes_lib_spec_info['end_time'];
$as = (new self)->getWithAlisaName();
//判断时间是否有交叠(只查所有的免费的预约记录)
$order_info = self::with("detail")->where("detail.price",0)
->where("{$as}.status","in",["-1","0"])
->where(function ($query) use ($as,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("{$as}.start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("{$as}.end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("{$as}.start_time <= {$start_time} AND {$as}.end_time >= {$end_time}");
$query->whereOr("{$as}.start_time >= {$start_time} AND {$as}.end_time <= {$end_time}");
})
->where("{$as}.user_id",$user_id)->find();
if($order_info) throw new \Exception("当前时间区间内,您已预约免费课程{$order_info['detail']['title']},无法再预约其他免费课程");
}
}
if(!config("site.all_time_overlap_check")){
//判断时间是否有交叠
$start_time = $classes_lib_spec_info['start_time'];
$end_time = $classes_lib_spec_info['end_time'];
$as = (new self)->getWithAlisaName();
//判断时间是否有交叠(只查所有的免费的预约记录)
$order_info = self::with("detail")
->where("{$as}.status","in",["-1","0"])
->where(function ($query) use ($as,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("{$as}.start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("{$as}.end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("{$as}.start_time <= {$start_time} AND {$as}.end_time >= {$end_time}");
$query->whereOr("{$as}.start_time >= {$start_time} AND {$as}.end_time <= {$end_time}");
})
->where("{$as}.user_id",$user_id)->find();
if($order_info) throw new \Exception("当前时间区间内,您已预约课程{$order_info['detail']['title']},无法再预约其他课程");
}
}

View File

@ -225,6 +225,12 @@ class ClassesLib extends ManystoreBase
$params["user_id"] = $teacher["user_id"];
//课时必须大于等于1
if($params["classes_num"] < 1) $this->error("课时必须大于等于1");
//售价必须大于0
if($params["price"] < 0) $this->error("售价必须大于0");
//独立地点需传定位信息
if($params["address_type"] == "2"){
if(empty($params["address_city"])
@ -329,11 +335,25 @@ class ClassesLib extends ManystoreBase
$this->have_auth = true;
}
//如果是上架,判断是否拥有课时规格,没有则无法上架
if($params["status"]=="1"){
if(!$row)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
//判断是否拥有课时规格,没有则无法上架
$check_spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row->id)->count();
if(!$check_spec)$this->error("新添加的课程请先至少添加一个课时规格后再上架!");
}
}
protected function update_classes($classes_lib_id){
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
/**
* 添加
*
@ -366,7 +386,8 @@ class ClassesLib extends ManystoreBase
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $this->model];
@ -425,8 +446,8 @@ class ClassesLib extends ManystoreBase
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
$this->update_classes($row["id"]);
if($this->have_auth){
//调用通过事件

View File

@ -139,12 +139,80 @@ class ClassesSpec extends ManystoreBase
$this->error("店铺不存在");
}
//开始和结束时间不能为空
$start_time = $params["start_time"];
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
$this->error("请选择开始和结束时间");
}
//转化时间戳
$start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
$end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
$this->error("结束时间不能小于开始时间");
}
//结束时间不能是已经过去的时间
$now_time = time();
if($end_time<=$now_time){
$this->error("结束时间不能是已经过去的时间");
}
$orderTimeTableName = $this->model->getWithAlisaName();
//修改
if($row){
$this->updateCheck($row->id,$params,$row);
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->where("id","<>",$row->id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->where("id","<>",$row->id)->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}else{
//规格名字不能一样(同课程下)
$spec_name = $params["name"];
$classes_lib_id = $params["classes_lib_id"];
$spec_name_exist = $this->model::where("name",$spec_name)->where("classes_lib_id",$classes_lib_id)->find();
if($spec_name_exist){
$this->error("该课程下已存在该课时规格名称,请重新输入");
}
//同课程下,各个课时的开始和结束时间不能有重叠(出现时间交叠也不行)
$spec_time_exist = $this->model::where(function ($query) use ($orderTimeTableName,$start_time,$end_time) {
//兩個時間區間重合 存在任意交集 都不行
$query->where("start_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("end_time BETWEEN {$start_time} AND {$end_time}");
$query->whereOr("start_time <= {$start_time} AND end_time >= {$end_time}");
$query->whereOr("start_time >= {$start_time} AND end_time <= {$end_time}");
})
->where("classes_lib_id",$classes_lib_id)
->find();
if($spec_time_exist){
$this->error("该课程下,{$spec_time_exist['name']}课时的开始和结束时间与你有重叠");
}
}

View File

@ -39,6 +39,10 @@ class VirtualUser extends ManystoreBase
parent::import();
}
protected function update_classes($classes_lib_id){
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
@ -111,6 +115,8 @@ class VirtualUser extends ManystoreBase
// $result = $this->model->allowField(true)->save($params);
if(!$params["classes_lib_id"])throw new Exception( "请选择课程");
$res = (new Virtual)->getVirtualUser($params["num"],$params["classes_lib_id"],$params["time"],true);
$this->update_classes($params["classes_lib_id"]);
$result = true;
Db::commit();
} catch (ValidateException $e) {
@ -134,4 +140,58 @@ class VirtualUser extends ManystoreBase
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);
}
$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', ''));
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,72 @@
<?php
namespace app\manystore\controller\user;
use app\common\controller\ManystoreBase;
use app\manystore\model\school\classes\order\Order;
/**
* 会员管理
*
* @icon fa fa-user
*/
class User extends ManystoreBase
{
/**
* User模型对象
* @var \app\manystore\model\user\User
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\user\User;
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//设置过滤方法
$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();
// $where[] = [$aliasName.'shop_id','eq',SHOP_ID];
$user_ids = Order::where("shop_id",SHOP_ID)->where("status","<>","-3")->column("user_id");
$list = $this->model
->where($where)
->where("id","in",$user_ids)
->order($sort, $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,35 @@
<?php
return [
'Id' => 'ID',
'Group_id' => '组别ID',
'Username' => '用户名',
'Nickname' => '昵称',
'Realname' => '真实姓名',
'Work' => '职业',
'Password' => '密码',
'Salt' => '密码盐',
'Email' => '电子邮箱',
'Mobile' => '手机号',
'Avatar' => '头像',
'Level' => '等级',
'Gender' => '性别',
'Birthday' => '生日',
'Bio' => '格言',
'Money' => '余额',
'Score' => '积分',
'Successions' => '连续登录天数',
'Maxsuccessions' => '最大连续登录天数',
'Prevtime' => '上次登录时间',
'Logintime' => '登录时间',
'Loginip' => '登录IP',
'Loginfailure' => '失败次数',
'Loginfailuretime' => '最后登录失败时间',
'Joinip' => '加入IP',
'Jointime' => '加入时间',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Token' => 'Token',
'Status' => '状态',
'Verification' => '验证'
];

View File

@ -2,6 +2,7 @@
namespace app\manystore\model\school\classes;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
@ -198,7 +199,7 @@ class ClassesLib extends Model
public function manystore()
{
return $this->belongsTo('app\manystore\model\Manystore', 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
}

View File

@ -2,10 +2,11 @@
namespace app\manystore\model\school\classes;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class ClassesSpec extends Model
class ClassesSpec extends BaseModel
{
use SoftDelete;

View File

@ -0,0 +1,87 @@
<?php
namespace app\manystore\model\user;
use think\Model;
class User extends Model
{
// 表名
protected $name = 'user';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = false;
// 追加属性
protected $append = [
'prevtime_text',
'logintime_text',
'loginfailuretime_text',
'jointime_text'
];
public function getPrevtimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['prevtime']) ? $data['prevtime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getLogintimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['logintime']) ? $data['logintime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getLoginfailuretimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['loginfailuretime']) ? $data['loginfailuretime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getJointimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['jointime']) ? $data['jointime'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
protected function setPrevtimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setLogintimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setLoginfailuretimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setJointimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
}

View File

@ -0,0 +1,27 @@
<?php
namespace app\manystore\validate\user;
use think\Validate;
class User extends Validate
{
/**
* 验证规则
*/
protected $rule = [
];
/**
* 提示消息
*/
protected $message = [
];
/**
* 验证场景
*/
protected $scene = [
'add' => [],
'edit' => [],
];
}

View File

@ -62,6 +62,9 @@
<h3 class="profile-username text-center">{$manystore.username|htmlentities}</h3>
<p class="text-muted text-center">{$manystore.email|htmlentities}</p>
<p class="text-muted text-center">所属前端用户ID: <span style="color:red ">[{$manystore.user_id|htmlentities}]</span> </p>
<div class="form-group">
<label for="username" class="control-label">{:__('Username')}:</label>
<input type="text" class="form-control" id="username" name="row[username]"

View File

@ -202,20 +202,20 @@
<textarea id="c-notice" class="form-control editor" rows="5" name="row[notice]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Virtual_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_num" class="form-control" name="row[virtual_num]" type="number">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('虚拟参与人数')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-virtual_people" class="form-control" name="row[virtual_people]" type="number">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('虚拟参与人数')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-virtual_people" class="form-control" name="row[virtual_people]" type="number">-->
<!-- </div>-->
<!-- </div>-->

View File

@ -1,5 +1,46 @@
<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">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="authStatusList" item="vo"}
<label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" disabled type="radio" value="{$key}" {in name="key" value="$row.auth_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
{if ( $row.auth_status == 2) }
<span style="color: red">(不通过原因:{$row.reason})</span>
{else /}
{/if}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}"
{in name="key" value="$row.status"}checked{/in}
{in name="key" value="3"} disabled {/in}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<!--横线隔离-->
<br><br><br>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Manystore_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
@ -246,40 +287,8 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}"
{in name="key" value="$row.status"}checked{/in}
{in name="key" value="3"} disabled {/in}
/>
{$vo}
</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Auth_status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="authStatusList" item="vo"}
<label for="row[auth_status]-{$key}"><input id="row[auth_status]-{$key}" name="row[auth_status]" disabled type="radio" value="{$key}" {in name="key" value="$row.auth_status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
{if ( $row.auth_status == 2) }
<span style="color: red">(不通过原因:{$row.reason})</span>
{else /}
{/if}
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Reason')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
@ -354,6 +363,9 @@
<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-success btn-embossed disabled">{:__('提交修改【涉及名称等核心数据将提交审核,审核时课程会下架】')}</button>
<button type="button" data-url="school/classes/classes_spec/index?classes_lib_id={$row.id}" class="btn btn-success btn-changeuser {:$auth->check('school/classes/classes_spec/index')?'':'hide'}" title="{:__('设置课时')}" ><i class="fa fa-plus"></i> {:__('设置课时')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>

View File

@ -0,0 +1,108 @@
<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">{:__('Group_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-group_id" data-rule="required" data-source="group/index" class="form-control selectpage" name="row[group_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-username" class="form-control" name="row[username]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-nickname" class="form-control" name="row[nickname]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Realname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-realname" class="form-control" name="row[realname]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Work')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-work" class="form-control" name="row[work]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-password" class="form-control" name="row[password]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Salt')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-salt" class="form-control" name="row[salt]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Email')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-email" class="form-control" name="row[email]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" class="form-control" name="row[mobile]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Avatar')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-avatar" class="form-control" size="50" name="row[avatar]" type="text" value="">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-avatar" class="btn btn-danger faupload" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-avatar"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-avatar" class="btn btn-primary fachoose" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-avatar"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-avatar"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-level" data-rule="required" class="form-control" name="row[level]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Gender')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-gender" data-rule="required" class="form-control" name="row[gender]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Birthday')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-birthday" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[birthday]" type="text" value="{:date('Y-m-d')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bio')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bio" class="form-control" name="row[bio]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="0.00">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="0">
</div>
</div>
<div class="form-group">
<lab

View File

@ -0,0 +1,122 @@
<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">{:__('Group_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-group_id" data-rule="required" data-source="group/index" class="form-control selectpage" name="row[group_id]" type="text" value="{$row.group_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Username')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-username" class="form-control" name="row[username]" type="text" value="{$row.username|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Nickname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-nickname" class="form-control" name="row[nickname]" type="text" value="{$row.nickname|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Realname')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-realname" class="form-control" name="row[realname]" type="text" value="{$row.realname|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Work')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-work" class="form-control" name="row[work]" type="text" value="{$row.work|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Password')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-password" class="form-control" name="row[password]" type="text" value="{$row.password|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Salt')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-salt" class="form-control" name="row[salt]" type="text" value="{$row.salt|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Email')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-email" class="form-control" name="row[email]" type="text" value="{$row.email|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Mobile')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-mobile" class="form-control" name="row[mobile]" type="text" value="{$row.mobile|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Avatar')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-avatar" class="form-control" size="50" name="row[avatar]" type="text" value="{$row.avatar|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-avatar" class="btn btn-danger faupload" data-input-id="c-avatar" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-avatar"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-avatar" class="btn btn-primary fachoose" data-input-id="c-avatar" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-avatar"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-avatar"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-level" data-rule="required" class="form-control" name="row[level]" type="number" value="{$row.level|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Gender')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-gender" data-rule="required" class="form-control" name="row[gender]" type="number" value="{$row.gender|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Birthday')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-birthday" class="form-control datetimepicker" data-date-format="YYYY-MM-DD" data-use-current="true" name="row[birthday]" type="text" value="{$row.birthday}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Bio')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-bio" class="form-control" name="row[bio]" type="text" value="{$row.bio|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-money" data-rule="required" class="form-control" step="0.01" name="row[money]" type="number" value="{$row.money|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Score')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-score" data-rule="required" class="form-control" name="row[score]" type="number" value="{$row.score|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Successions')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-successions" data-rule="required" class="form-control" name="row[successions]" type="number" value="{$row.successions|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Maxsuccessions')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-maxsuccessions" data-rule="required" class="form-control" name="row[maxsuccessions]" type="number" value="{$row.maxsuccessions|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Prevtime')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-prevtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[prevtime]" type="text" value="{:$row.prevtime?datetime($row.prevtime

View File

@ -0,0 +1,34 @@
<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('user/user/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('user/user/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('user/user/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
<!-- <div class="dropdown btn-group {:$auth->check('user/user/multi')?'':'hide'}">-->
<!-- <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>-->
<!-- <ul class="dropdown-menu text-left" role="menu">-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>-->
<!-- <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>-->
<!-- </ul>-->
<!-- </div>-->
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="0"
data-operate-del="0"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -25,7 +25,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'operate', title: __('Operate'),width:750, table: table , buttons: [
{field: 'operate', title: __('Operate'),width:900, table: table , buttons: [
{name: 'free',
text: '免登录进入机构后台',
icon: 'fa fa-sign-in',
@ -110,8 +110,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
{
name: 'order',
text: __('机构课程订单'),
title: __('机构课程订单'),
text: __('机构课程购买订单'),
title: __('机构课程购买订单'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: order_url,
@ -122,6 +122,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'hourorder',
text: __('机构课时预约记录'),
title: __('机构课时预约记录'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: hourorder_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
//
// {name: 'unsetmockauth',
@ -155,7 +169,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'email', title: __('Email')},
{field: 'status', title: __("Status"), formatter: Table.api.formatter.status},
{field: 'shop.status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'user_id', title: __('User_id'),visible:false},
{field: 'user_id', title: __('User_id')},
{field: 'shop.type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
@ -163,7 +177,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
// {field: 'user_id', title: __('申请姓名|机构名'), operate: 'LIKE'},
{field: 'shop.name', title: __('申请姓名|机构名'), operate: 'LIKE'},
{field: 'shop.logo', title: __('Logo'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'shop.image', title: __('Image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
@ -299,6 +313,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/order/order/index?shop_id='+row.id;
}
//hourorder_url
var hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?shop_id='+row.id;
}
return Controller;
});

View File

@ -88,6 +88,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_hourorder',
text: __('课时预约记录'),
title: __('课时预约记录'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: classes_hourorder_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
//
// {name: 'unsetmockauth',
// text: '取消加圈资格',
@ -118,6 +132,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'classes_cate_title', title: __('Classes_cate_ids'), operate: false, formatter: Table.api.formatter.flag},
{field: 'classes_label_title', title: __('Classes_label_ids'), operate: false, formatter: Table.api.formatter.flag},
@ -128,7 +143,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'reason', title: __('Reason'), operate: 'LIKE' },
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE',visible:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
@ -364,5 +378,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
var classes_hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?classes_lib_id='+row.id;
}
return Controller;
});

View File

@ -78,6 +78,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'order_detail',
text: __('课程信息'),
title: __('课程信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: order_detail_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
//
// {name: 'unsetmockauth',
@ -111,6 +125,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'order_no', title: __('Order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'classes_order_id',visible:false, title: __('Classes_order_id')},
{field: 'classes_lib_spec_id',visible:false, title: __('Classes_lib_spec_id')},
@ -137,6 +155,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{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: 'classesorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'manystore_id', title: __('Manystore_id'),visible:false},
{field: 'shop_id', title: __('Shop_id'),visible:false},
// {field: 'spec.name', title: __('Spec.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'lib.title', title: __('Lib.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
@ -249,5 +271,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/hourorder/order_log/index?classes_hour_order_id='+row.id;
}
var order_detail_url = function (row,dom) {
return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id;
}
return Controller;
});

View File

@ -29,7 +29,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate},
{field: 'id', title: __('Id'),sortable: true},
{field: 'id', title: __('Id')},
{field: 'weigh', title: __('Weigh'), operate: false,sortable: true},
{field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2')}, formatter: Table.api.formatter.normal},

View File

@ -24,10 +24,62 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'third',
text: __('三方账号信息'),
title: __('三方账号信息'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: third_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_order',
text: __('课程购买单'),
title: __('课程购买单'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: classes_order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_hourorder',
text: __('课时预约单'),
title: __('课时预约单'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: classes_hourorder_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
{field: 'id', title: __('Id'), sortable: true},
{field: 'group.name', title: __('Group')},
{field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'realname', title: __('真实姓名'), operate: 'LIKE'},
{field: 'work', title: __('职业'), operate: 'LIKE'},
{field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
@ -41,7 +93,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
{field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
{field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
@ -89,5 +141,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
}
};
var third_url = function (row,dom) {
return 'third/index?user_id='+row.id;
}
//classes_order_url
var classes_order_url = function (row,dom) {
return 'school/classes/order/order/index?user_id='+row.id;
}
//classes_hourorder_url
var classes_hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?user_id='+row.id;
}
return Controller;
});

View File

@ -84,6 +84,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_hourorder',
text: __('课时预约记录'),
title: __('课时预约记录'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: classes_hourorder_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
// {name: 'unsetmockauth',
// text: '取消加圈资格',
// icon: 'fa fa-sign-in',
@ -113,6 +127,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'classes_cate_title', title: __('Classes_cate_ids'), operate: false, formatter: Table.api.formatter.flag},
@ -124,7 +139,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'title', title: __('Title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'headimage', title: __('Headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'reason', title: __('Reason'), operate: 'LIKE' },
{field: 'auth_time', title: __('Auth_time'), operate:'RANGE',visible:false, addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
@ -359,5 +373,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/order/order/index?classes_lib_id='+row.id +'&shop_id='+row.shop_id;
}
var classes_hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?classes_lib_id='+row.id;
}
return Controller;
});

View File

@ -76,6 +76,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'order_detail',
text: __('课程信息'),
title: __('课程信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: order_detail_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
//
// {name: 'unsetmockauth',
@ -110,6 +124,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'start_time', title: __('Start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'end_time', title: __('End_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'auth_status', title: __('Auth_status'), searchList: {"0":__('Auth_status 0'),"1":__('Auth_status 1'),"2":__('Auth_status 2')}, formatter: Table.api.formatter.status},
{field: 'order_no', title: __('Order_no'), operate: 'LIKE'},
{field: 'classes_order_id',visible:false, title: __('Classes_order_id')},
{field: 'classes_lib_spec_id',visible:false, title: __('Classes_lib_spec_id')},
@ -136,6 +153,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{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: 'schoolclassesorder.order_no',visible:false, title: __('Schoolclassesorder.order_no'), operate: 'LIKE'},
{field: 'manystore_id', title: __('Manystore_id'),visible:false},
{field: 'shop_id', title: __('Shop_id'),visible:false},
// {field: 'schoolclasseslibspec.name',visible:false, title: __('Schoolclasseslibspec.name'), operate: 'LIKE'},
// {field: 'schoolclasseslib.title',visible:false, title: __('Schoolclasseslib.title'), operate: 'LIKE'},
// {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
@ -240,5 +262,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/hourorder/order_log/index?classes_hour_order_id='+row.id;
}
var order_detail_url = function (row,dom) {
return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id;
}
return Controller;
});

View File

@ -0,0 +1,128 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'user/user/index' + location.search,
add_url: 'user/user/add',
edit_url: 'user/user/edit',
del_url: 'user/user/del',
multi_url: 'user/user/multi',
import_url: 'user/user/import',
table: 'user',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'classes_order',
text: __('课程购买记录'),
title: __('课程购买记录'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: classes_order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_hourorder',
text: __('课时预约记录'),
title: __('课时预约记录'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-list',
url: classes_hourorder_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
{field: 'id', title: __('Id')},
// {field: 'group_id', title: __('Group_id')},
// {field: 'username', title: __('Username'), operate: 'LIKE'},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'realname', title: __('Realname'), operate: 'LIKE'},
{field: 'work', title: __('Work'), operate: 'LIKE'},
// {field: 'password', title: __('Password'), operate: 'LIKE'},
// {field: 'salt', title: __('Salt'), operate: 'LIKE'},
// {field: 'email', title: __('Email'), operate: 'LIKE'},
{field: 'bio', title: __('Bio'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
// {field: 'level', title: __('Level')},
// {field: 'gender', title: __('Gender')},
// {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
// {field: 'bio', title: __('Bio'), operate: 'LIKE'},
// {field: 'money', title: __('Money'), operate:'BETWEEN'},
// {field: 'score', title: __('Score')},
// {field: 'successions', title: __('Successions')},
// {field: 'maxsuccessions', title: __('Maxsuccessions')},
// {field: 'prevtime', title: __('Prevtime')},
// {field: 'logintime', title: __('Logintime')},
// {field: 'loginip', title: __('Loginip'), operate: 'LIKE'},
// {field: 'loginfailure', title: __('Loginfailure')},
// {field: 'loginfailuretime', title: __('Loginfailuretime')},
// {field: 'joinip', title: __('Joinip'), operate: 'LIKE'},
// {field: 'jointime', title: __('Jointime')},
// {field: 'createtime', title: __('Createtime')},
// {field: 'updatetime', title: __('Updatetime')},
// {field: 'token', title: __('Token'), operate: 'LIKE'},
// {field: 'status', title: __('Status'), operate: 'LIKE', formatter: Table.api.formatter.status},
// {field: 'verification', title: __('Verification'), operate: 'LIKE'},
// {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]"));
}
}
};
var classes_order_url = function (row,dom) {
return 'school/classes/order/order/index?user_id='+row.id;
}
//classes_hourorder_url
var classes_hourorder_url = function (row,dom) {
return 'school/classes/hourorder/order/index?user_id='+row.id;
}
return Controller;
});