夜校完善功能

This commit is contained in:
15090180611 2024-12-20 18:14:20 +08:00
parent 525d204e35
commit 758e1ffbf2
39 changed files with 1977 additions and 25 deletions

View File

@ -0,0 +1,274 @@
<?php
namespace app\admin\controller\school\classes;
use app\common\controller\Backend;
use app\common\model\manystore\UserAuth;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\Exception;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 活动样品数据
*
* @icon fa fa-circle-o
*/
class ActivityDemo extends Backend
{
/**
* ActivityDemo模型对象
* @var \app\admin\model\school\classes\ActivityDemo
*/
protected $model = null;
public function _initialize()
{
$this->model = new \app\admin\model\school\classes\ActivityDemo;
parent::_initialize();
$this->getCity();
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("itemStatusList", $this->model->getItemStatusList());
$this->view->assign("sexList", $this->model->getSexList());
//getItemStatusList
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
//开始和结束时间不能为空
$time = $params["time"];
if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
$split_line = " - ";
$time_arr = explode($split_line,$time);
$params["start_time"] = $time_arr[0] ;
$params["end_time"] = $time_arr[1];
unset($params["time"]);
$start_time = $params["start_time"];
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
}
//转化时间戳
$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){
throw new \Exception("{$params["title"]}结束时间不能小于开始时间");
}
//开始和结束时间不能为空
$time = $params["sign_time"];
if(empty($time))throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
$split_line = " - ";
$time_arr = explode($split_line,$time);
$params["sign_start_time"] = $time_arr[0] ;
$params["sign_end_time"] = $time_arr[1];
unset($params["sign_time"]);
$start_time = $params["sign_start_time"];
$end_time = $params["sign_end_time"];
if(empty($start_time) || empty($end_time)){
throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
}
//转化时间戳
$start_time = $params["sign_start_time"] && !is_numeric($params["sign_start_time"]) ? strtotime($params["sign_start_time"]) : $params["sign_start_time"];
$end_time = $params["sign_end_time"] && !is_numeric($params["sign_end_time"]) ? strtotime($params["sign_end_time"]) : $params["sign_end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
throw new \Exception("{$params["title"]}结束时间不能小于开始时间");
}
//修改
if($row){
}else{
//新增
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if (false === $this->request->isPost()) {
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);
if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
$params[$this->dataLimitField] = $this->auth->id;
}
$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 . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException()->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage().$e->getFile().$e->getLine());
}
if ($result === false) {
$this->error(__('No rows were inserted'));
}
$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);
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if (false === $result) {
$this->error(__('No rows were updated'));
}
$this->success();
}
/**
* 删除
*
* @param $ids
* @return void
* @throws DbException
* @throws DataNotFoundException
* @throws ModelNotFoundException
*/
public function del($ids = null)
{
if (false === $this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ?: $this->request->post("ids");
if (empty($ids)) {
$this->error(__('Parameter %s can not be empty', 'ids'));
}
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $item) {
$count += $item->delete();
}
Db::commit();
} catch (PDOException|Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
}
$this->error(__('No rows were deleted'));
}
}

View File

@ -29,7 +29,10 @@ class ClassesLib extends Backend
protected $qSwitch = true; protected $qSwitch = true;
protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"]; protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"];
/**
* 是否开启Validate验证
*/
protected $modelValidate = true;
/** /**
* ClassesLib模型对象 * ClassesLib模型对象
@ -508,6 +511,7 @@ class ClassesLib extends Backend
if ($this->modelValidate) { if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException()->validate($validate); $row->validateFailException()->validate($validate);
} }

View File

@ -27,6 +27,8 @@ class User extends Backend
{ {
parent::_initialize(); parent::_initialize();
$this->model = new \app\admin\model\User; $this->model = new \app\admin\model\User;
$this->view->assign("genderListJson", json_encode($this->model->getGenderList(), JSON_UNESCAPED_UNICODE));
} }
/** /**

View File

@ -0,0 +1,32 @@
<?php
return [
'Title' => '标题',
'Headimage' => '头图',
'Images' => '轮播图',
'Address_city' => '城市选择',
'Province' => '省编号',
'City' => '市编号',
'District' => '县区编号',
'Address' => '活动地址',
'Address_detail' => '活动详细地址',
'Longitude' => '经度',
'Latitude' => '纬度',
'Start_time' => '活动开始时间',
'End_time' => '活动结束时间',
'Sign_start_time' => '报名开始时间',
'Sign_end_time' => '报名结束时间',
'Status' => '状态',
'Status 1' => '报名中',
'Set status to 1' => '设为报名中',
'Status 2' => '已结束',
'Set status to 2' => '设为已结束',
'Price' => '报名费用',
'People_num' => '活动人数',
'Item' => '活动项目',
'Content' => '活动详情',
'Item_json' => '活动报名项目',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间'
];

View File

@ -59,7 +59,7 @@ class User extends Model
public function getGenderList() public function getGenderList()
{ {
return ['1' => __('Male'), '0' => __('Female')]; return [ 1 => __('Male'), 0 => __('Female')];
} }
public function getStatusList() public function getStatusList()

View File

@ -0,0 +1,112 @@
<?php
namespace app\admin\model\school\classes;
use think\Model;
use traits\model\SoftDelete;
class ActivityDemo extends Model
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_demo';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'start_time_text',
'end_time_text',
'sign_start_time_text',
'sign_end_time_text',
'status_text'
];
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getItemStatusList()
{
return ['1' => __('已满'), '2' => __('未满')];
}
public function getSexList()
{
return ['1' => __('男'), '2' => __('女'), '3' => __('男女不限')];
}
public function getStartTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getEndTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getSignStartTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sign_start_time']) ? $data['sign_start_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getSignEndTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sign_end_time']) ? $data['sign_end_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
protected function setStartTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setEndTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setSignStartTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setSignEndTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
}

View File

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

View File

@ -10,18 +10,33 @@ class ClassesLib extends Validate
* 验证规则 * 验证规则
*/ */
protected $rule = [ protected $rule = [
'title' => 'require|length:1,50|alphaNum',
// 'alphaNum' 是自定义的规则,用于过滤中文、数字和拼音字符
]; ];
/** /**
* 提示消息 * 提示消息
*/ */
protected $message = [ protected $message = [
'title.require' => '课程名不能为空',
'title.length' => '课程名长度必须在1到50之间',
'title.alphaNum' =>'课程名只允许中文、数字和拼音字符'
]; ];
/** /**
* 验证场景 * 验证场景
*/ */
protected $scene = [ protected $scene = [
'add' => [], 'add' => ["title"],
'edit' => [], 'edit' => ["title"],
]; ];
// 自定义验证规则
protected function alphaNum($value, $rule, $data = [])
{
$pattern = '/^[\x{4e00}-\x{9fa5}\d]+$/u'; // 正则表达式,匹配中文和数字
if (preg_match($pattern, $value)) {
return true;
} else {
return false;
}
}
} }

