1,课时管理(机构端和总后台端)

2,教师管理(机构端和总后台端)
3,课程生成虚拟参与者(机构端和总后台端)
4,课程扩展免费课程并实现机构端课程提交审核
5,设计授权机构用户逻辑表和站内信表
This commit is contained in:
15090180611 2024-11-14 18:40:04 +08:00
parent 771460f16d
commit a4b369c59d
41 changed files with 1473 additions and 226 deletions

View File

@ -576,7 +576,7 @@ class Field extends Backend
return $typeList;
}
protected function getCommonFields($fields = '')
public function getCommonFields($fields = '')
{
$fieldList = include ADDON_PATH . 'famysql' . DS . 'data' . DS . 'fields.php';

View File

@ -180,7 +180,8 @@ class ClassesLib extends Backend
protected function update_check(&$params,$row=null)
{
$shop_id = $row["shop_id"];
$shop_id = $params["shop_id"];
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
$this->error("店铺不存在");
@ -189,7 +190,7 @@ class ClassesLib extends Backend
//验证老师id
$teacher_id = $row['teacher_id'];
$teacher_id = $params['teacher_id'];
$teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find();
if(!$teacher){
$this->error("老师不存在");
@ -215,11 +216,48 @@ class ClassesLib extends Backend
|| empty($params["longitude"])
|| empty($params["latitude"])) $this->error("独立地点需传定位信息");
}else{
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
$this->error("店铺不存在");
}
if(empty($shop["address_city"])
|| empty($shop["province"])
|| empty($shop["city"])
|| empty($shop["district"])
|| empty($shop["longitude"])
|| empty($shop["latitude"])) $this->error("当前机构地址并未完善,请在机构处完善!");
$params["address_city"] = $shop["address_city"];
$params["province"] = $shop["province"];
$params["city"] = $shop["city"];
$params["district"] = $shop["district"];
$params["longitude"] = $shop["longitude"];
$params["latitude"] = $shop["latitude"];
}
//特有认证判断
$this->authClasses($params,$row);
// var_dump($row);die;
//收费免费判断
if($params["price"]==0){
$params["feel"] = "1";
}else{
//个人认证无法下付费课程
$shop = ManystoreShop::where("id",$shop_id)->find();
if($shop["type"]=="1"){
$this->error("这个机构属于个人认证,无法发布付费课程!");
}
$params["feel"] = "0";
}
//更新
if($row){
$this->have_auth = false;
@ -234,10 +272,26 @@ class ClassesLib extends Backend
}
$this->updateCheck($row->id,$params,$row);
//名称title不能与其他课程重复
$check_title = $this->model->where('id','<>',$row["id"])->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}else{
//新增
$params["add_type"] = '2';
$params["add_id"] = $this->auth->id;
//名称title不能重复
$check_title = $this->model->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}
}

View File

@ -18,10 +18,15 @@ class ClassesSpec extends Backend
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_lib_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\school\classes\ClassesSpec;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}

View File

