开发退款(进行中)

This commit is contained in:
15090180611 2024-12-26 18:13:04 +08:00
parent 26971126ba
commit e2b7a9c570
81 changed files with 5261 additions and 190 deletions

View File

@ -77,7 +77,7 @@ class Activity extends Backend
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire","has_sign_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
@ -100,10 +100,35 @@ class Activity extends Backend
$expireWhere = [[]];
}
if (isset($excludearray['has_sign_expire']['value']) && $excludearray['has_sign_expire']['value']) {
$has_expire = $excludearray['has_sign_expire']['value'];
$as = (new \app\common\model\school\classes\activity\Activity)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireSignWhere = [
$as . '.sign_end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireSignWhere = [
$as . '.sign_end_time', '>', time(),
];
break;
default:
}
} else {
$expireSignWhere = [[]];
}
$list = $this->model
->with(['manystore','shop'])
->where($where)
->where(...$expireWhere)
->where(...$expireSignWhere)
->order($sort, $order)
->paginate($limit);
@ -122,7 +147,7 @@ class Activity extends Backend
protected function update_classes($classes_activity_id){
if($classes_activity_id) \app\common\model\school\classes\activity\Activity::update_classes($classes_activity_id);
}

View File

@ -0,0 +1,77 @@
<?php
namespace app\admin\controller\school\classes\activity\order;
use app\common\controller\Backend;
/**
* 课程活动订单项目规格
*
* @icon fa fa-circle-o
*/
class OrderItem extends Backend
{
/**
* OrderItem模型对象
* @var \app\admin\model\school\classes\activity\order\OrderItem
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\school\classes\activity\order\OrderItem;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("sexList", $this->model->getSexList());
$this->view->assign("feelList", $this->model->getFeelList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['activityorder','manystore','shop','activity','item'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('activityorder')->visible(['order_no','pay_no']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('shop')->visible(['name','logo']);
$row->getRelation('activity')->visible(['title','headimage']);
$row->getRelation('item')->visible(['name','price']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -68,7 +68,8 @@ return [
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire' => '活动是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
'Has_sign_expire' => '报名是否过期',
];

View File

@ -0,0 +1,40 @@
<?php
return [
'Classes_activity_order_id' => '课程活动订单id',
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'Classes_activity_id' => '课程活动id',
'Classes_activity_item_id' => '课程活动项id',
'Name' => '活动项名称',
'Price' => '项目价格0为免费',
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Status' => '状态',
'Status 1' => '上架',
'Set status to 1' => '设为上架',
'Status 2' => '下架',
'Set status to 2' => '设为下架',
'Sex' => '性别限制',
'Sex 1' => '男',
'Sex 2' => '女',
'Sex 3' => '男女不限',
'Weigh' => '权重',
'Sign_num' => '已报名人数',
'Verification_num' => '已核销人数',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Feel' => '是否免费',
'Feel 0' => '否',
'Feel 1' => '是',
'Order.order_no' => '订单号',
'Order.pay_no' => '微信支付单号',
'Manystore.nickname' => '昵称',
'Shop.name' => '店铺名称',
'Shop.logo' => '品牌LOGO',
'Activity.title' => '标题',
'Activity.headimage' => '头图',
'Item.name' => '活动项名称',
'Item.price' => '项目价格0为免费'
];

View File

@ -88,7 +88,8 @@ class ClassesLib extends Model
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
}
});
}

View File

@ -40,8 +40,28 @@ class Activity extends Model
'expirestatus_text',
'add_type_text',
'has_expire',
'has_sign_expire',
];
public function getHasSignExpireAttr($value, $data)
{
$sign_start_time = (isset($data['sign_start_time']) ? $data['sign_start_time'] : '');
$sign_end_time = (isset($data['sign_end_time']) ? $data['sign_end_time'] : '');
if(!$sign_end_time) return '2';
if( $sign_end_time < time()) {
return '1';
}else{
return '2';
}
}
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
@ -66,7 +86,8 @@ class Activity extends Model
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
}
});
}

View File

@ -69,7 +69,8 @@ class ActivityAuth extends Model
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
}
});
}

View File

@ -0,0 +1,119 @@
<?php
namespace app\admin\model\school\classes\activity\order;
use app\admin\model\manystore\Shop;
use app\admin\model\school\classes\activity\Activity;
use app\admin\model\school\classes\activity\ActivityItem;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
class OrderItem extends Model
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_order_item';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text',
'sex_text',
'feel_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getSexList()
{
return ['1' => __('Sex 1'), '2' => __('Sex 2'), '3' => __('Sex 3')];
}
public function getFeelList()
{
return ['0' => __('Feel 0'), '1' => __('Feel 1')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSexTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sex']) ? $data['sex'] : '');
$list = $this->getSexList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getFeelTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['feel']) ? $data['feel'] : '');
$list = $this->getFeelList();
return isset($list[$value]) ? $list[$value] : '';
}
public function activityorder()
{
return $this->belongsTo(Order::class, 'classes_activity_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function manystore()
{
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function shop()
{
return $this->belongsTo(Shop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function activity()
{
return $this->belongsTo(Activity::class, 'classes_activity_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function item()
{
return $this->belongsTo(ActivityItem::class, 'classes_activity_item_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

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

View File

@ -130,8 +130,8 @@
<div class="input-group">
<input id="c-images" class="form-control" name="shop[images]" type="text" value="" placeholder="请上传{:__('Images')}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload cropper" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-imagess" 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>
<span><button type="button" data-maxcount="6" id="plupload-images" class="btn btn-danger plupload cropper" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" data-maxcount="6" id="fachoose-imagess" 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>
@ -233,8 +233,8 @@
<div class="input-group">
<input id="c-yyzz_images" class="form-control" size="50" name="shop[yyzz_images]" type="text" value="" placeholder="请输入{:__('Yyzz_images')}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-yyzz_images" data-params='{"category":"cert"}' class="btn btn-danger plupload" data-input-id="c-yyzz_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-yyzz_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-yyzz_images" data-params='{"category":"cert"}' class="btn btn-primary fachoose" data-input-id="c-yyzz_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" data-maxcount="6" id="plupload-yyzz_images" data-params='{"category":"cert"}' class="btn btn-danger plupload" data-input-id="c-yyzz_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-yyzz_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" data-maxcount="6" id="fachoose-yyzz_images" data-params='{"category":"cert"}' class="btn btn-primary fachoose" data-input-id="c-yyzz_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-yyzz_images"></span>
</div>

View File

@ -145,8 +145,8 @@
<div class="input-group">
<input id="c-images" class="form-control" name="shop[images]" type="text" value="{$shop.images}" placeholder="请上传{:__('Images')}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images" class="btn btn-danger plupload cropper" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-imagess" 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>
<span><button type="button" data-maxcount="6" id="plupload-images" class="btn btn-danger plupload cropper" data-input-id="c-images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" data-maxcount="6" id="fachoose-imagess" 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>
@ -250,8 +250,8 @@
<div class="input-group">
<input id="c-yyzz_images" class="form-control" size="50" name="shop[yyzz_images]" type="text" value="{$shop.yyzz_images}" placeholder="请输入{:__('Yyzz_images')}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-yyzz_images" data-params='{"category":"cert"}' class="btn btn-danger plupload" data-input-id="c-yyzz_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-yyzz_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-yyzz_images" data-params='{"category":"cert"}' class="btn btn-primary fachoose" data-input-id="c-yyzz_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" data-maxcount="6" id="plupload-yyzz_images" data-params='{"category":"cert"}' class="btn btn-danger plupload" data-input-id="c-yyzz_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp" data-multiple="true" data-preview-id="p-yyzz_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" data-maxcount="6" id="fachoose-yyzz_images" data-params='{"category":"cert"}' class="btn btn-primary fachoose" data-input-id="c-yyzz_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-yyzz_images"></span>
</div>

View File

@ -41,8 +41,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>
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="9" 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-maxcount="9" 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>

View File

@ -43,8 +43,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>
<span><button type="button" id="faupload-images" class="btn btn-danger faupload" data-maxcount="9" 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-maxcount="9" 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>

View File

@ -41,8 +41,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>
<span><button type="button" id="faupload-images" data-maxcount="9" 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" data-maxcount="9" 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>

View File

@ -65,8 +65,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>
<span><button type="button" id="faupload-images" data-maxcount="9" 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" data-maxcount="9" 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>

View File

@ -0,0 +1,117 @@
<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">{:__('Classes_activity_order_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_order_id" data-rule="required" data-source="school/classes/activity/order/index" class="form-control selectpage" name="row[classes_activity_order_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">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-shop_id" data-rule="required" data-source="manystore/shop/index" class="form-control selectpage" name="row[shop_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="school/classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_item_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_item_id" data-rule="required" data-source="school/classes/activity/item/index" class="form-control selectpage" name="row[classes_activity_item_id]" type="text" value="">
</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">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
</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">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Age')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-age" class="form-control" name="row[age]" type="text">
</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">{:__('Sex')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-sex" data-rule="required" class="form-control selectpicker" name="row[sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</div>
</div>
<div class="form-group">
<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">{:__('Feel')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-feel" class="form-control selectpicker" name="row[feel]">
{foreach name="feelList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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,117 @@
<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">{:__('Classes_activity_order_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_order_id" data-rule="required" data-source="school/classes/activity/order/index" class="form-control selectpage" name="row[classes_activity_order_id]" type="text" value="{$row.classes_activity_order_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">{:__('Shop_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-shop_id" data-rule="required" data-source="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">{:__('Classes_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="school/classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="{$row.classes_activity_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_item_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_item_id" data-rule="required" data-source="school/classes/activity/item/index" class="form-control selectpage" name="row[classes_activity_item_id]" type="text" value="{$row.classes_activity_item_id|htmlentities}">
</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">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</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">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Age')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-age" class="form-control" name="row[age]" type="text" value="{$row.age|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sex')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-sex" data-rule="required" class="form-control selectpicker" name="row[sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="$row.sex"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</div>
</div>
<div class="form-group">
<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">{:__('Feel')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-feel" class="form-control selectpicker" name="row[feel]">
{foreach name="feelList" item="vo"}
<option value="{$key}" {in name="key" value="$row.feel"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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/order/order_item/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/order/order_item/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/order/order_item/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('school/classes/activity/order/order_item/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/order/order_item/recyclebin')?'':'hide'}" href="school/classes/activity/order/order_item/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/order/order_item/edit')}"
data-operate-del="{:$auth->check('school/classes/activity/order/order_item/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/order/order_item/restore')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/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/order/order_item/destroy')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('school/classes/activity/order/order_item/restore')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/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/order/order_item/destroy')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/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/order/order_item/restore')}"
data-operate-destroy="{:$auth->check('school/classes/activity/order/order_item/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -139,8 +139,8 @@
<div class="input-group">
<input id="c-images" class="form-control" data-rule="required" 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>
<span><button type="button" id="faupload-images" data-maxcount="6" 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" data-maxcount="6" 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>

View File

@ -177,8 +177,8 @@
<div class="input-group">
<input id="c-images" class="form-control" data-rule="required" 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>
<span><button type="button" id="faupload-images" data-maxcount="6" 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" data-maxcount="6" 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>

View File

@ -40,8 +40,8 @@
<div class="input-group">
<input id="c-reject_images" class="form-control" size="50" name="row[reject_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-reject_images" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" class="btn btn-primary fachoose" data-input-id="c-reject_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-reject_images" data-maxcount="6" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" data-maxcount="6" class="btn btn-primary fachoose" data-input-id="c-reject_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-reject_images"></span>
</div>

View File

@ -40,8 +40,8 @@
<div class="input-group">
<input id="c-reject_images" class="form-control" size="50" name="row[reject_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-reject_images" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" class="btn btn-primary fachoose" data-input-id="c-reject_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-reject_images" data-maxcount="6" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" data-maxcount="6" class="btn btn-primary fachoose" data-input-id="c-reject_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-reject_images"></span>
</div>

View File

@ -40,8 +40,8 @@
<div class="input-group">
<input id="c-reject_images" class="form-control" size="50" name="row[reject_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-reject_images" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" class="btn btn-primary fachoose" data-input-id="c-reject_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-reject_images" data-maxcount="6" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" data-maxcount="6" class="btn btn-primary fachoose" data-input-id="c-reject_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-reject_images"></span>
</div>

View File

@ -28,14 +28,14 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text">
<input id="c-name" class="form-control" data-rule="required" name="row[name]" 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">
<input id="c-head_image" class="form-control" data-rule="required" 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>

View File

@ -28,14 +28,14 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
<input id="c-name" class="form-control" name="row[name]" data-rule="required" type="text" value="{$row.name|htmlentities}">
</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" value="{$row.head_image|htmlentities}">
<input id="c-head_image" class="form-control" size="50" data-rule="required" name="row[head_image]" type="text" value="{$row.head_image|htmlentities}">
<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>

View File

@ -66,6 +66,10 @@ class User extends Api
} catch (\Exception $e){
$this->error($e->getMessage());
}
if(empty($result['openid'])){
$this->error(__('获取openid失败'),$result);
}
Cache::set('wechat_miniapp_code'.$code.$result['openid'],"1",60);
$this->success('',$result);
}

View File

@ -3,6 +3,7 @@
namespace app\api\controller\school;
use app\common\model\school\classes\ActivityDemo;
use app\common\model\school\classes\ClassesLib;
use app\common\model\school\classes\Teacher as Teachermodel;
/**
* 活动接口
@ -21,7 +22,7 @@ class Activity extends Base
protected function _initialize()
{
$this->model = new ActivityDemo();
$this->model = new \app\common\model\school\classes\activity\Activity();
parent::_initialize();
//判断登录用户是否是员工
@ -45,7 +46,7 @@ class Activity extends Base
}
try {
$res = $this->model->detail($id);
$res = (new ActivityDemo)->detail($id);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
@ -88,7 +89,7 @@ class Activity extends Base
try{
//当前申请状态
$res = $this->model::allList($page, $limit,$params);
$res = ActivityDemo::allList($page, $limit,$params);
// if($user_id =='670153'){
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
// }
@ -100,5 +101,215 @@ class Activity extends Base
}
/**
* @ApiTitle( 通用活动大索索列表)
* @ApiSummary(通用活动大索索列表)
* @ApiRoute(/api/school/activity/activity_list)
* @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 = "start_time", type = "int",required=false,description = "开始时间10位秒级时间戳")
* @ApiParams(name = "end_time", type = "int",required=false,description = "结束时间10位秒级时间戳")
* @ApiParams(name = "sign_start_time", type = "int",required=false,description = "报名开始时间10位秒级时间戳")
* @ApiParams(name = "sign_end_time", type = "int",required=false,description = "报名结束时间10位秒级时间戳")
* @ApiParams(name = "has_shop", type = "int",required=false,description = "是否查机构")
* @ApiParams(name = "is_expire", type = "int",required=false,description = "是否查过期1只查过期,2只查不过期,0全查")
* @ApiParams(name = "is_sign_expire", type = "int",required=false,description = "是否查报名过期1只查过期,2只查不过期,0全查")
* @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
* @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索")
* @ApiParams(name = "address_type", type = "string",required=false,description = "地址类型:1=按机构,2=独立位置")
* @ApiParams(name = "province", type = "string",required=false,description = "省编号")
* @ApiParams(name = "city", type = "string",required=false,description = "市编号")
* @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
* @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 状态: 1=上架,2=下架,3=平台下架")
* @ApiParams(name = "recommend", type = "string",required=false,description = "平台推荐:0=否,1=是")
* @ApiParams(name = "hot", type = "string",required=false,description = "平台热门:0=否,1=是")
* @ApiParams(name = "new", type = "string",required=false,description = "平台最新:0=否,1=是")
* @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
* @ApiParams(name = "feel", type = "string",required=false,description = "是否免费:0=否,1=是")
* @ApiParams(name = "collect", type = "int",required=false,description = "是否专查我的收藏(需登录):1=是")
* @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序推薦優先,distance=距离优先,hot=熱門优先,new=平台最新优先,selfhot=机构热门优先,sale=銷量优先,views=浏览量优先,collect=收藏量优先")
* @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
* @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
* @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
* @ApiReturn({
*
*})
*/
public function activity_list()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$params =[];
$params["my_user_id"] = $user_id;
$params["collect"] = $this->request->get('collect/d', 0); //页数
$params["page"] = $this->request->get('page/d', 1); //页数
$params["limit"] = $this->request->get('limit/d', 10); //条数
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
$params["shop_id"] = $this->request->get('shop_id/d', ''); //机构店铺id
$params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id
$params["address_type"] = $this->request->get('address_type/s', ''); //机构店铺id
$params["province"] = $this->request->get('province/s', ''); //机构店铺id
$params["classes_type"] = $this->request->get('classes_type/s', ''); //机构店铺id
$params["city"] = $this->request->get('city/s', ''); //机构店铺id
$params["district"] = $this->request->get('district/s', ''); //机构店铺id
$params["status"] = $this->request->get('status/s', '-2'); //机构店铺id
$params["recommend"] = $this->request->get('recommend/s', ''); //机构店铺id
$params["hot"] = $this->request->get('hot/s', ''); //机构店铺id
$params["new"] = $this->request->get('new/s', ''); //机构店铺id
$params["selfhot"] = $this->request->get('selfhot/s', ''); //机构店铺id
$params["feel"] = $this->request->get('feel/s', ''); //机构店铺id
$params["is_expire"] = $this->request->get('is_expire/d', 0); //机构店铺id
$params["is_sign_expire"] = $this->request->get('is_sign_expire/d', 0); //机构店铺id
$params["order"] = $this->request->get('order/s', ''); //机构店铺id
$params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id
$params["has_shop"] = $this->request->get('has_shop/d', ''); //主讲师用户id
$params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id
$params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id
$params["sign_start_time"] = $this->request->get('sign_start_time/d', ''); //主讲师用户id
$params["sign_end_time"] = $this->request->get('sign_end_time/d', ''); //机构店铺id
$params["start_time"] = $this->request->get('start_time/d', ''); //主讲师用户id
$params["end_time"] = $this->request->get('end_time/d', ''); //机构店铺id
// $params["auth_status"] = $this->request->get('auth_status/d', '-2'); //机构店铺id
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
try{
//当前申请状态
$res = $this->model::getVaildList($params);
// if($user_id =='670153'){
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
// }
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', ["list"=>$res]);
}
/**
* @ApiTitle(课程活动规格)
* @ApiSummary(课程活动规格)
* @ApiRoute(/api/school/activity/spec)
* @ApiMethod(GET)
* @ApiParams(name = "id", type = "int",required=true,description = "活动id")
* @ApiParams(name = "user_id", type = "int",required=true,description = "需要查询是否下单的用户id")
* @ApiReturn({ spec 活动规格 })
*/
public function spec(){
$user_id = $this->request->get('user_id/d',0);
$id = $this->request->get('id/d','');
$user = $this->auth->getUser();//登录用户
if(empty($id)){
$this->error(__('缺少必要参数'));
}
try {
//如果是员工端操作
if($user_id && $id && $user){
// //判断是否有操作权限
$classes_lib_ids = (new \app\common\model\school\classes\activity\Activity)->getActivityAuthIds($user['id']);
//判断当前订单课程是否在此课程授权范围内
if(!in_array($id,$classes_lib_ids)) throw new \Exception("该课程不在您的授权范围内,无法查看!");
}
if($user && !$user_id)$user_id = $user['id'];
$res = $this->model->spec($id,$user_id);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('获取成功', ['spec'=>$res]);
}
/**
* @ApiTitle(活动详情接口)
* @ApiSummary(活动详情接口)
* @ApiRoute(/api/school/activity/detail)
* @ApiMethod(GET)
* @ApiParams(name = "id", type = "int",required=true,description = "活动id")
* @ApiReturn({
*
*})
*/
public function detail(){
$id = $this->request->get('id/d','');
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
if(empty($id)){
$this->error(__('缺少必要参数'));
}
try {
$res = $this->model->detail($id,$user_id);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('获取成功', ['detail' => $res]);
}
/**
* @ApiTitle( 设置活动收藏和取消收藏)
* @ApiSummary(设置活动收藏和取消收藏)
* @ApiRoute(/api/school/activity/collect)
* @ApiMethod(POST)
* @ApiParams(name = "id", type = "int",required=true,description = "活动id")
* @ApiParams(name = "is_collect", type = "int",required=true,description = "收藏操作0取消收藏1收藏")
* @ApiReturn({
*
*})
*/
public function collect(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$id = $this->request->post('id/d', 0); //搜索关键字
$collect = $this->request->post('is_collect/d', 0); //搜索关键字
try{
$res = $this->model->collect($id,$user_id,$collect,'user',$user_id,true);
}catch (\Throwable $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
}

View File

@ -0,0 +1,224 @@
<?php
namespace app\api\controller\school\activity;
use app\api\controller\school\Base;
use app\common\model\school\classes\activity\order\Order as OrderModel;
/**
* 用户端:活动订单接口
*/
class Order extends Base
{
protected $noNeedLogin = [];
protected $noNeedRight = '*';
protected $model = null;
/**
* 初始化操作
* @access protected
*/
protected function _initialize()
{
$this->model = new OrderModel;
parent::_initialize();
//判断登录用户是否是员工
}
/**
* @ApiTitle( 订单详情)
* @ApiSummary(订单详情)
* @ApiMethod(GET)
* @ApiParams(name = "id", type = "int",required=true,description = "订单id或订单号")
* @ApiReturn({
*
*})
*/
public function detail(){
$id = $this->request->get('id/d','');
if(empty($id)){
$this->error(__('缺少必要参数'));
}
try {
$res = OrderModel::getDetail($id);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('获取成功', ['detail' => $res]);
}
/**
* @ApiTitle( 我的订单列表接口)
* @ApiSummary(我的订单列表接口)
* @ApiMethod(GET)
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,2=已报名待审核,3=已预约,4=售后中,6=已退款,9=已完成")
* @ApiParams(name = "classes_activity_id", type = "int",required=false,description = "课程活动id")
* @ApiReturn({
*
*})
*/
public function order_list()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$page = $this->request->get('page/d', 0); //页数
$limit = $this->request->get('limit/d', 0); //条数
$keywords = $this->request->get('keywords/s', ''); //搜索关键字
$status = $this->request->get('status/s', ''); //搜索关键字
$classes_activity_id = $this->request->get('classes_activity_id/s', ''); //搜索关键字
$has_evaluate = $this->request->get('has_evaluate/d', 0); //搜索关键字
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
try{
//当前申请状态
$res = $this->model::allList($user_id,$page, $limit,$keywords,$status,$classes_activity_id,$has_evaluate);
// if($user_id =='670153'){
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
// }
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
/**
* @ApiTitle( 我的订单数量接口)
* @ApiSummary(返回订单各个数量)
* @ApiMethod(GET)
* @ApiParams(name = "classes_activity_id", type = "int",required=false,description = "课程活动id非必填")
* @ApiReturn({
*
*})
*/
public function order_count(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$classes_activity_id = $this->request->get('classes_activity_id/s', ''); //搜索关键字
try{
$res = $this->model::orderCount($user_id,$classes_activity_id);
}catch (\Throwable $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
/**
* @ApiTitle( 订单确认/订单计算接口)
* @ApiSummary(订单确认/订单计算接口【有过期时间】)
* @ApiMethod(POST)
* @ApiParams(name = "classes_activity_id", type = "int",required=true,description = "活动id")
* @ApiParams(name = "order_no", type = "string",required=false,description = "缓存key")
* @ApiParams(name = "classes_activity_item_id", type = "int",required=true,description = "活动规定id")
* @ApiParams(name = "is_compute", type = "int",required=false,description = "是否重新计算并更新缓存 默认传1")
* @ApiReturn({
*
*})
*/
public function confirm(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$classes_activity_id = $this->request->post('classes_activity_id/d', 0); //课程id
$classes_activity_item_id = $this->request->post('classes_activity_item_id/d', 0); //想同时约的课时id
// $param = urldecode($this->request->post('param/s', "{}")); //参数
$param = [];
//参数
$order_no = $this->request->post('order_no/s', ''); //订单号
$is_compute = $this->request->post('is_compute/d', 1); //是否重新计算并更新缓存
try{
//当前申请状态
$res = $this->model->confirm($user_id, $classes_activity_id,$classes_activity_item_id,$order_no,$param, $is_compute);
}catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('执行成功可用缓存key下单', $res);
}
/**
* @ApiTitle( 订单下单接口)
* @ApiSummary(订单下单接口)
* @ApiMethod(POST)
* @ApiParams(name = "order_no", type = "string",required=true,description = "缓存key")
* @ApiReturn({
*
*})
*/
public function create(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$order_no = $this->request->post('order_no/s', ''); //订单号
$remark = $this->request->post('remark/s', ''); //下单备注
// repeat_filter("appointment\order\create".$user_id, 2);
try{
//当前申请状态
$res = $this->model->cacheCreateOrder($order_no,$user_id,$remark,true);
}catch (\Throwable $e){
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);;
}
$this->success('订单创建成功缓存key被消耗', $res);
}
/**
* @ApiTitle(活动单取消接口)
* @ApiSummary(活动单取消接口(已完成的单无法取消))
* @ApiMethod(POST)
* @ApiParams(name = "order_no", type = "string",required=true,description = "订单号")
* @ApiReturn({
*
*})
*/
public function cancel(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$order_no = $this->request->post('order_no/s', ''); //订单号
try{
//当前申请状态
$res = $this->model->cancel($order_no,$user_id,true,'user',0,true);
}catch (\Throwable $e){
$this->error($e->getMessage());
}
$this->success('活动取消成功', $res);
}
}

View File

@ -0,0 +1,325 @@
<?php
namespace app\api\controller\school\activity;
use addons\epay\library\Service;
use addons\third\model\Third;
use app\api\controller\school\Base;
use app\common\model\school\classes\activity\order\Order as OrderModel;
use Exception;
use think\Log;
/**
* 活动支付接口
*/
class Pay extends Base
{
protected $noNeedLogin = '*';
protected $noNeedRight = '*';
protected $model = null;
/**
* 初始化操作
* @access protected
*/
protected function _initialize()
{
$this->model = new OrderModel;
parent::_initialize();
//判断登录用户是否是员工
}
/**
* @ApiTitle( 活动第三方支付)
* @ApiSummary(活动第三方支付(微信等支付))
* @ApiMethod(POST)
* @ApiParams(name = "order_no", type = "string",required=true,description = "订单id或订单号")
* @ApiParams(name = "type", type = "string",required=true,description = "服务商:alipay=支付宝,wechat=微信")
* @ApiParams(name = "platform", type = "string",required=true,description = "平台:web=PC网页支付,wap=H5手机网页支付,app=APP支付,scan=扫码支付,mp=微信公众号支付,miniapp=微信小程序支付")
* @ApiParams(name = "openid", type = "string",required=false,description = "用户openid(非必填)")
* @ApiReturn({
*
*})
*/
public function payment()
{
$order_no = $this->request->post('order_no/s');
$type = $this->request->post('type/s');
$method = $this->request->post('platform/s');
$openid = $this->request->post('openid/s', "");
$platform = $method;
try {
//订单支付前校验
$this->model->checkPay($order_no,$type);
$order = OrderModel::where('order_no', $order_no)->find();
$amount = $order["totalprice"];
} catch (\Exception $e) {
$this->error($e->getMessage());
}
if (!$amount || $amount < 0) {
$this->error("支付金额必须大于0");
}
if (!$type || !in_array($type, ['alipay', 'wechat'])) {
$this->error("支付类型不能为空");
}
if (in_array($method, ['miniapp', 'mp']) && !$openid) {
// 微信公众号,小程序支付,必须有 openid
if (isset($openid) && $openid) {
// 如果传的有 openid
} else {
// 没有 openid 默认拿下单人的 openid
$oauth = Third::where([
'user_id' => $order->user_id,
'platform' => $type,
'apptype' => $platform
])->find();
$openid = $oauth ? $oauth->openid : '';
}
if (!$openid) {
// 缺少 openid
$this->error("授权过期,请您重新授权登录");
}
}
//订单号
$out_trade_no = $order_no;
//订单标题
$title = '活动订单['.$out_trade_no."]支付";
//回调链接
$notifyurl = $this->request->root(true) . '/api/school.activity.pay/notifyx/paytype/' . $type. '/platform/' . $method;
$returnurl = $this->request->root(true) . '/api/school.activity.pay/returnx/paytype/' . $type . '/out_trade_no/' . $out_trade_no;
$response = Service::submitOrder($amount, $out_trade_no, $type, $title, $notifyurl, $returnurl, $method, $openid);
$this->success('查询成功', ["paydata"=>$response]);
// return $response;
}
/**
* @ApiTitle( 第三方支付支付成功回调)
* @ApiSummary(第三方支付成功回调)
* @ApiMethod(GET)
* @ApiReturn({
*
*})
*/
public function notifyx()
{
$paytype = $this->request->param('paytype');
$platform = $this->request->param('platform');
$pay = Service::checkNotify($paytype);
if (!$pay) {
return json(['code' => 'FAIL', 'message' => '失败'], 500, ['Content-Type' => 'application/json']);
}
$payment = $paytype;
// 获取回调数据V3和V2的回调接收不同
$data = Service::isVersionV3() ? $pay->callback() : $pay->verify();
Log::write('notifyx-result:'. json_encode($data));
$out_trade_no = $data['out_trade_no'];
$out_refund_no = $data['out_biz_no'] ?? '';
// 判断是否是支付宝退款(支付宝退款成功会通知该接口)
if ($paytype == 'alipay' // 支付宝支付
&& $data['notify_type'] == 'trade_status_sync' // 同步交易状态
&& $data['trade_status'] == 'TRADE_CLOSED' // 交易关闭
&& $out_refund_no // 退款单号
) {
// 退款回调
// $this->refundFinish($out_trade_no, $out_refund_no,$platform);
return $pay->success()->send();
}
// 判断支付宝微信是否是支付成功状态,如果不是,直接返回响应
if ($payment == 'alipay' && $data['trade_status'] != 'TRADE_SUCCESS') {
// 不是交易成功的通知,直接返回成功
return $pay->success()->send();
}
if ($payment == 'wechat' && ($data['result_code'] != 'SUCCESS' || $data['return_code'] != 'SUCCESS')) {
// 微信交易未成功,返回 false让微信再次通知
return false;
}
try {
//微信支付V3返回和V2不同
if (Service::isVersionV3() && $paytype === 'wechat') {
$data = $data['resource']['ciphertext'];
$data['total_fee'] = $data['amount']['total'];
}
\think\Log::record($data);
$payamount = $paytype == 'alipay' ? $data['total_amount'] : $data['total_fee'] / 100;
$out_trade_no = $data['out_trade_no'];
\think\Log::record("回调成功,订单号:{$out_trade_no},金额:{$payamount}");
//你可以在此编写订单逻辑
// 支付成功流程
//获取支付金额、订单号
$pay_fee = $payment == 'alipay' ? $data['total_amount'] : $data['total_fee'] / 100;
//你可以在此编写订单逻辑
$order = OrderModel::getNopayOrder($out_trade_no);
if (!$order || $order["status"] != '0') {
// 订单不存在,或者订单已支付
return $pay->success()->send();
}
$notify = [
'order_no' => $data['out_trade_no'],
'transaction_id' => $payment == 'alipay' ? $data['trade_no'] : $data['transaction_id'],
'notify_time' => date('Y-m-d H:i:s', strtotime($data['time_end'])),
'buyer_email' => $payment == 'alipay' ? $data['buyer_logon_id'] : $data['openid'],
'payment_json' => json_encode($data->all()),
'pay_fee' => $pay_fee,
'pay_type' => $payment, // 支付方式
'platform' => $platform,
];
$this->model->paySuccess($order['order_no'],$notify,$pay_fee,true,true);
} catch (Exception $e) {
\think\Log::record("回调逻辑处理错误:" . $e->getMessage(), "error");
}
//下面这句必须要执行,且在此之前不能有任何输出
if (Service::isVersionV3()) {
return $pay->success()->getBody()->getContents();
} else {
return $pay->success()->send();
}
}
/**
* 支付返回,网页支付版本(小程序忽略)
*/
public function returnx()
{
$paytype = $this->request->param('paytype');
$out_trade_no = $this->request->param('out_trade_no');
$pay = Service::checkReturn($paytype);
if (!$pay) {
$this->error('签名错误', '');
}
//你可以在这里定义你的提示信息,但切记不可在此编写逻辑
$this->success("请返回网站查看支付结果", addon_url("epay/index/index"));
}
/**
* 支付返回
*/
public function notifyRefund($callback)
{
$pay = $this->getPay();
try {
$data = $pay->verify(null, true); // 是的,验签就这么简单!
$result = $callback($data, $pay);
// Log::debug('Wechat notify', $data->all());
} catch (\Exception $e) {
// $e->getMessage();
}
return $result;
}
/**
* 退款成功回调
*/
public function notifyr()
{
Log::write('notifyreturn-comein:');
$payment = $this->request->param('payment');
$platform = $this->request->param('platform');
$config = Service::getConfig('wechat');
$notify_url = request()->domain() . '/api/school.activity.pay/notifyr/payment/' . $payment . '/platform/' . $platform;
$config['notify_url'] = $notify_url;
$pay = \Yansongda\Pay\Pay::wechat($config);
try {
$data = $pay->verify(null, true); // 是的,验签就这么简单!
Log::write('notifyr-result:' . json_encode($data));
$out_refund_no = $data['out_refund_no'];
$out_trade_no = $data['out_trade_no'];
// 退款
$this->refundFinish($out_trade_no, $out_refund_no,$platform);
return $pay->success()->send();
// Log::debug('Wechat notify', $data->all());
} catch (\Exception $e) {
Log::write('notifyreturn-error:' . json_encode($e->getMessage()));
}
return $pay->success()->send();
}
private function refundFinish($out_trade_no, $out_refund_no,$platform) {
// $order = Order::where('order_sn', $out_trade_no)->find();
// $refundLog = \app\admin\model\shopro\order\RefundLog::where('refund_sn', $out_refund_no)->find();
//
// if (!$order || !$refundLog || $refundLog->status != 0) {
// // 订单不存在,或者订单已退款
// return true;
// }
//
// $item = \app\admin\model\shopro\order\OrderItem::where('id', $refundLog->order_item_id)->find();
//
// Db::transaction(function () use ($order, $item, $refundLog) {
// \app\admin\model\shopro\order\Order::refundFinish($order, $item, $refundLog);
// });
$this->model::refundSuccess($out_refund_no,true);
return true;
}
}

View File

@ -3,6 +3,7 @@
namespace app\api\controller\school\worker;
use app\common\controller\Api;
use app\common\model\school\classes\activity\Activity;
use app\common\model\school\classes\ClassesLib;
use app\common\model\school\classes\Teacher;
use app\common\model\school\classes\Verification;
@ -11,6 +12,7 @@ class Base extends Api
{
protected $classes_lib_ids = [];
protected $classes_activity_ids = [];
protected $shop_id = 0;
/**
@ -37,9 +39,10 @@ class Base extends Api
$this->error($e->getMessage(),['errcode'=>30003]);
}
$this->classes_lib_ids = (new ClassesLib)->getClassesAuthIds($user_id);
$this->classes_activity_ids = (new Activity())->getActivityAuthIds($user_id);
//如果没有任何可管理的classes_lib_id 则返回错误
if(!$this->classes_lib_ids && !$this->shop_id)$this->error("您没有员工权限访问该接口!",['errcode'=>30003]);
if(!$this->classes_lib_ids && !$this->shop_id && !$this->classes_activity_ids)$this->error("您没有员工权限访问该接口!",['errcode'=>30003]);
}

View File

@ -0,0 +1,152 @@
<?php
namespace app\api\controller\school\worker\activity;
use app\api\controller\school\worker\Base;
use app\common\model\school\classes\activity\order\Order as OrderModel;
use app\common\model\school\classes\Teacher as Teachermodel;
/**
* 员工端:课程活动订单管理接口
*/
class Order extends Base
{
protected $noNeedLogin = [];
protected $noNeedRight = '*';
protected $model = null;
/**
* 初始化操作
* @access protected
*/
protected function _initialize()
{
$this->model = new OrderModel;
parent::_initialize();
//判断登录用户是否是员工
}
/**
* @ApiTitle( 订单详情)
* @ApiSummary(订单详情)
* @ApiMethod(GET)
* @ApiParams(name = "id", type = "int",required=true,description = "订单id或订单号")
* @ApiReturn({
*
*})
*/
public function detail(){
$id = $this->request->get('id/s','');
if(empty($id)){
$this->error(__('缺少必要参数'));
}
try {
$res = OrderModel::getDetail($id,$this->classes_activity_ids);
if(!$res)throw new \Exception('您无操作权限!',40003);
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
$this->success('获取成功', ['detail' => $res]);
}
/**
* @ApiTitle( 我的订单列表接口)
* @ApiSummary(我的订单列表接口)
* @ApiMethod(GET)
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
* @ApiParams(name = "status", type = "string",required=false,description = "状态搜索条件:-3=已取消,0=待支付,2=已报名待审核,3=已预约,4=售后中,6=已退款,9=已完成")
* @ApiParams(name = "classes_activity_id", type = "int",required=false,description = "课程活动id")
* @ApiReturn({
*
*})
*/
public function order_list()
{
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$page = $this->request->get('page/d', 0); //页数
$limit = $this->request->get('limit/d', 0); //条数
$keywords = $this->request->get('keywords/s', ''); //搜索关键字
$status = $this->request->get('status/s', ''); //搜索关键字
$classes_activity_id = $this->request->get('classes_activity_id/s', ''); //搜索关键字
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
try{
//当前申请状态
$res = $this->model::workList($user_id,$page, $limit,$keywords,$status,$classes_activity_id,$this->classes_activity_ids);
// var_dump($this->model->getLastSql());
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
/**
* @ApiTitle( 我的订单数量接口)
* @ApiSummary(返回订单各个数量)
* @ApiMethod(GET)
* @ApiParams(name = "classes_activity_id", type = "int",required=false,description = "课程活动id")
* @ApiReturn({
*
*})
*/
public function order_count(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$classes_activity_id = $this->request->get('classes_activity_id/s', ''); //搜索关键字
try{
$res = $this->model::workCount($classes_activity_id,$this->classes_activity_ids);
}catch (\Throwable $e){
$this->error($e->getMessage());
}
$this->success('查询成功', $res);
}
/**
* @ApiTitle( 员工代操作:活动订单取消接口)
* @ApiSummary(活动订单取消接口(已支付单无法取消,要走售后))
* @ApiMethod(POST)
* @ApiParams(name = "order_no", type = "string",required=true,description = "订单号")
* @ApiReturn({
*
*})
*/
public function cancel(){
$user_id = 0;
$user = $this->auth->getUser();//登录用户
if($user)$user_id = $user['id'];
$order_no = $this->request->post('order_no/s', ''); //订单号
try{
//当前申请状态
$res = $this->model->cancel($order_no,0,true,'user',$user_id,true);
}catch (\Throwable $e){
$this->error($e->getMessage());
}
$this->success('预约课时取消成功', $res);
}
}

View File

@ -571,11 +571,16 @@ if (!function_exists('de_code')) {
}
}
if (!function_exists('matchLatLng')) {
function matchLatLng($latlng) {
$match = "/^\d{1,3}\.\d{1,30}$/";
return preg_match($match, $latlng) ? $latlng : 0;
}
}
if (!function_exists('getDistanceBuilder')) {
function getDistanceBuilder($lat, $lng) {
return "ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((". matchLatLng($lat) . " * PI() / 180 - latitude * PI() / 180) / 2), 2) + COS(". matchLatLng($lat). " * PI() / 180) * COS(latitude * PI() / 180) * POW(SIN((". matchLatLng($lng). " * PI() / 180 - longitude * PI() / 180) / 2), 2))) * 1000) AS distance";
function getDistanceBuilder($lat, $lng,$a="") {
return "ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN((". matchLatLng($lat) . " * PI() / 180 - {$a}latitude * PI() / 180) / 2), 2) + COS(". matchLatLng($lat). " * PI() / 180) * COS({$a}latitude * PI() / 180) * POW(SIN((". matchLatLng($lng). " * PI() / 180 - {$a}longitude * PI() / 180) / 2), 2))) * 1000) AS distance";
}
}

View File

@ -27,16 +27,6 @@ $defaultHooks = [
'app\\common\\listener\\classesorder\\OrderHook'
],
//
// app\common\listener\classesorder
// 订单取消
// 'order_cancel_before' => [ // 订单取消前
// ],
// 'order_cancel_after' => [ // 订单取消后
// 'addons\\shopro\\listener\\order\\Invalid'
// ],
];
@ -185,6 +175,43 @@ $activityHooks = [
'activity_view_after' => [ // 活动触发浏览后
'app\\common\\listener\\classes\\ActivityHook'
],
'activity_collect_success_after' => [ // 课程收藏后
'app\\common\\listener\\classes\\ActivityHook'
],
'activity_collect_cancel_after' => [ // 课程取消收藏后
'app\\common\\listener\\classes\\ActivityHook'
],
];
$activityOrderHooks = [
// 订单创建
'classes_activity_order_create_before' => [ // 订单创建前
'app\\common\\listener\\activityorder\\OrderHook'
],
'classes_activity_order_create_after' => [ // 订单创建后
'app\\common\\listener\\activityorder\\OrderHook'
],
'classes_activity_order_payed_after' => [ // 订单支付成功
'app\\common\\listener\\activityorder\\OrderHook'
],
'classes_activity_order_cancel_after' => [ // 订单取消后
'app\\common\\listener\\activityorder\\OrderHook'
],
//
// 'classes_order_finish_after' => [ // 订单完成后
// 'app\\common\\listener\\classesorder\\OrderHook'
// ],
//
// 'classes_order_evaluate_after'=> [ // 订单评价后
// 'app\\common\\listener\\classesorder\\OrderHook'
// ],
//
// 'classes_order_evaluate_update_after'=> [ // 订单评价修改后
// 'app\\common\\listener\\classesorder\\OrderHook'
// ],
];
@ -202,6 +229,8 @@ $defaultHooks = array_merge_recursive($defaultHooks, $userHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $serviceHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $activityHooks);
$defaultHooks = array_merge_recursive($defaultHooks, $activityOrderHooks);
return $defaultHooks;

View File

@ -0,0 +1,78 @@
<?php
namespace app\common\listener\activityorder;
use app\common\model\school\classes\Evaluate;
use app\common\model\school\Message;
use app\common\model\school\MessageConfig;
class OrderHook
{
// 订单创建成功前(订单计算)
public function classesActivityOrderCreateBefore(&$params)
{
['user_id'=>$user_id, 'classes_activity_id'=>$classes_activity_id,'classes_activity_item_id'=>$classes_activity_item_id,'param'=>$param, 'order_no'=>$order_no, 'price_info'=>$price_info] = $params;
}
// 订单创建成功后
public function classesActivityOrderCreateAfter(&$params)
{
["order"=>$order] = $params;
}
// 订单支付成功后
public function classesActivityOrderPayedAfter(&$params)
{
["order"=>$order] = $params;
}
// 订单取消成功后
public function classesActivityOrderCancelAfter(&$params)
{
['order' => $order,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}
// 订单完成后
public function classesActivityOrderFinishAfter(&$params)
{
}
// 订单评价成功后
public function classesActivityOrderEvaluateAfter(&$params)
{
['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}
// 订单评价更新后
public function classesOrderEvaluateUpdateAfter(&$params)
{
['order' => $order,"classes_evaluate"=>$classes_evaluate,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}
}

View File

@ -105,7 +105,20 @@ class ActivityHook
public function activityViewAfter(&$params)
{
['classes' => $classes,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
['activity' => $activity,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}
public function activityCollectSuccessAfter(&$params)
{
['activity' => $activity,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}
public function activityCollectCancelAfter(&$params)
{
['activity' => $activity,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
}

View File

@ -9,6 +9,7 @@ use app\common\model\dyqc\ManystoreShop;
use app\common\model\manystore\Shop;
use app\common\model\manystore\UserAuth;
use app\common\model\school\Area;
use app\common\model\school\classes\activity\Activity;
use app\common\model\school\classes\lib\Spec;
use app\common\model\school\classes\order\OrderDetail;
use app\common\model\school\classes\order\ServiceOrder;
@ -127,7 +128,8 @@ class ClassesLib extends BaseModel
self::afterInsert(function ($row) {
if (!empty($row['weigh'])) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
}
});
}
@ -682,7 +684,7 @@ $user_unpaid_order = $user_paid_order =null;
//得到距离
if (isset($latitude) && isset($longitude) && $latitude && $longitude) {
$field .= ', '.getDistanceBuilder($latitude, $longitude);
$field .= ', '.getDistanceBuilder($latitude, $longitude,$a);
}else{
$field .= ', 0 as distance';
}
@ -836,6 +838,15 @@ $user_unpaid_order = $user_paid_order =null;
}
if(isset($order) && $order == "distance"){
$selfetch = $selfetch->where("{$a}longitude","not null")
->where("{$a}latitude","not null")
->where("{$a}longitude","<>","")
->where("{$a}latitude","<>","")
->where("{$a}longitude","<>","null")
->where("{$a}latitude","<>","null");
}
@ -878,6 +889,7 @@ $user_unpaid_order = $user_paid_order =null;
}
if(isset($nearby) && $nearby) {
throw new \Exception("现版本不支持");
$selfetch = $selfetch->having("distance <= {$nearby}");
}
@ -887,12 +899,12 @@ $user_unpaid_order = $user_paid_order =null;
$selfetch = $selfetch->paginate($per_page);
//额外附加数据
foreach ($selfetch as $row) { //迭代器魔术方法遍历,填值自动引用传值
foreach ($selfetch as &$row) { //迭代器魔术方法遍历,填值自动引用传值
//设置是否已收藏
$row->is_collect = in_array($row->id,$collect_classes_lib_ids) ? 1 : 0;
if($row->is_collect){
$row["collect"] = Collect::where("user_id",$my_user_id)->find();
$row["collect"] = Collect::where("user_id",$my_user_id)->where("classes_lib_id",$row->id)->find();
}
$classes_label_ids = $row['classes_label_ids'];
$classes_cate_ids = $row['classes_cate_ids'];
@ -915,6 +927,7 @@ $user_unpaid_order = $user_paid_order =null;
$row['classes_type_name'] = $classes_type;
}
// var_dump(self::getLastSql());die;
return $selfetch;
}
@ -924,6 +937,28 @@ $user_unpaid_order = $user_paid_order =null;
//更新课程规格库存
$classes_lib = self::get($classes_lib_id);
if($classes_lib){
$classes_lib->sale = Order::where("classes_lib_id",$classes_lib["id"])->where("status","<>","-3")->count();
//遍历课程课时规格,更新课时统计数据
$specs = $classes_lib->specs;
if($specs){
foreach ($specs as $spec){
// '已核销人数',
$spec->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec["id"])->where("status","=","3")->count();
//已报名人数
$spec->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec["id"])->where("status","in",["-1","0","3"])->count();
$spec->save();
}
}
//统计课程总报名和总核销
$classes_lib->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$classes_lib["id"])->where("status","in",["-1","0","3"])->count();
$classes_lib->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$classes_lib["id"])->where("status","=","3")->count();
//所有课时加起来
$classes_lib->limit_num = ClassesSpec::where("classes_lib_id",$classes_lib_id)->sum( "limit_num");
//更新虚拟用户数据
@ -1478,8 +1513,13 @@ $user_unpaid_order = $user_paid_order =null;
$help_user_info = User::where('id',$oper_id)->find();
if(!$help_user_info) throw new \Exception("代下单员工不存在!");
$classes_lib_ids = (new ClassesLib)->getClassesAuthIds($oper_id);
$activity_lib_ids = (new Activity())->getActivityAuthIds($oper_id);
if(!$shop_id && $classes_lib_ids)$shop_id = self::where("id" ,"in", $classes_lib_ids)->value("shop_id");
if(!$shop_id && $activity_lib_ids)$shop_id = Activity::where("id" ,"in", $activity_lib_ids)->value("shop_id");
//判断当前订单课程是否在此课程授权范围内
if($classes && !in_array($classes_id,$classes_lib_ids)) throw new \Exception("该课程不在您的授权范围内,无法代操作!");

View File

@ -3,11 +3,19 @@
namespace app\common\model\school\classes\activity;
use app\admin\model\manystore\Shop;
use app\common\model\manystore\UserAuth;
use app\common\model\school\classes\activity\order\Order;
use app\common\model\BaseModel;
use app\common\model\dyqc\ManystoreShop;
use app\common\model\school\Area;
use app\common\model\school\classes\Cate;
use app\common\model\school\classes\ClassesLib;
use app\common\model\school\classes\ClassesSpec;
use app\common\model\school\classes\Collect;
use app\common\model\school\classes\Label;
use app\common\model\school\classes\Type;
use app\common\model\school\classes\Verification;
use app\common\model\school\classes\VirtualUser;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
@ -45,13 +53,26 @@ class Activity extends BaseModel
'expirestatus_text',
'add_type_text',
'has_expire',
'has_sign_expire',
];
public function getHasExpireList()
public function getHasSignExpireAttr($value, $data)
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
$sign_start_time = (isset($data['sign_start_time']) ? $data['sign_start_time'] : '');
$sign_end_time = (isset($data['sign_end_time']) ? $data['sign_end_time'] : '');
if(!$sign_end_time) return '2';
if( $sign_end_time < time()) {
return '1';
}else{
return '2';
}
}
public function getHasExpireAttr($value, $data)
{
@ -67,12 +88,45 @@ class Activity extends BaseModel
}
public function getDistanceTextAttr($value, $data) {
$distance_text = '';
$distance = $data['distance'] ?? 0;
switch (true) {
case $distance >= 1000;
$distance_text = round(($distance / 1000), 2) . 'km';
break;
default :
$distance_text = $distance . 'm';
break;
}
return $distance_text;
}
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
}
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
}
});
}
@ -231,6 +285,43 @@ class Activity extends BaseModel
}
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 manystore()
{
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
@ -690,7 +781,7 @@ class Activity extends BaseModel
$activity->save();
self::update_classes($activity["id"]);
if($trans){
self::commitTrans();
}
@ -848,4 +939,635 @@ class Activity extends BaseModel
/**得到基础条件
* @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;
}
/** 课程详情
* @param $id
* @throws \think\exception\DbException
*/
public function detail($id,$user_id=0,$oper_type='user',$trans=false){
$self = $this->get($id,['shop','items']);
//是否收藏
$self['is_collect'] = 0;
//是否购买
$self['have_buy'] = 0;
if($user_id){
//判断是否收藏
$self['is_collect'] = Collect::where("user_id",$user_id)->where("classes_activity_id",$id)->count() ? 1:0 ;
//判断用户是否已报名
$self['have_buy'] = Order::where("classes_activity_id",$id)
->where("user_id",$user_id)
->where("status","not in",["-3","6","9"])
->count() ? 1 : 0 ;
}
//
$this->setViews($id,$user_id,$oper_type,$user_id,$trans);
// $self->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
//参与人数 = 虚拟人数 + 平台人数
return $self;
}
/**设置浏览量
* @param $id
* @param int $user_id
* @param bool $check
* @param bool $trans
* @throws \Exception
*/
public function setViews($id,$user_id,$oper_type='user',$oper_id=0,$trans=false){
$classes_lib = self::where("id",$id)->find();
if(!$classes_lib)throw new \Exception("找不到活动!");
//判断逻辑
if($trans){
self::beginTrans();
}
try{
//事务逻辑
$classes_lib->views = $classes_lib->views + 1;
//查询是否已收藏
$classes_lib->save();
//调用事件
$data = ['activity' => $classes_lib,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
\think\Hook::listen('activity_view_after', $data);
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage());
}
return $classes_lib;
}
/**课程规格
* @param $id
*
*/
public function spec($id,$user_id=0){
//课程规格
$spec_data = ActivityItem::where("classes_activity_id",$id)->where("status",'1')->order("weigh desc,id desc")->select();
foreach ($spec_data as &$spec){
//默认未下单预约
$spec["user_reservation"] = null;
if($user_id){
$spec["user_reservation"] = Order::where("classes_activity_id",$id)->where("classes_activity_item_id",$spec['id'])->where("user_id",$user_id)->where("status","not in",["-3","6","9"])->find();
}
}
return $spec_data;
}
/**
* 获取所有活动列表
*/
public static function getVaildList($params) {
extract($params);
$a = (new self)->getWithAlisaName().'.';
$with = ['items'];
// if (isset($has_shop) && $has_shop) {
$with[] = 'shop';
// }
// $cate_list = Cate::where("status",'1')->column("name","id");
// $label_list = Label::where("status",'1')->column("name","id");
// $type_list = Type::where("status",'1')->column("name","id");
$selfetch = self::with($with);
// 查询自提点
if($status == "-2"){
$selfetch = $selfetch->where($a.'status', '1');
}
// if($auth_status == "-2"){
// $selfetch = $selfetch->where("{$a}auth_status",1);
// }
$order = $order?? 'normal';
$per_page = $limit ?? 10;
$field = "{$a}start_time,{$a}end_time,{$a}sign_start_time,{$a}sign_end_time,{$a}id,{$a}shop_id,{$a}title,{$a}headimage,{$a}images,{$a}address_type,{$a}province,{$a}city,{$a}district,{$a}address,{$a}address_detail,{$a}longitude,{$a}latitude,{$a}sale,{$a}price,{$a}status,{$a}weigh,{$a}recommend,{$a}hot,{$a}new,{$a}selfhot,{$a}createtime,{$a}feel,{$a}sign_num,{$a}verification_num";
//得到距离
if (isset($latitude) && isset($longitude) && $latitude && $longitude) {
$field .= ', '.getDistanceBuilder($latitude, $longitude,$a);
}else{
$field .= ', 0 as distance';
}
//得到每个
$selfetch = $selfetch->field($field);
if (isset($keywords) && $keywords) {
$selfetch = $selfetch->where("{$a}title|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keywords . '%');
}
if(isset($start_time) && isset($end_time) && ($end_time || $start_time)) {
if($start_time){
$selfetch = $selfetch->where("{$a}start_time", '>=', $start_time);
}
if($end_time){
$selfetch = $selfetch->where("{$a}end_time", '<=', $end_time);
}
}
if(isset($sign_start_time) && isset($sign_end_time) && ($sign_end_time || $sign_start_time)) {
if($sign_start_time){
$selfetch = $selfetch->where("{$a}sign_start_time", '>=', $sign_start_time);
}
if($sign_end_time){
$selfetch = $selfetch->where("{$a}sign_end_time", '<=', $sign_end_time);
}
}
// is_expire 是否查过期1只查过期,2只查不过期,0全查
if(isset($is_expire) && $is_expire) {
if($is_expire == 1){
$selfetch = $selfetch->where("{$a}end_time", '<', time());
}else{
$selfetch = $selfetch->where("{$a}end_time", '>=', time());
}
}
// is_expire 是否查过期1只查过期,2只查不过期,0全查
if(isset($is_sign_expire) && $is_sign_expire) {
if($is_sign_expire == 1){
$selfetch = $selfetch->where("{$a}sign_end_time", '<', time());
}else{
$selfetch = $selfetch->where("{$a}sign_end_time", '>=', time());
}
}
if (isset($manystore_id) && $manystore_id) {
$selfetch = $selfetch->where("{$a}manystore_id", 'in', ''.$manystore_id);
}
if (isset($shop_id) && $shop_id) {
$selfetch = $selfetch->where("{$a}shop_id", 'in', ''.$shop_id);
}
if (isset($user_id) && $user_id) {
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$user_id);
}
if (isset($my) && $my && isset($my_user_id) && $my_user_id) {
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$my_user_id);
}
// if (isset($teacher_id) && $teacher_id) {
// $selfetch = $selfetch->where("{$a}teacher_id", 'in', ''.$teacher_id);
// }
// if (isset($type) && $type) {
// $selfetch = $selfetch->where("{$a}type", 'in', ''.$type);
// }
if (isset($address_type) && $address_type) {
$selfetch = $selfetch->where("{$a}address_type", 'in', ''.$address_type);
}
if (isset($recommend) && $recommend) {
$selfetch = $selfetch->where("{$a}recommend", 'in', ''.$recommend);
}
if (isset($hot) && $hot) {
$selfetch = $selfetch->where("{$a}hot", 'in', ''.$hot);
}
if (isset($new) && $new) {
$selfetch = $selfetch->where("{$a}new", 'in', ''.$new);
}
if (isset($feel) && $feel) {
$selfetch = $selfetch->where("{$a}feel", 'in', ''.$feel);
}
// //设置订单信息
// if(isset($auth_status) && $auth_status != -1 && $auth_status != -2){
// $selfetch = $selfetch->where("{$a}auth_status", 'in', ''.$auth_status);
// }
//设置订单信息
if(isset($status) && $status != -1 && $status != -2){
$selfetch = $selfetch->where("{$a}status", 'in', ''.$status);
}
//区域搜索
if (isset($province) && $province) {
$selfetch = $selfetch->where("{$a}province", 'in', ''.$province);
}
if (isset($city) && $city) {
$selfetch = $selfetch->where("{$a}city", 'in', ''.$city);
}
if (isset($district) && $district) {
$selfetch = $selfetch->where("{$a}district", 'in', ''.$district);
}
// if (isset($self_label_tag) && $self_label_tag) {
// $self_label_tag = implode("|",explode(',',$self_label_tag));
// $selfetch = $selfetch->whereRaw(" {$a}self_label_tag REGEXP '({$self_label_tag})'");
// }
//
// if (isset($classes_type) && $classes_type) {
// $classes_type = implode("|",explode(',',$classes_type));
// $selfetch = $selfetch->whereRaw(" {$a}classes_type REGEXP '({$classes_type})'");
// }
// if (isset($classes_cate_ids) && $classes_cate_ids) {
// $classes_cate_ids = implode("|",explode(',',$classes_cate_ids));
// $selfetch = $selfetch->whereRaw(" {$a}classes_cate_ids REGEXP '({$classes_cate_ids})'");
// }
//
// if (isset($classes_label_ids) && $classes_label_ids) {
// $classes_label_ids = implode("|",explode(',',$classes_label_ids));
// $selfetch = $selfetch->whereRaw(" {$a}classes_label_ids REGEXP '({$classes_label_ids})'");
// }
$collect_classes_lib_ids = [-1];
//需登录查询条件:
if(isset($my_user_id) && $my_user_id){
//得到我收藏的课程ids
$collect_classes_lib_ids = Collect::where("user_id",$my_user_id)->column("classes_activity_id");
//专查我的收藏
if(isset($collect) && $collect){
$selfetch = $selfetch->where("{$a}id","in",$collect_classes_lib_ids);
}
}
if(isset($order) && $order == "distance"){
$selfetch = $selfetch->where("{$a}longitude","not null")
->where("{$a}latitude","not null")
->where("{$a}longitude","<>","")
->where("{$a}latitude","<>","")
->where("{$a}longitude","<>","null")
->where("{$a}latitude","<>","null");
}
//排序
switch ($order) {
case "normal": //综合排序(推薦優先)
$selfetch = $selfetch->order("{$a}recommend desc,{$a}hot desc,{$a}new desc,{$a}weigh desc,{$a}start_time desc,{$a}id desc");
break;
case "distance": //距离优先 权重
$selfetch = $selfetch->order("distance asc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
break;
case "hot": //熱門优先
$selfetch = $selfetch->order("{$a}hot desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
break;
case "new": //平台最新优先
$selfetch = $selfetch->order("{$a}new desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
break;
case "selfhot": //机构热门优先
$selfetch = $selfetch->order("{$a}selfhot desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
break;
case "recommend": //推薦优先
$selfetch = $selfetch->order("{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
break;
case "sale": //銷量优先
$selfetch = $selfetch->order("{$a}sale desc,{$a}verification_num desc,{$a}sign_num desc,{$a}recommend desc,{$a}weigh desc");
break;
case "views": //浏览量优先
$selfetch = $selfetch->order("{$a}views desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc");
break;
case "collect": //收藏量优先
$selfetch = $selfetch->order("{$a}collect desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc");
break;
default:
throw new \Exception("不支持的排序类型");
}
if(isset($nearby) && $nearby) {
// throw new \Exception("现版本不支持");
$selfetch = $selfetch->having("distance <= {$nearby}");
}
$selfetch = $selfetch->page($page,$limit)->select();
foreach ($selfetch as $row) {
// $row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('shop')->visible(['name','logo']);
}
$rows = $selfetch;
// $total = $selfetch->total();
//额外附加数据
foreach ($rows as &$row) { //迭代器魔术方法遍历,填值自动引用传值
//设置是否已收藏
$row->is_collect = in_array($row->id,$collect_classes_lib_ids) ? 1 : 0;
if($row->is_collect){
$row["collect"] = Collect::where("user_id",$my_user_id)->where("classes_activity_id",$row->id)->find();
}
// $classes_label_ids = $row['classes_label_ids'];
// $classes_cate_ids = $row['classes_cate_ids'];
// $classes_type_ids = $row['classes_type'];
// $classes_label = $classes_cate = $classes_type = [];
// foreach (explode(",", $classes_label_ids) as $classes_label_id){
// if(isset($label_list[$classes_label_id]))$classes_label[] = $label_list[$classes_label_id];
// }
// foreach (explode(",", $classes_cate_ids) as $classes_cate_id){
// if(isset($cate_list[$classes_cate_id]))$classes_cate[] = $cate_list[$classes_cate_id];
// }
//
// foreach (explode(",", $classes_type_ids) as $classes_type_id){
// if(isset($type_list[$classes_type_id]))$classes_type[] = $type_list[$classes_type_id];
// }
//
//
// $row['classes_label'] = $classes_label;
// $row['classes_cate'] = $classes_cate;
// $row['classes_type_name'] = $classes_type;
}
$result = array("data" => $rows);
return $result;
}
protected $classes_activity_ids = [];
/** 管理的活动ids
* @param $user_id
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getActivityAuthIds($user_id){
//必须是授权过的用户
if(config("site.shop_auth_user_check")){
$auth_shop_ids = UserAuth::where("status" ,1)->where("user_id",$user_id)->column("shop_id");
$shop_where = ["shop_id" ,"in" ,$auth_shop_ids];
}else{
$shop_where = [[]];
}
//核销员有核销全部课程权力
$classes_lib_ids = [];
$shop_id = Verification::where("user_id",$user_id)->where(...$shop_where)->where("status",'1')->value("shop_id");
if($shop_id){
$classes_libids = self::where("shop_id",$shop_id)->column("id");
if($classes_libids)$classes_lib_ids[] = implode(",", $classes_libids);
}
if($classes_lib_ids){
//遍历课程ids
foreach ($classes_lib_ids as $classes_lib_id){
$classes_lib_id_arr = explode(",",$classes_lib_id)?:[];
foreach ($classes_lib_id_arr as $v){
$this->classes_activity_ids[] = $v;
}
}
}
$this->classes_activity_ids = array_unique($this->classes_activity_ids);
return $this->classes_activity_ids;
}
/**设置收藏
* @param $id
* @param int $user_id
* @param int $collect 0取消收藏 1收藏
* @param bool $check
* @param bool $trans
* @throws \Exception
*/
public function collect($id,$user_id,$collect,$oper_type='user',$oper_id=0,$trans=false){
$classes_lib = self::where("id",$id)->find();
if(!$classes_lib)throw new \Exception("找不到活动!");
//判断逻辑
if($trans){
self::beginTrans();
}
try{
//事务逻辑
$where = [
"user_id"=>$user_id,
"classes_activity_id"=>$id,
// "weigh"=>$classes_lib["weigh"],
];
//查询是否已收藏
$res1 = Collect::where($where)->find();
if($collect){
if(!$res1){
$where["weigh"] = $classes_lib["weigh"];
//未收藏,添加收藏
$res1 = new Collect();
$res1->allowField(true)->save($where);
}
self::update_classes($classes_lib["id"]);
//调用事件
$data = ['activity' => $classes_lib,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
\think\Hook::listen('activity_collect_success_after', $data);
}else{
unset($where["weigh"]);
//取消收藏
$res1 = Collect::where($where)->delete();
self::update_classes($classes_lib["id"]);
//调用事件
$data = ['activity' => $classes_lib,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id];
\think\Hook::listen('activity_collect_cancel_after', $data);
}
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage());
}
$where["is_collect"] = $collect;
return $where;
}
public static function update_classes($classes_lib_id){
//更新课程规格库存
$classes_lib = self::get($classes_lib_id);
if($classes_lib){
$classes_lib->sale = Order::where("classes_activity_id",$classes_lib["id"])->where("status","not in",["-3","6"])->count();
//遍历课程课时规格,更新课时统计数据
$specs = $classes_lib->items;
if($specs){
foreach ($specs as $item){
// '已核销人数',
$item->verification_num = Order::where("classes_activity_item_id",$item["id"])->where("status","=","9")->count();
//已报名人数
$item->sign_num = Order::where("classes_activity_item_id",$item["id"])->where("status","not in",["-3","6"])->count();
$item->save();
}
}
//统计课程总报名和总核销
$classes_lib->sign_num = Order::where("classes_activity_id",$classes_lib["id"])->where("status","not in",["-3","6"])->count();
$classes_lib->verification_num = Order::where("classes_activity_id",$classes_lib["id"])->where("status","=","9")->count();
//所有课时加起来
$classes_lib->stock = ActivityItem::where("classes_activity_id",$classes_lib_id)->sum( "limit_num");
//更新课程信息开始和结束时间信息
//课程开始和结束时间等于所有课时的最早开始和最晚结束时间
// $classes_lib->start_time = ClassesSpec::where("classes_lib_id",$classes_lib_id)->min("start_time");
// $classes_lib->end_time = ClassesSpec::where("classes_lib_id",$classes_lib_id)->max("end_time");
//设置课程收藏
$classes_lib->collect = Collect::where("classes_activity_id",$classes_lib_id)->count();
$classes_lib->save();
//将课程信息和课时信息同步到所有已下单的订单信息中
self::orderInfoSync($classes_lib_id);
}
return $classes_lib;
}
public static function orderInfoSync($classes_lib_id){
$classes_lib = self::get($classes_lib_id);
if($classes_lib){
//查询所有课程订单更新课程单信息
$order = \app\common\model\school\classes\activity\order\OrderDetail::where("classes_activity_id",$classes_lib_id)->select();
foreach ($order as $row){
$update = $classes_lib->toArray();
$update_data = $row->checkAssemblyParameters($update,["id","status","createtime","updatetime"]);
$row->save($update_data);
}
//同步更新订单课时信息
$specs = $classes_lib->items;
foreach ($specs as $item){
$hourorders = \app\common\model\school\classes\activity\order\OrderItem::where("classes_activity_item_id",$item->id)->select();
foreach ($hourorders as $hourorder){
$update = $item->toArray();
$update_data = $hourorder->checkAssemblyParameters($update,["id","status","createtime","updatetime"]);
$hourorder->save($update_data);
}
}
}
}
}

View File

@ -74,7 +74,8 @@ class ActivityAuth extends BaseModel
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
}
});
}

View File

@ -3,13 +3,14 @@
namespace app\common\model\school\classes\activity\order;
use app\admin\model\manystore\Shop;
use app\common\model\BaseModel;
use app\common\model\school\classes\activity\Activity;
use app\common\model\dyqc\ManystoreShop;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
class OrderDetail extends Model
class OrderDetail extends BaseModel
{
use SoftDelete;

View File

@ -0,0 +1,119 @@
<?php
namespace app\common\model\school\classes\activity\order;
use app\admin\model\manystore\Shop;
use app\common\model\BaseModel;
use app\manystore\model\Manystore;
use think\Model;
use traits\model\SoftDelete;
class OrderItem extends BaseModel
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_order_item';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'integer';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text',
'sex_text',
'feel_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
if (!$row['weigh']) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
}
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getSexList()
{
return ['1' => __('Sex 1'), '2' => __('Sex 2'), '3' => __('Sex 3')];
}
public function getFeelList()
{
return ['0' => __('Feel 0'), '1' => __('Feel 1')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSexTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sex']) ? $data['sex'] : '');
$list = $this->getSexList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getFeelTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['feel']) ? $data['feel'] : '');
$list = $this->getFeelList();
return isset($list[$value]) ? $list[$value] : '';
}
public function activityorder()
{
return $this->belongsTo(Order::class, 'classes_activity_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function manystore()
{
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function shop()
{
return $this->belongsTo(Shop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function activity()
{
return $this->belongsTo(\app\common\model\school\classes\activity\Activity::class, 'classes_activity_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function item()
{
return $this->belongsTo(\app\common\model\school\classes\activity\ActivityItem::class, 'classes_activity_item_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

@ -2,10 +2,12 @@
namespace app\common\model\school\classes\activity\order;
use app\common\model\BaseModel;
use think\Model;
use traits\model\SoftDelete;
class OrderLog extends Model
class OrderLog extends BaseModel
{
use SoftDelete;
@ -50,4 +52,51 @@ class OrderLog extends Model
{
return $this->belongsTo(Order::class, 'classes_activity_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
/**记录订单日志
* @param $params
* @param bool $trans
* @throws \Exception
*/
public static function log($order,$mark='更新订单状态',$oper_type='user',$oper_id = 0,$trans=false){
if(is_numeric($order)||is_string($order))$order = Order::where('order_no|id|pay_no',$order)->find();
if(!$order)throw new \Exception("找不到订单");
//操作人信息(可扩展)
$data = [
'oper_type'=>$oper_type ?: 'user',
'oper_id'=>$oper_id ?: $order['user_id'],
'remark'=>$mark,
];
//判断逻辑
if($trans){
self::beginTrans();
}
$res = true;
try{
//事务逻辑
$log_data = $order->toArray();
$log_data["classes_activity_order_id"] = $order['id'];
unset($log_data['id']);
unset($log_data['createtime']);
if($mark)$log_data['log_text'] = $mark;
$log_data = array_merge($log_data,$data);
$log = (new self);
$log->allowField(true)->save($log_data);
if($trans){
self::commitTrans();
}
}catch (\Exception $e){
if($trans){
self::rollbackTrans();
}
throw new \Exception($e->getMessage());
}
return $log;
}
}

View File

@ -563,7 +563,7 @@ class Order extends BaseModel
$order_data["classes_lib_id"] = $classes_lib_id;
$order_data["beforeprice"] = $classes_lib_info["price"];
$order_data["totalprice"] = $classes_lib_info["price"];
$order_data["payprice"] = $classes_lib_info["price"];
$order_data["payprice"] = 0;
$order_data["classes_lib_spec_id"] = $param['classes_lib_spec_id'] ?? 0;
$order_data["status"] = '0';
$order_type = "multiple";
@ -1038,24 +1038,24 @@ class Order extends BaseModel
//课程下单时已核销人数更新
$lib = $order->lib;
if($lib){
$lib->sale = self::where("classes_lib_id",$lib["id"])->where("status","<>","-3")->count();
//遍历课程课时规格,更新课时统计数据
$specs = $lib->specs;
if($specs){
foreach ($specs as $spec){
// '已核销人数',
$spec->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec["id"])->where("status","=","3")->count();
//已报名人数
$spec->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec["id"])->where("status","in",["-1","0","3"])->count();
$spec->save();
}
}
//统计课程总报名和总核销
$lib->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","in",["-1","0","3"])->count();
$lib->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","=","3")->count();
$lib->save();
// $lib->sale = self::where("classes_lib_id",$lib["id"])->where("status","<>","-3")->count();
//
// //遍历课程课时规格,更新课时统计数据
// $specs = $lib->specs;
// if($specs){
// foreach ($specs as $spec){
// // '已核销人数',
// $spec->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec["id"])->where("status","=","3")->count();
// //已报名人数
// $spec->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_spec_id",$spec["id"])->where("status","in",["-1","0","3"])->count();
// $spec->save();
// }
//
// }
// //统计课程总报名和总核销
// $lib->sign_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","in",["-1","0","3"])->count();
// $lib->verification_num = \app\common\model\school\classes\hourorder\Order::where("classes_lib_id",$lib["id"])->where("status","=","3")->count();
// $lib->save();
}
@ -1063,7 +1063,7 @@ class Order extends BaseModel
//检测订单完成状态
self::statisticsAndUpdateOrderFinish($order->id);
//将课程信息和课时信息同步到所有已下单的订单信息中
ClassesLib::orderInfoSync($order["classes_lib_id"]);
ClassesLib::update_classes($order["classes_lib_id"]);
//如果有评价执行评价更新
return $order;

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ return [
/**
* CDN地址
*/
'cdnurl' => '',
'cdnurl' => 'https://testy1.hschool.com.cn',
/**
* 文件保存格式
*/

View File

@ -84,7 +84,7 @@ class Activity extends ManystoreBase
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
list($where, $sort, $order, $offset, $limit, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire","has_sign_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
@ -107,10 +107,34 @@ class Activity extends ManystoreBase
$expireWhere = [[]];
}
if (isset($excludearray['has_sign_expire']['value']) && $excludearray['has_sign_expire']['value']) {
$has_expire = $excludearray['has_sign_expire']['value'];
$as = (new \app\common\model\school\classes\activity\Activity)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireSignWhere = [
$as . '.sign_end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireSignWhere = [
$as . '.sign_end_time', '>', time(),
];
break;
default:
}
} else {
$expireSignWhere = [[]];
}
$list = $this->model
->with(['manystore','manystoreshop'])
->where($where)
->where(...$expireWhere)
->where(...$expireSignWhere)
->order($sort, $order)
->paginate($limit);
@ -128,7 +152,7 @@ class Activity extends ManystoreBase
}
protected function update_classes($classes_activity_id){
if($classes_activity_id) \app\common\model\school\classes\activity\Activity::update_classes($classes_activity_id);
}

View File

@ -0,0 +1,80 @@
<?php
namespace app\manystore\controller\school\classes\activity\order;
use app\common\controller\ManystoreBase;
/**
* 课程活动订单项目规格
*
* @icon fa fa-circle-o
*/
class OrderItem extends ManystoreBase
{
/**
* OrderItem模型对象
* @var \app\manystore\model\school\classes\activity\order\OrderItem
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\order\OrderItem;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("sexList", $this->model->getSexList());
$this->view->assign("feelList", $this->model->getFeelList());
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['schoolclassesactivityorder','manystore','manystoreshop','schoolclassesactivity','schoolclassesactivityitem'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesactivityorder')->visible(['order_no','pay_no']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
$row->getRelation('schoolclassesactivity')->visible(['title','headimage']);
$row->getRelation('schoolclassesactivityitem')->visible(['name','price']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -65,8 +65,9 @@ return [
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire' => '活动是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
'OK' => '确认提交审核',
'Has_sign_expire' => '报名是否过期',
];

View File

@ -0,0 +1,38 @@
<?php
return [
'Classes_activity_order_id' => '课程活动订单id',
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'Classes_activity_id' => '课程活动id',
'Classes_activity_item_id' => '课程活动项id',
'Name' => '活动项名称',
'Price' => '项目价格0为免费',
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Status' => '状态',
'Status 1' => '上架',
'Status 2' => '下架',
'Sex' => '性别限制',
'Sex 1' => '男',
'Sex 2' => '女',
'Sex 3' => '男女不限',
'Weigh' => '权重',
'Sign_num' => '已报名人数',
'Verification_num' => '已核销人数',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Feel' => '是否免费',
'Feel 0' => '否',
'Feel 1' => '是',
'Schoolclassesactivityorder.order_no' => '订单号',
'Schoolclassesactivityorder.pay_no' => '微信支付单号',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'Schoolclassesactivity.title' => '标题',
'Schoolclassesactivity.headimage' => '头图',
'Schoolclassesactivityitem.name' => '活动项名称',
'Schoolclassesactivityitem.price' => '项目价格0为免费'
];

View File

@ -475,6 +475,9 @@ class Auth extends ManystoreAuth
}
$v['icon'] = $v['icon'] . ' fa-fw';
$v['url'] = '/' . $module . '/' . $v['name'];
$v['badge'] = isset($badgeList[$v['name']]) ? $badgeList[$v['name']] : '';
$v['py'] = $pinyin->abbr($v['title'], '');
$v['pinyin'] = $pinyin->permalink($v['title'], '');

View File

@ -117,7 +117,7 @@ class ManystoreAuth
parse_str($query, $param); //解析规则中的param
$intersect = array_intersect_assoc($REQUEST, $param);
$rule = preg_replace('/\?.*$/U', '', $rule);
if (in_array($rule, $name) && $intersect == $param) {
if (in_array($rule, $name)) {
//如果节点相符且url参数满足
$list[] = $rule;
}

View File

@ -82,7 +82,8 @@ class ClassesLib extends Model
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
});
}

View File

@ -40,8 +40,25 @@ class Activity extends Model
'expirestatus_text',
'add_type_text',
'has_expire',
'has_sign_expire',
];
public function getHasSignExpireAttr($value, $data)
{
$sign_start_time = (isset($data['sign_start_time']) ? $data['sign_start_time'] : '');
$sign_end_time = (isset($data['sign_end_time']) ? $data['sign_end_time'] : '');
if(!$sign_end_time) return '2';
if( $sign_end_time < time()) {
return '1';
}else{
return '2';
}
}
public function getHasExpireList()
{
return ['1' => __('Has_expire 1'), '2' => __('Has_expire 2')];
@ -66,7 +83,8 @@ class Activity extends Model
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
});
}

View File

@ -68,7 +68,8 @@ class ActivityAuth extends Model
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
// $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => 0]);
});
}

View File

@ -0,0 +1,117 @@
<?php
namespace app\manystore\model\school\classes\activity\order;
use app\admin\model\manystore\Shop;
use app\manystore\model\Manystore;
use app\manystore\model\school\classes\activity\Activity;
use app\manystore\model\school\classes\activity\ActivityItem;
use think\Model;
use traits\model\SoftDelete;
class OrderItem extends Model
{
use SoftDelete;
// 表名
protected $name = 'school_classes_activity_order_item';
// 自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected $deleteTime = 'deletetime';
// 追加属性
protected $append = [
'status_text',
'sex_text',
'feel_text'
];
protected static function init()
{
self::afterInsert(function ($row) {
$pk = $row->getPk();
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
});
}
public function getStatusList()
{
return ['1' => __('Status 1'), '2' => __('Status 2')];
}
public function getSexList()
{
return ['1' => __('Sex 1'), '2' => __('Sex 2'), '3' => __('Sex 3')];
}
public function getFeelList()
{
return ['0' => __('Feel 0'), '1' => __('Feel 1')];
}
public function getStatusTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
$list = $this->getStatusList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getSexTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['sex']) ? $data['sex'] : '');
$list = $this->getSexList();
return isset($list[$value]) ? $list[$value] : '';
}
public function getFeelTextAttr($value, $data)
{
$value = $value ? $value : (isset($data['feel']) ? $data['feel'] : '');
$list = $this->getFeelList();
return isset($list[$value]) ? $list[$value] : '';
}
public function schoolclassesactivityorder()
{
return $this->belongsTo(Order::class, 'classes_activity_order_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function manystore()
{
return $this->belongsTo(Manystore::class, 'manystore_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function manystoreshop()
{
return $this->belongsTo(Shop::class, 'shop_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function schoolclassesactivity()
{
return $this->belongsTo(Activity::class, 'classes_activity_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
public function schoolclassesactivityitem()
{
return $this->belongsTo(ActivityItem::class, 'classes_activity_item_id', 'id', [], 'LEFT')->setEagerlyType(0);
}
}

View File

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

View File

@ -206,11 +206,13 @@
value="{$shop_info.images}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-images"
data-maxcount="6"
class="btn btn-danger plupload cropper" data-input-id="c-images"
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple="true" data-preview-id="p-images"><i
class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-imagess"
data-maxcount="6"
class="btn btn-primary fachoose"
data-input-id="c-images" data-mimetype="image/*"
data-multiple="true"><i
@ -302,12 +304,16 @@
class="form-control" size="50"
name="shop[yyzz_images]" type="text" value="{$shop_info.yyzz_images}">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="plupload-yyzz_images" data-params='{"category":"cert"}'
<span><button type="button" id="plupload-yyzz_images"
data-maxcount="6"
data-params='{"category":"cert"}'
class="btn btn-danger plupload" data-input-id="c-yyzz_images"
data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp"
data-multiple="true" data-preview-id="p-yyzz_images"><i
class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-yyzz_images" data-params='{"category":"cert"}'
<span><button type="button" id="fachoose-yyzz_images"
data-maxcount="6"
data-params='{"category":"cert"}'
class="btn btn-primary fachoose" data-input-id="c-yyzz_images"
data-mimetype="image/*" data-multiple="true"><i
class="fa fa-list"></i> {:__('Choose')}</button></span>

View File

@ -28,8 +28,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>
<span><button type="button" id="faupload-images" data-maxcount="9" 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" data-maxcount="9" 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>
@ -229,42 +229,42 @@
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>
<div class="col-xs-12 col-sm-8">
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<select id="c-recommend" class="form-control selectpicker" name="row[recommend]">
{foreach name="recommendList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- <select id="c-recommend" class="form-control selectpicker" name="row[recommend]">-->
<!-- {foreach name="recommendList" 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">{:__('Hot')}:</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">{:__('Hot')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<select id="c-hot" class="form-control selectpicker" name="row[hot]">
{foreach name="hotList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- <select id="c-hot" class="form-control selectpicker" name="row[hot]">-->
<!-- {foreach name="hotList" 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">{:__('New')}:</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">{:__('New')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<select id="c-new" class="form-control selectpicker" name="row[new]">
{foreach name="newList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- <select id="c-new" class="form-control selectpicker" name="row[new]">-->
<!-- {foreach name="newList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
</div>
</div>
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Selfhot')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -27,8 +27,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>
<span><button type="button" id="faupload-images" data-maxcount="9" 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" data-maxcount="9" 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>
@ -218,42 +218,42 @@
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>
<div class="col-xs-12 col-sm-8">
<!-- <div class="form-group">-->
<!-- <label class="control-label col-xs-12 col-sm-2">{:__('Recommend')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<select id="c-recommend" class="form-control selectpicker" name="row[recommend]">
{foreach name="recommendList" item="vo"}
<option value="{$key}" {in name="key" value="$row.recommend"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- <select id="c-recommend" class="form-control selectpicker" name="row[recommend]">-->
<!-- {foreach name="recommendList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="$row.recommend"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Hot')}:</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">{:__('Hot')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<select id="c-hot" class="form-control selectpicker" name="row[hot]">
{foreach name="hotList" item="vo"}
<option value="{$key}" {in name="key" value="$row.hot"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- <select id="c-hot" class="form-control selectpicker" name="row[hot]">-->
<!-- {foreach name="hotList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="$row.hot"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('New')}:</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">{:__('New')}:</label>-->
<!-- <div class="col-xs-12 col-sm-8">-->
<select id="c-new" class="form-control selectpicker" name="row[new]">
{foreach name="newList" item="vo"}
<option value="{$key}" {in name="key" value="$row.new"}selected{/in}>{$vo}</option>
{/foreach}
</select>
<!-- <select id="c-new" class="form-control selectpicker" name="row[new]">-->
<!-- {foreach name="newList" item="vo"}-->
<!-- <option value="{$key}" {in name="key" value="$row.new"}selected{/in}>{$vo}</option>-->
<!-- {/foreach}-->
<!-- </select>-->
</div>
</div>
<!-- </div>-->
<!-- </div>-->
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Selfhot')}:</label>
<div class="col-xs-12 col-sm-8">

View File

@ -28,8 +28,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>
<span><button type="button" id="faupload-images" data-maxcount="9" 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" data-maxcount="9" 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>

View File

@ -46,8 +46,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>
<span><button type="button" id="faupload-images" data-maxcount="9" 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" data-maxcount="9" 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>

View File

@ -0,0 +1,112 @@
<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">{:__('Classes_activity_order_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_order_id" data-rule="required" data-source="classes/activity/order/index" class="form-control selectpage" name="row[classes_activity_order_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">{:__('Classes_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_item_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_item_id" data-rule="required" data-source="classes/activity/item/index" class="form-control selectpage" name="row[classes_activity_item_id]" type="text" value="">
</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">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
</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">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Age')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-age" class="form-control" name="row[age]" type="text">
</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">{:__('Sex')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-sex" data-rule="required" class="form-control selectpicker" name="row[sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="0">
</div>
</div>
<div class="form-group">
<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">{:__('Feel')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-feel" class="form-control selectpicker" name="row[feel]">
{foreach name="feelList" item="vo"}
<option value="{$key}" {in name="key" value="0"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>

View File

@ -0,0 +1,112 @@
<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">{:__('Classes_activity_order_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_order_id" data-rule="required" data-source="classes/activity/order/index" class="form-control selectpage" name="row[classes_activity_order_id]" type="text" value="{$row.classes_activity_order_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">{:__('Classes_activity_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_id" data-rule="required" data-source="classes/activity/index" class="form-control selectpage" name="row[classes_activity_id]" type="text" value="{$row.classes_activity_id|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Classes_activity_item_id')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-classes_activity_item_id" data-rule="required" data-source="classes/activity/item/index" class="form-control selectpage" name="row[classes_activity_item_id]" type="text" value="{$row.classes_activity_item_id|htmlentities}">
</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">
<input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
</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">{:__('Limit_num')}:</label>
<div class="col-xs-12 col-sm-8">
<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">{:__('Age')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-age" class="form-control" name="row[age]" type="text" value="{$row.age|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="radio">
{foreach name="statusList" item="vo"}
<label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label>
{/foreach}
</div>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Sex')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-sex" data-rule="required" class="form-control selectpicker" name="row[sex]">
{foreach name="sexList" item="vo"}
<option value="{$key}" {in name="key" value="$row.sex"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-weigh" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
</div>
</div>
<div class="form-group">
<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">{:__('Feel')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-feel" class="form-control selectpicker" name="row[feel]">
{foreach name="feelList" item="vo"}
<option value="{$key}" {in name="key" value="$row.feel"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</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-success btn-embossed disabled">{:__('OK')}</button>
<button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
</div>
</div>
</form>

View File

@ -0,0 +1,44 @@
<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/order/order_item/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/order/order_item/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/order/order_item/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('school/classes/activity/order/order_item/multi')?'':'hide'}">
<a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
<ul class="dropdown-menu text-left" role="menu">
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
<li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
</ul>
</div>
<a class="btn btn-success btn-recyclebin btn-dialog {:$auth->check('school/classes/activity/order/order_item/recyclebin')?'':'hide'}" href="school/classes/activity/order/order_item/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/order/order_item/edit')}"
data-operate-del="{:$auth->check('school/classes/activity/order/order_item/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/order/order_item/restore')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/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/order/order_item/destroy')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/destroy" data-action="destroy"><i class="fa fa-times"></i> {:__('Destroy')}</a>
<a class="btn btn-success btn-restoreall {:$auth->check('school/classes/activity/order/order_item/restore')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/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/order/order_item/destroy')?'':'hide'}" href="javascript:;" data-url="school/classes/activity/order/order_item/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/order/order_item/restore')}"
data-operate-destroy="{:$auth->check('school/classes/activity/order/order_item/destroy')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -114,8 +114,8 @@
<div class="input-group">
<input id="c-images" class="form-control" data-rule="required" 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>
<span><button type="button" id="faupload-images" data-maxcount="6" 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" data-maxcount="6" 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>

View File

@ -149,8 +149,8 @@
<div class="input-group">
<input id="c-images" class="form-control" data-rule="required" 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>
<span><button type="button" id="faupload-images" data-maxcount="6" 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" data-maxcount="6" 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>

View File

@ -40,8 +40,8 @@
<div class="input-group">
<input id="c-reject_images" class="form-control" size="50" name="row[reject_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-reject_images" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" class="btn btn-primary fachoose" data-input-id="c-reject_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-reject_images" data-maxcount="6" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" data-maxcount="6" class="btn btn-primary fachoose" data-input-id="c-reject_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-reject_images"></span>
</div>

View File

@ -40,8 +40,8 @@
<div class="input-group">
<input id="c-reject_images" class="form-control" size="50" name="row[reject_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-reject_images" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" class="btn btn-primary fachoose" data-input-id="c-reject_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-reject_images" data-maxcount="6" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" data-maxcount="6" class="btn btn-primary fachoose" data-input-id="c-reject_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-reject_images"></span>
</div>

View File

@ -40,8 +40,8 @@
<div class="input-group">
<input id="c-reject_images" class="form-control" size="50" name="row[reject_images]" type="text">
<div class="input-group-addon no-border no-padding">
<span><button type="button" id="faupload-reject_images" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" class="btn btn-primary fachoose" data-input-id="c-reject_images" data-mimetype="image/*" data-multiple="true"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
<span><button type="button" id="faupload-reject_images" data-maxcount="6" class="btn btn-danger faupload" data-input-id="c-reject_images" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="true" data-preview-id="p-reject_images"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
<span><button type="button" id="fachoose-reject_images" data-maxcount="6" class="btn btn-primary fachoose" data-input-id="c-reject_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-reject_images"></span>
</div>

View File

@ -26,14 +26,14 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text">
<input id="c-name" class="form-control" data-rule="required" name="row[name]" 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">
<input id="c-head_image" class="form-control" data-rule="required" 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>

View File

@ -23,14 +23,14 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
<input id="c-name" class="form-control" name="row[name]" data-rule="required" type="text" value="{$row.name|htmlentities}">
</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" value="{$row.head_image|htmlentities}">
<input id="c-head_image" class="form-control" size="50" data-rule="required" name="row[head_image]" type="text" value="{$row.head_image|htmlentities}">
<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>

View File

@ -36,6 +36,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),"3":__('Status 3')}, formatter: Table.api.formatter.status},
{field: 'has_expire', title: __('Has_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'has_sign_expire', title: __('Has_sign_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费活动'),"1":__('免费活动')}, formatter: Table.api.formatter.normal},
@ -65,7 +67,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
{field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
// {field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
{field: 'add_id', title: __('Add_id')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
@ -355,7 +357,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
}
var activity_auth_url = function (row,dom) {
return 'school/classes/activity/activity_auth/index?classes_activity_id='+row.id;
return 'school/classes/activity/activity_auth/index?classes_activity_id='+row.id ;
}
var activity_url = function (row,dom) {
return 'school/classes/activity/activity_auth/edit/ids/'+row.classes_activity_auth_id;

View File

@ -67,7 +67,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
{field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
// {field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
{field: 'add_id', title: __('Add_id')},
{field: 'admin_id', title: __('Admin_id')},

View File

@ -61,7 +61,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
{field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
// {field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
{field: 'add_id', title: __('Add_id')},
{field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},

View File

@ -0,0 +1,139 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'school/classes/activity/order/order_item/index' + location.search,
add_url: 'school/classes/activity/order/order_item/add',
edit_url: 'school/classes/activity/order/order_item/edit',
del_url: 'school/classes/activity/order/order_item/del',
multi_url: 'school/classes/activity/order/order_item/multi',
import_url: 'school/classes/activity/order/order_item/import',
table: 'school_classes_activity_order_item',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
fixedColumns: true,
fixedRightNumber: 1,
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'classes_activity_order_id', title: __('Classes_activity_order_id')},
{field: 'manystore_id', title: __('Manystore_id')},
{field: 'shop_id', title: __('Shop_id')},
{field: 'classes_activity_id', title: __('Classes_activity_id')},
{field: 'classes_activity_item_id', title: __('Classes_activity_item_id')},
{field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'limit_num', title: __('Limit_num')},
{field: 'age', title: __('Age'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2'),"3":__('Sex 3')}, formatter: Table.api.formatter.normal},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'sign_num', title: __('Sign_num')},
{field: 'verification_num', title: __('Verification_num')},
{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: 'feel', title: __('Feel'), searchList: {"0":__('Feel 0'),"1":__('Feel 1')}, formatter: Table.api.formatter.normal},
{field: 'activityorder.order_no', title: __('Order.order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'activityorder.pay_no', title: __('Order.pay_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'shop.name', title: __('Shop.name'), operate: 'LIKE'},
{field: 'shop.logo', title: __('Shop.logo'), operate: 'LIKE'},
{field: 'activity.title', title: __('Activity.title'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'activity.headimage', title: __('Activity.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'item.name', title: __('Item.name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
{field: 'item.price', title: __('Item.price'), operate:'BETWEEN'},
{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/order/order_item/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), 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/order/order_item/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/order/order_item/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});

View File

@ -38,6 +38,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'has_expire', title: __('Has_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'has_sign_expire', title: __('Has_sign_expire'), searchList: {"1":__('Has_expire 1'),"2":__('Has_expire 2')}, formatter: Table.api.formatter.normal},
{field: 'feel', title: __('是否免费'), searchList: {"0":__('付费活动'),"1":__('免费活动')}, formatter: Table.api.formatter.normal},
@ -68,7 +69,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
{field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
// {field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
{field: 'add_id', title: __('Add_id')},
{field: 'createtime', title: __('Createtime')},

View File

@ -66,7 +66,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
{field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
// {field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
{field: 'add_id', title: __('Add_id')},
{field: 'admin_id', title: __('Admin_id')},

View File

@ -59,7 +59,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'sale', title: __('Sale')},
{field: 'stock', title: __('Stock')},
{field: 'views', title: __('Views')},
{field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
// {field: 'expirestatus', title: __('Expirestatus'), searchList: {"1":__('Expirestatus 1'),"2":__('Expirestatus 2')}, formatter: Table.api.formatter.status},
{field: 'add_type', title: __('Add_type'), searchList: {"1":__('Add_type 1'),"2":__('Add_type 2')}, formatter: Table.api.formatter.normal},
{field: 'add_id', title: __('Add_id')},
{field: 'createtime', title: __('Createtime')},

View File

@ -0,0 +1,136 @@
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'school/classes/activity/order/order_item/index' + location.search,
add_url: 'school/classes/activity/order/order_item/add',
edit_url: 'school/classes/activity/order/order_item/edit',
del_url: 'school/classes/activity/order/order_item/del',
multi_url: 'school/classes/activity/order/order_item/multi',
import_url: 'school/classes/activity/order/order_item/import',
table: 'school_classes_activity_order_item',
}
});
var table = $("#table");
// 初始化表格
table.bootstrapTable({
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'classes_activity_order_id', title: __('Classes_activity_order_id')},
{field: 'manystore_id', title: __('Manystore_id')},
{field: 'shop_id', title: __('Shop_id')},
{field: 'classes_activity_id', title: __('Classes_activity_id')},
{field: 'classes_activity_item_id', title: __('Classes_activity_item_id')},
{field: 'name', title: __('Name'), operate: 'LIKE'},
{field: 'price', title: __('Price'), operate:'BETWEEN'},
{field: 'limit_num', title: __('Limit_num')},
{field: 'age', title: __('Age'), operate: 'LIKE'},
{field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2')}, formatter: Table.api.formatter.status},
{field: 'sex', title: __('Sex'), searchList: {"1":__('Sex 1'),"2":__('Sex 2'),"3":__('Sex 3')}, formatter: Table.api.formatter.normal},
{field: 'weigh', title: __('Weigh'), operate: false},
{field: 'sign_num', title: __('Sign_num')},
{field: 'verification_num', title: __('Verification_num')},
{field: 'createtime', title: __('Createtime')},
{field: 'updatetime', title: __('Updatetime')},
{field: 'feel', title: __('Feel'), searchList: {"0":__('Feel 0'),"1":__('Feel 1')}, formatter: Table.api.formatter.normal},
{field: 'schoolclassesactivityorder.order_no', title: __('Schoolclassesactivityorder.order_no'), operate: 'LIKE'},
{field: 'schoolclassesactivityorder.pay_no', title: __('Schoolclassesactivityorder.pay_no'), operate: 'LIKE'},
{field: 'manystore.nickname', title: __('Manystore.nickname'), operate: 'LIKE'},
{field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
{field: 'manystoreshop.logo', title: __('Manystoreshop.logo'), operate: 'LIKE'},
{field: 'schoolclassesactivity.title', title: __('Schoolclassesactivity.title'), operate: 'LIKE'},
{field: 'schoolclassesactivity.headimage', title: __('Schoolclassesactivity.headimage'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.image},
{field: 'schoolclassesactivityitem.name', title: __('Schoolclassesactivityitem.name'), operate: 'LIKE'},
{field: 'schoolclassesactivityitem.price', title: __('Schoolclassesactivityitem.price'), operate:'BETWEEN'},
{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/order/order_item/recyclebin' + location.search,
pk: 'id',
sortName: 'id',
columns: [
[
{checkbox: true},
{field: 'id', title: __('Id')},
{field: 'name', title: __('Name'), align: 'left'},
{
field: 'deletetime',
title: __('Deletetime'),
operate: 'RANGE',
addclass: 'datetimerange',
formatter: Table.api.formatter.datetime
},
{
field: 'operate',
width: '130px',
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/order/order_item/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/order/order_item/destroy',
refresh: true
}
],
formatter: Table.api.formatter.operate
}
]
]
});
// 为表格绑定事件
Table.api.bindevent(table);
},
add: function () {
Controller.api.bindevent();
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});