View File

@ -0,0 +1,203 @@
<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" data-rule="required" class="form-control" name="row[title]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Headimage')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-headimage" data-rule="required" class="form-control" size="50" name="row[headimage]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-headimage" class="btn btn-danger faupload" data-input-id="c-headimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-headimage" class="btn btn-primary fachoose" data-input-id="c-headimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-headimage"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-headimage"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="{$q_address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$q_province_code}" >
<input type="hidden" id="city" name="row[city]" value="{$q_city_code}" >
<input type="hidden" id="district" name="row[district]" value="{$q_area_code}" >
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address" class="form-control form-control"
data-lat-id="c-latitude" data-lng-id="c-longitude" readonly data-input-id="c-address" data-toggle="addresspicker" name="row[address]" value="" type="text" placeholder="请地图选址。如调起地图失败请检查插件《地图位置(经纬度)选择》是否安装">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="" placeholder="请输入{:__('Address_detail')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="">
</div>
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="">
</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-time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[time]" type="text" value="{:date('Y-m-d 0:01')} - {:date('Y-m-d H:i')}">
</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-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_time]" type="text" value="{:date('Y-m-d 0:01')} - {:date('Y-m-d H:i')}">
</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="1"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('People_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-people_num" class="form-control" name="row[people_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Item')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item" class="form-control" name="row[item]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<td>开始结束时间</td>
<td>限定人数</td>
<td>年龄限制</td>
<!-- <td>权重</td>-->
<td>报名是否已满</td>
<td>男女</td>
<td>价格</td>
<td></td>
</tr>
<tr>
<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></td>
</tr>
<textarea name="row[item_json]" id="item_json" class="form-control hide" cols="30" rows="8"></textarea>
</table>
<!-- <span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)</span>-->
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td><input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="15" placeholder="活动项名"></td>
<td>
<input type="text" name="row[<%=name%>][<%=index%>][time]" data-rule="required" class="form-control datetimerange" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" value="<%=row['time']%>" size="25" />
<!--<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">-->
</td>
<td><input type="text" name="row[<%=name%>][<%=index%>][limit_num]" data-rule="required" class="form-control" value="<%=row['limit_num']%>" placeholder="限制人数" size="2" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>
<td><input type="text" name="row[<%=name%>][<%=index%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="10" placeholder="年龄限制"></td>
<!-- <td><input type="text" name="row[<%=name%>][<%=index%>][weigh]" data-rule="required" class="form-control" value="<%=row['weigh']%>" size="2" placeholder="课时排序权重" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>-->
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['status']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="<%=row['sex']%>"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>
<td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></td>
</tr>
</script>
</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>

View File