@ -3,7 +3,16 @@
namespace app\admin\controller\school\classes;
use app\common\controller\Backend;
use app\common\model\User;
use app\manystore\model\Manystore;
use fast\Tree;
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;
use think\Model;
/**
@ -23,11 +32,14 @@ class Teacher extends Backend
protected $selectpageFields = 'id,name,head_image,manystore_id,shop_id,user_id';
protected $searchFields = 'id,name,user_id';
protected $qSwitch = true;
protected $qFields = ["manystore_id","shop_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\school\classes\Teacher;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
@ -218,4 +230,191 @@ class Teacher extends Backend
return json(['list' => $list, 'total' => $total]);
}
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
$shop_id = $params["shop_id"];
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
$this->error("店铺不存在");
}
//用户不存在
$user_id = $params["user_id"];
$user = User::where("id",$user_id)->find();
if(!$user){
$this->error("用户不存在");
}
//修改
if($row){
//用户已是其他的教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->where("id","<>",$row["id"])->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构教师!");
}
}else{
//新增
//用户已是教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构教师!");
}
}
$params["manystore_id"] = $manystore["id"];
}
/**
* 添加
*
* @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());
}
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

@ -3,6 +3,11 @@
namespace app\admin\controller\school\classes;
use app\common\controller\Backend;
use app\common\library\Virtual;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程虚拟参与者
@ -17,11 +22,14 @@ class VirtualUser extends Backend
* @var \app\admin\model\school\classes\VirtualUser
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_lib_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\school\classes\VirtualUser;
parent::_initialize();
$this->view->assign("jointypeList", $this->model->getJointypeList());
$this->view->assign("havetypeList", $this->model->getHavetypeList());
}
@ -70,4 +78,51 @@ class VirtualUser extends Backend
return $this->view->fetch();
}
/**
* 添加
*
* @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);
// }
// $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);
$result = true;
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();
}
}

View File

@ -4,6 +4,8 @@ namespace app\admin\controller\user;
use app\common\controller\Backend;
use app\common\library\Auth;
use fast\Tree;
use think\Model;
/**
* 会员管理
@ -15,7 +17,7 @@ class User extends Backend
protected $relationSearch = true;
protected $searchFields = 'id,username,nickname';
protected $selectpageFields = '*';
/**
* @var \app\admin\model\User
*/
@ -102,4 +104,147 @@ class User extends Backend
$this->success();
}
/**
* Selectpage的实现方法
*
* 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可
* 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可
*
*/
protected function selectpage()
{
//设置过滤方法
$this->request->filter(['trim', 'strip_tags', 'htmlspecialchars']);
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = (array)$this->request->request("q_word/a");
//当前页
$page = $this->request->request("pageNumber");
//分页大小
$pagesize = $this->request->request("pageSize");
//搜索条件
$andor = $this->request->request("andOr", "and", "strtoupper");
//排序方式
$orderby = (array)$this->request->request("orderBy/a");
//显示的字段
$field = $this->request->request("showField");
//主键
$primarykey = $this->request->request("keyField");
//主键值
$primaryvalue = $this->request->request("keyValue");
//搜索字段
$searchfield = (array)$this->request->request("searchField/a");
//自定义搜索条件
$custom = (array)$this->request->request("custom/a");
//是否返回树形结构
$istree = $this->request->request("isTree", 0);
$ishtml = $this->request->request("isHtml", 0);
if ($istree) {
$word = [];
$pagesize = 999999;
}
$order = [];
foreach ($orderby as $k => $v) {
$order[$v[0]] = $v[1];
}
$field = $field ? $field : 'name';
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue !== null) {
$where = [$primarykey => ['in', $primaryvalue]];
$pagesize = 999999;
} else {
$where = function ($query) use ($word, $andor, $field, $searchfield, $custom) {
$logic = $andor == 'AND' ? '&' : '|';
$searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield;
$searchfield = str_replace(',', $logic, $searchfield);
$word = array_filter(array_unique($word));
if (count($word) == 1) {
$query->where($searchfield, "like", "%" . reset($word) . "%");
} else {
$query->where(function ($query) use ($word, $searchfield) {
foreach ($word as $index => $item) {
$query->whereOr(function ($query) use ($item, $searchfield) {
$query->where($searchfield, "like", "%{$item}%");
});
}
});
}
if ($custom && is_array($custom)) {
foreach ($custom as $k => $v) {
if (is_array($v) && 2 == count($v)) {
$query->where($k, trim($v[0]), $v[1]);
} else {
$query->where($k, '=', $v);
}
}
}
};
}
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = [];
$total = $this->model->where($where)->count();
if ($total > 0) {
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$fields = is_array($this->selectpageFields) ? $this->selectpageFields : ($this->selectpageFields && $this->selectpageFields != '*' ? explode(',', $this->selectpageFields) : []);
//如果有primaryvalue,说明当前是初始化传值,按照选择顺序排序
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
//修复自定义data-primary-key为字符串内容时给排序字段添加上引号
$primaryvalue = array_map(function ($value) {
return '\'' . $value . '\'';
}, $primaryvalue);
$primaryvalue = implode(',', $primaryvalue);
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
} else {
$this->model->order($order);
}
$datalist = $this->model->where($where)
->page($page, $pagesize)
->select();
foreach ($datalist as $index => $item) {
unset($item['password'], $item['salt']);
if ($this->selectpageFields == '*') {
$result = [
$primarykey => $item[$primarykey] ?? '',
$field => $item[$field] ?? '',
'nickname' => isset($item['nickname']) ? $item['nickname'] : '',
'mobile' => isset($item['mobile']) ? $item['mobile'] : '',
'realname' => isset($item['realname']) ? $item['realname'] : '',
];
} else {
$result = array_intersect_key(($item instanceof Model ? $item->toArray() : (array)$item), array_flip($fields));
}
$result['pid'] = isset($item['pid']) ? $item['pid'] : (isset($item['parent_id']) ? $item['parent_id'] : 0);
$list[] = $result;
}
if ($istree && !$primaryvalue) {
$tree = Tree::instance();
$tree->init(collection($list)->toArray(), 'pid');
$list = $tree->getTreeList($tree->getTreeArray(0), $field);
if (!$ishtml) {
foreach ($list as &$item) {
$item = str_replace('&nbsp;', ' ', $item);
}
unset($item);
}
}
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return json(['list' => $list, 'total' => $total]);
}
}

View File

@ -43,7 +43,7 @@ return [
'Set status to 1' => '设为上架',
'Status 2' => '下架',
'Set status to 2' => '设为下架',
'Status 3' => '平台下架',
'Status 3' => '(审核课程)平台下架',
'Set status to 3' => '设为平台下架',
'Auth_status' => '审核状态',
'Auth_status 0' => '待审核',

View File

@ -224,6 +224,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
<span style="color: red">( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! )</span>
</div>
</div>
<div class="form-group">

View File

@ -215,6 +215,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
<span style="color: red">( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! )</span>
</div>
</div>
<div class="form-group">

View File

@ -3,7 +3,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$q_classes_lib_id}">
</div>
</div>
<div class="form-group">
@ -30,18 +30,18 @@
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-verification_num" class="form-control" name="row[verification_num]" type="number">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-verification_num" class="form-control" name="row[verification_num]" type="number">-->
<!-- </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">

View File