@ -0,0 +1,196 @@
<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" data-rule="required" 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">{:__('Headimage')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-headimage" data-rule="required" class="form-control" size="50" name="row[headimage]" type="text" value="{$row.headimage|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-headimage" class="btn btn-danger faupload" data-input-id="c-headimage" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-headimage"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-headimage" class="btn btn-primary fachoose" data-input-id="c-headimage" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-headimage"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-headimage"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Images')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-images" data-rule="required" class="form-control" size="50" name="row[images]" type="text" value="{$row.images|htmlentities}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-images" class="btn btn-primary fachoose" data-input-id="c-images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-images"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-images"></ul>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_city')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address_city" class="form-control form-control" data-toggle="city-picker" name="row[address_city]" value="{$row.address_city}" type="text">
</div>
<input type="hidden" id="province" name="row[province]" value="{$row.province}" >
<input type="hidden" id="city" name="row[city]" value="{$row.city}" >
<input type="hidden" id="district" name="row[district]" value="{$row.district}" >
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
<div class="col-xs-12 col-sm-8">
<div class='control-relative'>
<input id="c-address" class="form-control form-control"
data-lat-id="c-latitude" data-lng-id="c-longitude" readonly data-input-id="c-address" data-toggle="addresspicker" name="row[address]" value="{$row.address}" type="text" placeholder="请地图选址。如调起地图失败请检查插件《地图位置(经纬度)选择》是否安装">
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Address_detail')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-address_detail" class="form-control" name="row[address_detail]" type="text" value="{$row.address_detail}" placeholder="请输入{:__('Address_detail')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Longitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-longitude" readonly class="form-control" name="row[longitude]" type="text" value="{$row.longitude}">
</div>
<label class="control-label col-xs-12 col-sm-2">{:__('Latitude')}:</label>
<div class="col-xs-12 col-sm-3">
<input id="c-latitude" readonly class="form-control" name="row[latitude]" type="text" value="{$row.latitude}">
</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-time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[time]" type="text" value="{:$row.start_time?datetime($row.start_time):''} - {:$row.end_time?datetime($row.end_time):''}">
</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-sign_time" class="form-control datetimerange" data-rule="required" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" name="row[sign_time]" type="text" value="{:$row.sign_start_time?datetime($row.sign_start_time):''} - {:$row.sign_end_time?datetime($row.sign_end_time):''}">
</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">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" data-rule="required" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('People_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-people_num" class="form-control" name="row[people_num]" type="number" value="{$row.people_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Item')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-item" class="form-control" name="row[item]" type="text" value="{$row.item|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea id="c-content" data-rule="required" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Item_json')}:</label>
<div class="col-xs-12 col-sm-8">
<table class="table table-responsive fieldlist" data-name="row[item_json]" data-template="testtpl" data-tag="tr">
<tr>
<td>活动项名</td>
<td>开始结束时间</td>
<td>限定人数</td>
<td>年龄限制</td>
<!-- <td>权重</td>-->
<td>报名是否已满</td>
<td>男女</td>
<td>价格</td>
<td></td>
</tr>
<tr>
<td colspan="5"><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 追加</a></td>
</tr>
<textarea name="row[item_json]" id="item_json" class="form-control hide" cols="30" rows="8">{$row.item_json|htmlentities}</textarea>
</table>
<!-- <span style="color: red">(每个课时规格为当前课程的一节课,课程总共多少节课就需要上多少个课时规格,每个课时的开始和结束时间不能有重叠,单节课开始结束时间必须在同一天,后续有变更将触发审核机制!)</span>-->
<!--定义模板-->
<script type="text/html" id="testtpl">
<tr class="form-inline">
<td><input type="text" name="row[<%=name%>][<%=index%>][name]" data-rule="required" class="form-control" value="<%=row['name']%>" size="15" placeholder="活动项名"></td>
<td>
<input type="text" name="row[<%=name%>][<%=index%>][time]" data-rule="required" class="form-control datetimerange" data-time-picker="true" data-locale='{"format":"YYYY/MM/DD HH:mm"}' placeholder="指定开始结束时间" value="<%=row['time']%>" size="25" />
<!--<input type="text" class="form-control datetimerange" name="updatetime" value="" placeholder="修改时间" id="updatetime" data-index="49" autocomplete="off">-->
</td>
<td><input type="text" name="row[<%=name%>][<%=index%>][limit_num]" data-rule="required" class="form-control" value="<%=row['limit_num']%>" placeholder="限制人数" size="2" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>
<td><input type="text" name="row[<%=name%>][<%=index%>][age]" data-rule="required" class="form-control" value="<%=row['age']%>" size="10" placeholder="年龄限制"></td>
<!-- <td><input type="text" name="row[<%=name%>][<%=index%>][weigh]" data-rule="required" class="form-control" value="<%=row['weigh']%>" size="2" placeholder="课时排序权重" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>-->
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][status]">
{foreach name="itemStatusList" item="vo"}
<option value="{$key}" <%if(row.status=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td>
<select class="form-control" name="row[<%=name%>][<%=index%>][sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" <%if(row.sex=={$key}){%> selected <%}%> >{$vo}</option>
{/foreach}
</select>
</td>
<td><input size="10" type="text" name="row[<%=name%>][<%=index%>][price]" data-rule="required" class="form-control" value="<%=row['price']%>" placeholder="价格" onkeyup="this.value=this.value.replace(/[^0-9]/g,'')" onafterpaste="this.value=this.value.replace(/[^0-9]/g,'')"></td>
<td><span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-times"></i></span> <span class="btn btn-sm btn-primary btn-dragsort"><i class="fa fa-arrows"></i></span></td>
</tr>
</script>
</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>

View File

@ -0,0 +1,46 @@
<div class="panel panel-default panel-intro">
<div class="panel-heading">
{:build_heading(null,FALSE)}
<ul class="nav nav-tabs" data-field="status">
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
{foreach name="statusList" item="vo"}
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
{/foreach}
</ul>
</div>
<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/classes/activity_demo/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/classes/activity_demo/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/classes/activity_demo/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('school/classes/activity_demo/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">
{foreach name="statusList" item="vo"}
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:" data-params="status={$key}">{:__('Set status to ' . $key)}</a></li>
{/foreach}
</ul>
</div>
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('school/classes/activity_demo/recyclebin')?'':'hide'}" href="school/classes/activity_demo/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/classes/activity_demo/edit')}"
data-operate-del="{:$auth->check('school/classes/activity_demo/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -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/classes/activity_demo/restore')?'':'hide'}" href="javascript:;" data-url="school/classes/activity_demo/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/classes/activity_demo/destroy')?'':'hide'}" href="javascript:;" data-url="school/classes/activity_demo/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('school/classes/activity_demo/restore')?'':'hide'}" href="javascript:;" data-url="school/classes/activity_demo/restore" title="{:__('Restore all')}"><i class="fa fa-rotate-left"></i> {:__('Restore all')}</a>
<a class="btn btn-danger btn-destroyall {:$auth->check('school/classes/activity_demo/destroy')?'':'hide'}" href="javascript:;" data-url="school/classes/activity_demo/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/classes/activity_demo/restore')}"
data-operate-destroy="{:$auth->check('school/classes/activity_demo/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -28,3 +28,6 @@
</div> </div>
</div> </div>
</div> </div>
<script>
var genderListJson = {$genderListJson};
</script>

View File

@ -94,6 +94,8 @@ class User extends Api
$this->error(__('Params error')); $this->error(__('Params error'));
} }
$result = LoginService::getInstance(['mini_config' => $this->miniConfig])->decodeData($iv,$sessionKey,$encryptedData); $result = LoginService::getInstance(['mini_config' => $this->miniConfig])->decodeData($iv,$sessionKey,$encryptedData);
$info = empty($result["phoneNumber"]) ? ($result["purePhoneNumber"] ?? '' ) : $result["phoneNumber"];
Cache::set('wechat_miniapp_core'.$info,"1",60);
$this->success('',$result); $this->success('',$result);
} }
@ -128,9 +130,20 @@ class User extends Api
if(empty($code)){ if(empty($code)){
$this->error(__('缺少code')); $this->error(__('缺少code'));
} }
//手机号变必填
// if(empty($extend['mobile'])){
// $this->error(__('未传手机号'));
// }
$wechat_mini_code = Cache::get("{$platform}_{$params['apptype']}_code".$code.$params['openid']); $wechat_mini_code = Cache::get("{$platform}_{$params['apptype']}_code".$code.$params['openid']);
if(!$wechat_mini_code)$this->error("授权code已过期或已使用请重新发起授权",['errcode'=>30002]); if(!$wechat_mini_code)$this->error("授权code已过期或已使用请重新发起授权",['errcode'=>30002]);
if($extend['mobile']){
$wechat_mini_mobile = Cache::get("{$platform}_{$params['apptype']}_core".$extend['mobile']);
if(!$wechat_mini_mobile)$this->error("授权手机号已过期或已使用,请重新发起授权!",['errcode'=>30002]);
}
//推荐人:逻辑未实现 //推荐人:逻辑未实现
@ -144,7 +157,12 @@ class User extends Api
Log::log($e->getMessage()); Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]); $this->error($e->getMessage(),['errcode'=>$e->getCode()]);
} }
Cache::rm('wechat_mini_code'.$code.$params['openid']); Cache::rm("{$platform}_{$params['apptype']}_code".$code.$params['openid']);
if($extend['mobile']){
Cache::rm("{$platform}_{$params['apptype']}_core".$extend['mobile']);
}
$this->success('获取成功', ['token' => $this->auth->getToken()]); $this->success('获取成功', ['token' => $this->auth->getToken()]);
} }

View File

@ -0,0 +1,104 @@
<?php
namespace app\api\controller\school;
use app\common\model\school\classes\ActivityDemo;
use app\common\model\school\classes\Teacher as Teachermodel;
/**
* 活动接口
*/
class Activity extends Base
{
protected $noNeedLogin = ["demo_detail","demo_list"];
protected $noNeedRight = '*';
protected $model = null;
/**
* 初始化操作
* @access protected
*/
protected function _initialize()
{
$this->model = new ActivityDemo();
parent::_initialize();
//判断登录用户是否是员工
}
/**
* @ApiTitle( 活动demo数据详情)
* @ApiSummary(活动demo数据详情)
* @ApiMethod(GET)
* @ApiParams(name = "id", type = "int",required=true,description = "活动demo数据id")
* @ApiReturn({
*
*})
*/
public function demo_detail(){
$id = $this->request->get('id/d','');
if(empty($id)){
$this->error(__('缺少必要参数'));
}
try {
$res = $this->model->detail($id);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('获取成功', ['detail' => $res]);
}
/**
* @ApiTitle( 活动demo数据列表取决于搜索条件)
* @ApiSummary(活动demo数据列表取决于搜索条件)
* @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 = "条数")
* @ApiParams(name = "status", type = "string",required=false,description = "状态:1=报名中,2=已结束")
* @ApiReturn({
*
*})
*/
public function demo_list()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$params=[];
$page = $this->request->get('page/d', 0); //页数
$limit = $this->request->get('limit/d', 0); //条数
$params['keywords'] = $this->request->get('keywords/s', ''); //搜索关键字
$params['status'] = $this->request->get('status/s', ''); //搜索关键字
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
try{
//当前申请状态
$res = $this->model::allList($page, $limit,$params);
// if($user_id =='670153'){
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
// }
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
}

View File

@ -8,6 +8,7 @@ use app\common\exception\UploadException;
use app\common\library\Upload; use app\common\library\Upload;
use app\common\library\Virtual; use app\common\library\Virtual;
use app\common\model\Area; use app\common\model\Area;
use app\common\model\ManystoreAttachment;
use app\common\model\school\classes\ClassesLib; use app\common\model\school\classes\ClassesLib;
use app\common\model\Version; use app\common\model\Version;
use fast\Random; use fast\Random;
@ -189,7 +190,7 @@ class Common extends Base
'sha1' => $sha1, 'sha1' => $sha1,
'extparam' => json_encode($extparam), 'extparam' => json_encode($extparam),
); );
$attachment = model("ManystoreAttachment"); $attachment = new ManystoreAttachment;
$attachment->data(array_filter($params)); $attachment->data(array_filter($params));
$attachment->save(); $attachment->save();
\think\Hook::listen("upload_after", $attachment); \think\Hook::listen("upload_after", $attachment);