@ -30,18 +30,18 @@
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="{$row.limit_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="{$row.sign_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-verification_num" class="form-control" name="row[verification_num]" type="number" value="{$row.verification_num|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="{$row.sign_num|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-verification_num" class="form-control" name="row[verification_num]" type="number" value="{$row.verification_num|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">

View File

@ -1,21 +1,21 @@
<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">{:__('Manystore_id')}:</label>
<div class="col-xs-12 col-sm-8">
<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="">
</div>
</div>
<!-- <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">-->
<!-- <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="">-->
<!-- </div>-->
<!-- </div>-->
<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">
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="">
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$q_shop_id}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="id" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="">
</div>
</div>
<div class="form-group">

View File

@ -1,11 +1,11 @@
<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">{:__('Manystore_id')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Manystore_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <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">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
@ -15,7 +15,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="id" data-format-item="{id} - {nickname} - {mobile}" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
</div>
</div>
<div class="form-group">

View File

@ -1,29 +1,17 @@
<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">{:__('Nickname')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('需要生成的数量')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-nickname" class="form-control" name="row[nickname]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-head_image" class="form-control" size="50" name="row[head_image]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-head_image" class="btn btn-danger faupload" data-input-id="c-head_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-head_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-head_image" class="btn btn-primary fachoose" data-input-id="c-head_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-head_image"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-head_image"></ul>
<input id="c-num" data-rule="required" class="form-control" name="row[num]" type="number" value="10">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$q_classes_lib_id}">
</div>
</div>
<div class="form-group">

View File

@ -2,7 +2,9 @@
namespace app\common\controller;
use app\admin\controller\famysql\Field;
use app\admin\library\Auth;
use Monolog\Handler\IFTTTHandler;
use think\Config;
use think\Controller;
use think\Hook;
@ -109,6 +111,55 @@ class Backend extends Controller
*/
protected $importHeadType = 'comment';
protected $qSwitch = false;
protected $qFields = [];
protected function checkAssemblyParameters(){
if(!$this->qSwitch)return false;
//得到所有get参数
$get = $this->request->get();
//得到当前model所有字段
$fields = $this->model->getTableFields();
// $commonFields = (new Field())->getCommonFields();
// var_dump($commonFields);
$fieldLists = $fields;
// foreach ($commonFields as $commonField) {
// if (!in_array($commonField['column_name'], $fields)) {
// $fieldLists[] = $commonField;
// }
// }
$q_fields = [];
foreach ($get as $kay=>$getField) {
if (in_array($kay, $fieldLists)) {
$q_fields[$kay] = $getField;
}
}
//将q_fields塞入模板中
foreach ($q_fields as $k=>$v) {
//渲染站点配置
$this->assign('q_'.$k, $v);
}
foreach ($this->qFields as $k) {
//渲染站点配置
if(!isset($q_fields[$k]))$this->assign('q_'.$k, "");
}
}
/**
* 引入后台控制器的traits
*/
@ -228,6 +279,7 @@ class Backend extends Controller
$this->assign('auth', $this->auth);
//渲染管理员对象
$this->assign('admin', Session::get('admin'));
$this->checkAssemblyParameters();
}
/**

View File

@ -2,6 +2,8 @@
namespace app\common\controller;
use app\admin\controller\famysql\Field;
use app\common\model\dyqc\ManystoreShop;
use app\manystore\library\Auth;
use app\common\model\ManystoreConfig;
use think\Config;
@ -109,6 +111,57 @@ class ManystoreBase extends Controller
'setShopAutoRelation',
];
protected $qSwitch = false;
protected $qFields = [];
protected function checkAssemblyParameters(){
if(!$this->qSwitch)return false;
//得到所有get参数
$get = $this->request->get();
//得到当前model所有字段
$fields = $this->model->getTableFields();
// $commonFields = (new Field())->getCommonFields();
// var_dump($commonFields);
$fieldLists = $fields;
// foreach ($commonFields as $commonField) {
// if (!in_array($commonField['column_name'], $fields)) {
// $fieldLists[] = $commonField;
// }
// }
$q_fields = [];
foreach ($get as $kay=>$getField) {
if (in_array($kay, $fieldLists)) {
$q_fields[$kay] = $getField;
}
}
//将q_fields塞入模板中
foreach ($q_fields as $k=>$v) {
//渲染站点配置
$this->assign('q_'.$k, $v);
}
foreach ($this->qFields as $k) {
//渲染站点配置
if(!isset($q_fields[$k]))$this->assign('q_'.$k, "");
}
}
/**
* 引入后台控制器的traits
*/
@ -165,6 +218,11 @@ class ManystoreBase extends Controller
if(!defined('SHOP_ID')){
define('SHOP_ID', $this->auth->shop_id);
}
$manystoreShop = ManystoreShop::where("id",$this->auth->shop_id)->find();
if(!defined('SHOP_USER_ID')) {
define('SHOP_USER_ID', $manystoreShop->user_id ?:0);
}
if(!defined('STORE_ID')) {
define('STORE_ID', $this->auth->id);
@ -209,6 +267,8 @@ class ManystoreBase extends Controller
// 上传信息配置后
Hook::listen("upload_config_init", $upload);
// 配置信息
$config = [
'site' => array_intersect_key($site, array_flip(['name', 'indexurl', 'cdnurl', 'version', 'timezone', 'languages'])),
@ -219,7 +279,10 @@ class ManystoreBase extends Controller
'jsname' => 'manystore/' . str_replace('.', '/', $controllername),
'moduleurl' => rtrim(url("/{$modulename}", '', false), '/'),
'language' => $lang,
'referer' => Session::get("referer")
'referer' => Session::get("referer"),
'shop_id' => $this->auth->shop_id,
'store_id' => $this->auth->id,
'shop_user_id' => $manystoreShop->user_id ?:0,
];
$config = array_merge($config, Config::get("view_replace_str"));
@ -237,6 +300,21 @@ class ManystoreBase extends Controller
$this->assign('auth', $this->auth);
//渲染管理员对象
$this->assign('manystore', Session::get('manystore'));
$this->assign('shop_id', $this->auth->shop_id);
$this->assign('store_id', $this->auth->id);
$this->assign('shop_user_id', $manystoreShop->user_id ?:0 );
// if(!defined('SHOP_ID')){
// define('SHOP_ID', $this->auth->shop_id);
// }
//
// if(!defined('STORE_ID')) {
// define('STORE_ID', $this->auth->id);
// }
$this->checkAssemblyParameters();
}
/**

View File

@ -22,6 +22,8 @@ class Virtual
}
public function getVirtualUser($num=10,$classes_lib_id = 0,$time=null,$set=false){
if(!is_numeric($time)) $time = strtotime($time); //日期字符格式化时间戳
$users = [];
if(!$time)$time = time();
//mysql随机查询$num个数据

View File

@ -2,12 +2,14 @@
namespace app\common\model\dyqc;
use app\common\model\BaseModel;
use app\common\model\school\classes\ClassesLib;
use app\common\model\school\classes\Teacher;
use app\common\model\User;
use think\Model;
class ManystoreShop extends Model
class ManystoreShop extends BaseModel
{
@ -175,4 +177,128 @@ class ManystoreShop extends Model
return $data;
}
/**申请机构
* @param $type 申请类型 类型:1=个人,2=机构
* @param int $user_id 申请人
* @param $params 申请参数
* @param bool $check
* @param bool $trans
* @return bool
* @throws \Exception
*/
public function apply($type,$user_id=0,$params=[],$check=false,$oper_type='user',$oper_id=0,$trans=false){
if($check){
$user = User::get($user_id);
if(!$user)throw new \Exception("用户不存在");
//已经是机构
$shop = ManystoreShop::where( 'user_id',$user_id)->where("status","1")->find();
if($shop)throw new \Exception("已申请机构,请勿重复申请");
//验证参数
//$type 1=个人,2=机构
if(!in_array($type,['1','2']))throw new \Exception("类型参数错误");
//switch不同类型type做不同验证
//未传手机号则默认用户手机号
if(empty($params['tel'])) $params['tel'] = $user['mobile'];
switch ($type) {
case '1': //个人
$rule = [
'name' => 'require',
'tel' => 'require|number',
// 'desc' => 'require',
'front_idcard_image' => 'require',
'reverse_idcard_image' => 'require',
];
$rule_msg = [
'name.require' => '姓名必须填写',
'tel.require' => '服务电话必须填写',
'tel.number' => '服务电话必须是数字',
// 'desc.require' => '申请备注必须填写',
'front_idcard_image.require' => '身份证正面必须上传',
'reverse_idcard_image.require' => '身份证反面必须上传',
];
break;
case '2': //机构
$rule = [
'name' => 'require',
'tel' => 'require|number',
// 'desc' => 'require',
'front_idcard_image' => 'require',
'reverse_idcard_image' => 'require',
'images' => 'require',
'yyzz_images' => 'require',
];
$rule_msg = [
'name.require' => '机构名称必须填写',
'tel.require' => '服务电话必须填写',
'tel.number' => '服务电话必须是数字',
// 'desc.require' => '申请备注必须填写',
'front_idcard_image.require' => '法人身份证正面必须上传',
'reverse_idcard_image.require' => '法人身份证反面必须上传',
'images.require' => '机构环境照片必须上传',
'yyzz_images.require' => '营业执照照片必须上传',
];
break;
}
self::check($params,$rule,$rule_msg);
}
$params["type"] = $type;
//得到申请单(没有则创建)
$shop = ManystoreShop::where( 'user_id',$user_id)->where("status","1")->find();
//如果存在申请单,则直接更新这个单的状态
//如果不存在则创建一个新单
// $order = self::getHaveCancelOrder($order_no);
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
//事务逻辑
// //更新订单取消状态
// $order = Order::updateCancel($order);
// //插入订单取消日志
// if(!$user_id ||$order["user_id"] !=$user_id ){
// OrderLog::log($order['id'],"[员工代操作]课时预约单取消成功,课时已原路退回",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
// }else{
// OrderLog::log($order['id'],"课时预约单取消成功,课时已原路退回",$oper_type ?: 'user', $oper_id ?: $order['user_id']);
// }
//
// //调用订单取消事件
// $data = ['order' => $order];
// \think\Hook::listen('classeshour_order_cancel_after', $data);
// //执行课时数更新
// $res1 = \app\common\model\school\classes\order\Order::statisticsAndUpdateClassesNumber($order['classes_order_id']);
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage());
}
return $res;
}
}