View File

@ -0,0 +1,221 @@
<?php
namespace app\common\model\school\classes;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class ActivityDemo extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_demo';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'start_time_text',
'end_time_text',
'sign_start_time_text',
'sign_end_time_text',
'status_text'
];
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getItemStatusList()
{
return ['1' => __('已满'), '2' => __('未满')];
}
public function getSexList()
{
return ['1' => __('男'), '2' => __('女'), '3' => __('男女不限')];
}
public function getStartTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['start_time']) ? $data['start_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getEndTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['end_time']) ? $data['end_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getSignStartTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sign_start_time']) ? $data['sign_start_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getSignEndTimeTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sign_end_time']) ? $data['sign_end_time'] : '');
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
protected function setStartTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setEndTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setSignStartTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
protected function setSignEndTimeAttr($value)
{
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
}
public function getItemJsonAttr($value, $data)
{
return $value === '' ? [] : json_decode($value, true);
}
public function getHeadimageAttr($value, $data)
{
if (!empty($value)) return cdnurl($value, true);
}
public function getImagesAttr($value, $data)
{
$imagesArray = [];
if (!empty($value)) {
$imagesArray = explode(',', $value);
foreach ($imagesArray as &$v) {
$v = cdnurl($v, true);
}
return $imagesArray;
}
return $imagesArray;
}
public function setImagesAttr($value, $data)
{
$imagesArray = $value;
if (!empty($value) && is_array($value)) {
//转成逗号拼接字符串
$imagesArray = implode(',', $value);
}
return $imagesArray;
}
public function detail($id){
$self = $this->get($id);
return $self;
}
/**得到基础条件
* @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','title','address_city','address','address_detail','start_time','end_time','sign_start_time','sign_end_time']))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']) && $whereData['status']) $model = $model->where("{$alisa}status", 'in', $whereData['status']);
if (isset($whereData['not_status']) && $whereData['not_status']) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']);
if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}title|{$alisa}id|{$alisa}address|{$alisa}address_detail", '=', $whereData['keywords']);
if (isset($whereData['time'])&&$whereData['time']){
$model = $model->time(["{$alisa}createtime",$whereData['time']]);
}
return $model;
}
public static function allList($page, $limit,$params=[]){
$sort = "weigh desc,id desc";
return (new self)->getBaseList($params, $page, $limit,$sort);
}
}

View File

@ -769,7 +769,7 @@ class Order extends BaseModel
if($trans){ if($trans){
self::rollbackTrans(); self::rollbackTrans();
} }
throw new \Exception($e->getMessage()); throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
} }
return $res; return $res;
} }

View File

@ -26,6 +26,10 @@ class ClassesLib extends ManystoreBase
protected $qSwitch = true; protected $qSwitch = true;
protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"]; protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"];
/**
* 是否开启Validate验证
*/
protected $modelValidate = true;
/** /**
* ClassesLib模型对象 * ClassesLib模型对象

View File

@ -24,7 +24,8 @@ class User extends ManystoreBase
public function _initialize() public function _initialize()
{ {
parent::_initialize(); parent::_initialize();
$this->model = new \app\manystore\model\user\User; $this->model = new \app\admin\model\User;
$this->view->assign("genderListJson", json_encode($this->model->getGenderList(), JSON_UNESCAPED_UNICODE));
} }

View File

@ -31,5 +31,7 @@ return [
'Updatetime' => '更新时间', 'Updatetime' => '更新时间',
'Token' => 'Token', 'Token' => 'Token',
'Status' => '状态', 'Status' => '状态',
'Male' => '男',
'FeMale' => '女',
'Verification' => '验证' 'Verification' => '验证'
]; ];

View File

@ -10,18 +10,34 @@ class ClassesLib extends Validate
* 验证规则 * 验证规则
*/ */
protected $rule = [ protected $rule = [
'title' => 'require|length:1,50|alphaNum',
// 'alphaNum' 是自定义的规则,用于过滤中文、数字和拼音字符
]; ];
/** /**
* 提示消息 * 提示消息
*/ */
protected $message = [ protected $message = [
'title.require' => '课程名不能为空',
'title.length' => '课程名长度必须在1到50之间',
'title.alphaNum' =>'课程名只允许中文、数字和拼音字符'
]; ];
/** /**
* 验证场景 * 验证场景
*/ */
protected $scene = [ protected $scene = [
'add' => [], 'add' => ["title"],
'edit' => [], 'edit' => ["title"],
]; ];
// 自定义验证规则
protected function alphaNum($value, $rule, $data = [])
{
$pattern = '/^[\x{4e00}-\x{9fa5}\d]+$/u'; // 正则表达式,匹配中文和数字
if (preg_match($pattern, $value)) {
return true;
} else {
return false;
}
}
} }