View File

@ -353,9 +353,16 @@ class Order extends BaseModel
}
try {
//1订单执行创建
$this->createOrder($user_id,$orderInfo['classes_lib_id'],$order_no,$orderInfo['param'],$remark);
$order = $this->createOrder($user_id,$orderInfo['classes_lib_id'],$order_no,$orderInfo['param'],$remark);
//5删除缓存
self::deleteOrderCache($user_id, $order_no);
//如果是免费订单,则直接调用支付完成
if ($order['totalprice'] == 0) {
//调用订单支付成功事件
$this->paySuccess($order_no,['platform'=>"miniapp",'pay_type'=>'yue']);
}
if ($trans) {
self::commitTrans();
}

View File

@ -30,7 +30,7 @@ class ClassesLib extends ManystoreBase
protected $model = null;
//不用审核允许修改的字段
protected $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price"];
protected $no_auth_fields = ['headimage','images','notice','content',"virtual_num","virtual_collect","underline_price","selfhot","price","classes_num"];
//更新数据是否需要触发审核开关
protected $need_auth = true;
@ -51,6 +51,7 @@ class ClassesLib extends ManystoreBase
$this->view->assign("hotList", $this->model->getHotList());
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
}
public function import()
@ -87,6 +88,8 @@ class ClassesLib extends ManystoreBase
->order($sort, $order)
->paginate($limit);
// var_dump($this->model->getLastSql());die;
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname']);
@ -136,8 +139,11 @@ class ClassesLib extends ManystoreBase
if($params["status"] == '3') $params["status"] = '2';
}
}else{
//新增
}
}
@ -187,8 +193,9 @@ class ClassesLib extends ManystoreBase
protected function update_check(&$params,$row=null)
{
$shop_id = $row["shop_id"];
unset($params["auth_status"]);
if(!isset($params['status']))$params['status'] = "3";
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id",$shop_id)->find();
if(!$manystore){
$this->error("店铺不存在");
@ -197,7 +204,7 @@ class ClassesLib extends ManystoreBase
//验证老师id
$teacher_id = $row['teacher_id'];
$teacher_id = $params['teacher_id'];
$teacher = \app\admin\model\school\classes\Teacher::where("id",$teacher_id)->find();
if(!$teacher){
$this->error("老师不存在");
@ -223,17 +230,58 @@ class ClassesLib extends ManystoreBase
|| empty($params["longitude"])
|| empty($params["latitude"])) $this->error("独立地点需传定位信息");
}else{
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
$this->error("店铺不存在");
}
if(empty($shop["address_city"])
|| empty($shop["province"])
|| empty($shop["city"])
|| empty($shop["district"])
|| empty($shop["longitude"])
|| empty($shop["latitude"])) $this->error("当前机构地址并未完善!请去【个人资料】完善信息");
//地址取机构的
$shop = ManystoreShop::where("id",$shop_id)->find();
if(!$shop){
$this->error("店铺不存在");
}
$params["address_city"] = $shop["address_city"];
$params["province"] = $shop["province"];
$params["city"] = $shop["city"];
$params["district"] = $shop["district"];
$params["longitude"] = $shop["longitude"];
$params["latitude"] = $shop["latitude"];
}
//收费免费判断
if($params["price"]==0){
$params["feel"] = "1";
}else{
//个人认证无法下付费课程
$shop = ManystoreShop::where("id",$shop_id)->find();
if($shop["type"]=="1"){
$this->error("当前属于个人认证,无法发布付费课程!");
}
$params["feel"] = "0";
}
//特有认证判断
// $this->authClasses($params,$row);
// var_dump($row);die;
//更新
if($row){
if($row['status'] == "3" && $params['status'] != $row['status']){
$this->error("平台下架审核的课程无法上架!");
}
$this->have_auth = false;
if($this->need_auth){
//判断更新的变动数据
@ -241,15 +289,39 @@ class ClassesLib extends ManystoreBase
if($this->have_auth){
$params['status'] = "3";
$params['auth_status'] = "0";
$params['auth_status'] = 0;
$params["reason"] = "";
}
}
$this->updateCheck($row->id,$params,$row);
//如果是审核失败,提交后自动更新成审核中
if($row['auth_status'] == 2){
$params['status'] = "3";
$params['auth_status'] = 0;
$params["reason"] = "";
}
//名称title不能与其他课程重复
$check_title = $this->model->where('id','<>',$row["id"])->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}else{
//新增
$params["add_type"] = '2';
//新增(需审核)
$params["add_type"] = '1';
$params["add_id"] = $this->auth->id;
$params['status'] = "3";//平台下架
$params['auth_status'] = 0;
//名称title不能重复
$check_title = $this->model->where('title',$params["title"])->find();
if($check_title){
$this->error("课程名称已存在或被其他机构占用,请更改!");
}
}
}

View File

@ -18,10 +18,14 @@ class ClassesSpec extends ManystoreBase
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_lib_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\ClassesSpec;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}

View File

@ -3,6 +3,12 @@
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 机构老师
@ -18,10 +24,14 @@ class Teacher extends ManystoreBase
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["manystore_id","shop_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\Teacher;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
@ -73,4 +83,200 @@ class Teacher extends ManystoreBase
return $this->view->fetch();
}
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id", $shop_id)->find();
if (!$manystore) {
$this->error("店铺不存在");
}
$params["manystore_id"] = $manystore["id"];
$params["shop_id"] = $shop_id;
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$params["user_id"] = $user["id"];
$user_id = $params["user_id"];
//修改
if($row){
//用户已是其他的教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->where("id","<>",$row["id"])->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构教师!");
}
}else{
//新增
//用户已是教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构教师!");
}
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_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(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
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 inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
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);
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
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', ''));
}
$user = User::where("id", $row["user_id"])->find();
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -3,6 +3,11 @@
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\library\Virtual;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程虚拟参与者
@ -17,11 +22,14 @@ class VirtualUser extends ManystoreBase
* @var \app\manystore\model\school\classes\VirtualUser
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_lib_id"];
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\VirtualUser;
parent::_initialize();
$this->view->assign("jointypeList", $this->model->getJointypeList());
$this->view->assign("havetypeList", $this->model->getHavetypeList());
}
@ -72,4 +80,58 @@ class VirtualUser extends ManystoreBase
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_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(true)->validate($validate);
// }
// $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);
$result = true;
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 inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
}

View File