View File

@ -32,3 +32,6 @@
</div> </div>
</div> </div>
</div> </div>
<script>
var genderListJson = {$genderListJson};
</script>

View File

@ -116,9 +116,9 @@ class Common
]; ];
$file = (new File($file_path))->isTest(true)->setUploadInfo($temp); $file = (new File($file_path))->isTest(true)->setUploadInfo($temp);
$category = $_POST["category"]; $category = $_POST["category"] ?? 'code';
$_POST["category"] = 'code'; $_POST["category"] = 'code';
$upload = new Upload($file); $upload = new Upload($file,$category);
$res = $upload->upload(); $res = $upload->upload();
$_POST["category"] = $category; $_POST["category"] = $category;
return $res; return $res;

View File

@ -26,7 +26,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[ [
{checkbox: true}, {checkbox: true},
{field: 'id', title: 'ID'}, {field: 'id', title: '账号ID'},
{field: 'shop_id', title: '机构ID'},
{field: 'shop.name', title: __('申请姓名|机构名'), operate: 'LIKE'}, {field: 'shop.name', title: __('申请姓名|机构名'), operate: 'LIKE'},
{field: 'check_full', title: __('是否完善展示信息'), {field: 'check_full', title: __('是否完善展示信息'),
searchList: {"false":__('未完善'),"true":__('已完善')}, formatter: Table.api.formatter.normal searchList: {"false":__('未完善'),"true":__('已完善')}, formatter: Table.api.formatter.normal

View File

@ -0,0 +1,204 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'school/classes/activity_demo/index' + location.search,
add_url: 'school/classes/activity_demo/add',
edit_url: 'school/classes/activity_demo/edit',
del_url: 'school/classes/activity_demo/del',
multi_url: 'school/classes/activity_demo/multi',
import_url: 'school/classes/activity_demo/import',
table: 'school_classes_activity_demo',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'id',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{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: 'address_city', title: __('Address_city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'province', title: __('Province')},
{field: 'city', title: __('City')},
{field: 'district', title: __('District')},
{field: 'address', title: __('Address'), operate: 'LIKE'},
{field: 'address_detail', title: __('Address_detail'), operate: 'LIKE'},
{field: 'longitude', title: __('Longitude'), operate: 'LIKE'},
{field: 'latitude', title: __('Latitude'), operate: 'LIKE'},
{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: 'sign_start_time', title: __('Sign_start_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'sign_end_time', title: __('Sign_end_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'people_num', title: __('People_num')},
{field: 'item', title: __('Item'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{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/classes/activity_demo/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/classes/activity_demo/restore',
refresh: true
},
{
name: 'Destroy',
text: __('Destroy'),
classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
icon: 'fa fa-times',
url: 'school/classes/activity_demo/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 () {
$(document).on("dp.change", "#add-form .datetimerange", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#add-form .datetimepicker", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#edit-form .datetimerange", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("dp.change", "#edit-form .datetimepicker", function () {
$(this).parent().prev().find("input").trigger("change");
});
$(document).on("fa.event.appendfieldlist", "#add-form .btn-append", function (e, obj) {
// Form.api.bindevent($("form[role=form]"));
// // //绑定动态下拉组件
Form.events.selectpage(obj);
// // //绑定日期组件
Form.events.daterangepicker(obj);
Form.events.datetimepicker(obj);
// // Form.events.datetimerange(obj);
// Form.api.bindevent(this);
// //绑定上传组件
// Form.events.faupload(obj);
// //上传成功回调事件,变更按钮的背景
// $(".upload-image", obj).data("upload-success", function (data) {
// $(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')");
// })
});
$(document).on("fa.event.appendfieldlist", "#edit-form .btn-append", function (e, obj) {
// Form.api.bindevent($("form[role=form]"));
// // //绑定动态下拉组件
Form.events.selectpage(obj);
// // //绑定日期组件
Form.events.daterangepicker(obj);
Form.events.datetimepicker(obj);
// // Form.events.datetimerange(obj);
// Form.api.bindevent(this);
// //绑定上传组件
// Form.events.faupload(obj);
// //上传成功回调事件,变更按钮的背景
// $(".upload-image", obj).data("upload-success", function (data) {
// $(this).css("background-image", "url('" + Fast.api.cdnurl(data.url) + "')");
// })
});
$("#c-address_city").on("cp:updated", function() {
var citypicker = $(this).data("citypicker");
var province = citypicker.getCode("province");
var city = citypicker.getCode("city");
var district = citypicker.getCode("district");
if(province){
$("#province").val(province);
}
if(city){
$("#city").val(city);
}
if(district){
$("#district").val(district);
}
$(this).blur();
});
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@ -234,6 +234,23 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// } // }
}, },
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
// //
// {name: 'unsetmockauth', // {name: 'unsetmockauth',
// text: '取消加圈资格', // text: '取消加圈资格',
@ -578,6 +595,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/evaluate/index?classes_lib_id='+row.id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id; return 'school/classes/evaluate/index?classes_lib_id='+row.id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id;
} }
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
return Controller; return Controller;
}); });

View File

@ -72,7 +72,71 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'classesorder.order_no', title: __('Order.order_no'),visible:false, operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'classesorder.order_no', title: __('Order.order_no'),visible:false, operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'manystore.nickname', title: __('Manystore.nickname'),visible:false, operate: 'LIKE'}, {field: 'manystore.nickname', title: __('Manystore.nickname'),visible:false, operate: 'LIKE'},
{field: 'shop.logo', title: __('Shop.logo'),visible:false, operate: 'LIKE'}, {field: 'shop.logo', title: __('Shop.logo'),visible:false, operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'classes_lib',
text: __('评价课程信息'),
title: __('评价课程信息'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
{
name: 'manystore',
text: __('评价机构信息'),
title: __('评价机构信息'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
{
name: 'order',
text: __('评价的课程购买订单'),
title: __('评价的课程购买订单'),
classname: 'btn btn-dialog',
icon: 'fa fa-cart-arrow-down',
dropdown : '更多',
url: order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'teacher',
text: __('评价老师信息'),
title: __('评价老师信息'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-user',
url: teacher_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
] ]
] ]
}); });
@ -155,5 +219,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
} }
} }
}; };
var order_url = function (row,dom) {
return 'school/classes/order/order/index?id='+row.classes_order_id;
}
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id;
}
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?id='+row.teacher_id +'&shop_id='+row.shop_id;
}
return Controller; return Controller;
}); });