@ -3,7 +3,7 @@
return [
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'User_id' => '教师前台用户id',
'User_id' => '教师前台用户',
'Name' => '教师名',
'Head_image' => '教师头像',
'Content' => '教师简介',

View File

@ -224,6 +224,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number">
<span style="color: red">( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! )</span>
</div>
</div>
<div class="form-group">
@ -238,35 +239,35 @@
<input id="c-virtual_collect" class="form-control" name="row[virtual_collect]" type="number" value="0">
</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="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}
{in name="key" value="3"} disabled {/in}
/>
{$vo}
</label>
{/foreach}
</div>
<!-- <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}-->
<!-- {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>-->
<!-- </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="0"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
<!-- <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="0"}checked{/in} /> {$vo}</label>-->
<!-- {/foreach}-->
<!-- </div>-->
</div>
</div>
<!-- </div>-->
<!-- </div>-->
<!--用php标签判断 如果不通过,展示原因-->
@ -340,8 +341,13 @@
<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-success btn-embossed disabled">{:__('OK')}</button>
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('提价审核')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<script>
var shop_id = {$shop_id};
var store_id = {$store_id};
var shop_user_id = {$shop_user_id};
</script>

View File

@ -6,12 +6,12 @@
<!-- <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">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">
</div>
</div>
<!-- <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">-->
<!-- <input id="c-shop_id" data-rule="required" data-source="dyqc/manystore_shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="{$row.shop_id|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
@ -215,6 +215,7 @@
<label class="control-label col-xs-12 col-sm-2">{:__('Price')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-price" class="form-control" step="0.01" name="row[price]" type="number" value="{$row.price|htmlentities}">
<span style="color: red">( 如果填零则为免费课程,课程下单后无需支付,直接可去预约课时! )</span>
</div>
</div>
<div class="form-group">
@ -262,9 +263,14 @@
<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>
<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>
@ -341,8 +347,13 @@
<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-success btn-embossed disabled">{:__('OK')}</button>
<button type="submit" class="btn btn-success btn-embossed disabled">{:__('提交修改【涉及名称等核心数据将提交审核,审核时课程会下架】')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>
<script>
var shop_id = {$shop_id};
var store_id = {$store_id};
var shop_user_id = {$shop_user_id};
</script>

View File

@ -42,3 +42,8 @@
</div>
</div>
</div>
<script>
var shop_id = {$shop_id};
var store_id = {$store_id};
var shop_user_id = {$shop_user_id};
</script>

View File

@ -3,7 +3,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_lib_id" data-rule="required" data-source="classes/lib/index" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$q_classes_lib_id}">
</div>
</div>
<div class="form-group">
@ -30,18 +30,18 @@
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-verification_num" class="form-control" name="row[verification_num]" type="number">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="0">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-verification_num" class="form-control" name="row[verification_num]" type="number">-->
<!-- </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">

View File

@ -3,7 +3,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_lib_id" data-rule="required" data-source="classes/lib/index" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$row.classes_lib_id|htmlentities}">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$row.classes_lib_id|htmlentities}">
</div>
</div>
<div class="form-group">
@ -30,18 +30,18 @@
<input id="c-limit_num" class="form-control" name="row[limit_num]" type="number" value="{$row.limit_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="{$row.sign_num|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-verification_num" class="form-control" name="row[verification_num]" type="number" value="{$row.verification_num|htmlentities}">
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Sign_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-sign_num" class="form-control" name="row[sign_num]" type="number" value="{$row.sign_num|htmlentities}">-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Verification_num')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-verification_num" class="form-control" name="row[verification_num]" type="number" value="{$row.verification_num|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">

View File

@ -1,17 +1,19 @@
<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">{:__('Manystore_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-manystore_id" data-rule="required" data-source="manystore/index" class="form-control selectpage" name="row[manystore_id]" type="text" value="">
</div>
</div>
<!-- <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">-->
<!-- <input id="c-manystore_id" data-rule="required" data-source="manystore/index" class="form-control selectpage" name="row[manystore_id]" type="text" value="">-->
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="">
<input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="">
<span style="color: red">(请先让对方登录小程序,之后输入小程序端用户:手机号,昵称 或 姓名 )</span>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -1,15 +1,16 @@
<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">{:__('Manystore_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-manystore_id" data-rule="required" data-source="manystore/index" 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">{:__('Manystore_id')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- <input id="c-manystore_id" data-rule="required" data-source="manystore/index" 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">{:__('User_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="nickname" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<input id="c-user_id" data-rule="required" class="form-control" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}">
<span style="color: red">(请先让对方登录小程序,之后输入小程序端用户:手机号,昵称 或 姓名 )</span>
</div>
</div>
<div class="form-group">

View File

@ -1,29 +1,15 @@
<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">{:__('Nickname')}:</label>
<label class="control-label col-xs-12 col-sm-2">{:__('需要生成的数量')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-nickname" class="form-control" name="row[nickname]" type="text">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Head_image')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group">
<input id="c-head_image" class="form-control" size="50" name="row[head_image]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-head_image" class="btn btn-danger faupload" data-input-id="c-head_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="false" data-preview-id="p-head_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-head_image" class="btn btn-primary fachoose" data-input-id="c-head_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
</div>
<span class="msg-box n-right" for="c-head_image"></span>
</div>
<ul class="row list-inline faupload-preview" id="p-head_image"></ul>
<input id="c-num" data-rule="required" class="form-control" name="row[num]" type="number" value="10">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_lib_id" data-rule="required" data-source="classes/lib/index" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="">
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$q_classes_lib_id}">
</div>
</div>
<div class="form-group">
@ -32,30 +18,30 @@
<input id="c-time" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[time]" type="text" value="{:date('Y-m-d H:i:s')}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Jointype')}:</label>
<div class="col-xs-12 col-sm-8">
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Jointype')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <select id="c-jointype" class="form-control selectpicker" name="row[jointype]">-->
<!-- {foreach name="jointypeList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
<select id="c-jointype" class="form-control selectpicker" name="row[jointype]">
{foreach name="jointypeList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Havetype')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<!-- -->
<!-- <select id="c-havetype" class="form-control selectpicker" name="row[havetype]">-->
<!-- {foreach name="havetypeList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Havetype')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-havetype" class="form-control selectpicker" name="row[havetype]">
{foreach name="havetypeList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<!-- </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">

View File

@ -23,8 +23,7 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_lib_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_lib_id" data-rule="required" data-source="classes/lib/index" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$row.classes_lib_id|htmlentities}">
</div>
<input id="c-classes_lib_id" data-rule="required" data-source="school/classes/classes_lib/index" data-field="title" class="form-control selectpage" name="row[classes_lib_id]" type="text" value="{$row.classes_lib_id|htmlentities}"> </div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Time')}:</label>

View File

@ -26,8 +26,79 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'classes_spec',
text: __('设置课程规格'),
title: __('设置课程规格'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: classes_spec_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'virtual_user',
text: __('设置虚拟参与者'),
title: __('设置虚拟参与者'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: virtual_user_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'teacher',
text: __('主讲老师信息'),
title: __('主讲老师信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: teacher_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
//
// {name: 'unsetmockauth',
// text: '取消加圈资格',
// icon: 'fa fa-sign-in',
// classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
// url: $.fn.bootstrapTable.defaults.extend.unsetmockauth_url,
// confirm: '(分车版本)确认取消用户加圈资格!',
// success: function (data, ret) {
// Layer.alert(ret.msg );
// $(".btn-refresh").trigger("click");
// },
// error: function (data, ret) {
// Layer.alert(ret.msg);
// return false;
// },
// visible: function (row) {
// //显示条件 只能待入住订单
// if((row.status == 2 || row.status == 3) && row.mock_type == "base" && row.add_mock_status == "2"){
// return true;
// }
// return false;
// }},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
{field: 'id', title: __('Id')},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
{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},
{field: 'classes_cate_ids', title: __('Classes_cate_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible:false},
@ -90,7 +161,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'),visible:false, operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'admin.nickname', title: __('Admin.nickname'),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, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
@ -233,5 +304,18 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
var classes_spec_url = function (row,dom) {
return 'school/classes/classes_spec/index?classes_lib_id='+row.id;
}
var virtual_user_url = function (row,dom) {
return 'school/classes/virtual_user/index?classes_lib_id='+row.id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?id='+row.teacher_id +'&shop_id='+row.shop_id;
}
return Controller;
});

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/classes_spec/index' + location.search,
add_url: 'school/classes/classes_spec/add',
edit_url: 'school/classes/classes_spec/edit',
add_url: 'school/classes/classes_spec/add' + location.search,
edit_url: 'school/classes/classes_spec/edit' + location.search,
del_url: 'school/classes/classes_spec/del',
multi_url: 'school/classes/classes_spec/multi',
import_url: 'school/classes/classes_spec/import',

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/teacher/index' + location.search,
add_url: 'school/classes/teacher/add',
edit_url: 'school/classes/teacher/edit',
add_url: 'school/classes/teacher/add'+ location.search,
edit_url: 'school/classes/teacher/edit'+ location.search,
del_url: 'school/classes/teacher/del',
multi_url: 'school/classes/teacher/multi',
import_url: 'school/classes/teacher/import',

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/virtual_user/index' + location.search,
add_url: 'school/classes/virtual_user/add',
edit_url: 'school/classes/virtual_user/edit',
add_url: 'school/classes/virtual_user/add'+ location.search,
edit_url: 'school/classes/virtual_user/edit'+ location.search,
del_url: 'school/classes/virtual_user/del',
multi_url: 'school/classes/virtual_user/multi',
import_url: 'school/classes/virtual_user/import',
@ -25,7 +25,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'id', title: __('Classes_lib_id')},
// {field: 'id', title: __('Classes_lib_id')},
{field: 'id', title: __('Id')},
{field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
{field: 'head_image', title: __('Head_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},

View File

@ -27,7 +27,78 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
columns: [
[
{checkbox: true},
{field: 'operate', title: __('Operate'), table: table , buttons: [
{
name: 'classes_spec',
text: __('设置课程规格'),
title: __('设置课程规格'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: classes_spec_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'virtual_user',
text: __('设置虚拟参与者'),
title: __('设置虚拟参与者'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: virtual_user_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
{
name: 'teacher',
text: __('主讲老师信息'),
title: __('主讲老师信息'),
classname: 'btn btn-xs btn-primary btn-dialog',
icon: 'fa fa-list',
url: teacher_url,
callback: function (data) {
},
// visible: function (row) {
// return row.status == '2'||row.status == '3';
// }
},
// {name: 'unsetmockauth',
// text: '取消加圈资格',
// icon: 'fa fa-sign-in',
// classname: 'btn btn-xs btn-danger btn-magic btn-ajax',
// url: $.fn.bootstrapTable.defaults.extend.unsetmockauth_url,
// confirm: '(分车版本)确认取消用户加圈资格!',
// success: function (data, ret) {
// Layer.alert(ret.msg );
// $(".btn-refresh").trigger("click");
// },
// error: function (data, ret) {
// Layer.alert(ret.msg);
// return false;
// },
// visible: function (row) {
// //显示条件 只能待入住订单
// if((row.status == 2 || row.status == 3) && row.mock_type == "base" && row.add_mock_status == "2"){
// return true;
// }
// return false;
// }},
], events: Table.api.events.operate, formatter: Table.api.formatter.operate},
{field: 'id', title: __('Id')},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费课程'),"1":__('免费课程')}, formatter: Table.api.formatter.normal},
{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},
{field: 'classes_cate_ids', title: __('Classes_cate_ids'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content,visible:false},
@ -90,7 +161,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'),visible:false, operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'admin.nickname', title: __('Admin.nickname'),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, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]
});
@ -191,7 +262,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
//老师必须是上面机构中的
$("#c-teacher_id").data("params", function (obj) {
//obj为SelectPage对象
return {custom: {shop_id: $("#c-shop_id").val()}};
return {custom: {shop_id: Config.shop_id}};
});
//机构清除老师也要清除
$("#c-shop_id").change(function () {
@ -232,6 +303,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
}
var classes_spec_url = function (row,dom) {
return 'school/classes/classes_spec/index?classes_lib_id='+row.id;
}
var virtual_user_url = function (row,dom) {
return 'school/classes/virtual_user/index?classes_lib_id='+row.id;
}
var teacher_url = function (row,dom) {
return 'school/classes/teacher/index?id='+row.teacher_id +'&shop_id='+row.shop_id;
}
return Controller;
});

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/classes_spec/index' + location.search,
add_url: 'school/classes/classes_spec/add',
edit_url: 'school/classes/classes_spec/edit',
add_url: 'school/classes/classes_spec/add'+ location.search,
edit_url: 'school/classes/classes_spec/edit'+ location.search,
del_url: 'school/classes/classes_spec/del',
multi_url: 'school/classes/classes_spec/multi',
import_url: 'school/classes/classes_spec/import',
@ -115,6 +115,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
bindevent: function () {
//老师必须是上面机构中的
$("#c-classes_lib_id").data("params", function (obj) {
//obj为SelectPage对象
return {custom: {shop_id: Config.shop_id}};
});
Form.api.bindevent($("form[role=form]"));
}
}

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/teacher/index' + location.search,
add_url: 'school/classes/teacher/add',
edit_url: 'school/classes/teacher/edit',
add_url: 'school/classes/teacher/add' + location.search,
edit_url: 'school/classes/teacher/edit' + location.search,
del_url: 'school/classes/teacher/del',
multi_url: 'school/classes/teacher/multi',
import_url: 'school/classes/teacher/import',
@ -26,9 +26,13 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'manystore_id', title: __('Manystore_id')},
{field: 'shop_id', title: __('Shop_id')},
{field: 'user_id', title: __('User_id')},
{field: 'manystore_id', title: __('Manystore_id'),visible:false},
{field: 'shop_id', title: __('Shop_id'),visible:false},
{field: 'user_id', title: __('User_id'),visible:false},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'head_image', title: __('Head_image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
@ -36,18 +40,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'createtime', title: __('Createtime')},
{field: 'updatetime', title: __('Updatetime')},
{field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
{field: 'user.realname', title: __('User.realname'), operate: 'LIKE'},
{field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
{field: 'manystoreshop.image', title: __('Manystoreshop.image'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'manystoreshop.address_city', title: __('Manystoreshop.address_city'), operate: 'LIKE'},
{field: 'manystoreshop.province', title: __('Manystoreshop.province')},
{field: 'manystoreshop.city', title: __('Manystoreshop.city')},
{field: 'manystoreshop.district', title: __('Manystoreshop.district')},
{field: 'manystoreshop.address', title: __('Manystoreshop.address'), operate: 'LIKE'},
{field: 'manystoreshop.address_detail', title: __('Manystoreshop.address_detail'), operate: 'LIKE'},
// {field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE',visible:false},
// {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE',visible:false},
// {field: 'manystoreshop.image', title: __('Manystoreshop.image'),visible:false, operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
// {field: 'manystoreshop.address_city', title: __('Manystoreshop.address_city'), operate: 'LIKE'},
// {field: 'manystoreshop.province', title: __('Manystoreshop.province')},
// {field: 'manystoreshop.city', title: __('Manystoreshop.city')},
// {field: 'manystoreshop.district', title: __('Manystoreshop.district')},
// {field: 'manystoreshop.address', title: __('Manystoreshop.address'), operate: 'LIKE'},
// {field: 'manystoreshop.address_detail', title: __('Manystoreshop.address_detail'), operate: 'LIKE'},
{field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
]
]

View File

@ -6,8 +6,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
Table.api.init({
extend: {
index_url: 'school/classes/virtual_user/index' + location.search,
add_url: 'school/classes/virtual_user/add',
edit_url: 'school/classes/virtual_user/edit',
add_url: 'school/classes/virtual_user/add'+ location.search,
edit_url: 'school/classes/virtual_user/edit'+ location.search,
del_url: 'school/classes/virtual_user/del',
multi_url: 'school/classes/virtual_user/multi',
import_url: 'school/classes/virtual_user/import',
@ -50,6 +50,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
},
api: {
bindevent: function () {
$("#c-classes_lib_id").data("params", function (obj) {
//obj为SelectPage对象
return {custom: {shop_id: Config.shop_id}};
});
Form.api.bindevent($("form[role=form]"));
}
}