View File

@ -139,6 +139,54 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.paytime; // return row.paytime;
// } // }
}, },
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
{
name: 'order',
text: __('课程订单查看'),
title: __('课程订单查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-list',
dropdown : '更多',
url: order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_lib',
text: __('线上课程查看'),
title: __('线上课程查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
// //
// {name: 'unsetmockauth', // {name: 'unsetmockauth',
// text: '取消加圈资格', // text: '取消加圈资格',
@ -281,5 +329,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id; return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id;
} }
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var order_url = function (row,dom) {
return 'school/classes/order/order/index?id='+row.classes_order_id;
}
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id;
}
return Controller; return Controller;
}); });

View File

@ -213,9 +213,39 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
callback: function (data) { callback: function (data) {
}, },
visible: function (row) { // visible: function (row) {
return row.classes_evaluate_id; // return row.classes_evaluate_id;
} // }
},
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
{
name: 'classes_lib',
text: __('线上课程查看'),
title: __('线上课程查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
}, },
@ -354,5 +384,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/evaluate/index?classes_order_id='+row.id + '&classes_lib_id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id+ '&user_id='+row.user_id+ '&nickname='+row.user.nickname + '&image='+row.user.avatar; return 'school/classes/evaluate/index?classes_order_id='+row.id + '&classes_lib_id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id+ '&user_id='+row.user_id+ '&nickname='+row.user.nickname + '&image='+row.user.avatar;
} }
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id;
}
return Controller; return Controller;
}); });

View File

@ -194,6 +194,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.status == '2'||row.status == '3'; // return row.status == '2'||row.status == '3';
// } // }
}, },
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
{
name: 'classes_lib',
text: __('线上课程查看'),
title: __('线上课程查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
// //
// {name: 'unsetmockauth', // {name: 'unsetmockauth',
@ -367,5 +397,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/order/order/index?id='+row.classes_order_id; return 'school/classes/order/order/index?id='+row.classes_order_id;
} }
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.detail.teacher_id;
}
return Controller; return Controller;
}); });

View File

@ -94,6 +94,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.classes_evaluate_id; // return row.classes_evaluate_id;
// } // }
}, },
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate}, ], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
@ -207,7 +222,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var classes_url= function (row,dom) { var classes_url= function (row,dom) {
return 'school/classes/classes_lib/index?shop_id='+row.shop_id+ '&teacher_id='+row.id; return 'school/classes/classes_lib/index?shop_id='+row.shop_id+ '&teacher_id='+row.id;
} }
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
return Controller; return Controller;
}); });

View File

@ -54,7 +54,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'user.realname', title: __('User.realname'), operate: 'LIKE'}, {field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'}, {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image}, {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} {field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'manystore',
text: __('查看机构'),
title: __('查看机构'),
classname: 'btn btn-dialog',
icon: 'fa fa-home',
dropdown : '更多',
url: manystore_url,
callback: function (data) {
},
// visible: function (row) {
// return row.classes_evaluate_id;
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
] ]
] ]
}); });
@ -105,5 +123,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
} }
} }
}; };
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
return Controller; return Controller;
}); });

View File

@ -38,7 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'mobile', title: __('Mobile'), operate: 'LIKE'}, {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
{field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false}, {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
{field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true}, {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
{field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}}, {field: 'gender', title: __('Gender'), visible: false, searchList: genderListJson, formatter: Table.api.formatter.normal},
{field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true}, {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
{field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true}, {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
{field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true}, {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},

View File

@ -22,6 +22,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
url: $.fn.bootstrapTable.defaults.extend.index_url, url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id', pk: 'id',
sortName: 'weigh', sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [ columns: [
[ [
{checkbox: true}, {checkbox: true},
@ -76,7 +78,71 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'manystore.nickname',visible:false, title: __('Manystore.nickname'), operate: 'LIKE'}, {field: 'manystore.nickname',visible:false, title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'manystoreshop.logo',visible:false, title: __('Manystoreshop.logo'), operate: 'LIKE'}, {field: 'manystoreshop.logo',visible:false, title: __('Manystoreshop.logo'), operate: 'LIKE'},
{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}
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'classes_lib',
text: __('评价课程信息'),
title: __('评价课程信息'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
// {
// name: 'manystore',
// text: __('评价机构信息'),
// title: __('评价机构信息'),
// classname: 'btn btn-dialog',
// icon: 'fa fa-home',
// dropdown : '更多',
// url: manystore_url,
// callback: function (data) {
//
// },
// // visible: function (row) {
// // return row.classes_evaluate_id;
// // }
// },
{
name: 'order',
text: __('评价的课程购买订单'),
title: __('评价的课程购买订单'),
classname: 'btn btn-dialog',
icon: 'fa fa-cart-arrow-down',
dropdown : '更多',
url: order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'teacher',
text: __('评价老师信息'),
title: __('评价老师信息'),
classname: 'btn btn-xs btn-danger btn-magic btn-dialog',
icon: 'fa fa-user',
url: teacher_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
] ]
] ]
}); });
@ -159,5 +225,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
} }
} }
}; };
var order_url = function (row,dom) {
return 'school/classes/order/order/index?id='+row.classes_order_id;
}
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.teacher_id;
}
var manystore_url = function (row,dom) {
return 'manystore/index/index?shop_id='+row.shop_id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?id='+row.teacher_id +'&shop_id='+row.shop_id;
}
return Controller; return Controller;
}); });

View File

@ -141,6 +141,36 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.paytime; // return row.paytime;
// } // }
}, },
{
name: 'order',
text: __('课程订单查看'),
title: __('课程订单查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-list',
dropdown : '更多',
url: order_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'classes_lib',
text: __('线上课程查看'),
title: __('线上课程查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
// //
// {name: 'unsetmockauth', // {name: 'unsetmockauth',
// text: '取消加圈资格', // text: '取消加圈资格',
@ -277,5 +307,11 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id; return 'school/classes/order/order_detail/index?id='+row.classes_order_detail_id;
} }
var order_url = function (row,dom) {
return 'school/classes/order/order/index?id='+row.classes_order_id;
}
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id;
}
return Controller; return Controller;
}); });

View File

@ -198,9 +198,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
callback: function (data) { callback: function (data) {
}, },
visible: function (row) { // visible: function (row) {
return row.classes_evaluate_id; // return row.classes_evaluate_id;
} // }
}, },
{ {
@ -218,6 +218,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return (row.status == '3' || row.status == '9') && row.schoolclassesorderdetail.feel == '0'; return (row.status == '3' || row.status == '9') && row.schoolclassesorderdetail.feel == '0';
} }
}, },
{
name: 'classes_lib',
text: __('线上课程查看'),
title: __('线上课程查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
// //
// {name: 'unsetmockauth', // {name: 'unsetmockauth',
@ -352,5 +367,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
var evaluate_url= function (row,dom) { var evaluate_url= function (row,dom) {
return 'school/classes/evaluate/index?classes_order_id='+row.id + '&classes_lib_id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id+ '&user_id='+row.user_id+ '&nickname='+row.user.nickname + '&image='+row.user.avatar; return 'school/classes/evaluate/index?classes_order_id='+row.id + '&classes_lib_id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id+ '&user_id='+row.user_id+ '&nickname='+row.user.nickname + '&image='+row.user.avatar;
} }
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id;
}
return Controller; return Controller;
}); });

View File

@ -147,6 +147,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// return row.status == '2'||row.status == '3'; // return row.status == '2'||row.status == '3';
// } // }
}, },
{
name: 'classes_lib',
text: __('线上课程查看'),
title: __('线上课程查看'),
classname: 'btn btn-dialog',
icon: 'fa fa-leanpub',
dropdown : '更多',
url: classes_lib_url,
callback: function (data) {
},
// visible: function (row) {
// return row.paytime;
// }
},
// //
// {name: 'unsetmockauth', // {name: 'unsetmockauth',
// text: '取消加圈资格', // text: '取消加圈资格',
@ -314,5 +329,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
return 'school/classes/order/order/index?id='+row.classes_order_id; return 'school/classes/order/order/index?id='+row.classes_order_id;
} }
var classes_lib_url= function (row,dom) {
return 'school/classes/classes_lib/index?id='+row.classes_lib_id+ '&shop_id='+row.shop_id+ '&teacher_id='+row.schoolclassesorderdetail.teacher_id;
}
return Controller; return Controller;
}); });

View File

@ -43,6 +43,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'bio', title: __('Bio'), operate: 'LIKE'}, {field: 'bio', title: __('Bio'), operate: 'LIKE'},
{field: 'mobile', title: __('Mobile'), 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: 'avatar', title: __('Avatar'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'gender', title: __('Gender'), visible: false, searchList: genderListJson, formatter: Table.api.formatter.normal},
// {field: 'level', title: __('Level')}, // {field: 'level', title: __('Level')},
// {field: 'gender', title: __('Gender')}, // {field: 'gender', title: __('Gender')},
// {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, // {field: 'birthday', title: __('Birthday'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},