api更新

This commit is contained in:
15090180611 2025-01-13 18:03:44 +08:00
parent 823852b0a6
commit a29809b72c
359 changed files with 31763 additions and 59 deletions

View File

@ -0,0 +1,149 @@
<?php
namespace app\admin\controller\manystore;
use app\manystore\model\ManystoreApiAuthRule;
use app\common\controller\Backend;
use fast\Tree;
use think\Cache;
/**
* 规则管理
*
* @icon fa fa-list
* @remark 规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过控制台进行生成规则节点
*/
class Apirule extends Backend
{
/**
* @var \app\manystore\model\ManystoreApiAuthRule
*/
protected $model = null;
protected $rulelist = [];
protected $multiFields = 'ismenu,status';
public function _initialize()
{
parent::_initialize();
$this->model = new ManystoreApiAuthRule();
// 必须将结果集转换为数组
$ruleList = collection($this->model->order('weigh', 'desc')->order('id', 'asc')->select())->toArray();
foreach ($ruleList as $k => &$v) {
$v['title'] = __($v['title']);
$v['remark'] = __($v['remark']);
}
unset($v);
Tree::instance()->init($ruleList);
$this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'title');
$ruledata = [0 => __('None')];
foreach ($this->rulelist as $k => &$v) {
if (!$v['ismenu']) {
continue;
}
$ruledata[$v['id']] = $v['title'];
}
unset($v);
$this->view->assign('ruledata', $ruledata);
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax()) {
$list = $this->rulelist;
$total = count($this->rulelist);
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a", [], 'strip_tags');
if ($params) {
if (!$params['ismenu'] && !$params['pid']) {
$this->error(__('The non-menu rule must have parent'));
}
$result = $this->model->validate()->save($params);
if ($result === false) {
$this->error($this->model->getError());
}
Cache::rm('__menu__');
$this->success();
}
$this->error();
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
$row = $this->model->get(['id' => $ids]);
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a", [], 'strip_tags');
if ($params) {
if (!$params['ismenu'] && !$params['pid']) {
$this->error(__('The non-menu rule must have parent'));
}
if ($params['pid'] != $row['pid']) {
$childrenIds = Tree::instance()->init(collection(ManystoreApiAuthRule::select())->toArray())->getChildrenIds($row['id']);
if (in_array($params['pid'], $childrenIds)) {
$this->error(__('Can not change the parent to child'));
}
}
//这里需要针对name做唯一验证
$ruleValidate = \think\Loader::validate('ManystoreApiAuthRule');
$ruleValidate->rule([
'name' => 'require|format|unique:ManystoreApiAuthRule,name,' . $row->id,
]);
$result = $row->validate()->save($params);
if ($result === false) {
$this->error($row->getError());
}
Cache::rm('__manystore_menu__');
$this->success();
}
$this->error();
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$delIds = [];
foreach (explode(',', $ids) as $k => $v) {
$delIds = array_merge($delIds, Tree::instance()->getChildrenIds($v, true));
}
$delIds = array_unique($delIds);
$count = $this->model->where('id', 'in', $delIds)->delete();
if ($count) {
Cache::rm('__manystore_menu__');
$this->success();
}
}
$this->error();
}
}

View File

@ -15,6 +15,8 @@ use app\common\model\school\classes\Order;
use app\common\model\school\classes\order\OrderDetail;
use app\common\model\school\classes\order\ServiceOrder;
use app\manystore\model\Manystore;
use app\manystore\model\ManystoreApiAuthGroup;
use app\manystore\model\ManystoreApiAuthGroupAccess;
use app\manystore\model\ManystoreLog;
use app\manystore\model\ManystoreShop;
use app\manystore\model\ManystoreAuthGroup;
@ -71,6 +73,7 @@ class Index extends Backend
$this->view->assign("statusList", $this->shopModel->getStatusList());
$this->view->assign("typeList", $this->shopModel->getTypeList());
$this->view->assign("shop_backend_url", config("site.shop_backend_url"));
$this->view->assign("shop_api_backend_url", config("site.shop_api_backend_url"));
$this->getCity();
$this->getAuthMsg();
@ -124,6 +127,53 @@ class Index extends Backend
/**
* 免登录进入机构api版本后台
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function freeapi($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
$this->error("API版本后台正在开发中敬请期待");
// try{
if(isset($param['ids']))$ids = $param['ids'];
// //机构登录
// //如果存在登录,先退出登录
// $auth = \app\manystore\library\Auth::instance();
// if($auth->isLogin()){
// $auth->logout();
// Hook::listen("manystore_logout_after", $this->request);
// }
// //执行登录
// ManystoreLog::setTitle(__('Login'));
// $result = $auth->freelogin($ids, 0);
// if ($result === true) {
// Hook::listen("admin_login_after", $this->request);
// $this->success(__('Login successful'), null, [ 'id' => $auth->id, 'avatar' => $auth->avatar]);
// } else {
// $msg = $auth->getError();
// $msg = $msg ? $msg : __('Username or password is incorrect');
// $this->error($msg, null, ['token' => $this->request->token()]);
// }
//
// }catch (\Exception $e){
// $this->error($e->getMessage());
// }
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
/**
* 查看
@ -485,6 +535,11 @@ class Index extends Backend
if(!$group_id){
throw new \Exception('添加失败');
}
$manystoreApiAuthGroupModel = new ManystoreApiAuthGroup();
$api_group_id = $manystoreApiAuthGroupModel->insertGetId($group);
if(!$api_group_id){
throw new \Exception('添加失败');
}
$manystoreAuthGroupAccessModel = new ManystoreAuthGroupAccess();
$group_access = [];
@ -493,6 +548,14 @@ class Index extends Backend
$manystoreAuthGroupAccessModel->insert($group_access);
$manystoreApiAuthGroupAccessModel = new ManystoreApiAuthGroupAccess();
$group_access = [];
$group_access['uid'] = $this->model->id;
$group_access['group_id'] = $api_group_id;
$manystoreApiAuthGroupAccessModel->insert($group_access);
//调用事件
$data = ['shop' => $this->shopModel];
@ -642,6 +705,10 @@ class Index extends Backend
\app\common\model\school\classes\Verification::where(array('shop_id'=>$row['shop_id']))->delete();
Order::where(array('shop_id'=>$row['shop_id']))->delete();
OrderDetail::where(array('shop_id'=>$row['shop_id']))->delete();
\app\admin\model\school\classes\activity\order\Order::where(array('shop_id'=>$row['shop_id']))->delete();
\app\admin\model\school\classes\activity\order\OrderDetail::where(array('shop_id'=>$row['shop_id']))->delete();
\app\admin\model\school\classes\hour\Order::where(array('shop_id'=>$row['shop_id']))->delete();
ServiceOrder::where(array('shop_id'=>$row['shop_id']))->delete();
$classesLibs = \app\common\model\school\classes\ClassesLib::where(array('shop_id'=>$row['shop_id']))->select();

View File

@ -0,0 +1,20 @@
<?php
return [
'Toggle all' => '显示全部',
'Condition' => '规则条件',
'Remark' => '备注',
'Icon' => '图标',
'Alert' => '警告',
'Name' => '规则',
'Controller/Action' => '控制器名/方法名',
'Ismenu' => '菜单',
'Search icon' => '搜索图标',
'Toggle menu visible' => '点击切换菜单显示',
'Toggle sub menu' => '点击切换子菜单',
'Menu tips' => '父级菜单无需匹配控制器和方法,子级菜单请使用控制器名',
'Node tips' => '控制器/方法名,如果有目录请使用 目录名/控制器名/方法名',
'The non-menu rule must have parent' => '非菜单规则节点必须有父级',
'Can not change the parent to child' => '父组别不能是它的子组别',
'Name only supports letters, numbers, underscore and slash' => 'URL规则只能是小写字母、数字、下划线和/组成',
];

View File

@ -0,0 +1,52 @@
<?php
namespace app\admin\validate;
use think\Validate;
class ManystoreApiAuthRule extends Validate
{
/**
* 正则
*/
protected $regex = ['format' => '[a-z0-9_\/]+'];
/**
* 验证规则
*/
protected $rule = [
'name' => 'require|format|unique:ManystoreApiAuthRule',
'title' => 'require',
];
/**
* 提示消息
*/
protected $message = [
'name.format' => 'URL规则只能是小写字母、数字、下划线和/组成'
];
/**
* 字段描述
*/
protected $field = [
];
/**
* 验证场景
*/
protected $scene = [
];
public function __construct(array $rules = [], $message = [], $field = [])
{
$this->field = [
'name' => __('Name'),
'title' => __('Title'),
];
$this->message['name.format'] = __('Name only supports letters, numbers, underscore and slash');
parent::__construct($rules, $message, $field);
}
}

View File

@ -0,0 +1,52 @@
<?php
namespace app\admin\validate\manystore;
use think\Validate;
class Apirule extends Validate
{
/**
* 正则
*/
protected $regex = ['format' => '[a-z0-9_\/]+'];
/**
* 验证规则
*/
protected $rule = [
'name' => 'require|format|unique:Apirule',
'title' => 'require',
];
/**
* 提示消息
*/
protected $message = [
'name.format' => 'URL规则只能是小写字母、数字、下划线和/组成'
];
/**
* 字段描述
*/
protected $field = [
];
/**
* 验证场景
*/
protected $scene = [
];
public function __construct(array $rules = [], $message = [], $field = [])
{
$this->field = [
'name' => __('Name'),
'title' => __('Title'),
];
$this->message['name.format'] = __('Name only supports letters, numbers, underscore and slash');
parent::__construct($rules, $message, $field);
}
}

View File

@ -0,0 +1,68 @@
<form id="add-form" class="form-horizontal form-ajax" role="form" data-toggle="validator" method="POST" action="">
{:token()}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[pid]', $ruledata, null, ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group">
<label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control" id="name" name="row[name]" data-placeholder-node="{:__('Node tips')}" data-placeholder-menu="{:__('Menu tips')}" value="" data-rule="required" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control" id="title" name="row[title]" value="" data-rule="required" />
</div>
</div>
<div class="form-group">
<label for="icon" class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group input-groupp-md">
<input type="text" class="form-control" id="icon" name="row[icon]" value="fa fa-circle-o" />
<a href="javascript:;" class="btn-search-icon input-group-addon">{:__('Search icon')}</a>
</div>
</div>
</div>
<div class="form-group">
<label for="weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control" id="weigh" name="row[weigh]" value="0" data-rule="required" />
</div>
</div>
<div class="form-group">
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Condition')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea class="form-control" id="condition" name="row[condition]"></textarea>
</div>
</div>
<div class="form-group">
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea class="form-control" id="remark" name="row[remark]"></textarea>
</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">
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')])}
</div>
</div>
<div class="form-group hidden layer-footer">
<div class="col-xs-2"></div>
<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>
{include file="auth/rule/tpl" /}

View File

@ -0,0 +1,68 @@
<form id="edit-form" class="form-horizontal form-ajax" role="form" method="POST" action="">
{:token()}
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Ismenu')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_radios('row[ismenu]', ['1'=>__('Yes'), '0'=>__('No')], $row['ismenu'])}
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Parent')}:</label>
<div class="col-xs-12 col-sm-8">
{:build_select('row[pid]', $ruledata, $row['pid'], ['class'=>'form-control', 'required'=>''])}
</div>
</div>
<div class="form-group">
<label for="name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control" id="name" name="row[name]" data-placeholder-node="{:__('Node tips')}" data-placeholder-menu="{:__('Menu tips')}" value="{$row.name|htmlentities}" data-rule="required" />
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Title')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control" id="title" name="row[title]" value="{$row.title|htmlentities}" data-rule="required" />
</div>
</div>
<div class="form-group">
<label for="icon" class="control-label col-xs-12 col-sm-2">{:__('Icon')}:</label>
<div class="col-xs-12 col-sm-8">
<div class="input-group input-groupp-md">
<input type="text" class="form-control" id="icon" name="row[icon]" value="{$row.icon}" />
<a href="javascript:;" class="btn-search-icon input-group-addon">{:__('Search icon')}</a>
</div>
</div>
</div>
<div class="form-group">
<label for="weigh" class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
<div class="col-xs-12 col-sm-8">
<input type="text" class="form-control" id="weigh" name="row[weigh]" value="{$row.weigh}" data-rule="required" />
</div>
</div>
<div class="form-group">
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Condition')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea class="form-control" id="condition" name="row[condition]">{$row.condition|htmlentities}</textarea>
</div>
</div>
<div class="form-group">
<label for="remark" class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
<div class="col-xs-12 col-sm-8">
<textarea class="form-control" id="remark" name="row[remark]">{$row.remark|htmlentities}</textarea>
</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">
{:build_radios('row[status]', ['normal'=>__('Normal'), 'hidden'=>__('Hidden')], $row['status'])}
</div>
</div>
<div class="form-group hidden layer-footer">
<div class="col-xs-2"></div>
<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>
{include file="auth/rule/tpl" /}

View File

@ -0,0 +1,35 @@
<style>
.bootstrap-table tr td .text-muted {color:#888;}
</style>
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('manystore/apirule/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('manystore/apirule/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('manystore/apirule/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
<div class="dropdown btn-group {:$auth->check('manystore/apirule/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 href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
</div>
<table id="table" class="table table-bordered table-hover"
data-operate-edit="{:$auth->check('manystore/apirule/edit')}"
data-operate-del="{:$auth->check('manystore/apirule/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,43 @@
<style>
#chooseicon {
margin:10px;
}
#chooseicon ul {
margin:5px 0 0 0;
}
#chooseicon ul li{
width:41px;height:42px;
line-height:42px;
border:1px solid #efefef;
padding:1px;
margin:1px;
text-align: center;
font-size:18px;
}
#chooseicon ul li:hover{
border:1px solid #2c3e50;
cursor:pointer;
}
</style>
<script id="chooseicontpl" type="text/html">
<div id="chooseicon">
<div>
<form onsubmit="return false;">
<div class="input-group input-groupp-md">
<div class="input-group-addon">{:__('Search icon')}</div>
<input class="js-icon-search form-control" type="text" placeholder="">
</div>
</form>
</div>
<div>
<ul class="list-inline">
<% for(var i=0; i<iconlist.length; i++){ %>
<li data-font="<%=iconlist[i]%>" data-toggle="tooltip" title="<%=iconlist[i]%>">
<i class="fa fa-<%=iconlist[i]%>"></i>
</li>
<% } %>
</ul>
</div>
</div>
</script>

View File

@ -39,4 +39,6 @@
</div>
<script>
var shop_backend_url = "{$shop_backend_url}";
var shop_api_backend_url = "{$shop_api_backend_url}";
</script>

View File

@ -61,7 +61,7 @@
<div class="widget-body no-padding">
<div id="toolbar2" 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/help/article/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<!-- <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('school/help/article/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/help/article/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/help/article/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>

View File

@ -1,7 +1,13 @@
<?php
namespace app\api\controller;
use addons\epay\library\Service;
use app\common\controller\Api;
use app\common\library\NightSchoolBigData;
use app\common\model\school\classes\order\Order;
use bw\UrlLock;
use think\Cache;
/** 定时任务控制器
* Class Crontab
* @package addons\shopro\controller
@ -18,12 +24,72 @@ class Crontab extends Api
public function day()
{
try{
$res = MockOrder::timeoutCheck(true);
MockOrder::cleanTodayCarNum(true);
$res = Order::timeoutCheck(true);
$res = \app\common\model\school\classes\activity\order\Order::timeoutCheck(true);
//得到近七天的开始结束时间 "start_date","end_date"
$seven_date = NightSchoolBigData::getLastSevenDaysDate();
$seven_days_start_date = $seven_date["start_date"];
$seven_days_end_date = $seven_date["end_date"];
$seven_date = NightSchoolBigData::getLastMonthDate();
$month_start_date = $seven_date["start_date"];
$month_end_date = $seven_date["end_date"];
$seven_date = NightSchoolBigData::getLastDaysDate();
$last_days_start_date = $seven_date["start_date"];
$last_days_end_date = $seven_date["end_date"];
$seven_date = NightSchoolBigData::getLastWeekDate();
$last_week_start_date = $seven_date["start_date"];
$last_week_end_date = $seven_date["end_date"];
//更新画像
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidUserportrait($seven_days_start_date, $seven_days_end_date);
$cacheNmae = 'getWeanalysisAppidUserportrait' . $seven_days_start_date . $seven_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
$res = $weMiniTotal->getWeanalysisAppidUserportrait($last_days_start_date, $last_days_end_date);
$cacheNmae = 'getWeanalysisAppidUserportrait' . $last_days_start_date . $last_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//微信小程序访问页面
$res = $weMiniTotal->getWeanalysisAppidVisitPage($last_days_start_date, $last_days_end_date);
$cacheNmae = 'getWeanalysisAppidVisitPage' . $last_days_start_date . $last_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//月留存
$res = $weMiniTotal->getWeanalysisAppidMonthlyRetaininfo($month_start_date, $month_end_date);
$cacheNmae = 'getWeanalysisAppidMonthlyRetaininfo' . $month_start_date . $month_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//周留存
$res = $weMiniTotal->getWeanalysisAppidWeeklyRetaininfo($last_week_start_date, $last_week_end_date);
$cacheNmae = 'getWeanalysisAppidWeeklyRetaininfo' . $last_week_start_date . $last_week_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//日留存
$res = $weMiniTotal->getWeanalysisAppidDailyRetaininfo($last_days_start_date, $last_days_end_date);
$cacheNmae = 'getWeanalysisAppidDailyRetaininfo' . $last_days_start_date . $last_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//访问分布
$res = $weMiniTotal->getWeanalysisAppidVisitdistribution($last_days_start_date, $last_days_end_date);
$cacheNmae = 'getWeanalysisAppidVisitdistribution' . $last_days_start_date . $last_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//微信小程序月趋势
$res = $weMiniTotal->getWeanalysisAppidMonthlyVisittrend($month_start_date, $month_end_date);
$cacheNmae = 'getWeanalysisAppidMonthlyVisittrend' . $month_start_date . $month_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//微信小程序周趋势
$res = $weMiniTotal->getWeanalysisAppidWeeklyVisittrend($last_week_start_date, $last_week_end_date);
$cacheNmae = 'getWeanalysisAppidWeeklyVisittrend' . $last_week_start_date . $last_week_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//微信小程序访问分析
$res = $weMiniTotal->getWeanalysisAppidDailyVisittrend($last_days_start_date, $last_days_end_date);
$cacheNmae = 'getWeanalysisAppidDailyVisittrend' . $last_days_start_date . $last_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
//微信小程序数据分析
$res = $weMiniTotal->getWeanalysisAppidDailySummarytrend($last_days_start_date, $last_days_end_date);
$cacheNmae = 'getWeanalysisAppidDailySummarytrend' . $last_days_start_date . $last_days_end_date;
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
}catch (\Exception $e){
$this->error("执行失败:".$e->getMessage());
}
$this->success("执行成功:本次取消的模拟单数量【{$res}");
$this->success("执行成功");
}
@ -33,12 +99,16 @@ class Crontab extends Api
public function minute()
{
try{
$lock = new UrlLock(2,"mock-lock-suffix",5,"您的请求过于频繁,请您稍后再试!");
$lock->lock();
var_dump("進入時間:".date("Y-m-d H:i:s "));
sleep(2);
$lock->free();
var_dump("釋放時間:".date("Y-m-d H:i:s "));
$res = Order::timeoutCheck(true);
$res = \app\common\model\school\classes\activity\order\Order::timeoutCheck(true);
// $lock = new UrlLock(2,"mock-lock-suffix",5,"您的请求过于频繁,请您稍后再试!");
// $lock->lock();
// var_dump("進入時間:".date("Y-m-d H:i:s "));
// sleep(2);
// $lock->free();
// var_dump("釋放時間:".date("Y-m-d H:i:s "));
// MockOrder::distributionFailSmsNotice(MockOrder::where("id",438)->find());
//${name},手机号${phone}有${number}圈已被分配到您的${car_number}号车上,请及时查看!
// $event = "distribution_success";
@ -80,6 +150,6 @@ class Crontab extends Api
}catch (\Exception $e){
$this->error("执行失败:".$e->getMessage());
}
$this->success("执行成功");
$this->success("执行成功");
}
}

View File

@ -5,6 +5,7 @@ namespace app\api\controller;
use addons\epay\library\Service;
use app\common\controller\Api;
use app\common\model\style\HomeImages;
use think\Cache;
/**
* 微信工具类接口
@ -208,14 +209,26 @@ class WechatUtil extends Api
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidUserportrait' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidUserportrait($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -236,15 +249,24 @@ class WechatUtil extends Api
public function getWeanalysisAppidVisitPage() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidVisitPage' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidVisitPage($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -266,15 +288,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidMonthlyRetaininfo() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidMonthlyRetaininfo' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidMonthlyRetaininfo($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -297,15 +327,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidWeeklyRetaininfo() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidWeeklyRetaininfo' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidWeeklyRetaininfo($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -326,15 +364,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidDailyRetaininfo() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidDailyRetaininfo' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidDailyRetaininfo($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -356,15 +402,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidVisitdistribution() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidVisitdistribution' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidVisitdistribution($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -385,15 +439,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidMonthlyVisittrend() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidMonthlyVisittrend' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidMonthlyVisittrend($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -415,15 +477,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidWeeklyVisittrend() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidWeeklyVisittrend' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidWeeklyVisittrend($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -444,15 +514,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidDailyVisittrend() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidDailyVisittrend' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidDailyVisittrend($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}
@ -474,15 +552,23 @@ class WechatUtil extends Api
public function getWeanalysisAppidDailySummarytrend() {
$begin_date = $this->request->post('begin_date/s',0);
$end_date = $this->request->post('end_date/s',0);
$cacheNmae = 'getWeanalysisAppidDailySummarytrend' . $begin_date . $begin_date;
try {
// 实例对应的接口对象
$weMiniTotal = new \WeMini\Total(Service::wechatConfig());
$res = $weMiniTotal->getWeanalysisAppidDailySummarytrend($begin_date, $end_date);
// 缓存在3600秒之后过期
Cache::set($cacheNmae, $res, (3600 * 24 * 32));
} catch (\Exception $e){
// Log::log($e->getMessage());
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
$res = Cache::get($cacheNmae);
if($res){
$this->success('生成成功', $res);
}else{
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
}
}
$this->success('生成成功', $res);
}

View File

@ -217,4 +217,132 @@ class BigData extends Api
}
/**
* @ApiTitle(得到七天内日期)
* @ApiSummary(得到七天内日期)
* @ApiParams(name = "time", type = "string",required=false,description = "计算的当前时间戳")
* @ApiMethod(GET)
* @ApiReturn({
"code" => 1,
"msg" => "获取成功",
"data" => {}
*})
*/
public function getLastSevenDaysDate()
{
try{
$lock = new UrlLock(1,"getLastSevenDaysDate-data-lock-suffix",120,"您的请求过于频繁请您稍后再试请求最大锁定间隔5秒/一次!");
$lock->lock();
$N = $this->request->request("time/s",0);
$res = NightSchoolBigData::getLastSevenDaysDate($N);
}catch (\Throwable $e){
$lock->free();
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
$this->error($e->getMessage());
}
$lock->free();
$this->success('返回成功', $res);
}
/**
* @ApiTitle(得到上个月日期)
* @ApiSummary(得到上个月日期)
* @ApiParams(name = "time", type = "string",required=false,description = "计算的当前时间戳")
* @ApiMethod(GET)
* @ApiReturn({
"code" => 1,
"msg" => "获取成功",
"data" => {}
*})
*/
public function getLastMonthDate()
{
try{
$lock = new UrlLock(1,"getLastMonthDate-data-lock-suffix",120,"您的请求过于频繁请您稍后再试请求最大锁定间隔5秒/一次!");
$lock->lock();
$N = $this->request->request("time/s",0);
$res = NightSchoolBigData::getLastMonthDate($N);
}catch (\Throwable $e){
$lock->free();
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
$this->error($e->getMessage());
}
$lock->free();
$this->success('返回成功', $res);
}
/**
* @ApiTitle(得到上个天日期)
* @ApiSummary(得到上个天日期)
* @ApiParams(name = "time", type = "string",required=false,description = "计算的当前时间戳")
* @ApiMethod(GET)
* @ApiReturn({
"code" => 1,
"msg" => "获取成功",
"data" => {}
*})
*/
public function getLastDaysDate()
{
try{
$lock = new UrlLock(1,"getLastDaysDate-data-lock-suffix",120,"您的请求过于频繁请您稍后再试请求最大锁定间隔5秒/一次!");
$lock->lock();
$N = $this->request->request("time/s",0);
$res = NightSchoolBigData::getLastDaysDate($N);
}catch (\Throwable $e){
$lock->free();
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
$this->error($e->getMessage());
}
$lock->free();
$this->success('返回成功', $res);
}
/**
* @ApiTitle(得到上周日期)
* @ApiSummary(得到上周日期)
* @ApiParams(name = "time", type = "string",required=false,description = "计算的当前时间戳")
* @ApiMethod(GET)
* @ApiReturn({
"code" => 1,
"msg" => "获取成功",
"data" => {}
*})
*/
public function getLastWeekDate()
{
try{
$lock = new UrlLock(1,"getLastWeekDate-data-lock-suffix",120,"您的请求过于频繁请您稍后再试请求最大锁定间隔5秒/一次!");
$lock->lock();
$N = $this->request->request("time/s",0);
$res = NightSchoolBigData::getLastWeekDate($N);
}catch (\Throwable $e){
$lock->free();
// file_put_contents("test.txt",$e->getMessage().$e->getFile().$e->getLine());//写入文件,一般做正式环境测试
$this->error($e->getMessage());
}
$lock->free();
$this->success('返回成功', $res);
}
}

View File

@ -0,0 +1,802 @@
<?php
namespace app\common\controller;
use addons\csmtable\library\xcore\xcore\utils\XcAdminSessionUtils;
use app\admin\controller\famysql\Field;
use app\common\library\Virtual;
use app\common\model\dyqc\ManystoreShop;
use app\manystoreapi\library\Auth;
use app\common\model\ManystoreConfig;
use app\manystore\model\Manystore;
use think\Config;
use think\Controller;
use think\Hook;
use think\Lang;
use think\Loader;
use think\Session;
use fast\Tree;
use think\Validate;
/**
* 机构后台api控制器基类
*/
class ManystoreApiBase extends Controller
{
/**
* 无需登录的方法,同时也就不需要鉴权了
* @var array
*/
protected $noNeedLogin = [];
/**
* 无需鉴权的方法,但需要登录
* @var array
*/
protected $noNeedRight = [];
/**
* 布局模板
* @var string
*/
protected $layout = 'default';
/**
* 权限控制类
* @var Auth
*/
protected $auth = null;
/**
* 模型对象
* @var \think\Model
*/
protected $model = null;
/**
* 快速搜索时执行查找的字段
*/
protected $searchFields = 'id';
/**
* 是否是关联查询
*/
protected $relationSearch = false;
/**
* 是否开启Validate验证
*/
protected $modelValidate = false;
/**
* 是否开启模型场景验证
*/
protected $modelSceneValidate = false;
/**
* Multi方法可批量修改的字段
*/
protected $multiFields = 'status';
/**
* Selectpage可显示的字段
*/
protected $selectpageFields = '*';
/**
* 前台提交过来,需要排除的字段数据
*/
protected $excludeFields = "";
/**
* 导入文件首行类型
* 支持comment/name
* 表示注释或字段名
*/
protected $importHeadType = 'comment';
/**
* 判断是否数据关联shop_id
*/
protected $storeIdFieldAutoFill = null;
/**
* 判断是否数据关联store_id
*/
protected $shopIdAutoCondition = null;
/**
* 控制器前置方法
*/
protected $beforeActionList = [
'setShopAutoRelation',
];
protected $qSwitch = false;
protected $qFields = [];
protected $have_auth = false;
protected $need_auth = false;
protected $no_auth_fields = [];
protected function no_auth_fields_check($params,$row){
if($this->no_auth_fields == "*")return $this->have_auth;
foreach ($params as $k=>$v){
//说明数值有变动
//$params[$k] 去掉两端空格
$params[$k] = trim($v);
if($row[$k]!=$params[$k]){
//当修改参数不在允许修改的字段中
if(!in_array($k,$this->no_auth_fields)){
$this->have_auth = true;break;
}
}
}
return $this->have_auth;
}
protected function checkAssemblyParameters(){
if(!$this->qSwitch)return false;
//得到所有get参数
$get = $this->request->get();
//得到当前model所有字段
$fields = $this->model->getTableFields();
// $commonFields = (new Field())->getCommonFields();
// var_dump($commonFields);
$fieldLists = $fields;
// foreach ($commonFields as $commonField) {
// if (!in_array($commonField['column_name'], $fields)) {
// $fieldLists[] = $commonField;
// }
// }
$q_fields = [];
foreach ($get as $kay=>$getField) {
if (in_array($kay, $fieldLists)) {
$q_fields[$kay] = $getField;
}
}
//将q_fields塞入模板中
foreach ($q_fields as $k=>$v) {
//渲染站点配置
$this->assign('q_'.$k, $v);
}
foreach ($this->qFields as $k) {
//渲染站点配置
if(!isset($q_fields[$k]))$this->assign('q_'.$k, "");
}
}
protected function getCity(){
$city_data = Virtual::getNowCity();
//全部参数前缀加 "q_" 塞入模板
$this->assign('q_city', $city_data['city']);
$this->assign('q_area', $city_data['area']);
$this->assign('q_province', $city_data['province']);
$this->assign('q_city_code', $city_data['city_code']);
$this->assign('q_area_code', $city_data['area_code']);
$this->assign('q_province_code', $city_data['province_code']);
$this->assign('q_address_city', $city_data['address_city']);
}
protected $needUrlLock = [];
public function setUrlLock($url_key="",$url_suffix="",$model=null){
if(($this->request->isPost() || (!empty($this->needUrlLock) && in_array($this->request->action(),$this->needUrlLock))) && (!empty($this->model) || $model)){
$user_id = $this->auth->id ?? 0;
// $user = $this->auth->getUser();//登录用户
// if($user)$user_id = $user['id'];
$modulename = $this->request->module();
$controllername = Loader::parseName($this->request->controller());
$actionname = strtolower($this->request->action());
$path = $modulename . '/' . str_replace('.', '/', $controllername) . '/' . $actionname;
if(!$model){
$this->model::$url_lock_key = $url_key ?: $user_id;
$this->model::$url_lock_suffix = $url_suffix ?: $path."lock-suffix";
$this->model::$url_lock = true;
}else{
$model::$url_lock_key = $url_key ?: $user_id;
$model::$url_lock_suffix = $url_suffix ?: $path."lock-suffix";
$model::$url_lock = true;
}
}
}
/**
* 引入后台控制器的traits
*/
use \app\manystore\library\traits\Backend;
public function _initialize()
{
//移除HTML标签
$this->request->filter('trim');
$modulename = $this->request->module();
$controllername = Loader::parseName($this->request->controller());
$actionname = strtolower($this->request->action());
$path = str_replace('.', '/', $controllername) . '/' . $actionname;
// 定义是否Addtabs请求
!defined('IS_ADDTABS') && define('IS_ADDTABS', input("addtabs") ? true : false);
// 定义是否Dialog请求
!defined('IS_DIALOG') && define('IS_DIALOG', input("dialog") ? true : false);
// 定义是否AJAX请求
!defined('IS_AJAX') && define('IS_AJAX', $this->request->isAjax());
$this->auth = Auth::instance();
// 设置当前请求的URI
$this->auth->setRequestUri($path);
// 检测是否需要验证登录
if (!$this->auth->match($this->noNeedLogin)) {
//检测是否登录
if (!$this->auth->isLogin()) {
Hook::listen('manystore_nologin', $this);
$url = Session::get('referer');
$url = $url ? $url : $this->request->url();
if ($url == '/') {
$this->redirect('index/login', [], 302, ['referer' => $url]);
exit;
}
$this->error(__('Please login first'), url('index/login', ['url' => $url]));
}
// 判断是否需要验证权限
if (!$this->auth->match($this->noNeedRight)) {
// 判断控制器和方法判断是否有对应权限
if (!$this->auth->check($path)) {
Hook::listen('manystore_nopermission', $this);
$this->error(__('You have no permission'), '');
}
}
}
if(!defined('SHOP_ID')){
define('SHOP_ID', $this->auth->shop_id);
}
$manystoreShop = ManystoreShop::where("id",$this->auth->shop_id)->find();
if($manystoreShop){
$url = Session::get('referer');
$url = $url ? $url : $this->request->url();
// if($manystoreShop["status"] !=1) {
// $this->error(__('账号正处于审核中,无法进行任何操作!!'), url('index/login', ['url' => $url]));
// }
$manystore = Manystore::where("id",$this->auth->id)->find();
if($manystore) {
if($manystore["status"]!="normal") $this->error(__('账号正处于审核中,无法进行任何操作!!'), url('index/login', ['url' => $url]));
}
}
if(!defined('SHOP_USER_ID')) {
define('SHOP_USER_ID', $manystoreShop->user_id ?? 0);
}
if(!defined('SHOP_AUTH_TYPE_TEXT')) {
define('SHOP_AUTH_TYPE_TEXT', $manystoreShop->type_text ?? "个人认证");
}
if(!defined('STORE_ID')) {
define('STORE_ID', $this->auth->id);
}
// 非选项卡时重定向
if (!$this->request->isPost() && !IS_AJAX && !IS_ADDTABS && !IS_DIALOG && input("ref") == 'addtabs') {
$url = preg_replace_callback("/([\?|&]+)ref=addtabs(&?)/i", function ($matches) {
return $matches[2] == '&' ? $matches[1] : '';
}, $this->request->url());
if (Config::get('url_domain_deploy')) {
if (stripos($url, $this->request->server('SCRIPT_NAME')) === 0) {
$url = substr($url, strlen($this->request->server('SCRIPT_NAME')));
}
$url = url($url, '', false);
}
$this->redirect('index/index', [], 302, ['referer' => $url]);
exit;
}
// 设置面包屑导航数据
$breadcrumb = $this->auth->getBreadCrumb($path);
array_pop($breadcrumb);
$this->view->breadcrumb = $breadcrumb;
// 如果有使用模板布局
if ($this->layout) {
$this->view->engine->layout('layout/' . $this->layout);
}
$manystoreConfig = new ManystoreConfig();
config('manystore_config',$manystoreConfig->manystore_config());
// 语言检测
$lang = $this->request->langset();
$lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
$site = Config::get("site");
$upload = \app\common\model\Config::upload();
// 上传信息配置后
Hook::listen("upload_config_init", $upload);
// 配置信息
$config = [
'site' => array_intersect_key($site, array_flip(['name', 'indexurl', 'cdnurl', 'version', 'timezone', 'languages'])),
'upload' => $upload,
'modulename' => $modulename,
'controllername' => $controllername,
'actionname' => $actionname,
'jsname' => 'manystore/' . str_replace('.', '/', $controllername),
'moduleurl' => rtrim(url("/{$modulename}", '', false), '/'),
'language' => $lang,
'referer' => Session::get("referer"),
'shop_id' => $this->auth->shop_id,
'store_id' => $this->auth->id,
'shop_user_id' => $manystoreShop->user_id ??0,
'auth_type_text' => $manystoreShop->type_text ?? "个人认证",
];
$config = array_merge($config, Config::get("view_replace_str"));
Config::set('upload', array_merge(Config::get('upload'), $upload));
if($this->auth->isLogin()){
$config["manystoretoken"] = $manystore["token"];
$config["clogintoken"] = "";
}
// 配置信息后
Hook::listen("config_init", $config);
//加载当前控制器语言包
$this->loadlang($controllername);
//渲染站点配置
$this->assign('site', $site);
//渲染配置信息
$this->assign('config', $config);
//渲染权限对象
$this->assign('auth', $this->auth);
//渲染管理员对象
$this->assign('manystore', Session::get('manystore'));
$this->assign('shop_id', $this->auth->shop_id);
$this->assign('store_id', $this->auth->id);
$this->assign('shop_user_id', $manystoreShop->user_id ??0 );
$this->assign( 'auth_type_text' , $manystoreShop->type_text ?? "个人认证");
// if(!defined('SHOP_ID')){
// define('SHOP_ID', $this->auth->shop_id);
// }
//
// if(!defined('STORE_ID')) {
// define('STORE_ID', $this->auth->id);
// }
$this->checkAssemblyParameters();
}
/**
* 加载语言文件
* @param string $name
*/
protected function loadlang($name)
{
$name = Loader::parseName($name);
$name = preg_match("/^([a-zA-Z0-9_\.\/]+)\$/i", $name) ? $name : 'index';
$lang = $this->request->langset();
$lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
Lang::load(APP_PATH . $this->request->module() . '/lang/' . $lang . '/' . str_replace('.', '/', $name) . '.php');
}
/**
* 渲染配置信息
* @param mixed $name 键名或数组
* @param mixed $value
*/
protected function assignconfig($name, $value = '')
{
$this->view->config = array_merge($this->view->config ? $this->view->config : [], is_array($name) ? $name : [$name => $value]);
}
/**
* 生成查询所需要的条件,排序方式
* @param mixed $searchfields 快速查询的字段
* @param boolean $relationSearch 是否关联查询
* @return array
*/
protected function buildparams($searchfields = null, $relationSearch = null,$excludefields = [])
{
$searchfields = is_null($searchfields) ? $this->searchFields : $searchfields;
$relationSearch = is_null($relationSearch) ? $this->relationSearch : $relationSearch;
$search = $this->request->get("search", '');
$filter = $this->request->get("filter", '');
$op = $this->request->get("op", '', 'trim');
$sort = $this->request->get("sort", !empty($this->model) && $this->model->getPk() ? $this->model->getPk() : 'id');
$order = $this->request->get("order", "DESC");
$offset = $this->request->get("offset/d", 0);
$limit = $this->request->get("limit/d", 999999);
//新增自动计算页码
$page = $limit ? intval($offset / $limit) + 1 : 1;
if ($this->request->has("page")) {
$page = $this->request->get("page/d", 1);
}
$this->request->get([config('paginate.var_page') => $page]);
$filter = (array)json_decode($filter, true);
$op = (array)json_decode($op, true);
$filter = $filter ? $filter : [];
$where = [];
$alias = [];
$excludearray = [];
$bind = [];
$name = '';
$aliasName = '';
if (!empty($this->model) && $this->relationSearch) {
$name = $this->model->getTable();
$alias[$name] = Loader::parseName(basename(str_replace('\\', '/', get_class($this->model))));
$aliasName = $alias[$name] . '.';
}
$sortArr = explode(',', $sort);
foreach ($sortArr as $index => & $item) {
$item = stripos($item, ".") === false ? $aliasName . trim($item) : $item;
}
unset($item);
$sort = implode(',', $sortArr);
if($this->shopIdAutoCondition){
$where[] = [$aliasName.'shop_id','eq',SHOP_ID];
}
if ($search) {
$searcharr = is_array($searchfields) ? $searchfields : explode(',', $searchfields);
foreach ($searcharr as $k => &$v) {
$v = stripos($v, ".") === false ? $aliasName . $v : $v;
}
unset($v);
$where[] = [implode("|", $searcharr), "LIKE", "%{$search}%"];
}
$index = 0;
foreach ($filter as $k => $v) {
if (!preg_match('/^[a-zA-Z0-9_\-\.]+$/', $k)) {
continue;
}
$sym = isset($op[$k]) ? $op[$k] : '=';
//忽略的查询条件出现在忽略数组中 2022年9月6日18:55:17
if(in_array($k, $excludefields)){
$excludearray[$k]['value'] = $v;
$excludearray[$k]['op'] = $sym;
if (stripos($k, ".") === false) {
$excludearray[$k]['alias'] = $aliasName;
}
unset($filter[$k]);
unset($op[$k]);
continue;
}
if (stripos($k, ".") === false) {
$k = $aliasName . $k;
}
$v = !is_array($v) ? trim($v) : $v;
$sym = strtoupper(isset($op[$k]) ? $op[$k] : $sym);
//null和空字符串特殊处理
if (!is_array($v)) {
if (in_array(strtoupper($v), ['NULL', 'NOT NULL'])) {
$sym = strtoupper($v);
}
if (in_array($v, ['""', "''"])) {
$v = '';
$sym = '=';
}
}
switch ($sym) {
case '=':
case '<>':
$where[] = [$k, $sym, (string)$v];
break;
case 'LIKE':
case 'NOT LIKE':
case 'LIKE %...%':
case 'NOT LIKE %...%':
$where[] = [$k, trim(str_replace('%...%', '', $sym)), "%{$v}%"];
break;
case '>':
case '>=':
case '<':
case '<=':
$where[] = [$k, $sym, intval($v)];
break;
case 'FINDIN':
case 'FINDINSET':
case 'FIND_IN_SET':
$v = is_array($v) ? $v : explode(',', str_replace(' ', ',', $v));
$findArr = array_values($v);
foreach ($findArr as $idx => $item) {
$bindName = "item_" . $index . "_" . $idx;
$bind[$bindName] = $item;
$where[] = "FIND_IN_SET(:{$bindName}, `" . str_replace('.', '`.`', $k) . "`)";
}
break;
case 'IN':
case 'IN(...)':
case 'NOT IN':
case 'NOT IN(...)':
$where[] = [$k, str_replace('(...)', '', $sym), is_array($v) ? $v : explode(',', $v)];
break;
case 'BETWEEN':
case 'NOT BETWEEN':
$arr = array_slice(explode(',', $v), 0, 2);
if (stripos($v, ',') === false || !array_filter($arr)) {
continue 2;
}
//当出现一边为空时改变操作符
if ($arr[0] === '') {
$sym = $sym == 'BETWEEN' ? '<=' : '>';
$arr = $arr[1];
} elseif ($arr[1] === '') {
$sym = $sym == 'BETWEEN' ? '>=' : '<';
$arr = $arr[0];
}
$where[] = [$k, $sym, $arr];
break;
case 'RANGE':
case 'NOT RANGE':
$v = str_replace(' - ', ',', $v);
$arr = array_slice(explode(',', $v), 0, 2);
if (stripos($v, ',') === false || !array_filter($arr)) {
continue 2;
}
//当出现一边为空时改变操作符
if ($arr[0] === '') {
$sym = $sym == 'RANGE' ? '<=' : '>';
$arr = $arr[1];
} elseif ($arr[1] === '') {
$sym = $sym == 'RANGE' ? '>=' : '<';
$arr = $arr[0];
}
$tableArr = explode('.', $k);
if (count($tableArr) > 1 && $tableArr[0] != $name && !in_array($tableArr[0], $alias) && !empty($this->model)) {
//修复关联模型下时间无法搜索的BUG
$relation = Loader::parseName($tableArr[0], 1, false);
$alias[$this->model->$relation()->getTable()] = $tableArr[0];
}
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' TIME', $arr];
break;
case 'NULL':
case 'IS NULL':
case 'NOT NULL':
case 'IS NOT NULL':
$where[] = [$k, strtolower(str_replace('IS ', '', $sym))];
break;
default:
break;
}
$index++;
}
if (!empty($this->model)) {
$this->model->alias($alias);
}
$model = $this->model;
$where = function ($query) use ($where, $alias, $bind, &$model) {
if (!empty($model)) {
$model->alias($alias);
$model->bind($bind);
}
foreach ($where as $k => $v) {
if (is_array($v)) {
call_user_func_array([$query, 'where'], $v);
} else {
$query->where($v);
}
}
};
return [$where, $sort, $order, $offset, $limit, $page, $alias, $bind,$excludearray];
}
/**
* Selectpage的实现方法
*
* 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可
* 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可
*
*/
protected function selectpage()
{
//设置过滤方法
$this->request->filter(['trim', 'strip_tags', 'htmlspecialchars']);
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = (array)$this->request->request("q_word/a");
//当前页
$page = $this->request->request("pageNumber");
//分页大小
$pagesize = $this->request->request("pageSize");
//搜索条件
$andor = $this->request->request("andOr", "and", "strtoupper");
//排序方式
$orderby = (array)$this->request->request("orderBy/a");
//显示的字段
$field = $this->request->request("showField");
//主键
$primarykey = $this->request->request("keyField");
//主键值
$primaryvalue = $this->request->request("keyValue");
//搜索字段
$searchfield = (array)$this->request->request("searchField/a");
//自定义搜索条件
$custom = (array)$this->request->request("custom/a");
//是否返回树形结构
$istree = $this->request->request("isTree", 0);
$ishtml = $this->request->request("isHtml", 0);
if ($istree) {
$word = [];
$pagesize = 999999;
}
$order = [];
foreach ($orderby as $k => $v) {
$order[$v[0]] = $v[1];
}
$field = $field ? $field : 'name';
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue !== null) {
$where = [$primarykey => ['in', $primaryvalue]];
$pagesize = 999999;
} else {
$where = function ($query) use ($word, $andor, $field, $searchfield, $custom) {
$logic = $andor == 'AND' ? '&' : '|';
$searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield;
$searchfield = str_replace(',', $logic, $searchfield);
$word = array_filter(array_unique($word));
if (count($word) == 1) {
$query->where($searchfield, "like", "%" . reset($word) . "%");
} else {
$query->where(function ($query) use ($word, $searchfield) {
foreach ($word as $index => $item) {
$query->whereOr(function ($query) use ($item, $searchfield) {
$query->where($searchfield, "like", "%{$item}%");
});
}
});
}
if ($custom && is_array($custom)) {
foreach ($custom as $k => $v) {
if (is_array($v) && 2 == count($v)) {
$query->where($k, trim($v[0]), $v[1]);
} else {
$query->where($k, '=', $v);
}
}
}
};
}
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = [];
$total = $this->model->where($where)->count();
if ($total > 0) {
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$fields = is_array($this->selectpageFields) ? $this->selectpageFields : ($this->selectpageFields && $this->selectpageFields != '*' ? explode(',', $this->selectpageFields) : []);
//如果有primaryvalue,说明当前是初始化传值,按照选择顺序排序
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
$primaryvalue = implode(',', $primaryvalue);
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
} else {
$this->model->order($order);
}
$datalist = $this->model->where($where)
->page($page, $pagesize)
->select();
foreach ($datalist as $index => $item) {
unset($item['password'], $item['salt']);
if ($this->selectpageFields == '*') {
$result = [
$primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '',
$field => isset($item[$field]) ? $item[$field] : '',
];
} else {
$result = array_intersect_key(($item instanceof Model ? $item->toArray() : (array)$item), array_flip($fields));
}
$result['pid'] = isset($item['pid']) ? $item['pid'] : (isset($item['parent_id']) ? $item['parent_id'] : 0);
$list[] = $result;
}
if ($istree && !$primaryvalue) {
$tree = Tree::instance();
$tree->init(collection($list)->toArray(), 'pid');
$list = $tree->getTreeList($tree->getTreeArray(0), $field);
if (!$ishtml) {
foreach ($list as &$item) {
$item = str_replace('&nbsp;', ' ', $item);
}
unset($item);
}
}
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return json(['list' => $list, 'total' => $total]);
}
/**
* 刷新Token
*/
protected function token()
{
$token = $this->request->post('__token__');
//验证Token
if (!Validate::is($token, "token", ['__token__' => $token])) {
$this->error(__('Token verification error'), '', ['__token__' => $this->request->token()]);
}
//刷新Token
$this->request->token();
}
/**
* 设置商家关联关系
*/
protected function setShopAutoRelation(){
if($this->model){
$fields = $this->model->getQuery()->getTableInfo('','fields');
if(!isset($this->storeIdFieldAutoFill)){
$this->storeIdFieldAutoFill = in_array("store_id",$fields);
}
if(!isset($this->shopIdAutoCondition)){
$this->shopIdAutoCondition = in_array("shop_id",$fields);
}
}
}
}

View File

@ -72,6 +72,7 @@ class NightSchoolBigData extends BaseModel
$types = Type::where("status",'1')->select();
foreach ($types as &$type){
$type["classes_views"] = ClassesLib::where("classes_type",$type["id"])->sum('views');
$type["classes_sign_num"] = ClassesLib::where("classes_type",$type["id"])->sum('sign_num');
$type["classes_num"] = ClassesLib::where("classes_type",$type["id"])->count();
}
@ -214,6 +215,8 @@ class NightSchoolBigData extends BaseModel
$type_data = [];
foreach ($dates as &$time){
//加入时间查询条件
$type_data["activity_sign_num_text"] = "报名人次";
$type_data["activity_num_text"] = "活动热度";
$type_data["activity_sign_num"][] = \app\common\model\school\classes\activity\order\Order::where( "createtime",'between',[$time["start"],$time["end"]])->where("status","not in",["-3","6"])->count();
$type_data["activity_num"][] = Activity::where( "createtime",'between',[$time["start"],$time["end"]])->count();
}
@ -222,4 +225,134 @@ class NightSchoolBigData extends BaseModel
}
public static function getLastSevenDaysDate($time=null){
//如果是非数字,转成时间戳
if ($time &&!is_numeric($time)){
$time = strtotime($time);
}
if(!$time)$time = time();
// var_dump($time);
//时间如果是当天,需要减去一天
if (date("Ymd",$time)==date("Ymd",time())){
$time = strtotime("-1 day",$time);
}
//得到当前是几号
$day = date("d",$time);
//用7进行除余得到余数和整数商
$mod = $day%7;
//进行除7截取整数部分(不需要向下或向上取整!)
$day = $day-$mod;
$last_seven = bcdiv($day,7,0);
//如果=0.取上个月的最后一个七天
if ($last_seven<=0){
//得到上月最后一天 date('Y-m-d H:i');
$last_mouth_last_day = strtotime(date("Y-m-01 00:00:00",$time))-1;
$start_date = date("Ymd",strtotime("-6 days",$last_mouth_last_day));
$end_date = date("Ymd",$last_mouth_last_day);
}
//如果>0,则取本月第$last_seven 个七天
if ($last_seven>0){
$last_seven_days = $last_seven * 7;
$start_date = date("Ymd",strtotime("-6 days",$time));
$end_date = date("Ymd",$time);
// $start_date = date("Ymd",strtotime("+".($last_seven_days-7)." days",strtotime(date("Y-m-01 00:00:00",$time))));
// $end_date = date("Ymd",strtotime("+".($last_seven_days-1)." days",strtotime(date("Y-m-01 00:00:00",$time))));
}
return compact("start_date","end_date");
}
public static function getLastMonthDate($time=null){
//如果是非数字,转成时间戳
if ($time &&!is_numeric($time)){
$time = strtotime($time);
}
if(!$time)$time = time();
// var_dump($time);
//时间如果是当天,需要减去一天
if (date("Ymd",$time)==date("Ymd",time())){
$last_time = strtotime("-1 month",$time);
$start_date = date("Ym01",$last_time);
$last_mouth_last_day = strtotime(date("Y-m-01 00:00:00",$time))-1;
$end_date = date("Ymd",$last_mouth_last_day);
}else{
//如果=0.取上个月的最后一个七天
$start_date = date("Ym01",$time);
$last_time = strtotime("+1 month",$time);
$last_mouth_last_day = strtotime(date("Y-m-01 00:00:00",$last_time))-1;
$end_date = date("Ymd",$last_mouth_last_day);
}
return compact("start_date","end_date");
}
public static function getLastDaysDate($time=null){
//如果是非数字,转成时间戳
if ($time &&!is_numeric($time)){
$time = strtotime($time);
}
if(!$time)$time = time();
// var_dump($time);
//时间如果是当天,需要减去一天
if (date("Ymd",$time)==date("Ymd",time())){
$time = strtotime("-1 day",$time);
}
$start_date = date("Ymd",$time);
$end_date = date("Ymd",$time);
return compact("start_date","end_date");
}
public static function getLastWeekDate($time=null){
//如果是非数字,转成时间戳
if ($time &&!is_numeric($time)){
$time = strtotime($time);
}
if(!$time)$time = time();
// var_dump($time);
if (date("Ymd",$time)==date("Ymd",time())){
$last_time = strtotime("-1 week",$time);
}else{
$last_time = $time;
}
//得到$last_time 的周一日期
$start_date_time = strtotime("-".(date("w",$last_time)-1)." day",$last_time);
$start_date = date("Ymd",$start_date_time);
//得到$last_time 的周日日期
$end_date = date("Ymd", strtotime("+6 days",$start_date_time));
return compact("start_date","end_date");
}
}

View File

@ -126,6 +126,7 @@ class ShopHook
$manystore = Manystore::where("shop_id",$shop["id"])->find();
$mobile = $user['mobile'] ?? "";
$shop_backend_url = config("site.shop_backend_url");
$shop_api_backend_url = config("site.shop_api_backend_url");
$title = "入驻申请通过";
$mini_type = "shop_apply";
@ -156,6 +157,7 @@ class ShopHook
"desc"=>$shop['desc'],
"address"=>$shop["address"]."(".$shop["address_detail"].")",
"shop_backend_url" => $shop_backend_url,
"shop_api_backend_url" => $shop_api_backend_url,
"username"=>$manystore["username"],
"password"=>$password,
];

View File

@ -13,6 +13,8 @@ use app\common\model\school\classes\Verification;
use app\common\model\school\SearchCity;
use app\common\model\User;
use app\manystore\model\Manystore;
use app\manystore\model\ManystoreApiAuthGroup;
use app\manystore\model\ManystoreApiAuthGroupAccess;
use app\manystore\model\ManystoreAuthGroup;
use app\manystore\model\ManystoreAuthGroupAccess;
use fast\Random;
@ -846,8 +848,14 @@ public function creatShop($type,$user_id,$params){
$group['updatetime'] = time();
$group_id = $manystoreAuthGroupModel->insertGetId($group);
if(!$group_id){
$this->error('添加失败');
throw new \Exception('添加失败');
}
$manystoreApiAuthGroupModel = new ManystoreApiAuthGroup();
$api_group_id = $manystoreApiAuthGroupModel->insertGetId($group);
if(!$api_group_id){
throw new \Exception('添加失败');
}
$manystoreAuthGroupAccessModel = new ManystoreAuthGroupAccess();
$group_access = [];
@ -856,6 +864,13 @@ public function creatShop($type,$user_id,$params){
$manystoreAuthGroupAccessModel->insert($group_access);
$manystoreApiAuthGroupAccessModel = new ManystoreApiAuthGroupAccess();
$group_access = [];
$group_access['uid'] = $model->id;
$group_access['group_id'] = $api_group_id;
$manystoreApiAuthGroupAccessModel->insert($group_access);
//调用订单事件
$data = ['shop' => $shop];

View File

@ -115,7 +115,13 @@ class UserAuth extends BaseModel
if(!$classes_lib){
$create = true;
}else{
if(!in_array($classes_lib["status"],[0,2]))throw new \Exception("已授权!");
if(!in_array($classes_lib["status"],[0,2])){
if($status != 1){
throw new \Exception("用户已授权!");
}else{
return $classes_lib;
}
}
}
}
@ -126,6 +132,8 @@ class UserAuth extends BaseModel
if(!$user_info)throw new \Exception("找不到用户!");
if($classes_lib && $classes_lib["user_id"]!=$user_id)throw new \Exception("用户与授权记录不匹配!");
}
if($classes_lib &&$classes_lib["status"] == $status)return $classes_lib;
//判断逻辑
if($trans){
self::beginTrans();

View File

@ -1956,4 +1956,42 @@ class Order extends BaseModel
/**
* 超时检测
*/
public static function timeoutCheck($trans = false){
$count = 0;
$unpaid_order_expire_time = config("site.unpaid_order_expire_time");
if(!$unpaid_order_expire_time)return $count;
$unpaid_order_expire_time = time() - $unpaid_order_expire_time;
//得到所有过期的队列
$list = self::where("status",'in',['0'])->where("createtime","<=",$unpaid_order_expire_time)->select();
if ($trans) {
self::beginTrans();
}
try {
foreach ($list as $order)
{
//取消订单
self::cancel($order["id"],0,false,'admin',0);
$count++;
}
if ($trans) {
self::commitTrans();
}
} catch (\Exception $e) {
if ($trans) {
self::rollbackTrans();
}
throw new \Exception($e->getMessage());
}
return $count;
}
}

View File

@ -1270,4 +1270,42 @@ class Order extends BaseModel
}
/**
* 超时检测
*/
public static function timeoutCheck($trans = false){
$count = 0;
$unpaid_order_expire_time = config("site.unpaid_order_expire_time");
if(!$unpaid_order_expire_time)return $count;
$unpaid_order_expire_time = time() - $unpaid_order_expire_time;
//得到所有过期的队列
$list = self::where("status",'in',['0'])->where("createtime","<=",$unpaid_order_expire_time)->select();
if ($trans) {
self::beginTrans();
}
try {
foreach ($list as $order)
{
//取消订单
self::cancel($order['id'],0,false,'admin',0);
$count++;
}
if ($trans) {
self::commitTrans();
}
} catch (\Exception $e) {
if ($trans) {
self::rollbackTrans();
}
throw new \Exception($e->getMessage());
}
return $count;
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace app\manystore\model;
use think\Model;
class ManystoreApiAuthGroup extends Model
{
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
public function getNameAttr($value, $data)
{
return __($value);
}
}

View File

@ -0,0 +1,10 @@
<?php
namespace app\manystore\model;
use think\Model;
class ManystoreApiAuthGroupAccess extends Model
{
//
}

View File

@ -0,0 +1,29 @@
<?php
namespace app\manystore\model;
use think\Cache;
use think\Model;
class ManystoreApiAuthRule extends Model
{
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
protected static function init()
{
self::afterWrite(function ($row) {
Cache::rm('__manystore_menu__');
});
}
public function getTitleAttr($value, $data)
{
return __($value);
}
}

View File

@ -0,0 +1,13 @@
<?php
namespace app\manystore\behavior;
class ManystoreLog
{
public function run(&$params)
{
if (request()->isPost() && config('fastadmin.auto_record_log')) {
\app\manystore\model\ManystoreLog::record();
}
}
}

View File

@ -0,0 +1,226 @@
<?php
use app\common\model\Category;
use fast\Form;
use fast\Tree;
use think\Db;
if (!function_exists('build_select')) {
/**
* 生成下拉列表
* @param string $name
* @param mixed $options
* @param mixed $selected
* @param mixed $attr
* @return string
*/
function build_select($name, $options, $selected = [], $attr = [])
{
$options = is_array($options) ? $options : explode(',', $options);
$selected = is_array($selected) ? $selected : explode(',', $selected);
return Form::select($name, $options, $selected, $attr);
}
}
if (!function_exists('build_radios')) {
/**
* 生成单选按钮组
* @param string $name
* @param array $list
* @param mixed $selected
* @return string
*/
function build_radios($name, $list = [], $selected = null)
{
$html = [];
$selected = is_null($selected) ? key($list) : $selected;
$selected = is_array($selected) ? $selected : explode(',', $selected);
foreach ($list as $k => $v) {
$html[] = sprintf(Form::label("{$name}-{$k}", "%s {$v}"), Form::radio($name, $k, in_array($k, $selected), ['id' => "{$name}-{$k}"]));
}
return '<div class="radio">' . implode(' ', $html) . '</div>';
}
}
if (!function_exists('build_checkboxs')) {
/**
* 生成复选按钮组
* @param string $name
* @param array $list
* @param mixed $selected
* @return string
*/
function build_checkboxs($name, $list = [], $selected = null)
{
$html = [];
$selected = is_null($selected) ? [] : $selected;
$selected = is_array($selected) ? $selected : explode(',', $selected);
foreach ($list as $k => $v) {
$html[] = sprintf(Form::label("{$name}-{$k}", "%s {$v}"), Form::checkbox($name, $k, in_array($k, $selected), ['id' => "{$name}-{$k}"]));
}
return '<div class="checkbox">' . implode(' ', $html) . '</div>';
}
}
if (!function_exists('build_category_select')) {
/**
* 生成分类下拉列表框
* @param string $name
* @param string $type
* @param mixed $selected
* @param array $attr
* @param array $header
* @return string
*/
function build_category_select($name, $type, $selected = null, $attr = [], $header = [])
{
$tree = Tree::instance();
$tree->init(Category::getCategoryArray($type), 'pid');
$categorylist = $tree->getTreeList($tree->getTreeArray(0), 'name');
$categorydata = $header ? $header : [];
foreach ($categorylist as $k => $v) {
$categorydata[$v['id']] = $v['name'];
}
$attr = array_merge(['id' => "c-{$name}", 'class' => 'form-control selectpicker'], $attr);
return build_select($name, $categorydata, $selected, $attr);
}
}
if (!function_exists('build_toolbar')) {
/**
* 生成表格操作按钮栏
* @param array $btns 按钮组
* @param array $attr 按钮属性值
* @return string
*/
function build_toolbar($btns = null, $attr = [])
{
$auth = \app\manystore\library\Auth::instance();
$controller = str_replace('.', '/', strtolower(think\Request::instance()->controller()));
$btns = $btns ? $btns : ['refresh', 'add', 'edit', 'del', 'import'];
$btns = is_array($btns) ? $btns : explode(',', $btns);
$index = array_search('delete', $btns);
if ($index !== false) {
$btns[$index] = 'del';
}
$btnAttr = [
'refresh' => ['javascript:;', 'btn btn-primary btn-refresh', 'fa fa-refresh', '', __('Refresh')],
'add' => ['javascript:;', 'btn btn-success btn-add', 'fa fa-plus', __('Add'), __('Add')],
'edit' => ['javascript:;', 'btn btn-success btn-edit btn-disabled disabled', 'fa fa-pencil', __('Edit'), __('Edit')],
'del' => ['javascript:;', 'btn btn-danger btn-del btn-disabled disabled', 'fa fa-trash', __('Delete'), __('Delete')],
'import' => ['javascript:;', 'btn btn-info btn-import', 'fa fa-upload', __('Import'), __('Import')],
];
$btnAttr = array_merge($btnAttr, $attr);
$html = [];
foreach ($btns as $k => $v) {
//如果未定义或没有权限
if (!isset($btnAttr[$v]) || ($v !== 'refresh' && !$auth->check("{$controller}/{$v}"))) {
continue;
}
list($href, $class, $icon, $text, $title) = $btnAttr[$v];
//$extend = $v == 'import' ? 'id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"' : '';
//$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '" ' . $extend . '><i class="' . $icon . '"></i> ' . $text . '</a>';
if ($v == 'import') {
$template = str_replace('/', '_', $controller);
$download = '';
if (file_exists("./template/{$template}.xlsx")) {
$download .= "<li><a href=\"/template/{$template}.xlsx\" target=\"_blank\">XLSX模版</a></li>";
}
if (file_exists("./template/{$template}.xls")) {
$download .= "<li><a href=\"/template/{$template}.xls\" target=\"_blank\">XLS模版</a></li>";
}
if (file_exists("./template/{$template}.csv")) {
$download .= empty($download) ? '' : "<li class=\"divider\"></li>";
$download .= "<li><a href=\"/template/{$template}.csv\" target=\"_blank\">CSV模版</a></li>";
}
$download .= empty($download) ? '' : "\n ";
if (!empty($download)) {
$html[] = <<<EOT
<div class="btn-group">
<button type="button" href="{$href}" class="btn btn-info btn-import" title="{$title}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="{$icon}"></i> {$text}</button>
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown" title="下载批量导入模版">
<span class="caret"></span>
<span class="sr-only">Toggle Dropdown</span>
</button>
<ul class="dropdown-menu" role="menu">{$download}</ul>
</div>
EOT;
} else {
$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="' . $icon . '"></i> ' . $text . '</a>';
}
} else {
$html[] = '<a href="' . $href . '" class="' . $class . '" title="' . $title . '"><i class="' . $icon . '"></i> ' . $text . '</a>';
}
}
return implode(' ', $html);
}
}
if (!function_exists('build_heading')) {
/**
* 生成页面Heading
*
* @param string $path 指定的path
* @return string
*/
function build_heading($path = null, $container = true)
{
$title = $content = '';
if (is_null($path)) {
$action = request()->action();
$controller = str_replace('.', '/', request()->controller());
$path = strtolower($controller . ($action && $action != 'index' ? '/' . $action : ''));
}
// 根据当前的URI自动匹配父节点的标题和备注
$data = Db::name('auth_rule')->where('name', $path)->field('title,remark')->find();
if ($data) {
$title = __($data['title']);
$content = __($data['remark']);
}
if (!$content) {
return '';
}
$result = '<div class="panel-lead"><em>' . $title . '</em>' . $content . '</div>';
if ($container) {
$result = '<div class="panel-heading">' . $result . '</div>';
}
return $result;
}
}
if (!function_exists('build_suffix_image')) {
/**
* 生成文件后缀图片
* @param string $suffix 后缀
* @param null $background
* @return string
*/
function build_suffix_image($suffix, $background = null)
{
$suffix = mb_substr(strtoupper($suffix), 0, 4);
$total = unpack('L', hash('adler32', $suffix, true))[1];
$hue = $total % 360;
list($r, $g, $b) = hsv2rgb($hue / 360, 0.3, 0.9);
$background = $background ? $background : "rgb({$r},{$g},{$b})";
$icon = <<<EOT
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path style="fill:#E2E5E7;" d="M128,0c-17.6,0-32,14.4-32,32v448c0,17.6,14.4,32,32,32h320c17.6,0,32-14.4,32-32V128L352,0H128z"/>
<path style="fill:#B0B7BD;" d="M384,128h96L352,0v96C352,113.6,366.4,128,384,128z"/>
<polygon style="fill:#CAD1D8;" points="480,224 384,128 480,128 "/>
<path style="fill:{$background};" d="M416,416c0,8.8-7.2,16-16,16H48c-8.8,0-16-7.2-16-16V256c0-8.8,7.2-16,16-16h352c8.8,0,16,7.2,16,16 V416z"/>
<path style="fill:#CAD1D8;" d="M400,432H96v16h304c8.8,0,16-7.2,16-16v-16C416,424.8,408.8,432,400,432z"/>
<g><text><tspan x="220" y="380" font-size="124" font-family="Verdana, Helvetica, Arial, sans-serif" fill="white" text-anchor="middle">{$suffix}</tspan></text></g>
</svg>
EOT;
return $icon;
}
}

View File

@ -0,0 +1,8 @@
<?php
//配置文件
return [
'url_common_param' => true,
'url_html_suffix' => '',
'controller_auto_search' => true,
];

View File

@ -0,0 +1,288 @@
<?php
namespace app\manystore\controller;
use app\common\controller\ManystoreBase;
use fast\Random;
use think\addons\Service;
use think\Cache;
use think\Config;
use think\Db;
use think\Lang;
/**
* Ajax异步请求接口
* @internal
*/
class Ajax extends ManystoreBase
{
protected $noNeedLogin = ['lang'];
protected $noNeedRight = ['*'];
protected $layout = '';
public function _initialize()
{
parent::_initialize();
//设置过滤方法
$this->request->filter(['strip_tags', 'htmlspecialchars']);
}
/**
* 加载语言包
*/
public function lang()
{
header('Content-Type: application/javascript');
$controllername = input("controllername");
//默认只加载了控制器对应的语言名,你还根据控制器名来加载额外的语言包
$this->loadlang($controllername);
return jsonp(Lang::get(), 200, [], ['json_encode_param' => JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE]);
}
/**
* 上传文件
*/
public function upload()
{
Config::set('default_return_type', 'json');
$file = $this->request->file('file');
if (empty($file)) {
$this->error(__('No file upload or server upload limit exceeded'));
}
//判断是否已经存在附件
$sha1 = $file->hash();
$extparam = $this->request->post();
$upload = Config::get('upload');
preg_match('/(\d+)(\w+)/', $upload['maxsize'], $matches);
$type = strtolower($matches[2]);
$typeDict = ['b' => 0, 'k' => 1, 'kb' => 1, 'm' => 2, 'mb' => 2, 'gb' => 3, 'g' => 3];
$size = (int)$upload['maxsize'] * pow(1024, isset($typeDict[$type]) ? $typeDict[$type] : 0);
$fileInfo = $file->getInfo();
$suffix = strtolower(pathinfo($fileInfo['name'], PATHINFO_EXTENSION));
$suffix = $suffix && preg_match("/^[a-zA-Z0-9]+$/", $suffix) ? $suffix : 'file';
$fileInfo['suffix'] = $suffix;
$mimetypeArr = explode(',', strtolower($upload['mimetype']));
$typeArr = explode('/', $fileInfo['type']);
//禁止上传PHP和HTML文件
if (in_array($fileInfo['type'], ['text/x-php', 'text/html']) || in_array($suffix, ['php', 'html', 'htm', 'phar', 'phtml']) || preg_match("/^php(.*)/i", $fileInfo['suffix'])) {
$this->error(__('Uploaded file format is limited'));
}
//Mimetype值不正确
if (stripos($fileInfo['type'], '/') === false) {
$this->error(__('Uploaded file format is limited'));
}
//验证文件后缀
if ($upload['mimetype'] !== '*' &&
(
!in_array($suffix, $mimetypeArr)
|| (stripos($typeArr[0] . '/', $upload['mimetype']) !== false && (!in_array($fileInfo['type'], $mimetypeArr) && !in_array($typeArr[0] . '/*', $mimetypeArr)))
)
) {
$this->error(__('Uploaded file format is limited'));
}
//验证是否为图片文件
$imagewidth = $imageheight = 0;
if (in_array($fileInfo['type'], ['image/gif', 'image/jpg', 'image/jpeg', 'image/bmp', 'image/png', 'image/webp']) || in_array($suffix, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'webp'])) {
$imgInfo = getimagesize($fileInfo['tmp_name']);
if (!$imgInfo || !isset($imgInfo[0]) || !isset($imgInfo[1])) {
$this->error(__('Uploaded file is not a valid image'));
}
$imagewidth = isset($imgInfo[0]) ? $imgInfo[0] : $imagewidth;
$imageheight = isset($imgInfo[1]) ? $imgInfo[1] : $imageheight;
}
$replaceArr = [
'{year}' => date("Y"),
'{mon}' => date("m"),
'{day}' => date("d"),
'{hour}' => date("H"),
'{min}' => date("i"),
'{sec}' => date("s"),
'{random}' => Random::alnum(16),
'{random32}' => Random::alnum(32),
'{filename}' => $suffix ? substr($fileInfo['name'], 0, strripos($fileInfo['name'], '.')) : $fileInfo['name'],
'{suffix}' => $suffix,
'{.suffix}' => $suffix ? '.' . $suffix : '',
'{filemd5}' => md5_file($fileInfo['tmp_name']),
];
$savekey = $upload['savekey'];
$savekey = str_replace(array_keys($replaceArr), array_values($replaceArr), $savekey);
$uploadDir = substr($savekey, 0, strripos($savekey, '/') + 1);
$fileName = substr($savekey, strripos($savekey, '/') + 1);
//
$splInfo = $file->validate(['size' => $size])->move(ROOT_PATH . '/public' . $uploadDir, $fileName);
$category = request()->post('category');
$category = array_key_exists($category, config('site.attachmentcategory') ?? []) ? $category : '';
if ($splInfo) {
$params = array(
'category' => $category,
'shop_id' => (int)SHOP_ID,
'user_id' => 0,
'filesize' => $fileInfo['size'],
'imagewidth' => $imagewidth,
'imageheight' => $imageheight,
'imagetype' => $suffix,
'imageframes' => 0,
'mimetype' => $fileInfo['type'],
'url' => $uploadDir . $splInfo->getSaveName(),
'uploadtime' => time(),
'storage' => 'local',
'sha1' => $sha1,
'extparam' => json_encode($extparam),
);
$attachment = model("ManystoreAttachment");
$attachment->data(array_filter($params));
$attachment->save();
\think\Hook::listen("upload_after", $attachment);
$this->success(__('Upload successful'), null, [
'url' => $uploadDir . $splInfo->getSaveName()
]);
} else {
// 上传失败获取错误信息
$this->error($file->getError());
}
}
/**
* 通用排序
*/
public function weigh()
{
//排序的数组
$ids = $this->request->post("ids");
//拖动的记录ID
$changeid = $this->request->post("changeid");
//操作字段
$field = $this->request->post("field");
//操作的数据表
$table = $this->request->post("table");
//主键
$pk = $this->request->post("pk");
//排序的方式
$orderway = $this->request->post("orderway", "", 'strtolower');
$orderway = $orderway == 'asc' ? 'ASC' : 'DESC';
$sour = $weighdata = [];
$ids = explode(',', $ids);
$prikey = $pk ? $pk : (Db::name($table)->getPk() ?: 'id');
$pid = $this->request->post("pid");
//限制更新的字段
$field = in_array($field, ['weigh']) ? $field : 'weigh';
// 如果设定了pid的值,此时只匹配满足条件的ID,其它忽略
if ($pid !== '') {
$hasids = [];
$list = Db::name($table)->where($prikey, 'in', $ids)->where('pid', 'in', $pid)->field("{$prikey},pid")->select();
foreach ($list as $k => $v) {
$hasids[] = $v[$prikey];
}
$ids = array_values(array_intersect($ids, $hasids));
}
$list = Db::name($table)->field("$prikey,$field")->where($prikey, 'in', $ids)->order($field, $orderway)->select();
foreach ($list as $k => $v) {
$sour[] = $v[$prikey];
$weighdata[$v[$prikey]] = $v[$field];
}
$position = array_search($changeid, $ids);
$desc_id = $sour[$position]; //移动到目标的ID值,取出所处改变前位置的值
$sour_id = $changeid;
$weighids = array();
$temp = array_values(array_diff_assoc($ids, $sour));
foreach ($temp as $m => $n) {
if ($n == $sour_id) {
$offset = $desc_id;
} else {
if ($sour_id == $temp[0]) {
$offset = isset($temp[$m + 1]) ? $temp[$m + 1] : $sour_id;
} else {
$offset = isset($temp[$m - 1]) ? $temp[$m - 1] : $sour_id;
}
}
$weighids[$n] = $weighdata[$offset];
Db::name($table)->where($prikey, $n)->update([$field => $weighdata[$offset]]);
}
$this->success();
}
/**
* 清空系统缓存
*/
public function wipecache()
{
$type = $this->request->request("type");
switch ($type) {
case 'all':
case 'content':
Cache::clear('ShopCacheTag'.SHOP_ID);
if ($type == 'content')
break;
}
\think\Hook::listen("wipecache_after");
$this->success();
}
/**
* 读取分类数据,联动列表
*/
public function category()
{
$type = $this->request->get('type');
$pid = $this->request->get('pid');
$where = ['status' => 'normal'];
$categorylist = null;
if ($pid !== '') {
if ($type) {
$where['type'] = $type;
}
if ($pid) {
$where['pid'] = $pid;
}
$categorylist = Db::name('category')->where($where)->field('id as value,name')->order('weigh desc,id desc')->select();
}
$this->success('', null, $categorylist);
}
/**
* 读取省市区数据,联动列表
*/
public function area()
{
$params = $this->request->get("row/a");
if (!empty($params)) {
$province = isset($params['province']) ? $params['province'] : '';
$city = isset($params['city']) ? $params['city'] : null;
} else {
$province = $this->request->get('province');
$city = $this->request->get('city');
}
$where = ['pid' => 0, 'level' => 1];
$provincelist = null;
if ($province !== '') {
if ($province) {
$where['pid'] = $province;
$where['level'] = 2;
}
if ($city !== '') {
if ($city) {
$where['pid'] = $city;
$where['level'] = 3;
}
$provincelist = Db::name('area')->where($where)->field('id as value,name')->select();
}
}
$this->success('', null, $provincelist);
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace app\manystore\controller;
use app\common\controller\ManystoreBase;
use think\Config;
/**
* 控制台
*
* @icon fa fa-dashboard
* @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据
*/
class Dashboard extends ManystoreBase
{
/**
* 查看
*/
public function index()
{
$seventtime = \fast\Date::unixtime('day', -7);
$paylist = $createlist = [];
for ($i = 0; $i < 7; $i++)
{
$day = date("Y-m-d", $seventtime + ($i * 86400));
$createlist[$day] = mt_rand(20, 200);
$paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day]));
}
$hooks = config('addons.hooks');
$uploadmode = isset($hooks['upload_config_init']) && $hooks['upload_config_init'] ? implode(',', $hooks['upload_config_init']) : 'local';
$addonComposerCfg = ROOT_PATH . '/vendor/karsonzhang/fastadmin-addons/composer.json';
Config::parse($addonComposerCfg, "json", "composer");
$config = Config::get("composer");
$addonVersion = isset($config['version']) ? $config['version'] : __('Unknown');
$this->view->assign([
'totaluser' => 35200,
'totalviews' => 219390,
'totalorder' => 32143,
'totalorderamount' => 174800,
'todayuserlogin' => 321,
'todayusersignup' => 430,
'todayorder' => 2324,
'unsettleorder' => 132,
'sevendnu' => '80%',
'sevendau' => '32%',
'paylist' => $paylist,
'createlist' => $createlist,
'addonversion' => $addonVersion,
'uploadmode' => $uploadmode
]);
$this->view->assign('check_full',(new \app\common\model\dyqc\ManystoreShop)->checkFull(SHOP_ID));
$this->view->assign('check_full_msg',(new \app\common\model\dyqc\ManystoreShop)->checkFullMsg(SHOP_ID));
return $this->view->fetch();
}
}

View File

@ -0,0 +1,133 @@
<?php
namespace app\manystore\controller;
use app\manystore\model\ManystoreLog;
use app\common\controller\ManystoreBase;
use think\Config;
use think\Hook;
use think\Validate;
/**
* 后台首页
* @internal
*/
class Index extends ManystoreBase
{
protected $noNeedLogin = ['login'];
protected $noNeedRight = ['index', 'logout'];
protected $layout = '';
public function _initialize()
{
parent::_initialize();
//移除HTML标签
$this->request->filter('trim,strip_tags,htmlspecialchars');
}
/**
* 后台首页
*/
public function index()
{
//左侧菜单
$cookieArr = ['adminskin' => "/^skin\-([a-z\-]+)\$/i", 'multiplenav' => "/^(0|1)\$/", 'multipletab' => "/^(0|1)\$/", 'show_submenu' => "/^(0|1)\$/"];
foreach ($cookieArr as $key => $regex) {
$cookieValue = $this->request->cookie($key);
if (!is_null($cookieValue) && preg_match($regex, $cookieValue)) {
config('fastadmin.' . $key, $cookieValue);
}
}
list($menulist, $navlist, $fixedmenu, $referermenu) = $this->auth->getSidebar([
'dashboard' => 'hot',
'addon' => ['new', 'red', 'badge'],
'auth/rule' => __('Menu'),
'general' => ['new', 'purple'],
], $this->view->site['fixedpage']);
$action = $this->request->request('action');
if ($this->request->isPost()) {
if ($action == 'refreshmenu') {
$this->success('', null, ['menulist' => $menulist, 'navlist' => $navlist]);
}
}
$this->assignconfig('cookie', ['prefix' => config('cookie.prefix')]);
$this->view->assign('menulist', $menulist);
$this->view->assign('navlist', $navlist);
$this->view->assign('fixedmenu', $fixedmenu);
$this->view->assign('referermenu', $referermenu);
$this->view->assign('title', __('Home'));
return $this->view->fetch();
}
/**
* 管理员登录
*/
public function login()
{
$url = $this->request->get('url', 'index/index');
if ($this->auth->isLogin()) {
$this->success(__("You've logged in, do not login again"), $url);
}
if ($this->request->isPost()) {
$username = $this->request->post('username');
$password = $this->request->post('password');
$keeplogin = $this->request->post('keeplogin');
$token = $this->request->post('__token__');
$rule = [
'username' => 'require|length:3,30',
'password' => 'require|length:3,30',
'__token__' => 'require|token',
];
$data = [
'username' => $username,
'password' => $password,
'__token__' => $token,
];
// if (Config::get('fastadmin.login_captcha')) {
// $rule['captcha'] = 'require|captcha';
// $data['captcha'] = $this->request->post('captcha');
// }
// $validate = new Validate($rule, [], ['username' => __('Username'), 'password' => __('Password'), 'captcha' => __('Captcha')]);
$validate = new Validate($rule, [], ['username' => __('Username'), 'password' => __('Password')]);
$result = $validate->check($data);
if (!$result) {
$this->error($validate->getError(), $url, ['token' => $this->request->token()]);
}
ManystoreLog::setTitle(__('Login'));
$result = $this->auth->login($username, $password, $keeplogin ? 86400 : 0);
if ($result === true) {
Hook::listen("admin_login_after", $this->request);
$this->success(__('Login successful'), $url, ['url' => $url, 'id' => $this->auth->id, 'username' => $username, 'avatar' => $this->auth->avatar]);
} else {
$msg = $this->auth->getError();
$msg = $msg ? $msg : __('Username or password is incorrect');
$this->error($msg, $url, ['token' => $this->request->token()]);
}
}
// 根据客户端的cookie,判断是否可以自动登录
if ($this->auth->autologin()) {
$this->redirect($url);
}
$background = Config::get('fastadmin.login_background');
$background = stripos($background, 'http') === 0 ? $background : config('site.cdnurl') . $background;
$this->view->assign('background', $background);
$this->view->assign('title', __('Login'));
Hook::listen("admin_login_init", $this->request);
return $this->view->fetch();
}
/**
* 注销登录
*/
public function logout()
{
$this->auth->logout();
Hook::listen("manystore_logout_after", $this->request);
$this->success(__('Logout successful'), 'index/login');
}
}

View File

@ -0,0 +1,299 @@
<?php
namespace app\manystore\controller\auth;
use app\manystore\model\ManystoreAuthGroup;
use app\common\controller\ManystoreBase;
use fast\Tree;
/**
* 角色组
*
* @icon fa fa-group
* @remark 角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别下级的角色组或管理员
*/
class Group extends ManystoreBase
{
/**
* @var \app\manystore\model\AuthGroup
*/
protected $model = null;
//当前登录管理员所有子组别
protected $childrenGroupIds = [];
//当前组别列表数据
protected $groupdata = [];
//无需要权限判断的方法
protected $noNeedRight = ['roletree'];
public function _initialize()
{
parent::_initialize();
$this->model = model('ManystoreAuthGroup');
$this->childrenGroupIds = $this->auth->getChildrenGroupIds(true);
$groupList = collection(ManystoreAuthGroup::where('id', 'in', $this->childrenGroupIds)->select())->toArray();
Tree::instance()->init($groupList);
$result = [];
if ($this->auth->isSuperAdmin()) {
$result = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0));
} else {
$groups = $this->auth->getGroups();
foreach ($groups as $m => $n) {
$result = array_merge($result, Tree::instance()->getTreeList(Tree::instance()->getTreeArray($n['pid'])));
}
}
$groupName = [];
foreach ($result as $k => $v) {
$groupName[$v['id']] = $v['name'];
}
$this->groupdata = $groupName;
$this->assignconfig("admin", ['id' => $this->auth->id, 'group_ids' => $this->auth->getGroupIds()]);
$this->view->assign('groupdata', $this->groupdata);
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax()) {
$list = ManystoreAuthGroup::all(array_keys($this->groupdata));
$list = collection($list)->toArray();
$groupList = [];
foreach ($list as $k => $v) {
$groupList[$v['id']] = $v;
}
$list = [];
foreach ($this->groupdata as $k => $v) {
if (isset($groupList[$k])) {
$groupList[$k]['name'] = $v;
$list[] = $groupList[$k];
}
}
$total = count($list);
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a", [], 'strip_tags');
$params['shop_id'] = SHOP_ID;
$params['rules'] = explode(',', $params['rules']);
if (!in_array($params['pid'], $this->childrenGroupIds)) {
$this->error(__('The parent group can not be its own child'));
}
$parentmodel = model("ManystoreAuthGroup")->get($params['pid']);
if (!$parentmodel) {
$this->error(__('The parent group can not found'));
}
// 父级别的规则节点
$parentrules = explode(',', $parentmodel->rules);
// 当前组别的规则节点
$currentrules = $this->auth->getRuleIds();
$rules = $params['rules'];
// 如果父组不是超级管理员则需要过滤规则节点,不能超过父组别的权限
$rules = in_array('*', $parentrules) ? $rules : array_intersect($parentrules, $rules);
// 如果当前组别不是超级管理员则需要过滤规则节点,不能超当前组别的权限
$rules = in_array('*', $currentrules) ? $rules : array_intersect($currentrules, $rules);
$params['rules'] = implode(',', $rules);
if ($params) {
$result = $this->model->create($params);
if($result){
$this->success();
}else{
$this->error();
}
}
$this->error();
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
$row = $this->model->get(['id' => $ids,'shop_id'=>SHOP_ID]);
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a", [], 'strip_tags');
// 父节点不能是它自身的子节点
if (!in_array($params['pid'], $this->childrenGroupIds)) {
$this->error(__('The parent group can not be its own child'));
}
$params['rules'] = explode(',', $params['rules']);
$parentmodel = model("ManystoreAuthGroup")->get($params['pid']);
if (!$parentmodel) {
$this->error(__('The parent group can not found'));
}
// 父级别的规则节点
$parentrules = explode(',', $parentmodel->rules);
// 当前组别的规则节点
$currentrules = $this->auth->getRuleIds();
$rules = $params['rules'];
// 如果父组不是超级管理员则需要过滤规则节点,不能超过父组别的权限
$rules = in_array('*', $parentrules) ? $rules : array_intersect($parentrules, $rules);
// 如果当前组别不是超级管理员则需要过滤规则节点,不能超当前组别的权限
$rules = in_array('*', $currentrules) ? $rules : array_intersect($currentrules, $rules);
$params['rules'] = implode(',', $rules);
if ($params) {
$row->save($params);
$this->success();
}
$this->error();
return;
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$ids = explode(',', $ids);
$grouplist = $this->auth->getGroups();
$group_ids = array_map(function ($group) {
return $group['id'];
}, $grouplist);
// 移除掉当前管理员所在组别
$ids = array_diff($ids, $group_ids);
// 循环判断每一个组别是否可删除
$grouplist = $this->model->where('id', 'in', $ids)->where(array('shop_id'=>SHOP_ID))->select();
$groupaccessmodel = model('ManystoreAuthGroupAccess');
foreach ($grouplist as $k => $v) {
// 当前组别下有管理员
$groupone = $groupaccessmodel->get(['group_id' => $v['id']]);
if ($groupone) {
$ids = array_diff($ids, [$v['id']]);
continue;
}
// 当前组别下有子组别
$groupone = $this->model->get(['pid' => $v['id']]);
if ($groupone) {
$ids = array_diff($ids, [$v['id']]);
continue;
}
}
if (!$ids) {
$this->error(__('You can not delete group that contain child group and administrators'));
}
$count = $this->model->where('id', 'in', $ids)->delete();
if ($count) {
$this->success();
}
}
$this->error();
}
/**
* 批量更新
* @internal
*/
public function multi($ids = "")
{
// 组别禁止批量操作
$this->error();
}
/**
* 读取角色权限树
*
* @internal
*/
public function roletree()
{
$this->loadlang('auth/group');
$model = model('ManystoreAuthGroup');
$id = $this->request->post("id");
$pid = $this->request->post("pid");
$parentGroupModel = $model->get($pid);
$currentGroupModel = null;
if ($id) {
$currentGroupModel = $model->get($id);
}
if (($pid || $parentGroupModel) && (!$id || $currentGroupModel)) {
$id = $id ? $id : null;
$ruleList = collection(model('ManystoreAuthRule')->order('weigh', 'desc')->order('id', 'asc')->select())->toArray();
//读取父类角色所有节点列表
$parentRuleList = [];
if (in_array('*', explode(',', $parentGroupModel->rules))) {
$parentRuleList = $ruleList;
} else {
$parentRuleIds = explode(',', $parentGroupModel->rules);
foreach ($ruleList as $k => $v) {
if (in_array($v['id'], $parentRuleIds)) {
$parentRuleList[] = $v;
}
}
}
$ruleTree = new Tree();
$groupTree = new Tree();
//当前所有正常规则列表
$ruleTree->init($parentRuleList);
//角色组列表
$groupTree->init(collection(model('ManystoreAuthGroup')->where(array('shop_id'=>SHOP_ID))->where('id', 'in', $this->childrenGroupIds)->select())->toArray());
//读取当前角色下规则ID集合
$adminRuleIds = $this->auth->getRuleIds();
//是否是超级管理员
$superadmin = $this->auth->isSuperAdmin();
//当前拥有的规则ID集合
$currentRuleIds = $id ? explode(',', $currentGroupModel->rules) : [];
if (!$id || !in_array($pid, $this->childrenGroupIds) || !in_array($pid, $groupTree->getChildrenIds($id, true))) {
$parentRuleList = $ruleTree->getTreeList($ruleTree->getTreeArray(0), 'name');
$hasChildrens = [];
foreach ($parentRuleList as $k => $v) {
if ($v['haschild']) {
$hasChildrens[] = $v['id'];
}
}
$parentRuleIds = array_map(function ($item) {
return $item['id'];
}, $parentRuleList);
$nodeList = [];
foreach ($parentRuleList as $k => $v) {
if (!$superadmin && !in_array($v['id'], $adminRuleIds)) {
continue;
}
if ($v['pid'] && !in_array($v['pid'], $parentRuleIds)) {
continue;
}
$state = array('selected' => in_array($v['id'], $currentRuleIds) && !in_array($v['id'], $hasChildrens));
$nodeList[] = array('id' => $v['id'], 'parent' => $v['pid'] ? $v['pid'] : '#', 'text' => __($v['title']), 'type' => 'menu', 'state' => $state);
}
$this->success('', null, $nodeList);
} else {
$this->error(__('Can not change the parent to child'));
}
} else {
$this->error(__('Group not found'));
}
}
}

View File

@ -0,0 +1,264 @@
<?php
namespace app\manystore\controller\auth;
use app\manystore\model\ManystoreAuthGroup;
use app\manystore\model\ManystoreAuthGroupAccess;
use app\common\controller\ManystoreBase;
use fast\Random;
use fast\Tree;
use think\Validate;
/**
* 管理员管理
*
* @icon fa fa-users
* @remark 一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成
*/
class Manystore extends ManystoreBase
{
/**
* @var \app\manystore\model\Manystore
*/
protected $model = null;
protected $childrenGroupIds = [];
protected $childrenAdminIds = [];
public function _initialize()
{
parent::_initialize();
$this->model = model('Manystore');
$this->childrenAdminIds = $this->auth->getChildrenAdminIds(true);
$this->childrenGroupIds = $this->auth->getChildrenGroupIds(true);
$groupList = collection(ManystoreAuthGroup::where('id', 'in', $this->childrenGroupIds)->where(array('shop_id'=>SHOP_ID))->select())->toArray();
Tree::instance()->init($groupList);
$groupdata = [];
if ($this->auth->isSuperAdmin()) {
$result = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0));
foreach ($result as $k => $v) {
$groupdata[$v['id']] = $v['name'];
}
} else {
$result = [];
$groups = $this->auth->getGroups();
foreach ($groups as $m => $n) {
$childlist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray($n['id']));
$temp = [];
foreach ($childlist as $k => $v) {
$temp[$v['id']] = $v['name'];
}
$result[__($n['name'])] = $temp;
}
$groupdata = $result;
}
$this->view->assign('groupdata', $groupdata);
$this->assignconfig("manystore", ['id' => STORE_ID]);
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
$this->storePidAutoCondition = false;
$childrenGroupIds = $this->childrenGroupIds;
$groupName = ManystoreAuthGroup::where('id', 'in', $childrenGroupIds)->where(array('shop_id'=>SHOP_ID))
->column('id,name');
$authGroupList = ManystoreAuthGroupAccess::where('group_id', 'in', $childrenGroupIds)
->field('uid,group_id')
->select();
$adminGroupName = [];
foreach ($authGroupList as $k => $v) {
if (isset($groupName[$v['group_id']])) {
$adminGroupName[$v['uid']][$v['group_id']] = $groupName[$v['group_id']];
}
}
$groups = $this->auth->getGroups();
foreach ($groups as $m => $n) {
$adminGroupName[$this->auth->id][$n['id']] = $n['name'];
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->where('id', 'in', $this->childrenAdminIds)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->where('id', 'in', $this->childrenAdminIds)
->field(['password', 'salt', 'token'], true)
->order($sort, $order)
->limit($offset, $limit)
->select();
foreach ($list as $k => &$v) {
$groups = isset($adminGroupName[$v['id']]) ? $adminGroupName[$v['id']] : [];
$v['groups'] = implode(',', array_keys($groups));
$v['groups_text'] = implode(',', array_values($groups));
}
unset($v);
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a");
if ($params) {
if (!Validate::is($params['password'], '\S{6,16}')) {
$this->error(__("Please input correct password"));
}
$params['shop_id'] = SHOP_ID;
$params['salt'] = Random::alnum();
$params['password'] = md5(md5($params['password']) . $params['salt']);
$params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。
$result = $this->model->validate('Manystore.add')->save($params);
if ($result === false) {
$this->error($this->model->getError());
}
$group = $this->request->post("group/a");
//过滤不允许的组别,避免越权
$group = array_intersect($this->childrenGroupIds, $group);
$dataset = [];
foreach ($group as $value) {
$dataset[] = ['uid' => $this->model->id, 'group_id' => $value];
}
model('ManystoreAuthGroupAccess')->saveAll($dataset);
$this->success();
}
$this->error();
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
$row = $this->model->get(['id' => $ids,'shop_id'=>SHOP_ID]);
if (!$row) {
$this->error(__('No Results were found'));
}
if (!in_array($row->id, $this->childrenAdminIds)) {
$this->error(__('You have no permission'));
}
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a");
if ($params) {
if ($params['password']) {
if (!Validate::is($params['password'], '\S{6,16}')) {
$this->error(__("Please input correct password"));
}
$params['salt'] = Random::alnum();
$params['password'] = md5(md5($params['password']) . $params['salt']);
} else {
unset($params['password'], $params['salt']);
}
//这里需要针对username和email做唯一验证
$manystoreValidate = \think\Loader::validate('Manystore');
$manystoreValidate->rule([
'username' => 'require|regex:\w{3,12}|unique:manystore,username,' . $row->id,
'email' => 'require|email|unique:manystore,email,' . $row->id,
'password' => 'regex:\S{32}',
]);
$result = $row->validate('Manystore.edit')->save($params);
if ($result === false) {
$this->error($row->getError());
}
// 先移除所有权限
model('ManystoreAuthGroupAccess')->where('uid', $row->id)->delete();
$group = $this->request->post("group/a");
// 过滤不允许的组别,避免越权
$group = array_intersect($this->childrenGroupIds, $group);
$dataset = [];
foreach ($group as $value) {
$dataset[] = ['uid' => $row->id, 'group_id' => $value];
}
model('ManystoreAuthGroupAccess')->saveAll($dataset);
$this->success();
}
$this->error();
}
$grouplist = $this->auth->getGroups($row['id']);
$groupids = [];
foreach ($grouplist as $k => $v) {
$groupids[] = $v['id'];
}
$this->view->assign("row", $row);
$this->view->assign("groupids", $groupids);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$ids = array_intersect($this->childrenAdminIds, array_filter(explode(',', $ids)));
// 避免越权删除管理员
$adminList = $this->model->where('id', 'in', $ids)->where(array('shop_id'=>SHOP_ID))->select();
if ($adminList) {
$deleteIds = [];
foreach ($adminList as $k => $v) {
$deleteIds[] = $v->id;
}
$deleteIds = array_values(array_diff($deleteIds, [$this->auth->id]));
if ($deleteIds) {
$this->model->destroy($deleteIds);
model('ManystoreAuthGroupAccess')->where('uid', 'in', $deleteIds)->delete();
$this->success();
}
}
}
$this->error(__('You have no permission'));
}
/**
* 批量更新
* @internal
*/
public function multi($ids = "")
{
// 管理员禁止批量操作
$this->error();
}
/**
* 下拉搜索
*/
public function selectpage()
{
$this->dataLimit = 'auth';
$this->dataLimitField = 'id';
return parent::selectpage();
}
}

View File

@ -0,0 +1,134 @@
<?php
namespace app\manystore\controller\auth;
use app\manystore\model\ManystoreAuthGroup;
use app\common\controller\ManystoreBase;
/**
* 管理员日志
*
* @icon fa fa-users
* @remark 管理员可以查看自己所拥有的权限的管理员日志
*/
class Manystorelog extends ManystoreBase
{
/**
* @var \app\manystore\model\ManystoreLog
*/
protected $model = null;
protected $childrenGroupIds = [];
protected $childrenAdminIds = [];
public function _initialize()
{
parent::_initialize();
$this->model = model('ManystoreLog');
$this->childrenAdminIds = $this->auth->getChildrenAdminIds(true);
$this->childrenGroupIds = $this->auth->getChildrenGroupIds($this->auth->isSuperAdmin() ? true : false);
$groupName = ManystoreAuthGroup::where('id', 'in', $this->childrenGroupIds)
->column('id,name');
$this->view->assign('groupdata', $groupName);
}
/**
* 查看
*/
public function index()
{
if ($this->request->isAjax())
{
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $this->model
->where($where)
->order($sort, $order)
->count();
$list = $this->model
->where($where)
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
/**
* 详情
*/
public function detail($ids)
{
$row = $this->model->field('store_id,shop_id',true)->where(['id' => $ids,'shop_id'=>SHOP_ID])->find();
if (!$row)
$this->error(__('No Results were found'));
$this->view->assign("row", $row->toArray());
return $this->view->fetch();
}
/**
* 添加
* @internal
*/
public function add()
{
$this->error();
}
/**
* 编辑
* @internal
*/
public function edit($ids = NULL)
{
$this->error();
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids)
{
$adminList = $this->model->where('id', 'in', $ids)->where(array('shop_id'=>SHOP_ID))->select();
if ($adminList)
{
$deleteIds = [];
foreach ($adminList as $k => $v)
{
$deleteIds[] = $v->id;
}
if ($deleteIds)
{
$this->model->destroy($deleteIds);
$this->success();
}
}
}
$this->error();
}
/**
* 批量更新
* @internal
*/
public function multi($ids = "")
{
// 管理员禁止批量操作
$this->error();
}
public function selectpage()
{
return parent::selectpage();
}
}

View File

@ -0,0 +1,325 @@
<?php
namespace app\manystore\controller\csmtable;
use think\App;
use app\common\controller\Backend;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use addons\csmtable\library\xcore\xcore\utils\XcRequestUtils;
use addons\csmtable\library\xapp\csmtable\utils\CsmTableUtils;
class Cligenerateexcel extends Backend
{
private $xlstask = null;
private $uploadtmppath = RUNTIME_PATH . 'temp' . DS;
public function _initialize()
{
parent::_initialize();
$this->xlstask = new \app\admin\model\csmtable\Xlstask();
}
/**
* http://127.0.0.1/fastadmin_plugin_csmmeet/public/q3HJDu2RgE.php/csmtable/cligenerateexcel/index
*/
public function index()
{
static::p('----generateExcelByClassname begin:');
set_time_limit(0);
$csmtable_xlstask_id = $this->request->request("csmtable_xlstask_id");
$pp = $this->request->request("params");
static::p($pp);
static::p($csmtable_xlstask_id);
$csmtable_xlstask_id = 119;
$pp = '{"search":null,"filter":"{}","op":"{}","sort":"weigh","order":"desc","offset":"0","limit":"10","csmtable_classname":"app\/admin\/controller\/fa\/Test","csmtable_methodname":"index","csmtable_columns":"[{\"field\":\"id\",\"title\":\"ID\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"title\",\"title\":\"\u6807\u9898\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"admin_id\",\"title\":\"\u7ba1\u7406\u5458ID\",\"datasource\":\"auth\/admin\",\"datafield\":\"nickname\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"category_id\",\"title\":\"\u5206\u7c7bID(\u5355\u9009)\",\"datasource\":\"category\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"category_ids\",\"title\":\"\u5206\u7c7bID(\u591a\u9009)\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"week\",\"title\":\"\u661f\u671f(\u5355\u9009)\",\"formatter\":\"\",\"searchList\":{\"monday\":\"\u661f\u671f\u4e00\",\"tuesday\":\"\u661f\u671f\u4e8c\",\"wednesday\":\"\u661f\u671f\u4e09\"},\"operate\":\"=\"},{\"field\":\"flag\",\"title\":\"\u6807\u5fd7(\u591a\u9009)\",\"formatter\":\"\",\"searchList\":{\"hot\":\"\u70ed\u95e8\",\"index\":\"\u9996\u9875\",\"recommend\":\"\u63a8\u8350\"},\"operate\":\"FIND_IN_SET\"},{\"field\":\"genderdata\",\"title\":\"\u6027\u522b(\u5355\u9009)\",\"formatter\":\"\",\"searchList\":{\"male\":\"\u7537\",\"female\":\"\u5973\"},\"operate\":\"=\"},{\"field\":\"hobbydata\",\"title\":\"\u7231\u597d(\u591a\u9009)\",\"formatter\":\"\",\"searchList\":{\"music\":\"\u97f3\u4e50\",\"reading\":\"\u8bfb\u4e66\",\"swimming\":\"\u6e38\u6cf3\"},\"operate\":\"FIND_IN_SET\"},{\"field\":\"image\",\"title\":\"\u56fe\u7247\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"images\",\"title\":\"\u56fe\u7247\u7ec4\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"attachfile\",\"title\":\"\u9644\u4ef6\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"keywords\",\"title\":\"\u5173\u952e\u5b57\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"description\",\"title\":\"\u63cf\u8ff0\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"city\",\"title\":\"\u7701\u5e02\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"price\",\"title\":\"\u4ef7\u683c\",\"formatter\":\"\",\"operate\":\"BETWEEN\"},{\"field\":\"views\",\"title\":\"\u70b9\u51fb\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"startdate\",\"title\":\"\u5f00\u59cb\u65e5\u671f\",\"formatter\":\"\",\"operate\":\"RANGE\"},{\"field\":\"activitytime\",\"title\":\"\u6d3b\u52a8\u65f6\u95f4(datetime)\",\"formatter\":\"\",\"operate\":\"RANGE\"},{\"field\":\"year\",\"title\":\"\u5e74\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"times\",\"title\":\"\u65f6\u95f4\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"refreshtime\",\"title\":\"\u5237\u65b0\u65f6\u95f4(int)\",\"formatter\":\"Table.api.formatter.datetime\",\"operate\":\"RANGE\"},{\"field\":\"createtime\",\"title\":\"\u521b\u5efa\u65f6\u95f4\",\"formatter\":\"Table.api.formatter.datetime\",\"operate\":\"RANGE\"},{\"field\":\"updatetime\",\"title\":\"\u66f4\u65b0\u65f6\u95f4\",\"formatter\":\"Table.api.formatter.datetime\",\"operate\":\"RANGE\"},{\"field\":\"weigh\",\"title\":\"\u6743\u91cd\",\"formatter\":\"\",\"operate\":\"=\"},{\"field\":\"switch\",\"title\":\"\u5f00\u5173\",\"formatter\":\"\",\"searchList\":{\"0\":\"\u5426\",\"1\":\"\u662f\"},\"operate\":\"=\"},{\"field\":\"status\",\"title\":\"\u72b6\u6001\",\"formatter\":\"\",\"searchList\":{\"normal\":\"\u6b63\u5e38\",\"hidden\":\"\u9690\u85cf\"},\"operate\":\"=\"},{\"field\":\"state\",\"title\":\"\u72b6\u6001\u503c\",\"formatter\":\"\",\"searchList\":{\"0\":\"\u7981\u7528\",\"1\":\"\u6b63\u5e38\",\"2\":\"\u63a8\u8350\"},\"operate\":\"=\"}]","csmtable_xlspagesize":null}';
$this->setProgress($csmtable_xlstask_id, 10);
$params = json_decode($pp, true);
$classname = str_replace('/', '\\', $this->getParamValue($params, 'csmtable_classname'));
$methodname = $this->getParamValue($params, 'csmtable_methodname');
$columnstr = $this->getParamValue($params, 'csmtable_columns');
$columns = json_decode($columnstr, true);
$excelPagesize = $this->getParamValue($params, 'csmtable_xlspagesize', 1000);
$this->generateExcelByClassname($csmtable_xlstask_id, $classname, $methodname, $params, $columns, $excelPagesize);
static::p('----generateExcelByClassname end:');
return;
}
private function setProgress(&$csmtable_xlstask_id, $progress, $filename = '')
{
// $dao = new \app\admin\model\csmtable\Xlstask();
// $this->xlstask->startTrans();
$this->xlstask->where("id", "=", $csmtable_xlstask_id)->update([
'progress' => $progress,
'filename' => $filename,
'updatetime' => time()
]);
static::p('progress:' . $progress);
// $dao->commit();
}
private function getParamValue(&$params, $key, $defaultvalue = null)
{
$sr = null;
if (isset($params[$key])) {
$sr = $params[$key];
}
$sr = ($sr == null) ? $defaultvalue : $sr;
return $sr;
}
private function generateExcelByClassname(&$csmtable_xlstask_id, &$classname, &$methodname, &$params, &$columns, &$excelPagesize)
{
$pageno = 0; // 当前页数
$pagesize = 1000;
$excelRowIndex = 0; // 当前excel中的记录行数
$excelRows = []; // Excel记录
$excelFileNo = 1; // 第N个Excel
$excelFiles = [];
static::p("config excelPagesize:{$excelPagesize}");
$request = XcRequestUtils::getRequest();
$instance = new $classname($request);
while (true) {
$request->set('search', $this->getParamValue($params, 'search'));
$request->set('filter', $this->getParamValue($params, 'filter'));
$request->set('op', $this->getParamValue($params, 'op'));
$request->set('sort', $this->getParamValue($params, 'sort'));
$request->set('order', $this->getParamValue($params, 'order'));
// $request->set('offset',$this->getParamValue($params,'offset'));
$request->set('limit', $pagesize);
$request->setMethodReturn("isAjax", true);
$request->set("offset", $pageno * $pagesize);
$sr = App::invokeMethod([
$instance,
$methodname
], null);
$request->clear();
if ($sr == null) {
break;
}
$datarows = &$sr->getData()['rows'];
$total = $sr->getData()['total'];
static::p("--remote total:{$total}/pageno:{$pageno}/offset:" . $pageno * $pagesize);
foreach ($datarows as &$row) {
if ($excelRowIndex >= $excelPagesize) {
$progress = (int) ($pageno * $pagesize / $total * 70) + 10;
$this->setProgress($csmtable_xlstask_id, $progress);
static::p("------generate excel fileno:{$excelFileNo}/progress:{$progress}");
$excelFiles[] = static::saveExcel($columns, $excelRows, $excelFileNo);
$excelRowIndex = 0;
unset($excelRows);
$excelRows = [];
$excelFileNo ++;
}
$excelRows[] = $row;
$excelRowIndex ++;
}
unset($datarows);
unset($sr);
$sr = null;
if ($total <= $pageno * $pagesize) {
break;
}
$pageno ++;
// break;
}
// 有剩余的Excel row,就保存剩余的
if ($excelRowIndex > 0) {
static::p("--generate excel fileno:{$excelFileNo}");
$excelFiles[] = static::saveExcel($columns, $excelRows, $excelFileNo);
}
// Excel保存到Zip
$this->setProgress($csmtable_xlstask_id, 90);
$zipfilename = static::saveExcelToZip($excelFiles);
echo $zipfilename . '<BR>';
$this->setProgress($csmtable_xlstask_id, 100, $zipfilename);
}
private function saveExcel(&$columns, &$rows, &$excelNo)
{
echo $excelNo . '<BR>';
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$filename = 'excel-' . $excelNo;
foreach ($columns as $k => $item) {
$sheet->setCellValueByColumnAndRow($k + 1, 1, $item['title']);
}
$dsDatas = $this->getDataSourceDatas($columns, $rows);
foreach ($rows as $k => $item) {
foreach ($columns as $k2 => $column) {
$vv = $item[$column['field']];
$vv = $this->_convertValueByColumn($column, $vv, $dsDatas);
$sheet->setCellValueByColumnAndRow($k2 + 1, $k + 2, $vv);
}
}
unset($rows);
unset($dsDatas);
$filename = 'csmtable_' . time() . '_' . $excelNo . '.xlsx';
$filepath = &$this->uploadtmppath;
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx');
$writer->save($filepath . $filename);
unset($writer);
$writer = null;
return [
'filename' => $filename,
'filepath' => $filepath
];
}
private function getDataSourceDatas(&$columns, &$rows)
{
$sr = [];
foreach ($columns as &$column) {
if (isset($column['datasource']) && $column['datasource'] != null) {
$datafield = null;
if (isset($column['datafield']) && $column['datafield'] != null) {
$datafield = $column['datafield'];
} else {
$datafield = 'name';
}
$ids = [];
foreach ($rows as $item) {
$ids[] = $item[$column['field']];
}
//v2.2.5 修复admin账号的安全楼栋
$datasdatasource_callremoteource = $column['datasource'];
if($datasdatasource_callremoteource=="auth/admin"){
$datasdatasource_callremoteource = "csmtable/datasource/admin";
}
$im = CsmTableUtils::getInstanceAndMethod($datasdatasource_callremoteource);
if ($im != null) {
$classname = $im[0];
$methodname = $im[1];
$request = XcRequestUtils::getRequest();
$request->setMethodReturn("isAjax", true);
$request->set('filter', '{"id":"' . implode(',', $ids) . '"}');
$request->set('op', '{"id":"in"}');
$request->set('sort', 'id');
$request->set('order', 'desc');
// \app\admin\controller\auth\Admin;
$instance2 = new $classname($request);
$json2 = App::invokeMethod([
$instance2,
$methodname
], null);
$request->clear();
if ($json2 == null) {
break;
}
$datarows = &$json2->getData()['rows'];
$vvs = [];
foreach ($datarows as &$row) {
$vv = null;
if (isset($row[$datafield])) {
$vv = $row[$datafield];
} else {
$vv = $row->$datafield;
}
$vvs['ID#' . $row['id']] = $vv;
}
unset($json2);
unset($instance2);
$instance2 = null;
}
$sr[$column['field']] = $vvs;
}
}
return $sr;
}
/**
* 将value根据table的options转换成文字
*/
private function _convertValueByColumn(&$column, &$value, &$dsDatas)
{
$sr = '';
if (isset($column['searchList']) && $column['searchList'] != null) {
// searchlist类型的,将code转为name
$searchList = $column['searchList'];
// operate类型,字典数组,用逗号分隔
if (isset($column['operate']) && $column['operate'] != null && $column['operate'] == 'FIND_IN_SET') {
$ssarr = explode(",", $value);
$sslabel = [];
foreach ($ssarr as $ssarrv) {
if (isset($searchList[$ssarrv])) {
$sslabel[] = $searchList[$ssarrv];
} else {
$sslabel[] = $ssarrv;
}
}
$sr = implode(',', $sslabel);
} else {
// 普通字典
if (isset($searchList[$value])) {
$sr = $searchList[$value];
}
}
} else if (isset($column['formatter']) && $column['formatter'] != null && $column['formatter'] == "Table.api.formatter.datetime") {
// 时间型
if ($value != null && $value != '') {
$sr = date('Y-m-s h:i:s', $value);
}
} else if (isset($column['datasource']) && $column['datasource'] != null && $column['datasource'] != "") {
// 时间型
if (isset($dsDatas[$column['field']]) && $dsDatas[$column['field']] != null) {
$dsDataitem = $dsDatas[$column['field']];
if (isset($dsDataitem['ID#' . $value]) && $dsDataitem['ID#' . $value] != null) {
$sr = $dsDataitem['ID#' . $value];
}
}
if ($sr == null || $sr == '') {
$sr = $value;
}
} else {
$sr = $value;
}
return $sr;
}
private function saveExcelToZip($excelFiles)
{
$zipfn = 'csmtable_' . time() . '.zip';
$zipfilename = $this->uploadtmppath . $zipfn;
$zip = new \ZipArchive();
$zip->open($zipfilename, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
foreach ($excelFiles as $item) {
$zip->addFile($item['filepath'] . $item['filename'], $item['filename']);
}
$zip->close();
foreach ($excelFiles as $item) {
unlink($item['filepath'] . $item['filename']);
}
return $zipfn;
}
private static function p($str){
//echo( $str."<BR>\r\n" ) ;
}
}

View File

@ -0,0 +1,88 @@
<?php
namespace app\admin\controller\csmtable;
use addons\csmtable\library\xcore\xcore\base\XcABackend;
use addons\csmtable\library\xapp\csmtable\utils\CsmTableUtils;
class Csmgenerate extends XcABackend
{
public function _initialize()
{
parent::_initialize();
}
public function generate()
{
set_time_limit(0);
$request = $this->request;
$filesource = $request->request('csmtable_filesource');
$indexurl = $request->request('csmtable_indexurl');
$dao = new \app\admin\model\csmtable\Xlstask();
// 限制下载
if (true) {
$userinfo = $this->auth->getUserInfo();
$adminId = $userinfo["id"];
$row = $dao->where("admin_id", "=", $adminId)
->where("progress", "<", "100")
->where("createtime", ">", time() - 1800)
->where("iserror", "<>", "Y")
->find();
if ($row) {
$this->error("当前有下载任务,请任务结束后再尝试下载。");
}
}
// 生成任务记录
$dao->where("admin_id", "=", $adminId)
->where("filesource", '=', $filesource)
->where("status", "=", "normal")
->update([
"status" => "hidden"
]);
// 触发异步生成Excel任务
$route2 = CsmTableUtils::getInstanceAndMethod($indexurl);
$classname = $route2[0];
$getparams = [
'search' => $request->request('search'),
'filter' => $request->request('filter'),
'op' => $request->request('op'),
'sort' => $request->request('sort'),
'order' => $request->request('order'),
'offset' => $request->request('offset'),
'limit' => $request->request('limit'),
'csmtable_classname' => str_replace('\\', '/', $classname),
'csmtable_methodname' => $route2[1],
'csmtable_columns' => $request->request('csmtable_columns')
];
$param = [
'admin_id' => $adminId,
'filesource' => $filesource,
'param' => json_encode($getparams),
'createtime' => time(),
];
$dao->create($param);
$this->success();
// $id = $dao->getLastInsID();
// $ret = $this->_index($id);
// if($ret===true){
// $this->success();
// }else{
// $this->error($ret);
// }
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace app\manystore\controller\csmtable;
use app\common\controller\Backend;
use app\admin\library\Auth;
/**
* Excel下载任务管理
*
* @icon fa fa-circle-o
*/
class Csmxlstable extends Backend
{
protected $noNeedRight = ["*"];
private $uploadtmppath = RUNTIME_PATH . 'temp' . DS;
/**
* Xlstask模型对象
*
* @var \app\admin\model\csmtable\Xlstask
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\csmtable\Xlstask();
}
/**
* 前台轮询查询下载进度
* http://127.0.0.1/fastadmin_plugin_csmmeet/public/q3HJDu2RgE.php/csmtable/csmxlstable/queryGenerageStatus
*/
public function queryGenerageStatus()
{
$filesource = $this->request->request("filesource");
$auth = Auth::instance();
$row = $this->model->where("admin_id", "=", $auth->id)
->where("filesource", '=', $filesource)
->where("status", "=", "normal")
->field("id,createtime,progress,iserror,errormsg")
->order("id", "desc")
->find();
// echo $this->model->getLastSql();
if ($row != null) {
// $row->filesource = str_replace(Config::get('upload.cdnurl'), '', $row->filesource);
$row->createtime = date('Y-m-d H:i:s', $row->createtime);
}
$this->success('', null, [
'row' => $row
]);
}
public function download()
{
$auth = Auth::instance();
$id = $this->request->request("id");
$row = $this->model->where("admin_id", "=", $auth->id)
->where("id", "=", $id)
->find();
if ($row == null) {
$this->error("文件不存在,请重新下载!");
}
$filename = $row->filename;
//var_dump($filename);
// $filename='csmtable_1588643591.zip';//完整文件名(路径加名字)
if (! file_exists($this->uploadtmppath . $filename)) {
header('HTTP/1.1 404 NOT FOUND');
} else {
$file = fopen($this->uploadtmppath . $filename, "rb");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: " . filesize($this->uploadtmppath . $filename));
Header("Content-Disposition: attachment; filename=" . $filename);
echo fread($file, filesize($this->uploadtmppath . $filename));
fclose($file);
exit();
}
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace app\manystore\controller\csmtable;
use app\common\controller\Backend;
/**
* 管理员管理
*
* @icon fa fa-users
* @remark 一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成
*/
class Datasource extends Backend
{
// protected $noNeedLogin = ["*"];
// protected $noNeedRight = ["*"];
/**
* 代替 /auth/admin
*
* 地址: /csmtable/datasource/admin
*/
public function admin()
{
$filter = $this->request->get("filter", '');
$filter = (array)json_decode($filter, true);
$dao = new \app\admin\model\Admin();
$list = $dao->where("id","in",$filter['id'])->field("id,nickname")->select();
return json(['rows' => $list]);
}
}

View File

@ -0,0 +1,107 @@
<?php
namespace app\manystore\controller\csmtable;
use app\common\controller\Backend;
use fast\Random;
/**
* 测试管理
*
* @icon fa fa-circle-o
*/
class Test extends Backend
{
/**
* Test模型对象
*
* @var \app\admin\model\fa\Test
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\csmtable\Test();
$this->view->assign("weekList", $this->model->getWeekList());
$this->view->assign("flagList", $this->model->getFlagList());
$this->view->assign("genderdataList", $this->model->getGenderdataList());
$this->view->assign("hobbydataList", $this->model->getHobbydataList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("stateList", $this->model->getStateList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
// https://csmtable.163fan.com/amZUNRxJGT.php//csmtable/test/generatedatas
protected function generatedatas()
{
$generatecount = 10;
$subsieze = 1001;
$count = $this->model->count();
for ($i = 0; $i < $generatecount; $i ++) {
$rows = [];
for ($ii = 0; $ii < $subsieze; $ii ++) {
$co = $i * $subsieze + $ii + $count;
$param = [
'admin_id' => 1,
'category_id' => 1,
'category_ids' => '1,2',
'week' => 'monday',
'flag' => 'index',
'hobbydata' => 'music,swimming',
'city' => 'xxx',
'views' => Random::numeric(2),
'price' => 0,
'year' => 2020,
'status' => 'normal',
'state' => '1'
];
$param['title'] = "我是{$co}篇测试文章" . time();
$param['createtime'] = time();
$param['content'] = Random::alpha(100);
$rows[] = $param;
}
$this->model->saveAll($rows);
}
$this->success("生成完成记录" . $generatecount * $subsieze, null, null, '10000');
}
/**
* 查看
*/
public function index()
{
// 设置过滤方法
$this->request->filter([
'strip_tags'
]);
if ($this->request->isAjax()) {
trace('----test------');
// 如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list ($where, $sort, $order, $offset, $limit) = $this->buildparams();
//在2.2.3版本中调整为fastadmin.1.3.3的写法
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items(),"totalviews" => 1530);
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,57 @@
<?php
namespace app\manystore\controller\csmtable;
use addons\csmtable\library\xcore\xcore\utils\XcDaoUtils;
use app\common\controller\Backend;
/**
* Excel下载任务管理
*
* @icon fa fa-circle-o
*/
class Xlstask extends Backend
{
// protected $noNeedRight = [];
/**
* Xlstask模型对象
*
* @var \app\admin\model\csmtable\Xlstask
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\csmtable\Xlstask();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if (false === $this->request->isAjax()) {
return $this->view->fetch();
}
//如果发送的来源是 Selectpage则转发到 Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
$list = $this->model
->where($where)
->order($sort, $order)
->paginate($limit);
XcDaoUtils::bindDbListColumn($list, "admin_id", new \app\admin\model\Admin(), "admin", ["nickname"]);
$result = ['total' => $list->total(), 'rows' => $list->items()];
return json($result);
}
}

View File

@ -0,0 +1,174 @@
<?php
namespace app\manystore\controller\general;
use app\common\controller\ManystoreBase;
use app\common\model\ManystoreAttachment;
/**
* 附件管理
*
* @icon fa fa-circle-o
* @remark 主要用于管理上传到又拍云的数据或上传至本服务的上传数据
*/
class Attachment extends ManystoreBase
{
/**
* @var \app\common\model\ManystoreAttachment
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = model('ManystoreAttachment');
$this->view->assign("mimetypeList", \app\common\model\ManystoreAttachment::getMimetypeList());
$this->view->assign("categoryList", \app\common\model\Attachment::getCategoryList());
$this->assignconfig("categoryList", \app\common\model\Attachment::getCategoryList());
}
/**
* 查看
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
$mimetypeQuery = [];
$filter = $this->request->request('filter');
$filterArr = (array)json_decode($filter, true);
if (isset($filterArr['category']) && $filterArr['category'] == 'unclassed') {
$filterArr['category'] = ',unclassed';
$this->request->get(['filter' => json_encode(array_diff_key($filterArr, ['category' => '']))]);
}
if (isset($filterArr['mimetype']) && preg_match("/[]\,|\*]/", $filterArr['mimetype'])) {
$this->request->get(['filter' => json_encode(array_diff_key($filterArr, ['mimetype' => '']))]);
$mimetypeQuery = function ($query) use ($filterArr) {
$mimetypeArr = explode(',', $filterArr['mimetype']);
foreach ($mimetypeArr as $index => $item) {
if (stripos($item, "/*") !== false) {
$query->whereOr('mimetype', 'like', str_replace("/*", "/", $item) . '%');
} else {
$query->whereOr('mimetype', 'like', '%' . $item . '%');
}
}
};
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model->with(["user"])
->where($mimetypeQuery)
->whereRaw("`filename` NOT REGEXP '^[0-9A-Fa-f]{32}'")
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname', 'realname', 'mobile', 'avatar']);
}
$rows = $list->items();
$cdnurl = preg_replace("/\/(\w+)\.php$/i", '', $this->request->root());
foreach ($rows as $k => &$v) {
$v['fullurl'] = ($v['storage'] == 'local' ? $cdnurl : $this->view->config['upload']['cdnurl']) . $v['url'];
}
unset($v);
$result = array("total" => $list->total(), "rows" => $rows);
return json($result);
}
return $this->view->fetch();
}
/**
* 选择附件
*/
public function select()
{
if ($this->request->isAjax()) {
return $this->index();
}
$mimetype = $this->request->get('mimetype', '');
$mimetype = substr($mimetype, -1) === '/' ? $mimetype . '*' : $mimetype;
$this->view->assign('mimetype', $mimetype);
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isAjax()) {
$this->error();
}
return $this->view->fetch();
}
/**
* 删除附件
* @param array $ids
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
\think\Hook::add('upload_delete', function ($params) {
if ($params['storage'] == 'local') {
$attachmentFile = ROOT_PATH . '/public' . $params['url'];
if (is_file($attachmentFile)) {
@unlink($attachmentFile);
}
}
});
$attachmentlist = $this->model->where('id', 'in', $ids)->select();
foreach ($attachmentlist as $attachment) {
\think\Hook::listen("upload_delete", $attachment);
$attachment->delete();
}
$this->success();
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 归类
*/
public function classify()
{
if (!$this->auth->check('general/attachment/edit')) {
\think\Hook::listen('admin_nopermission', $this);
$this->error(__('You have no permission'), '');
}
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$category = $this->request->post('category', '');
$ids = $this->request->post('ids');
if (!$ids) {
$this->error(__('Parameter %s can not be empty', 'ids'));
}
$categoryList = \app\common\model\Attachment::getCategoryList();
if ($category && !isset($categoryList[$category])) {
$this->error(__('Category not found'));
}
// if(!defined('SHOP_ID')){
// define('SHOP_ID', $this->auth->shop_id);
// }
$category = $category == 'unclassed' ? '' : $category;
ManystoreAttachment::where('id', 'in', $ids)->update(['category' => $category]);
$this->success();
}
}

View File

@ -0,0 +1,162 @@
<?php
namespace app\manystore\controller\general;
use app\common\controller\ManystoreBase;
use app\common\library\Email;
use app\common\model\ManystoreConfigGroup;
use app\common\model\ManystoreConfig as ManystoreConfigModel;
use think\Cache;
use think\Exception;
use think\Validate;
/**
* 系统配置
*
* @icon fa fa-cogs
* @remark 可以在此增改系统的变量和分组,也可以自定义分组和变量,如果需要删除请从数据库中删除
*/
class Config extends ManystoreBase
{
/**
* @var \app\common\model\Config
*/
protected $model = null;
protected $config_value_model = null;
public function _initialize()
{
parent::_initialize();
$this->model = model('ManystoreConfig');
$this->config_value_model = model('ManystoreValue');
}
/**
* 查看
*/
public function index()
{
$siteList = [];
$manystoreConfigGroup = new ManystoreConfigGroup();
$groupList = $manystoreConfigGroup->getGroupData();
foreach ($groupList as $k => $v) {
$siteList[$k]['name'] = $k;
$siteList[$k]['title'] = $v;
$siteList[$k]['list'] = [];
}
$config_value_data_array = [];
$config_value_data = collection($this->config_value_model->where(array('shop_id' => SHOP_ID))->select())->toArray();
foreach ($config_value_data as $value) {
$config_value_data_array[$value['config_id']] = $value;
}
foreach ($this->model->all() as $k => $v) {
if (!isset($siteList[$v['group']])) {
continue;
}
$value = $v->toArray();
$value['title'] = __($value['title']);
if (in_array($value['type'], ['select', 'selects', 'checkbox', 'radio'])) {
$value['value'] = explode(',', isset($config_value_data_array[$value['id']]['value']) ? $config_value_data_array[$value['id']]['value'] : $value['default']);
} else {
$value['value'] = isset($config_value_data_array[$value['id']]['value']) ? $config_value_data_array[$value['id']]['value'] : $value['default'];
}
$value['content'] = json_decode($value['content'], TRUE);
$siteList[$v['group']]['list'][] = $value;
}
$index = 0;
foreach ($siteList as $k => &$v) {
$v['active'] = !$index ? true : false;
$index++;
}
$this->view->assign('siteList', $siteList);
return $this->view->fetch();
}
/**
* 编辑
* @param null $ids
*/
public function edit($ids = NULL)
{
if ($this->request->isPost()) {
$row = $this->request->post("row/a");
if ($row) {
$configValueAll = [];
$config_value_data_array = [];
$config_value_data = collection($this->config_value_model->where(array('shop_id' => SHOP_ID))->select())->toArray();
foreach ($config_value_data as $value) {
$config_value_data_array[$value['config_id']] = $value;
}
foreach ($this->model->all() as $v) {
if (isset($row[$v['name']])) {
$value = $row[$v['name']];
if (is_array($value) && isset($value['field'])) {
$value = json_encode(ManystoreConfigModel::getArrayData($value), JSON_UNESCAPED_UNICODE);
} else {
$value = is_array($value) ? implode(',', $value) : $value;
}
$v['value'] = $value;
$config = $v->toArray();
$config_value = array();
if (!empty($config_value_data_array[$v['id']])) {
$config_value['id'] = $config_value_data_array[$v['id']]['id'];
}
$config_value['shop_id'] = SHOP_ID;
$config_value['store_id'] = STORE_ID;
$config_value['config_id'] = $config['id'];
$config_value['value'] = $value;
$configValueAll[] = $config_value;
}
}
$this->config_value_model->allowField(true)->saveAll($configValueAll);
try {
$this->refreshFile();
$this->success();
} catch (Exception $e) {
$this->error($e->getMessage());
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
}
/**
* 刷新配置文件
*/
protected function refreshFile()
{
Cache::rm('ManystoreConfig:' . SHOP_ID);
}
public function selectpage()
{
$id = $this->request->get("id/d");
$config = \app\common\model\ManystoreConfig::get($id);
if (!$config) {
$this->error(__('Invalid parameters'));
}
$setting = $config['setting'];
//自定义条件
$custom = isset($setting['conditions']) ? (array)json_decode($setting['conditions'], true) : [];
$custom = array_filter($custom);
$this->request->request(['showField' => $setting['field'], 'keyField' => $setting['primarykey'], 'custom' => $custom, 'searchField' => [$setting['field'], $setting['primarykey']]]);
$this->model = \think\Db::connect()->setTable($setting['table']);
return parent::selectpage();
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace app\manystore\controller\general;
use app\common\controller\ManystoreBase;
/**
* 商家日志
*
* @icon fa fa-user
*/
class Log extends ManystoreBase
{
/**
* 查看
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
$model = model('ManystoreLog');
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$total = $model
->where($where)
->where(array('shop_id'=> SHOP_ID))
->order($sort, $order)
->count();
$list = $model
->where($where)
->where(array('shop_id'=> SHOP_ID))
->order($sort, $order)
->limit($offset, $limit)
->select();
$result = array("total" => $total, "rows" => $list);
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,155 @@
<?php
namespace app\manystore\controller\general;
use app\manystore\model\Manystore;
use app\manystore\model\ManystoreShop;
use app\common\controller\ManystoreBase;
use fast\Random;
use think\Exception;
use think\Session;
use think\Url;
use think\Validate;
/**
* 商家信息配置
*
* @icon fa fa-user
*/
class Profile extends ManystoreBase
{
protected $noNeedLogin = ["miniqrcode"];
/**
* 查看
*/
public function index()
{
$shopModel = new ManystoreShop();
$shop_info = $shopModel->where(array('id'=>SHOP_ID))->find();
$this->view->assign('statusList',[0=>'待审核',1=>'审核通过',2=>'审核拒绝']);
$this->view->assign('typeList',$shop_info->getTypeList());
$this->view->assign('shop_info',$shop_info);
$this->view->assign('check_full',(new \app\common\model\dyqc\ManystoreShop)->checkFull(SHOP_ID));
$this->view->assign('check_full_msg',(new \app\common\model\dyqc\ManystoreShop)->checkFullMsg(SHOP_ID));
$this->getCity();
$this->view->assign('miniqrcode_link',Url::build("/manystore/general/profile/miniqrcode", ["ids" => SHOP_ID]));
return $this->view->fetch();
}
/**
* 更新个人信息
*/
public function update()
{
if ($this->request->isPost()) {
$this->token();
$params = $this->request->post("row/a");
$params = array_filter(array_intersect_key(
$params,
array_flip(array('email', 'nickname', 'password', 'avatar'))
));
unset($v);
if (!Validate::is($params['email'], "email")) {
$this->error(__("Please input correct email"));
}
// if (!Validate::is($params['nickname'], "/^[\x{4e00}-\x{9fa5}a-zA-Z0-9_-]+$/u")) {
// $this->error(__("Please input correct nickname"));
// }
if (isset($params['password'])) {
if (!Validate::is($params['password'], "/^[\S]{6,16}$/")) {
$this->error(__("Please input correct password"));
}
$params['salt'] = Random::alnum();
$params['password'] = md5(md5($params['password']) . $params['salt']);
}
$exist = Manystore::where('email', $params['email'])->where('id', '<>', $this->auth->id)->find();
if ($exist) {
$this->error(__("Email already exists"));
}
if ($params) {
$manystore = Manystore::get($this->auth->id);
$manystore->save($params);
Session::set("manystore", $manystore->toArray());
$this->success();
}
$this->error();
}
return;
}
public function shop_update(){
if ($this->request->isPost()) {
$this->token();
$shop = $this->request->post("shop/a");
if($shop["address_city"] && !$shop["district"])$this->error("请选择所在城市");
$shopModel = new ManystoreShop();
$shopModel->save($shop,array('id'=>SHOP_ID));
//调用事件
$data = ['shop' => $shopModel];
\think\Hook::listen('shop_update_after', $data);
$this->success();
}
$this->error();
}
/**
* 微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function miniqrcode($ids = ''){
$param = $this->request->param();
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\dyqc\ManystoreShop::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
return $url["response"];
}
/**
* 查看微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function lookminiqrcode($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\dyqc\ManystoreShop::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("生成小程序码成功",null,$url);
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace app\manystore\controller\manystore;
use app\common\controller\ManystoreBase;
/**
* 店铺更新log管理
*
* @icon fa fa-circle-o
*/
class ShopLog extends ManystoreBase
{
/**
* ShopLog模型对象
* @var \app\manystore\model\manystore\ShopLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\manystore\ShopLog;
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
}
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(['manystoreshop','user'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystoreshop')->visible(['name']);
$row->getRelation('user')->visible(['nickname','mobile','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,336 @@
<?php
namespace app\manystore\controller\manystore;
use app\common\controller\ManystoreBase;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 授权机构用户
*
* @icon fa fa-circle-o
*/
class UserAuth extends ManystoreBase
{
/**
* UserAuth模型对象
* @var \app\manystore\model\manystore\UserAuth
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["shop_id","user_id"];
public function _initialize()
{
$this->model = new \app\manystore\model\manystore\UserAuth;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
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->searchFields = ["id","user_id","manystoreshop.name","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['manystoreshop','user'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystoreshop')->visible(['name']);
$row->getRelation('user')->visible(['nickname','avatar','mobile']);
}
$rows = $list->items();
foreach ($list as $row) {
if($row["status"]!=1){
$row->user->mobile = "需授权通过";
}
}
$result = array("total" => $list->total(), "rows" => $rows);
return json($result);
}
return $this->view->fetch();
}
/**变更学员信息(教练专属)
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function changeuser(){
if($this->request->isPost())
{
try{
$people_name = $this->request->param('people_name/s');
$people_mobile = $this->request->param('people_mobile/s');
$user = \app\common\model\User::where("mobile",$people_mobile)->find();
//检测更新教练下单学员账号创建状态 2022/8/27 new
if(!$user)$user = (new \app\common\model\User)->addUserByMobile($people_mobile,$people_name);
$user['nickname'] = $people_name;
$user->save();
//添加用户机构认证
try {
\app\common\model\manystore\UserAuth::auth(0,SHOP_ID,$user["id"],0,'shop',$this->auth->id);
}catch (\Exception $e){
}
}catch (\Exception $e){
$this->error($e->getMessage());
}
//退押金
$this->success("已成功创建{$people_name}");
}
// $row = $this->model->get($param['ids']);
// $this->view->assign('vo', $row);
return $this->view->fetch();
}
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id", $shop_id)->find();
if (!$manystore) {
$this->error("店铺不存在");
}
// $params["manystore_id"] = $manystore["id"];
$params["shop_id"] = $shop_id;
$user = User::where("nickname|realname|mobile", $params["user_id"])->find();
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$params["user_id"] = $user["id"];
$user_id = $params["user_id"];
//修改
if($row){
//用户已是其他的教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->where("id","<>",$row["id"])->find();
if($teacher_user){
$this->error("已向用户发起过授权申请!");
}
}else{
//新增
//用户已是教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->find();
if($teacher_user){
$this->error("已向用户发起过授权申请!");
}
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
// $result = $this->model->allowField(true)->save($params);
$result = \app\common\model\manystore\UserAuth::auth(0,$params["shop_id"],$params["user_id"],0,'shop',$this->auth->id);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
// $result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$user = User::where("id", $row["user_id"])->find();
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace app\manystore\controller\school;
use app\common\controller\ManystoreBase;
/**
* 夜校站内信
*
* @icon fa fa-circle-o
*/
class Message extends ManystoreBase
{
/**
* Message模型对象
* @var \app\manystore\model\school\Message
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\Message;
$this->view->assign("platformList", $this->model->getPlatformList());
$this->view->assign("operTypeList", $this->model->getOperTypeList());
$this->view->assign("toTypeList", $this->model->getToTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("miniTypeList", $this->model->getMiniTypeList());
}
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(['admin','user'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('admin')->visible(['nickname','avatar']);
$row->getRelation('user')->visible(['nickname','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
/**
* 机构课程分类
*
* @icon fa fa-circle-o
*/
class Cate extends ManystoreBase
{
/**
* Cate模型对象
* @var \app\manystore\model\school\classes\Cate
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\Cate;
$this->view->assign("statusList", $this->model->getStatusList());
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -0,0 +1,707 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\admin\model\dyqc\ManystoreShop;
use app\common\controller\Backend;
use app\common\model\school\classes\lib\Spec;
use app\common\model\school\classes\Order;
use app\manystore\model\Manystore;
use think\Db;
use think\db\exception\DataNotFoundException;
use think\db\exception\ModelNotFoundException;
use think\Exception;
use think\exception\DbException;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\Url;
/**
* 机构课程库
*
* @icon fa fa-circle-o
*/
class ClassesLib extends ManystoreBase
{
protected $noNeedLogin = ["miniqrcode"];
protected $qSwitch = true;
protected $qFields = ["teacher_id","user_id","shop_id","manystore_id"];
/**
* 是否开启Validate验证
*/
protected $modelValidate = true;
/**
* ClassesLib模型对象
* @var \app\manystore\model\school\classes\ClassesLib
*/
protected $model = null;
//不用审核允许修改的字段
protected $no_auth_fields = ["title","classes_type","classes_cate_ids","classes_label_ids","self_label_tag",'headimage','images','notice','content',"virtual_num","virtual_collect","underline_price","selfhot","price","classes_num"];
//更新数据是否需要触发审核开关
protected $need_auth = true;
protected $have_auth = false;
protected $success_auth = false;
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\ClassesLib;
parent::_initialize();
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
$this->view->assign("recommendList", $this->model->getRecommendList());
$this->view->assign("hotList", $this->model->getHotList());
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
$this->view->assign("classesTypeList", $this->model->getClassesTypeList());
$this->view->assign("classesTypeListJson", json_encode($this->model->getClassesTypeList(), JSON_UNESCAPED_UNICODE));
$this->view->assign("classes_number_only_one", config("site.classes_number_only_one"));
$this->view->assign("specStatusList", (new \app\manystore\model\school\classes\ClassesSpec)->getStatusList());
$this->getCity();
$this->view->assign('check_full',(new \app\common\model\dyqc\ManystoreShop)->checkFull(SHOP_ID));
$this->view->assign('check_full_msg',(new \app\common\model\dyqc\ManystoreShop)->checkFullMsg(SHOP_ID));
}
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->searchFields = ["id","title","address","address_detail","address_city","user.nickname","user.realname","user.mobile","manystoreshop.name"];
//设置过滤方法
$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, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
$as = (new \app\common\model\school\classes\ClassesLib())->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$expireWhere = [[]];
}
$list = $this->model
->with(['manystore','manystoreshop','user','admin'])
->where($where)
->order($sort, $order)
->where(...$expireWhere)
->paginate($limit);
// var_dump($this->model->getLastSql());die;
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('admin')->visible(['nickname','avatar']);
}
$rows = $list->items();
$types = \app\admin\model\school\classes\Type::column("name", 'id');
foreach ($rows as $k=>&$v){
$v["classes_type_name"] = $types[$v["classes_type"]] ?? "" ;
$v["miniqrcode_link"] = Url::build("/manystore/school/classes/classes_lib/miniqrcode", ["ids" => $v["id"]]);
}
$result = array("total" => $list->total(), "rows" => $rows);
return json($result);
}
return $this->view->fetch();
}
protected function authClasses(&$params,$row=null){
//审核失败需填写原因
if($params["auth_status"] == '2' && empty($params["reason"])){
$this->error("审核失败需填写原因");
}
if($params["auth_status"] == '2'){
//审核不通过会平台下架
$params["status"] = '3';
}
//更新
if($row){
if($params["auth_status"] != '1' && $row["auth_status"] == '1'){
$this->error("审核已通过的课程不允许再修改审核状态!");
}
if($params["auth_status"] != '0' && $row["auth_status"] == '0'){
//填写审核时间和审核人
$params["auth_time"] = time();
$params["admin_id"] = $this->auth->id;
if($params["auth_status"] == '1'){
//审核通过
$this->success_auth = true;
}
}
//审核通过
if($this->success_auth){
//如果是平台下架,则更新成正常下架
if($params["status"] == '3') $params["status"] = '2';
}
}else{
//新增
}
}
protected function no_auth_fields_check($params,$row){
if($this->no_auth_fields == "*")return $this->have_auth;
foreach ($params as $k=>$v){
//说明数值有变动
//$params[$k] 去掉两端空格
$params[$k] = trim($v);
if($row[$k]!=$params[$k]){
//特殊:如果是上架状态或下架状态也可以修改
if($k=="status" && ($params[$k]=='1' || $params[$k]=='2')){
continue;
}
//当修改参数不在允许修改的字段中
if(!in_array($k,$this->no_auth_fields)){
$this->have_auth = true;break;
}
}
}
return $this->have_auth;
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在未完成订单则不允许操作
$order = Order::where("classes_lib_id",$id)->where("status","in","0,3")->find();
if($order)$this->error("存在正在使用中的课程订单或存在正在售后中的课程订单无法继续操作!");
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$params["shop_id"] = $shop_id;
try {
$classesLib = new \app\common\model\school\classes\ClassesLib();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->classesCheck($params,$shop_id,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
//特有认证判断
// $this->authClasses($params,$row);
// var_dump($row);die;
//更新
if($row){
if($row['status'] == "3" && $params['status'] != $row['status']){
$this->error("平台下架审核的课程无法上架!");
}
//如果是审核失败,提交后自动更新成审核中
if($row['auth_status'] == 2){
$params['status'] = "3";
$params['auth_status'] = 0;
$params["reason"] = "";
}
}else{
//新增(需审核)
$params["add_type"] = '1';
$params["add_id"] = $this->auth->id;
$params['status'] = "3";//平台下架
$params['auth_status'] = 0;
$this->have_auth = true;
}
}
protected function update_classes($classes_lib_id){
//课时数必须大于等于课时核销数
$count = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$classes_lib_id)->count();
$classes_num = \app\common\model\school\classes\ClassesLib::where("id",$classes_lib_id)->value("classes_num");
if($count < $classes_num){
throw new \Exception("课时数必须大于等于课时核销数");
}
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function addnew($row=null)
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
unset($params["id"]);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
if($row){
//如果走的复制
if(empty($params["teacher_id"]))$params["teacher_id"] = $row["teacher_id"];
}
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = false;
Db::startTrans();
try {
$spec = $params["spec"];
unset($params["spec"]);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
//添加课程规格
foreach ($spec as $k=>$v){
unset($v["id"]);
$v["classes_lib_id"] = $this->model["id"];
(new \app\common\model\school\classes\ClassesSpec)->allowField(true)->save($v);
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$this->model["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs->toArray();
(new \app\common\model\school\classes\ClassesSpec)->specCheck($params,null,$specs);
}
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_need_after', $data);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
\app\common\model\school\classes\ClassesLib::add_virtual_init($this->model["id"]);
$this->update_classes($this->model["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $this->model];
\think\Hook::listen('classes_auth_need_after', $data);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
//是否采用模型验证
// if ($this->modelValidate) {
// $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
// $row->validateFailException(true)->validate($validate);
// }
$this->update_check($params,$row);
$result = false;
Db::startTrans();
try {
$spec = $params["spec"] ?? [];//$params["delete_spec_ids"]
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["spec"]);
unset($params["delete_spec_ids"]);
$result = $row->allowField(true)->save($params);
foreach ($spec as $k=>$v){
$v["classes_lib_id"] = $row["id"];
//有id更新否则新增
if(isset($v["id"]) && $v["id"]){
\app\common\model\school\classes\ClassesSpec::update((new \app\common\model\school\classes\ClassesSpec)->checkAssemblyParameters($v));
}else{
\app\common\model\school\classes\ClassesSpec::create((new \app\common\model\school\classes\ClassesSpec)->checkAssemblyParameters($v));
}
}
//删除规格
foreach ($delete_spec_ids as $k=>$delete_spec){
(new \app\common\model\school\classes\ClassesSpec)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs->toArray();
(new \app\common\model\school\classes\ClassesSpec)->specCheck($params,null,$specs);
}
$this->update_classes($row["id"]);
if($this->have_auth){
//调用通过事件
$data = ['classes' => $row];
\think\Hook::listen('classes_auth_need_after', $data);
}
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (\Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row["id"])->field("id,classes_lib_id,name,start_time,end_time,limit_num,status,weigh")->order('weigh desc,id desc')->select();
foreach ($spec as $k=>&$v){
$v["time"] = date("Y/m/d H:i",$v["start_time"])." - ".date("Y/m/d H:i",$v["end_time"]);
}
$row["spec"] = json_encode($spec, JSON_UNESCAPED_UNICODE);//不转义任何字符串
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
//删除课程规格
Spec::where("classes_lib_id",$v->id)->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 复制课程
*/
public function copy($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$this->addnew($row);
}
$spec = \app\common\model\school\classes\ClassesSpec::where("classes_lib_id",$row["id"])->field("id,classes_lib_id,name,start_time,end_time,limit_num,status,weigh")->order('weigh desc,id desc')->select();
foreach ($spec as $k=>&$v){
$v["time"] = date("Y/m/d H:i",$v["start_time"])." - ".date("Y/m/d H:i",$v["end_time"]);
}
$row["spec"] = json_encode($spec, JSON_UNESCAPED_UNICODE);//不转义任何字符串
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function miniqrcode($ids = ''){
$param = $this->request->param();
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
return $url["response"];
}
/**
* 查看微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function lookminiqrcode($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("生成小程序码成功",null,$url);
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,311 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 机构课程课时规格
*
* @icon fa fa-circle-o
*/
class ClassesSpec extends ManystoreBase
{
/**
* ClassesSpec模型对象
* @var \app\manystore\model\school\classes\ClassesSpec
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_lib_id"];
protected $no_auth_fields = ['name','limit_num','status','weigh'];
protected $have_auth = false;
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\ClassesSpec;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
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->searchFields = ["id","name","schoolclasseslib.title"];
//设置过滤方法
$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(['schoolclasseslib'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
protected function update_classes($classes_lib_id){
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = \app\common\model\school\classes\hour\Order::where("classes_lib_spec_id",$id)->where("status","in","-1,0")->find();
if($order)$this->error("存在正在使用中的课时订单报名学员,课时规格无法继续操作,如规格有误请下架!");
}
protected function update_check(&$params,$row=null)
{
try {
$classesLib = new \app\common\model\school\classes\ClassesSpec();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->specCheck($params,SHOP_ID,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
//修改
if($row){
$classesLib->updateCheck($row->id,$params,$row);
}else{
}
// (new \app\common\model\school\classes\ClassesSpec)->specCheck($params,SHOP_ID,$row);
}catch (\Exception $e){
$this->error($e->getMessage());
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
$this->update_classes($this->model["classes_lib_id"]);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
$this->update_classes($row["classes_lib_id"]);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
// $user = User::where("id", $row["user_id"])->find();
//// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
// $row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
$datas = [];
foreach ($list as $item) {
$this->updateCheck($item->id);
$datas[] = $item->classes_lib_id;
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
foreach ($datas as $classes_lib_id) {
$this->update_classes($classes_lib_id);
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
/**
* 课程收藏
*
* @icon fa fa-circle-o
*/
class Collect extends ManystoreBase
{
/**
* Collect模型对象
* @var \app\manystore\model\school\classes\Collect
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\Collect;
}
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(['user','schoolclasseslib'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,300 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\model\manystore\UserAuth;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程反馈管理
*
* @icon fa fa-circle-o
*/
class Evaluate extends ManystoreBase
{
/**
* Evaluate模型对象
* @var \app\manystore\model\school\classes\Evaluate
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["user_id","classes_lib_id","classes_order_id","manystore_id","shop_id","teacher_id","image","nickname"];
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\Evaluate;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("topList", $this->model->getTopList());
}
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->searchFields = ["id","message_text","user_id","schoolclassesorder.order_no","schoolclassesorder.pay_no","schoolclasseslib.title","schoolteacher.name","manystoreshop.name","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['user','schoolclasseslib','schoolclassesorder','manystore','manystoreshop','schoolteacher'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
$row->getRelation('schoolclassesorder')->visible(['order_no']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
$row->getRelation('schoolteacher')->visible(['name','head_image']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_after(&$row)
{
}
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id", $shop_id)->find();
if (!$manystore) {
$this->error("店铺不存在");
}
$params["manystore_id"] = $manystore["id"];
$params["shop_id"] = $shop_id;
$user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单".$params["user_id"]);
$params["user_id"] = $user["id"];
$user_id = $params["user_id"];
//修改
if($row){
}else{
//新增
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
$this->update_after($this->model);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
$this->update_after($row);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$user = User::where("id", $row["user_id"])->find();
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
/**
* 平台课程类型标签
*
* @icon fa fa-circle-o
*/
class Label extends ManystoreBase
{
/**
* Label模型对象
* @var \app\manystore\model\school\classes\Label
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\Label;
$this->view->assign("statusList", $this->model->getStatusList());
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -0,0 +1,372 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\model\manystore\UserAuth;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\Url;
/**
* 机构老师
*
* @icon fa fa-circle-o
*/
class Teacher extends ManystoreBase
{
protected $noNeedLogin = ["miniqrcode"];
/**
* Teacher模型对象
* @var \app\manystore\model\school\classes\Teacher
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["manystore_id","shop_id","user_id"];
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\Teacher;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
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->searchFields = ["id","name","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['user','manystore','manystoreshop'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname','realname','avatar']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
}
$rows = $list->items();
foreach ($rows as $k=>&$v){
$v["miniqrcode_link"] = Url::build("/manystore/school/classes/teacher/miniqrcode", ["ids" => $v["id"]]);
}
$result = array("total" => $list->total(), "rows" => $rows);
return json($result);
}
return $this->view->fetch();
}
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id", $shop_id)->find();
if (!$manystore) {
$this->error("店铺不存在");
}
$params["manystore_id"] = $manystore["id"];
$params["shop_id"] = $shop_id;
$user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
//添加用户机构认证
try {
\app\common\model\manystore\UserAuth::auth(0,$shop_id,$user["id"],0,'shop',$this->auth->id);
}catch (\Exception $e){
}
//如果开启了检测用户授权,则检测用户是否授权
if(config("site.shop_auth_user_check")){
if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
}
$params["user_id"] = $user["id"];
$user_id = $params["user_id"];
//修改
if($row){
//用户已是其他的教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->where("id","<>",$row["id"])->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构教师!");
}
}else{
//新增
//用户已是教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构教师!");
}
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
try {
$this->update_check($params,$row=null);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
try {
$this->update_check($params,$row);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$user = User::where("id", $row["user_id"])->find();
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function miniqrcode($ids = ''){
$param = $this->request->param();
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\school\classes\Teacher::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
return $url["response"];
}
/**
* 查看微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function lookminiqrcode($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\school\classes\Teacher::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("生成小程序码成功",null,$url);
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
/**
* 机构课程类型
*
* @icon fa fa-circle-o
*/
class Type extends ManystoreBase
{
/**
* Type模型对象
* @var \app\manystore\model\school\classes\Type
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\Type;
$this->view->assign("statusList", $this->model->getStatusList());
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -0,0 +1,310 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\model\manystore\UserAuth;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 机构核销员
*
* @icon fa fa-circle-o
*/
class Verification extends ManystoreBase
{
/**
* Verification模型对象
* @var \app\manystore\model\school\classes\Verification
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["manystore_id","shop_id","user_id"];
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\Verification;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
}
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->searchFields = ["id","manystoreshop.name","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['manystore','manystoreshop','user'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname','avatar']);
$row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
protected function updateCheck($id,$params=[],$row=null){
// 课程存在售后订单则不允许操作
}
protected function update_check(&$params,$row=null)
{
$shop_id = SHOP_ID;
$manystore = Manystore::where("shop_id", $shop_id)->find();
if (!$manystore) {
$this->error("店铺不存在");
}
$params["manystore_id"] = $manystore["id"];
$params["shop_id"] = $shop_id;
$user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单".$params["user_id"]);
try {
\app\common\model\manystore\UserAuth::auth(0,$shop_id,$user["id"],0,'shop',$this->auth->id);
}catch (\Exception $e){
}
//如果开启了检测用户授权,则检测用户是否授权
if(config("site.shop_auth_user_check")){
if(!UserAuth::authcheck($shop_id,$user["id"])) $this->error("用户未授权当前机构!请先让用户授权同意您再操作!");
}
$params["user_id"] = $user["id"];
$user_id = $params["user_id"];
//修改
if($row){
//用户已是其他的教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->where("id","<>",$row["id"])->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构核销员!");
}
}else{
//新增
//用户已是教师(搜索)
$teacher_user = $this->model->where("user_id",$user_id)->find();
if($teacher_user){
$this->error("用户已存在或已是其他授权机构核销员!");
}
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
try {
$this->update_check($params,$row=null);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$result = $this->model->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
try {
$this->update_check($params,$row);
} catch (ValidateException|PDOException|Exception $e) {
$this->error($e->getMessage());
}
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
$result = $row->allowField(true)->save($params);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$user = User::where("id", $row["user_id"])->find();
// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
$row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
/**
* 虚拟头像管理
*
* @icon fa fa-circle-o
*/
class VirtualHead extends ManystoreBase
{
/**
* VirtualHead模型对象
* @var \app\manystore\model\school\classes\VirtualHead
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\VirtualHead;
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
}

View File

@ -0,0 +1,197 @@
<?php
namespace app\manystore\controller\school\classes;
use app\common\controller\ManystoreBase;
use app\common\library\Virtual;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程虚拟参与者
*
* @icon fa fa-circle-o
*/
class VirtualUser extends ManystoreBase
{
/**
* VirtualUser模型对象
* @var \app\manystore\model\school\classes\VirtualUser
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_lib_id"];
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\VirtualUser;
parent::_initialize();
$this->view->assign("jointypeList", $this->model->getJointypeList());
$this->view->assign("havetypeList", $this->model->getHavetypeList());
}
public function import()
{
parent::import();
}
protected function update_classes($classes_lib_id){
\app\common\model\school\classes\ClassesLib::update_classes($classes_lib_id);
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将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(['schoolclasseslib'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
// if ($this->modelValidate) {
// $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
// $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
// $this->model->validateFailException(true)->validate($validate);
// }
// $result = $this->model->allowField(true)->save($params);
if(!$params["classes_lib_id"])throw new Exception( "请选择课程");
$res = (new Virtual)->getVirtualUser($params["num"],$params["classes_lib_id"],$params["time"],true);
$this->update_classes($params["classes_lib_id"]);
$result = true;
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$result = $row->allowField(true)->save($params);
$this->update_classes($row["classes_lib_id"]);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,520 @@
<?php
namespace app\manystore\controller\school\classes\activity;
use app\common\controller\ManystoreBase;
use app\common\model\manystore\UserAuth;
use app\common\model\school\classes\activity\order\Order;
use app\common\model\User;
use app\manystore\model\Manystore;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
use think\Url;
/**
* 课程活动
*
* @icon fa fa-circle-o
*/
class Activity extends ManystoreBase
{
/**
* Activity模型对象
* @var \app\manystore\model\school\classes\activity\Activity
*/
protected $model = null;
protected $itemmodel = null;
protected $qSwitch = true;
protected $qFields = ["user_id","shop_id","manystore_id"];
//不用审核允许修改的字段
protected $no_auth_fields = ['headimage','images',"status"];
protected $noNeedLogin = ["miniqrcode"];
protected $need_auth = true;
public function _initialize()
{
// parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\Activity;
$this->itemmodel = new \app\manystore\model\school\classes\activity\ActivityItem();
parent::_initialize();
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("recommendList", $this->model->getRecommendList());
$this->view->assign("hotList", $this->model->getHotList());
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
$this->view->assign("expirestatusList", $this->model->getExpirestatusList());
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->getCity();
$this->view->assign("itemStatusList", $this->itemmodel->getStatusList());
$this->view->assign("sexList", $this->itemmodel->getSexList());
}
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->searchFields = ["id","title","address","address_detail","address_city","manystoreshop.name"];
//设置过滤方法
$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, $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'];
$as = (new \app\common\model\school\classes\activity\Activity)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$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);
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
}
$rows = $list->items();
foreach ($rows as $k=>&$v){
$v["miniqrcode_link"] = Url::build("/manystore/school/classes/activity/activity/miniqrcode", ["ids" => $v["id"]]);
}
$result = array("total" => $list->total(), "rows" => $rows);
return json($result);
}
return $this->view->fetch();
}
protected function update_classes($classes_activity_id){
if($classes_activity_id) \app\common\model\school\classes\activity\Activity::update_classes($classes_activity_id);
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
protected function update_check(&$params,$row=null)
{
try {
if($row){
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
if($params["status"] != '3' && $row["status"] == '3'){
throw new \Exception("已被平台下架!无法操作上架状态!");
}
}
$classesLib = new \app\common\model\school\classes\activity\Activity();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->activityCheck($params,null,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
//修改
if($row){
}else{
//新增
//新增
$params["add_type"] = '1';
$params["add_id"] = $this->auth->id;
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$this->error(__('添加功能已被禁用!', ''));
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$spec = $params["item_json"];
unset($params["item_json"]);
$result = $this->model->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_id"] = $this->model["id"];
$v["manystore_id"] = $this->model["manystore_id"];
$v["shop_id"] = $this->model["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItem())->allowField(true)->save($v);
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$this->model["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs->toArray();
(new \app\common\model\school\classes\activity\ActivityItem)->specCheck($params,null,$specs);
}
$this->update_classes($this->model["id"]);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
if($this->have_auth){
(new \app\common\model\school\classes\activity\Activity)->applyAuth($row["id"],$params);
$result = true;
}else{
// var_dump($this->have_auth);
$spec = $params["item_json"] ?? [];
// var_dump($spec);
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["item_json"]);
unset($params["delete_spec_ids"]);
$result = $row->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_id"] = $row["id"];
$v["manystore_id"] = $row["manystore_id"];
$v["shop_id"] = $row["shop_id"];
//有id更新否则新增
if(isset($v["id"]) && $v["id"]){
\app\common\model\school\classes\activity\ActivityItem::update((new \app\common\model\school\classes\activity\ActivityItem)->checkAssemblyParameters($v));
}else{
\app\common\model\school\classes\activity\ActivityItem::create((new \app\common\model\school\classes\activity\ActivityItem)->checkAssemblyParameters($v));
}
}
//删除规格
foreach ($delete_spec_ids as $k=>$delete_spec){
(new \app\common\model\school\classes\activity\ActivityItem)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$row["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs->toArray();
(new \app\common\model\school\classes\activity\ActivityItem)->specCheck($params,null,$specs);
}
}
$this->update_classes($row["id"]);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
// $user = User::where("id", $row["user_id"])->find();
//// if(!$user) $this->error("未找到用户请先让用户登录小程序再提交表单");
// $row["user_id"] = $user["mobile"]?? ""; //nickname|realname|mobile
$spec = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$row["id"])->field("id,classes_activity_id,name,price,age,sex,limit_num,status,weigh")->order('weigh desc,id desc')->select();
$row["item_json"] = json_encode($spec);
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
//删除课程规格
\app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$item->id)->delete();
//删除课程规格
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_id",$item->id)->delete();
\app\common\model\school\classes\activity\ActivityAuth::where("classes_activity_id",$item->id)->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**
* 微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function miniqrcode($ids = ''){
$param = $this->request->param();
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\school\classes\activity\Activity::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
return $url["response"];
}
/**
* 查看微信小程序码
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function lookminiqrcode($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$url = \app\common\model\school\classes\activity\Activity::getMiniQrcodeLink($ids);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("生成小程序码成功",null,$url);
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,462 @@
<?php
namespace app\manystore\controller\school\classes\activity;
use app\common\controller\ManystoreBase;
use app\common\model\school\classes\activity\order\Order;
use app\common\model\User;
use think\Db;
use think\Exception;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课程活动审核
*
* @icon fa fa-circle-o
*/
class ActivityAuth extends ManystoreBase
{
/**
* ActivityAuth模型对象
* @var \app\manystore\model\school\classes\activity\ActivityAuth
*/
protected $model = null;
protected $itemmodel = null;
//不用审核允许修改的字段
protected $no_auth_fields = ['headimage','images','content',"price"];
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\activity\ActivityAuth;
$this->itemmodel = new \app\manystore\model\school\classes\activity\ActivityItemAuth();
parent::_initialize();
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("recommendList", $this->model->getRecommendList());
$this->view->assign("hotList", $this->model->getHotList());
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
$this->view->assign("expirestatusList", $this->model->getExpirestatusList());
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->getCity();
$this->view->assign("itemStatusList", $this->itemmodel->getStatusList());
$this->view->assign("sexList", $this->itemmodel->getSexList());
}
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->searchFields = ["id","classes_activity_id","title","address","address_detail","address_city","manystoreshop.name"];
//设置过滤方法
$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, $page, $alias, $bind, $excludearray) = $this->buildparams(null, null, ["has_expire"]);
if (isset($excludearray['has_expire']['value']) && $excludearray['has_expire']['value']) {
$has_expire = $excludearray['has_expire']['value'];
$as = (new \app\common\model\school\classes\activity\ActivityAuth)->getWithAlisaName();
switch ($has_expire) {
case '1': //查过期
$expireWhere = [
$as . '.end_time', '<=', time(),
];
break;
case '2': //查未过期
$expireWhere = [
$as . '.end_time', '>', time(),
];
break;
default:
}
} else {
$expireWhere = [[]];
}
$list = $this->model
->with(['schoolclassesactivity','manystore','manystoreshop'])
->where($where)
->where(...$expireWhere)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesactivity')->visible(['id']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
protected function update_classes($classes_activity_id,$row=null){
if($classes_activity_id && $row){
$activity = \app\common\model\school\classes\activity\Activity::where("id",$classes_activity_id)->find();
if($activity && in_array($row["auth_status"],[0,2])){
$activity["classes_activity_auth_id"] = $row["id"];
$activity->save();
}
}
}
protected function updateCheck($id,$params=[],$row=null){
if($params && $row){
// var_dump($this->no_auth_fields_check($params,$row));
if(!$this->no_auth_fields_check($params,$row)){
return true;
}
}
// 课程存在售后订单则不允许操作
$order = Order::where("classes_activity_id",$id)->where("status","not in","-3,6,9")->find();
if($order)throw new \Exception("存在正在使用中的订单报名学员,规格无法继续操作,如规格有误请下架!");
}
protected function update_check(&$params,$row=null)
{
//只要提交,就审核
$params["auth_status"] = 0;
$params["classes_activity_id"] = $params["classes_activity_id"] ?? 0;
if($row){
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
//查询是否存在活动如果存在附上活动id
$activity = \app\common\model\school\classes\activity\Activity::where("id",$row["classes_activity_id"])->find();
if($activity && empty($params["classes_activity_id"])){
$params["classes_activity_id"] = $activity["id"];
}
}
try {
$classesLib = new \app\common\model\school\classes\activity\ActivityAuth();
$classesLib->no_auth_fields = $this->no_auth_fields;
$classesLib->need_auth = $this->need_auth;
$classesLib->have_auth = $this->have_auth;
$classesLib->activityCheck($params,null,$row);
$this->need_auth = $classesLib->need_auth;
$this->have_auth = $classesLib->have_auth;
}catch (\Exception $e){
$this->error($e->getMessage());
}
//修改
if($row){
}else{
//新增
//新增
$params["add_type"] = '1';
$params["add_id"] = $this->auth->id;
}
}
/**
* 添加
*
* @return string
* @throws \think\Exception
*/
public function add()
{
if ($this->request->isPost()) {
// $this->error(__('添加功能已被禁用!', ''));
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row=null);
$spec = $params["item_json"];
unset($params["item_json"]);
// $params["status"] = "2";
$result = $this->model->allowField(true)->save($params);
// $this->model = new \app\manystore\model\school\classes\activity\Activity;
// $this->itemmodel = new \app\manystore\model\school\classes\activity\ActivityItem();
$activity = \app\manystore\model\school\classes\activity\Activity::where("title",$params["title"])->find();
if(!$activity){
$params["status"] = "3";
$params["classes_activity_auth_id"] = $this->model["id"];
$activity = new \app\manystore\model\school\classes\activity\Activity;
$result2 = $activity->allowField(true)->save($params);
}
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $this->model["id"];
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($this->model->classes_activity_id ?? 0);
$v["manystore_id"] = $this->model["manystore_id"];
$v["shop_id"] = $this->model["shop_id"];
unset($v["id"]);
(new \app\common\model\school\classes\activity\ActivityItemAuth())->allowField(true)->save($v);
if(isset($result2)){
(new \app\common\model\school\classes\activity\ActivityItem())->allowField(true)->save($v);
}
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$this->model["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs->toArray();
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
$this->update_classes($this->model["classes_activity_id"] ?? 0,$this->model);
//调用事件
$data = ['activity' => $this->model];
\think\Hook::listen('activity_auth_need_after', $data);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
Db::startTrans();
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$this->update_check($params,$row);
$spec = $params["item_json"] ?? [];
// var_dump($spec);
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
unset($params["item_json"]);
unset($params["delete_spec_ids"]);
$result = $row->allowField(true)->save($params);
//添加课程规格
foreach ($spec as $k=>$v){
$v["classes_activity_auth_id"] = $row["id"];
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($row->classes_activity_id ?? 0);
$v["manystore_id"] = $row["manystore_id"];
$v["shop_id"] = $row["shop_id"];
//有id更新否则新增
if(isset($v["id"]) && $v["id"]){
\app\common\model\school\classes\activity\ActivityItemAuth::update((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
}else{
\app\common\model\school\classes\activity\ActivityItemAuth::create((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
}
}
//删除规格
foreach ($delete_spec_ids as $k=>$delete_spec){
(new \app\common\model\school\classes\activity\ActivityItemAuth)->updateCheck($delete_spec["id"]);
$delete_spec->delete();
}
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->select();
foreach ($specss as $k=>$specs){
$params =$specs->toArray();
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
}
$this->update_classes($row["classes_activity_id"],$row);
//调用事件
$data = ['activity' => $row];
\think\Hook::listen('activity_auth_need_after', $data);
Db::commit();
} catch (ValidateException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$spec = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->field("id,classes_activity_id,name,price,age,sex,limit_num,status,weigh")->order('weigh desc,id desc')->select();
$row["item_json"] = json_encode($spec);
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
foreach ($list as $item) {
$this->updateCheck($item->id);
}
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
//删除课程规格
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$item->id)->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace app\manystore\controller\school\classes\activity;
use app\common\controller\ManystoreBase;
/**
* 课程活动项目
*
* @icon fa fa-circle-o
*/
class ActivityItem extends ManystoreBase
{
/**
* ActivityItem模型对象
* @var \app\manystore\model\school\classes\activity\ActivityItem
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\ActivityItem;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("sexList", $this->model->getSexList());
}
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(['manystore','manystoreshop','schoolclassesactivity'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
$row->getRelation('schoolclassesactivity')->visible(['title','headimage']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace app\manystore\controller\school\classes\activity;
use app\common\controller\ManystoreBase;
/**
* 课程活动项目审核管理
*
* @icon fa fa-circle-o
*/
class ActivityItemAuth extends ManystoreBase
{
/**
* ActivityItemAuth模型对象
* @var \app\manystore\model\school\classes\activity\ActivityItemAuth
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\ActivityItemAuth;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("sexList", $this->model->getSexList());
}
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(['manystore','manystoreshop','schoolclassesactivity'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
$row->getRelation('schoolclassesactivity')->visible(['title','headimage']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,211 @@
<?php
namespace app\manystore\controller\school\classes\activity\order;
use app\common\controller\ManystoreBase;
/**
* 机构课程活动订单
*
* @icon fa fa-circle-o
*/
class Order extends ManystoreBase
{
/**
* Order模型对象
* @var \app\manystore\model\school\classes\activity\order\Order
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\order\Order;
$this->view->assign("payTypeList", $this->model->getPayTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("beforeStatusList", $this->model->getBeforeStatusList());
$this->view->assign("serverStatusList", $this->model->getServerStatusList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
}
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->searchFields = ["id","refund_error","code","refund_no","order_no","pay_no","user_id","orderitem.name","schoolclassesactivityorderdetail.title","user.nickname","user.realname","user.mobile","manystoreshop.name"];
//设置过滤方法
$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(['user',"orderitem",'manystore','manystoreshop','schoolclassesactivity','schoolclassesactivityorderdetail'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
$row->getRelation('schoolclassesactivity')->visible(['title','headimage']);
$row->getRelation('schoolclassesactivityorderdetail')->visible(['title','headimage']);
$row->getRelation('orderitem')->visible(['name','price','feel']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 课程订单取消
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function cancel($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$model = (new \app\common\model\school\classes\activity\order\Order);
$model->cancel($ids,0,true,'shop',$this->auth->id,true);;
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('取消成功!');
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
/**预约审核
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function examine($ids = ""){
if($this->request->isPost())
{
try{
$params = $this->request->post("row/a");
$auth_status = $params["auth_status"];
$reason = $params["reason"];
$model = (new \app\common\model\school\classes\activity\order\Order);
$model->examine($params["id"],$auth_status,$reason,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("已完成审核");
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
// $row = $this->model->get($param['ids']);
$this->view->assign('row', $row);
return $this->view->fetch();
}
/**
* 后台核销
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function verification($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$model = (new \app\common\model\school\classes\activity\order\Order);
$model->verification($ids,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('核销成功!');
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
/**
* 退款重试
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function refund($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$model = (new \app\common\model\school\classes\activity\order\Order);
$model->orderRefund($ids,null,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('已重新发起退款,如果是第三方支付请等待回调!');
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,85 @@
<?php
namespace app\manystore\controller\school\classes\activity\order;
use app\common\controller\ManystoreBase;
/**
* 课程活动订单详情
*
* @icon fa fa-circle-o
*/
class OrderDetail extends ManystoreBase
{
/**
* OrderDetail模型对象
* @var \app\manystore\model\school\classes\activity\order\OrderDetail
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\order\OrderDetail;
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("recommendList", $this->model->getRecommendList());
$this->view->assign("hotList", $this->model->getHotList());
$this->view->assign("newList", $this->model->getNewList());
$this->view->assign("selfhotList", $this->model->getSelfhotList());
$this->view->assign("expirestatusList", $this->model->getExpirestatusList());
$this->view->assign("addTypeList", $this->model->getAddTypeList());
}
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','schoolclassesactivity','manystore','manystoreshop','user'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesactivityorder')->visible(['order_no','pay_no']);
$row->getRelation('schoolclassesactivity')->visible(['title','headimage']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

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

@ -0,0 +1,74 @@
<?php
namespace app\manystore\controller\school\classes\activity\order;
use app\common\controller\ManystoreBase;
/**
* 机构课程活动订单日志
*
* @icon fa fa-circle-o
*/
class OrderLog extends ManystoreBase
{
/**
* OrderLog模型对象
* @var \app\manystore\model\school\classes\activity\order\OrderLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\activity\order\OrderLog;
$this->view->assign("statusList", $this->model->getStatusList());
}
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'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesactivityorder')->visible(['order_no','pay_no']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,324 @@
<?php
namespace app\manystore\controller\school\classes\hourorder;
use app\common\controller\ManystoreBase;
use think\Db;
use think\exception\PDOException;
use think\exception\ValidateException;
/**
* 课时订单
*
* @icon fa fa-circle-o
*/
class Order extends ManystoreBase
{
/**
* Order模型对象
* @var \app\manystore\model\school\classes\hourorder\Order
*/
protected $model = null;
protected $qSwitch = true;
protected $qFields = ["classes_order_id","classes_lib_spec_id","user_id","classes_order_detail_id","classes_lib_id"];
public function _initialize()
{
$this->model = new \app\manystore\model\school\classes\hourorder\Order;
parent::_initialize();
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("authStatusList", $this->model->getAuthStatusList());
}
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->searchFields = ["id","order_no","schoolclassesorder.order_no","schoolclassesorder.pay_no","user_id","schoolclasseslibspec.name","schoolclassesorderdetail.title","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['schoolclassesorder','schoolclasseslibspec','user','schoolclassesorderdetail','schoolclasseslib'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesorder')->visible(['order_no']);
$row->getRelation('schoolclasseslibspec')->visible(['name']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage','feel']);
$row->getRelation('schoolclasseslib')->visible(['title']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 添加
*/
public function add()
{
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
if($this->storeIdFieldAutoFill && STORE_ID ){
$params['store_id'] = STORE_ID;
}
if($this->shopIdAutoCondition && SHOP_ID){
$params['shop_id'] = SHOP_ID;
}
$result = false;
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
$this->model->validateFailException(true)->validate($validate);
}
//记录代下单人信息
$param = [
"type" =>'2',
"help_user_id" =>$this->auth->id,
"help_type" => 'shop',
];
//确认订单
$res = (new \app\common\model\school\classes\hourorder\Order)->confirm($this->auth->id,$params['classes_order_id'],null, $params['classes_lib_spec_id'],$param, true);
$remark = "总后台管理员帮忙下课时预约";
//创建订单
$result = (new \app\common\model\school\classes\hourorder\Order)->cacheCreateOrder($res['order_no'], $this->auth->id,$remark, true);
} catch (ValidateException $e) {
$this->error($e->getMessage());
} catch (PDOException $e) {
$this->error($e->getMessage());
} catch (\Exception $e) {
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were inserted'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
return $this->view->fetch();
}
/**
* 编辑
*/
public function edit($ids = null)
{
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
if ($this->request->isPost()) {
$params = $this->request->post("row/a");
if ($params) {
$params = $this->preExcludeFields($params);
$result = false;
try {
//是否采用模型验证
if ($this->modelValidate) {
$name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
$row->validateFailException(true)->validate($validate);
}
$result = (new \app\common\model\school\classes\hourorder\Order)->updateClassesSpec($row["id"],$params["classes_lib_spec_id"],0,true,'shop',$this->auth->id,true);
} catch (ValidateException $e) {
$this->error($e->getMessage());
} catch (PDOException $e) {
$this->error($e->getMessage());
} catch (\Exception $e) {
$this->error($e->getMessage());
}
if ($result !== false) {
$this->success();
} else {
$this->error(__('No rows were updated'));
}
}
$this->error(__('Parameter %s can not be empty', ''));
}
$this->view->assign("row", $row);
return $this->view->fetch();
}
/**
* 删除
*/
public function del($ids = "")
{
if (!$this->request->isPost()) {
$this->error(__("Invalid parameters"));
}
$ids = $ids ? $ids : $this->request->post("ids");
if ($ids) {
$pk = $this->model->getPk();
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
$list = $this->model->where($pk, 'in', $ids)->select();
$count = 0;
try {
foreach ($list as $k => $v) {
$res = (new \app\common\model\school\classes\hourorder\Order)->cancel($v["id"],0,true,'shop',$this->auth->id,true);
$count ++;
}
} catch (PDOException $e) {
$this->error($e->getMessage());
} catch (\Exception $e) {
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
/**预约审核
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function examine($ids = ""){
if($this->request->isPost())
{
try{
$params = $this->request->post("row/a");
$auth_status = $params["auth_status"];
$reason = $params["reason"];
$model = (new \app\common\model\school\classes\hourorder\Order);
$model->examine($params["id"],$auth_status,$reason,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("已完成审核");
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
// $row = $this->model->get($param['ids']);
$this->view->assign('row', $row);
return $this->view->fetch();
}
/**
* 后台核销
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function verification($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$model = (new \app\common\model\school\classes\hourorder\Order);
$model->verification($ids,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('核销成功!');
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace app\manystore\controller\school\classes\hourorder;
use app\common\controller\ManystoreBase;
/**
* 课时订单日志
*
* @icon fa fa-circle-o
*/
class OrderLog extends ManystoreBase
{
/**
* OrderLog模型对象
* @var \app\manystore\model\school\classes\hourorder\OrderLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\hourorder\OrderLog;
$this->view->assign("statusList", $this->model->getStatusList());
}
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(['schoolclasseshourorder'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclasseshourorder')->visible(['order_no']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,166 @@
<?php
namespace app\manystore\controller\school\classes\order;
use app\common\controller\ManystoreBase;
/**
* 机构课程订单
*
* @icon fa fa-circle-o
*/
class Order extends ManystoreBase
{
/**
* Order模型对象
* @var \app\manystore\model\school\classes\order\Order
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\order\Order;
$this->view->assign("payTypeList", $this->model->getPayTypeList());
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("beforeStatusList", $this->model->getBeforeStatusList());
$this->view->assign("serverStatusList", $this->model->getServerStatusList());
$this->view->assign("resultStatusList", $this->model->getResultStatusList());
}
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->searchFields = ["id","order_no","pay_no","user_id","code","manystoreshop.name","schoolclassesorderdetail.title","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['manystore','user','manystoreshop','schoolclasseslib','schoolclassesorderdetail','admin'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('manystore')->visible(['nickname','avatar']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage',"feel","teacher_id"]);
$row->getRelation('admin')->visible(['nickname','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* 课程订单取消
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function cancel($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$model = (new \app\common\model\school\classes\order\Order);
$model->cancel($ids,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('取消成功!');
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
/**发起售后
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function after_sales($ids = ""){
if($this->request->isPost())
{
try{
$params = $this->request->post("row/a");
$classes_order = $params["id"];
$reason = $params["reason"];
$model = (new \app\common\model\school\classes\order\ServiceOrder());
$remark = "机构端管理员帮忙下售后单";
$order = $model->afterSales($classes_order,$reason,$remark,'shop',$this->auth->id,true);
$price = $params["price"];
$status = "yes";
$reject_reason = "";
$reject_images = "";
$model = (new \app\common\model\school\classes\order\ServiceOrder());
$model->shopConfirmation($order["order_no"],$status,$price,$reject_reason,$reject_images,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("执行成功");
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
// $row = $this->model->get($param['ids']);
$order_info = \app\common\model\school\classes\order\ServiceOrder::getCost("43246634123432564",$ids,"",[],true);
// $row = $this->model->get($param['ids']);
$this->view->assign('row',array_merge($row->toArray(),$order_info));
return $this->view->fetch();
}
}

View File

@ -0,0 +1,79 @@
<?php
namespace app\manystore\controller\school\classes\order;
use app\common\controller\ManystoreBase;
/**
* 课程订单课程详情
*
* @icon fa fa-circle-o
*/
class OrderDetail extends ManystoreBase
{
/**
* OrderDetail模型对象
* @var \app\manystore\model\school\classes\order\OrderDetail
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\order\OrderDetail;
$this->view->assign("addTypeList", $this->model->getAddTypeList());
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("addressTypeList", $this->model->getAddressTypeList());
}
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(['schoolclassesorder','manystore','manystoreshop','user'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesorder')->visible(['order_no']);
$row->getRelation('manystore')->visible(['nickname','avatar']);
$row->getRelation('manystoreshop')->visible(['name','image','address_city','province','city','district','address','address_detail']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace app\manystore\controller\school\classes\order;
use app\common\controller\ManystoreBase;
/**
* 课程订单日志
*
* @icon fa fa-circle-o
*/
class OrderLog extends ManystoreBase
{
/**
* OrderLog模型对象
* @var \app\manystore\model\school\classes\order\OrderLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\order\OrderLog;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("beforeStatusList", $this->model->getBeforeStatusList());
$this->view->assign("serverStatusList", $this->model->getServerStatusList());
$this->view->assign("resultStatusList", $this->model->getResultStatusList());
}
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(['schoolclassesorder'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesorder')->visible(['order_no']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,235 @@
<?php
namespace app\manystore\controller\school\classes\order;
use app\common\controller\ManystoreBase;
/**
* 机构课程售后单
*
* @icon fa fa-circle-o
*/
class ServiceOrder extends ManystoreBase
{
/**
* ServiceOrder模型对象
* @var \app\manystore\model\school\classes\order\ServiceOrder
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\order\ServiceOrder;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("serviceStautsList", $this->model->getServiceStautsList());
$this->view->assign("salesTypeList", $this->model->getSalesTypeList());
$this->view->assign("platformList", $this->model->getPlatformList());
$this->view->assign("payTypeList", $this->model->getPayTypeList());
}
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->searchFields = ["id","order_no","schoolclassesorder.order_no","schoolclassesorder.pay_no","user_id","manystoreshop.name","schoolclassesorderdetail.title","user.nickname","user.realname","user.mobile"];
//设置过滤方法
$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(['schoolclassesorder','user','schoolclassesorderdetail','schoolclasseslib','manystore','manystoreshop'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesorder')->visible(['order_no','pay_no']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('schoolclassesorderdetail')->visible(['title','headimage']);
$row->getRelation('schoolclasseslib')->visible(['title','headimage']);
$row->getRelation('manystore')->visible(['nickname']);
$row->getRelation('manystoreshop')->visible(['name','logo']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**用户确认
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function user_confirmation($ids = ""){
if($this->request->isPost())
{
try{
$params = $this->request->post("row/a");
$order_no = $params["order_no"];
$reject_images = $params["reject_images"];
$reject_reason = $params["reject_reason"];
$status = $params["status"];
$model = (new \app\common\model\school\classes\order\ServiceOrder());
$model->userConfirmation($order_no,$status,$reject_reason,$reject_images,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("已完成审核");
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
// $row = $this->model->get($param['ids']);
$this->view->assign("statusList", ["yes"=>"同意", "no"=>"拒绝"]);
$this->view->assign('row', $row);
return $this->view->fetch();
}
/**机构确认
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function shop_confirmation($ids = ""){
if($this->request->isPost())
{
try{
$params = $this->request->post("row/a");
$order_no = $params["order_no"];
$reject_images = $params["reject_images"];
$reject_reason = $params["reject_reason"];
$price = $params["price"];
$status = $params["status"];
$model = (new \app\common\model\school\classes\order\ServiceOrder());
$model->shopConfirmation($order_no,$status,$price,$reject_reason,$reject_images,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("已完成审核");
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
// $row = $this->model->get($param['ids']);
$this->view->assign("statusList", ["yes"=>"同意", "no"=>"拒绝"]);
$this->view->assign('row', $row);
return $this->view->fetch();
}
/**系统确认
* @return string
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function admin_confirmation($ids = ""){
if($this->request->isPost())
{
try{
$params = $this->request->post("row/a");
$order_no = $params["order_no"];
$reject_images = $params["reject_images"];
$reject_reason = $params["reject_reason"];
$status = $params["status"];
$model = (new \app\common\model\school\classes\order\ServiceOrder());
$model->adminConfirmation($order_no,$status,$reject_reason,$reject_images,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success("已完成审核");
}
$row = $this->model->where(array('id'=>$ids))->find();
if (!$row) {
$this->error(__('No Results were found'));
}
// $row = $this->model->get($param['ids']);
$this->view->assign("statusList", ["yes"=>"同意", "no"=>"拒绝"]);
$this->view->assign('row', $row);
return $this->view->fetch();
}
/**
* 后台核销
* @return string
* @throws \think\Exception
* @throws \think\db\exception\BindParamException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException
*/
public function cancel($ids = ''){
$param = $this->request->param();
if($this->request->isPost()){
try{
if(isset($param['ids']))$ids = $param['ids'];
//设置模拟资格
$model = (new \app\common\model\school\classes\order\ServiceOrder());
$model->cancel($ids,0,true,'shop',$this->auth->id,true);
}catch (\Exception $e){
$this->error($e->getMessage());
}
$this->success('取消成功!');
}
$row = $this->model->get($ids);
$this->view->assign('vo', $row);
return $this->view->fetch();
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace app\manystore\controller\school\classes\order;
use app\common\controller\ManystoreBase;
/**
* 机构课程售后单日志
*
* @icon fa fa-circle-o
*/
class ServiceOrderLog extends ManystoreBase
{
/**
* ServiceOrderLog模型对象
* @var \app\manystore\model\school\classes\order\ServiceOrderLog
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\manystore\model\school\classes\order\ServiceOrderLog;
$this->view->assign("statusList", $this->model->getStatusList());
$this->view->assign("serviceStautsList", $this->model->getServiceStautsList());
$this->view->assign("salesTypeList", $this->model->getSalesTypeList());
}
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(['schoolclassesserviceorder','schoolclassesorder','user','schoolclassesorderdetail','admin'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('schoolclassesserviceorder')->visible(['order_no']);
$row->getRelation('schoolclassesorder')->visible(['order_no','pay_no']);
$row->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
$row->getRelation('schoolclassesorderdetail')->visible(['title']);
$row->getRelation('admin')->visible(['nickname']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}

View File

@ -0,0 +1,244 @@
<?php
namespace app\manystore\controller\user;
use app\common\controller\ManystoreBase;
use app\common\model\manystore\UserAuth;
use app\manystore\model\school\classes\order\Order;
use fast\Tree;
/**
* 会员管理
*
* @icon fa fa-user
*/
class User extends ManystoreBase
{
/**
* User模型对象
* @var \app\manystore\model\user\User
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\User;
$this->view->assign("genderListJson", json_encode($this->model->getGenderList(), JSON_UNESCAPED_UNICODE));
}
public function import()
{
parent::import();
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
$this->searchFields = ["id","nickname","realname","mobile"];
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
// $where[] = [$aliasName.'shop_id','eq',SHOP_ID];
$user_ids = Order::where("shop_id",SHOP_ID)->where("status","<>","-3")->column("user_id");
$activity_user_ids = \app\manystore\model\school\classes\activity\order\Order::where("shop_id",SHOP_ID)->where("status","<>","-3")->column("user_id");
$user_ids = array_merge($user_ids ,$activity_user_ids);
$list = $this->model
->where($where)
->where("id","in",$user_ids)
->order($sort, $order)
->paginate($limit);
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
/**
* Selectpage的实现方法
*
* 当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可
* 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可
*
*/
protected function selectpage()
{
//设置过滤方法
$this->request->filter(['trim', 'strip_tags', 'htmlspecialchars']);
//搜索关键词,客户端输入以空格分开,这里接收为数组
$word = (array)$this->request->request("q_word/a");
//当前页
$page = $this->request->request("pageNumber");
//分页大小
$pagesize = $this->request->request("pageSize");
//搜索条件
$andor = $this->request->request("andOr", "and", "strtoupper");
//排序方式
$orderby = (array)$this->request->request("orderBy/a");
//显示的字段
$field = $this->request->request("showField");
//主键
$primarykey = $this->request->request("keyField");
//主键值
$primaryvalue = $this->request->request("keyValue");
//搜索字段
// $searchfield = (array)$this->request->request("searchField/a");
$searchfield = [
'id','realname', 'username', 'nickname', 'mobile'
];
//自定义搜索条件
$custom = (array)$this->request->request("custom/a");
//是否返回树形结构
$istree = $this->request->request("isTree", 0);
$ishtml = $this->request->request("isHtml", 0);
if ($istree) {
$word = [];
$pagesize = 999999;
}
$order = [];
foreach ($orderby as $k => $v) {
$order[$v[0]] = $v[1];
}
$field = $field ? $field : 'name';
//如果有primaryvalue,说明当前是初始化传值
if ($primaryvalue !== null) {
$where = [$primarykey => ['in', $primaryvalue]];
$pagesize = 999999;
} else {
$where = function ($query) use ($word, $andor, $field, $searchfield, $custom) {
$logic = $andor == 'AND' ? '&' : '|';
$searchfield = is_array($searchfield) ? implode($logic, $searchfield) : $searchfield;
$searchfield = str_replace(',', $logic, $searchfield);
$word = array_filter(array_unique($word));
if (count($word) == 1) {
$query->where($searchfield, "like", "%" . reset($word) . "%");
} else {
$query->where(function ($query) use ($word, $searchfield) {
foreach ($word as $index => $item) {
$query->whereOr(function ($query) use ($item, $searchfield) {
$query->where($searchfield, "like", "%{$item}%");
});
}
});
}
if ($custom && is_array($custom)) {
foreach ($custom as $k => $v) {
if (is_array($v) && 2 == count($v)) {
$query->where($k, trim($v[0]), $v[1]);
} else {
$query->where($k, '=', $v);
}
}
}
};
}
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
//只允许查到授权过的用户
$user_ids = UserAuth::where("shop_id",SHOP_ID)->column("user_id");
if($user_ids){
$this->model->where("id","in",$user_ids);
}else{
$this->model->where("id","=",-1);
}
$list = [];
$total = $this->model->where($where)->count();
if ($total > 0) {
if($this->shopIdAutoCondition){
$this->model->where(array('shop_id'=>SHOP_ID));
}
if($user_ids){
$this->model->where("id","in",$user_ids);
}else{
$this->model->where("id","=",-1);
}
$fields = is_array($this->selectpageFields) ? $this->selectpageFields : ($this->selectpageFields && $this->selectpageFields != '*' ? explode(',', $this->selectpageFields) : []);
//如果有primaryvalue,说明当前是初始化传值,按照选择顺序排序
if ($primaryvalue !== null && preg_match("/^[a-z0-9_\-]+$/i", $primarykey)) {
$primaryvalue = array_unique(is_array($primaryvalue) ? $primaryvalue : explode(',', $primaryvalue));
$primaryvalue = implode(',', $primaryvalue);
$this->model->orderRaw("FIELD(`{$primarykey}`, {$primaryvalue})");
} else {
$this->model->order($order);
}
$datalist = $this->model->where($where)
->page($page, $pagesize)
->select();
foreach ($datalist as $index => $item) {
unset($item['password'], $item['salt']);
if ($this->selectpageFields == '*') {
$result = [
$primarykey => isset($item[$primarykey]) ? $item[$primarykey] : '',
$field => isset($item[$field]) ? $item[$field] : '',
'nickname' => isset($item['nickname']) ? $item['nickname'] : '',
'mobile' => isset($item['mobile']) ? $item['mobile'] : '',
'realname' => isset($item['realname']) ? $item['realname'] : '',
];
} else {
$result = array_intersect_key(($item instanceof Model ? $item->toArray() : (array)$item), array_flip($fields));
}
$result['pid'] = isset($item['pid']) ? $item['pid'] : (isset($item['parent_id']) ? $item['parent_id'] : 0);
$list[] = $result;
}
if ($istree && !$primaryvalue) {
$tree = Tree::instance();
$tree->init(collection($list)->toArray(), 'pid');
$list = $tree->getTreeList($tree->getTreeArray(0), $field);
if (!$ishtml) {
foreach ($list as &$item) {
$item = str_replace('&nbsp;', ' ', $item);
}
unset($item);
}
}
}
if (count($word) == 1 && !$list) {
$word = reset($word);
$list[] = [
'nickname' => '未授权',
'mobile' => $word,
'realname' => '',
];
}
//这里一定要返回有list这个字段,total是可选的,如果total<=list的数量,则会隐藏分页按钮
return json(['list' => $list, 'total' => $total]);
}
}

View File

@ -0,0 +1,186 @@
<?php
return [
'User id' => '会员ID',
'Username' => '用户名',
'Nickname' => '昵称',
'Password' => '密码',
'Sign up' => '注 册',
'Sign in' => '登 录',
'Sign out' => '注 销',
'Keep login' => '保持会话',
'Guest' => '游客',
'Welcome' => '%s你好',
'View' => '查看',
'Add' => '添加',
'Edit' => '编辑',
'Del' => '删除',
'Delete' => '删除',
'Import' => '导入',
'Export' => '导出',
'All' => '全部',
'Detail' => '详情',
'Multi' => '批量更新',
'Setting' => '配置',
'Move' => '移动',
'Name' => '名称',
'Status' => '状态',
'Weigh' => '权重',
'Operate' => '操作',
'Warning' => '温馨提示',
'Default' => '默认',
'Article' => '文章',
'Page' => '单页',
'OK' => '确定',
'Apply' => '应用',
'Cancel' => '取消',
'Clear' => '清空',
'Custom Range' => '自定义',
'Today' => '今天',
'Yesterday' => '昨天',
'Last 7 days' => '最近7天',
'Last 30 days' => '最近30天',
'Last month' => '上月',
'This month' => '本月',
'Loading' => '加载中',
'Money' => '余额',
'Score' => '积分',
'More' => '更多',
'Yes' => '是',
'No' => '否',
'Normal' => '正常',
'Hidden' => '隐藏',
'Locked' => '锁定',
'Submit' => '提交',
'Reset' => '重置',
'Execute' => '执行',
'Close' => '关闭',
'Choose' => '选择',
'Search' => '搜索',
'Refresh' => '刷新',
'Install' => '安装',
'Uninstall' => '卸载',
'First' => '首页',
'Previous' => '上一页',
'Next' => '下一页',
'Last' => '末页',
'None' => '无',
'Home' => '主页',
'Online' => '在线',
'Login' => '登录',
'Logout' => '注销',
'Profile' => '个人资料',
'Index' => '首页',
'Hot' => '热门',
'Recommend' => '推荐',
'Upload' => '上传',
'Uploading' => '上传中',
'Code' => '编号',
'Message' => '内容',
'Line' => '行号',
'File' => '文件',
'Menu' => '菜单',
'Type' => '类型',
'Title' => '标题',
'Content' => '内容',
'Append' => '追加',
'Select' => '选择',
'Memo' => '备注',
'Parent' => '父级',
'Params' => '参数',
'Permission' => '权限',
'Check all' => '选中全部',
'Expand all' => '展开全部',
'Begin time' => '开始时间',
'End time' => '结束时间',
'Create time' => '创建时间',
'Update time' => '更新时间',
'Flag' => '标志',
'Drag to sort' => '拖动进行排序',
'Redirect now' => '立即跳转',
'Key' => '键',
'Value' => '值',
'Common search' => '普通搜索',
'Search %s' => '搜索 %s',
'View %s' => '查看 %s',
'%d second%s ago' => '%d秒前',
'%d minute%s ago' => '%d分钟前',
'%d hour%s ago' => '%d小时前',
'%d day%s ago' => '%d天前',
'%d week%s ago' => '%d周前',
'%d month%s ago' => '%d月前',
'%d year%s ago' => '%d年前',
'Set to normal' => '设为正常',
'Set to hidden' => '设为隐藏',
'Recycle bin' => '回收站',
'Restore' => '还原',
'Restore all' => '还原全部',
'Destroy' => '销毁',
'Destroy all' => '清空回收站',
'Nothing need restore' => '没有需要还原的数据',
//提示
'Go back' => '返回首页',
'Jump now' => '立即跳转',
'Click to search %s' => '点击搜索 %s',
'Click to toggle' => '点击切换',
'Operation completed' => '操作成功!',
'Operation failed' => '操作失败!',
'Unknown data format' => '未知的数据格式!',
'Network error' => '网络错误!',
'Invalid parameters' => '未知参数',
'No results were found' => '记录未找到',
'No rows were inserted' => '未插入任何行',
'No rows were deleted' => '未删除任何行',
'No rows were updated' => '未更新任何行',
'Parameter %s can not be empty' => '参数%s不能为空',
'Are you sure you want to delete the %s selected item?' => '确定删除选中的 %s 项?',
'Are you sure you want to delete this item?' => '确定删除此项?',
'Are you sure you want to delete or turncate?' => '确定删除或清空?',
'Are you sure you want to truncate?' => '确定清空?',
'Token verification error' => 'Token验证错误',
'You have no permission' => '你没有权限访问',
'Please enter your username' => '请输入你的用户名',
'Please enter your password' => '请输入你的密码',
'Please login first' => '请登录后操作',
'You can upload up to %d file%s' => '你最多还可以上传%d个文件',
'You can choose up to %d file%s' => '你最多还可以选择%d个文件',
'An unexpected error occurred' => '发生了一个意外错误,程序猿正在紧急处理中',
'This page will be re-directed in %s seconds' => '页面将在 %s 秒后自动跳转',
//菜单
'Dashboard' => '控制台',
'General' => '常规管理',
'Category' => '分类管理',
'Addon' => '插件管理',
'Auth' => '权限管理',
'Config' => '系统配置',
'Attachment' => '附件管理',
'Admin' => '管理员管理',
'Admin log' => '管理员日志',
'Group' => '角色组',
'Rule' => '菜单规则',
'User' => '会员管理',
'User group' => '会员分组',
'User rule' => '会员规则',
'Select attachment' => '选择附件',
'Update profile' => '更新个人信息',
'Update shop' => '更新商家信息',
'Local install' => '本地安装',
'Update state' => '禁用启用',
'Admin group' => '超级管理组',
'Second group' => '二级管理组',
'Third group' => '三级管理组',
'Second group 2' => '二级管理组2',
'Third group 2' => '三级管理组2',
'Dashboard tips' => '用于展示当前系统中的统计数据、统计报表及重要实时数据',
'Config tips' => '提示:修改相关配置后,点击【确认】才会保存生效',
'Category tips' => '用于统一管理网站的所有分类,分类可进行无限级分类,分类类型请在常规管理->系统配置->字典配置中添加',
'Attachment tips' => '主要用于管理上传到服务器或第三方存储的数据',
'Addon tips' => '可在线安装、卸载、禁用、启用插件同时支持添加本地插件。FastAdmin已上线插件商店 ,你可以发布你的免费或付费插件:<a href="https://www.fastadmin.net/store.html" target="_blank">https://www.fastadmin.net/store.html</a>',
'Admin tips' => '一个管理员可以有多个角色组,左侧的菜单根据管理员所拥有的权限进行生成',
'Admin log tips' => '管理员可以查看自己所拥有的权限的管理员日志',
'Group tips' => '角色组可以有多个,角色有上下级层级关系,如果子角色有角色组和管理员的权限则可以派生属于自己组别的下级角色组或管理员',
'Rule tips' => '规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过命令行进行生成规则节点',
'Type 1' => '个人认证',
'Type 2' => '机构认证',
];

View File

@ -0,0 +1,93 @@
<?php
return [
'Id' => 'ID',
'Title' => '插件名称',
'Value' => '配置值',
'Array key' => '键',
'Array value' => '值',
'File' => '文件',
'Donate' => '打赏作者',
'Warmtips' => '温馨提示',
'Pay now' => '立即支付',
'Offline install' => '离线安装',
'Refresh addon cache' => '刷新插件缓存',
'Userinfo' => '会员信息',
'Online store' => '在线商店',
'Local addon' => '本地插件',
'Conflict tips' => '此插件中发现和现有系统中部分文件发现冲突!以下文件将会被影响,请备份好相关文件后再继续操作',
'Login tips' => '此处登录账号为<a href="https://www.fastadmin.net" target="_blank">FastAdmin官网账号</a>',
'Logined tips' => '你好!%s<br />当前你已经登录,将同步保存你的购买记录',
'Pay tips' => '扫码支付后如果仍然无法立即下载,请不要重复支付,请加<a href="https://jq.qq.com/?_wv=1027&k=487PNBb" target="_blank">QQ群636393962</a>向管理员反馈',
'Pay click tips' => '请点击这里在新窗口中进行支付!',
'Pay new window tips' => '请在新弹出的窗口中进行支付,支付完成后再重新点击安装按钮进行安装!',
'Uninstall tips' => '确认卸载<b>[%s]</b><p class="text-danger">卸载将会删除所有插件文件且不可找回!!! 插件如果有创建数据库表请手动删除!!!</p>如有重要数据请备份后再操作!',
'Upgrade tips' => '确认升级<b>[%s]</b><p class="text-danger">如果之前购买插件时未登录,此次升级可能出现购买后才可以下载的提示!!!<br>升级后可能出现部分冗余数据记录,请根据需要移除即可!!!</p>如有重要数据请备份后再操作!',
'Offline installed tips' => '插件安装成功!清除浏览器缓存和框架缓存后生效!',
'Online installed tips' => '插件安装成功!清除浏览器缓存和框架缓存后生效!',
'Not login tips' => '你当前未登录FastAdmin登录后将同步已购买的记录下载时无需二次付费',
'Not installed tips' => '请安装后再访问插件前台页面!',
'Not enabled tips' => '插件已经禁用,请启用后再访问插件前台页面!',
'New version tips' => '发现新版本:%s 点击查看更新日志',
'Store now available tips' => 'FastAdmin插件市场暂不可用是否切换到本地插件',
'Switch to the local' => '切换到本地插件',
'try to reload' => '重新尝试加载',
'Please disable addon first' => '请先禁用插件再进行升级',
'Login now' => '立即登录',
'Continue install' => '不登录,继续安装',
'View addon home page' => '查看插件介绍和帮助',
'View addon index page' => '查看插件前台首页',
'View addon screenshots' => '点击查看插件截图',
'Click to toggle status' => '点击切换插件状态',
'Click to contact developer' => '点击与插件开发者取得联系',
'My addons' => '我购买的插件',
'My posts' => '我发布的插件',
'Index' => '前台',
'All' => '全部',
'Uncategoried' => '未归类',
'Recommend' => '推荐',
'Hot' => '热门',
'New' => '新',
'Paying' => '付费',
'Free' => '免费',
'Sale' => '折扣',
'No image' => '暂无缩略图',
'Price' => '价格',
'Downloads' => '下载',
'Author' => '作者',
'Identify' => '标识',
'Homepage' => '主页',
'Intro' => '介绍',
'Version' => '版本',
'New version' => '新版本',
'Createtime' => '添加时间',
'Releasetime' => '更新时间',
'Detail' => '插件详情',
'Document' => '文档',
'Demo' => '演示',
'Feedback' => '反馈BUG',
'Install' => '安装',
'Uninstall' => '卸载',
'Upgrade' => '升级',
'Setting' => '配置',
'Disable' => '禁用',
'Enable' => '启用',
'Your username or email' => '你的手机号、用户名或邮箱',
'Your password' => '你的密码',
'Login FastAdmin' => '登录FastAdmin',
'Login' => '登录',
'Logout' => '退出登录',
'Register' => '注册账号',
'You\'re not login' => '当前未登录',
'Continue uninstall' => '继续卸载',
'Continue operate' => '继续操作',
'Install successful' => '安装成功',
'Uninstall successful' => '卸载成功',
'Operate successful' => '操作成功',
'Addon name incorrect' => '插件名称不正确',
'Addon info file was not found' => '插件配置文件未找到',
'Addon info file data incorrect' => '插件配置信息不正确',
'Addon already exists' => '上传的插件已经存在',
'Unable to open the zip file' => '无法打开ZIP文件',
'Unable to extract the file' => '无法解压ZIP文件',
];

View File

@ -0,0 +1,8 @@
<?php
return [
'No file upload or server upload limit exceeded' => '未上传文件或超出服务器上传限制',
'Uploaded file format is limited' => '上传文件格式受限制',
'Uploaded file is not a valid image' => '上传文件不是有效的图片文件',
'Upload successful' => '上传成功',
];

View File

@ -0,0 +1,12 @@
<?php
return [
'The parent group can not be its own child' => '父组别不能是自身的子组别',
'The parent group can not found' => '父组别未找到',
'Group not found' => '组别未找到',
'Can not change the parent to child' => '父组别不能是它的子组别',
'Can not change the parent to self' => '父组别不能是它自己',
'You can not delete group that contain child group and administrators' => '你不能删除含有子组和管理员的组',
'The parent group exceeds permission limit' => '父组别超出权限范围',
'The parent group can not be its own child or itself' => '父组别不能是它的子组别及本身',
];

View File

@ -0,0 +1,9 @@
<?php
return [
'Group' => '所属组别',
'Loginfailure' => '登录失败次数',
'Login time' => '最后登录',
'Please input correct username' => '用户名只能由3-12位数字、字母、下划线组合',
'Please input correct password' => '密码长度必须在6-16位之间不能包含空格',
];

View File

@ -0,0 +1,14 @@
<?php
return [
'Id' => '编号',
'Shop_id' => '商家编号',
'Store_id' => '管理员编号',
'Username' => '管理员名字',
'Url' => '操作页面',
'Title' => '日志标题',
'Content' => '内容',
'Ip' => 'IP地址',
'Useragent' => '浏览器',
'Createtime' => '操作时间',
];

View File

@ -0,0 +1,20 @@
<?php
return [
'Toggle all' => '显示全部',
'Condition' => '规则条件',
'Remark' => '备注',
'Icon' => '图标',
'Alert' => '警告',
'Name' => '规则',
'Controller/Action' => '控制器名/方法名',
'Ismenu' => '菜单',
'Search icon' => '搜索图标',
'Toggle menu visible' => '点击切换菜单显示',
'Toggle sub menu' => '点击切换子菜单',
'Menu tips' => '父级菜单无需匹配控制器和方法,子级菜单请使用控制器名',
'Node tips' => '控制器/方法名,如果有目录请使用 目录名/控制器名/方法名',
'The non-menu rule must have parent' => '非菜单规则节点必须有父级',
'Can not change the parent to child' => '父组别不能是它的子组别',
'Name only supports letters, numbers, underscore and slash' => 'URL规则只能是小写字母、数字、下划线和/组成',
];

View File

@ -0,0 +1,18 @@
<?php
return [
'Id' => 'ID',
'Pid' => '父ID',
'Type' => '类型',
'All' => '全部',
'Image' => '图片',
'Keywords' => '关键字',
'Description' => '描述',
'Diyname' => '自定义名称',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Weigh' => '权重',
'Category warmtips' => '温馨提示:栏目类型请前往<b>常规管理</b>-><b>系统配置</b>-><b>字典配置</b>中进行管理',
'Can not change the parent to child' => '父组别不能是它的子组别',
'Status' => '状态'
];

View File

@ -0,0 +1,16 @@
<?php
return [
'Id' => 'ID',
'Type' => '类型',
'Params' => '参数',
'Command' => '命令',
'Content' => '返回结果',
'Executetime' => '执行时间',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Execute again' => '再次执行',
'Successed' => '成功',
'Failured' => '失败',
'Status' => '状态'
];

View File

@ -0,0 +1,9 @@
<?php
return [
'name' => '变量名称',
'intro' => '描述',
'group' => '分组',
'type' => '类型',
'value' => '变量值'
];

View File

@ -0,0 +1,48 @@
<?php
return [
'Custom' => '自定义',
'Pid' => '父ID',
'Type' => '栏目类型',
'Image' => '图片',
'Total user' => '总会员数',
'Total view' => '总访问数',
'Total order' => '总订单数',
'Total order amount' => '总金额',
'Today user signup' => '今日注册',
'Today user login' => '今日登录',
'Today order' => '今日订单',
'Unsettle order' => '未处理订单',
'Seven dnu' => '七日新增',
'Seven dau' => '七日活跃',
'Custom zone' => '这里是你的自定义数据',
'Sales' => '成交数',
'Orders' => '订单数',
'Real time' => '实时',
'Category count' => '分类统计',
'Category count tips' => '当前分类总记录数',
'Attachment count' => '附件统计',
'Attachment count tips' => '当前上传的附件数量',
'Article count' => '文章统计',
'News count' => '新闻统计',
'Comment count' => '评论次数',
'Like count' => '点赞次数',
'Recent news' => '最新新闻',
'Recent discussion' => '最新发贴',
'Server info' => '服务器信息',
'PHP version' => 'PHP版本',
'Fastadmin version' => '主框架版本',
'Fastadmin addon version' => '插件版本',
'Thinkphp version' => 'ThinkPHP版本',
'Sapi name' => '运行方式',
'Debug mode' => '调试模式',
'Software' => '环境信息',
'Upload mode' => '上传模式',
'Upload url' => '上传URL',
'Upload cdn url' => '上传CDN',
'Cdn url' => '静态资源CDN',
'Timezone' => '时区',
'Language' => '语言',
'View more' => '查看更多',
'Security tips' => '<i class="fa fa-warning"></i> 安全提示:你正在使用默认的后台登录入口,为了你的网站安全,强烈建议你修改后台登录入口,<a href="https://forum.fastadmin.net/thread/7640" target="_blank">点击查看修改方法</a>',
];

View File

@ -0,0 +1,45 @@
<?php
return [
'Id' => 'ID',
'Admin_id' => '管理员ID',
'User_id' => '会员ID',
'Url' => '物理路径',
'Imagewidth' => '宽度',
'Imageheight' => '高度',
'Imagetype' => '图片类型',
'Imageframes' => '图片帧数',
'Preview' => '预览',
'Filename' => '文件名',
'Filesize' => '文件大小',
'Mimetype' => 'Mime类型',
'Image' => '图片',
'Audio' => '音频',
'Video' => '视频',
'Text' => '文档',
'Application' => '应用',
'Zip' => '压缩包',
'Extparam' => '透传数据',
'Createtime' => '创建日期',
'Uploadtime' => '上传时间',
'Storage' => '存储引擎',
'Category1' => '分类一',
'Category2' => '分类二',
'Custom' => '自定义',
'Unclassed' => '未归类',
'Category' => '类别',
'Classify' => '归类',
'Filter Type' => '类型筛选',
'Upload to third' => '上传到第三方',
'Upload to local' => '上传到本地',
'Upload to third by chunk' => '上传到第三方(分片模式)',
'Upload to local by chunk' => '上传到本地(分片模式)',
'Please enter a new name' => '请输入新的类别名称',
'Please select category' => '请选择一个类别',
'Category not found' => '指定的类别未找到',
'Upload from editor' => '从编辑器上传',
'User.nickname' => '上传用户昵称',
'User.realname' => '上传用户真实姓名',
'User.mobile' => '上传用户手机号',
'User.avatar' => '上传用户头像',
];

View File

@ -0,0 +1,65 @@
<?php
return [
'Name' => '变量名',
'Tip' => '提示信息',
'Group' => '分组',
'Type' => '类型',
'Title' => '变量标题',
'Value' => '变量值',
'Basic' => '基础配置',
'Email' => '邮件配置',
'Attachment' => '附件配置',
'Dictionary' => '字典配置',
'User' => '会员配置',
'Example' => '示例分组',
'Extend' => '扩展属性',
'String' => '字符',
'Text' => '文本',
'Editor' => '编辑器',
'Number' => '数字',
'Date' => '日期',
'Time' => '时间',
'Datetime' => '日期时间',
'Image' => '图片',
'Images' => '图片(多)',
'File' => '文件',
'Files' => '文件(多)',
'Select' => '列表',
'Selects' => '列表(多选)',
'Switch' => '开关',
'Checkbox' => '复选',
'Radio' => '单选',
'Array' => '数组',
'Array key' => '键名',
'Array value' => '键值',
'Custom' => '自定义',
'Content' => '数据列表',
'Rule' => '校验规则',
'Site name' => '站点名称',
'Beian' => '备案号',
'Cdn url' => 'CDN地址',
'Version' => '版本号',
'Timezone' => '时区',
'Forbidden ip' => '禁止IP',
'Languages' => '语言',
'Fixed page' => '后台固定页',
'Category type' => '分类类型',
'Config group' => '配置分组',
'Rule tips' => '校验规则使用请参考Nice-validator文档',
'Extend tips' => '扩展属性支持{id}、{name}、{group}、{title}、{value}、{content}、{rule}替换',
'Mail type' => '邮件发送方式',
'Mail smtp host' => 'SMTP服务器',
'Mail smtp port' => 'SMTP端口',
'Mail smtp user' => 'SMTP用户名',
'Mail smtp password' => 'SMTP密码',
'Mail vertify type' => 'SMTP验证方式',
'Mail from' => '发件人邮箱',
'Name already exist' => '变量名称已经存在',
'Add new config' => '点击添加新的配置',
'Send a test message' => '发送测试邮件',
'This is a test mail content' => '这是一封来自FastAdmin校验邮件,用于校验邮件配置是否正常!',
'This is a test mail' => '这是一封来自FastAdmin的邮件',
'Please input your email' => '请输入测试接收者邮箱',
'Please input correct email' => '请输入正确的邮箱地址',
];

View File

@ -0,0 +1,43 @@
<?php
return [
'SQL Result' => '查询结果',
'Basic query' => '基础查询',
'View structure' => '查看表结构',
'View data' => '查看表数据',
'Backup and Restore' => '备份与还原',
'Backup now' => '立即备份',
'File' => '文件',
'Size' => '大小',
'Date' => '备份日期',
'Restore' => '还原',
'Delete' => '删除',
'Optimize' => '优化表',
'Repair' => '修复表',
'Optimize all' => '优化全部表',
'Repair all' => '修复全部表',
'Backup successful' => '备份成功',
'Restore successful' => '还原成功',
'Delete successful' => '删除成功',
'Can not open zip file' => '无法打开备份文件',
'Can not unzip file' => '无法解压备份文件',
'Sql file not found' => '未找到SQL文件',
'Table:%s' => '总计:%s个表',
'Record:%s' => '记录:%s条',
'Data:%s' => '占用:%s',
'Index:%s' => '索引:%s',
'SQL Result:' => '查询结果:',
'SQL can not be empty' => 'SQL语句不能为空',
'Max output:%s' => '最大返回%s条',
'Total:%s' => '共有%s条记录! ',
'Row:%s' => '记录:%s',
'Executes one or multiple queries which are concatenated by a semicolon' => '请输入SQL语句支持批量查询多条SQL以分号(;)分格',
'Query affected %s rows and took %s seconds' => '共影响%s条记录! 耗时:%s秒!',
'Query returned an empty result' => '返回结果为空!',
'Query took %s seconds' => '耗时%s秒!',
'Optimize table %s done' => '优化表[%s]成功',
'Repair table %s done' => '修复表[%s]成功',
'Optimize table %s fail' => '优化表[%s]失败',
'Repair table %s fail' => '修复表[%s]失败'
];

View File

@ -0,0 +1,9 @@
<?php
return [
'Url' => '链接',
'Ip' => 'IP地址',
'Userame' => '用户名',
'Createtime' => '操作时间',
'Click to edit' => '点击编辑',
'Admin log' => '操作日志',
];

View File

@ -0,0 +1,65 @@
<?php
return [
'Leave password blank if dont want to change' => '不修改密码请留空',
'Please input correct email' => '请输入正确的Email地址',
'Please input correct password' => '密码长度不正确',
'Email already exists' => '邮箱已经存在',
'Please input correct nickname' => '昵称仅支持输入中文、英文字母(大小写)、数字、下划线',
'Please input length nickname' => '昵称请最多填写10个字符',
'Loss_ratio' => '课程损耗比(百分制)',
'Front_idcard_image' => '身份证人像面',
'Reverse_idcard_image' => '身份证国徽面',
'Auth_time' => '审核时间',
'Admin_id' => '审核管理员id',
'Type' => '认证类型',
'Type 1' => '个人认证',
'Type 2' => '机构认证',
'Desc' => '申请备注',
'user_id' => '申请用户',
'User.nickname' => '昵称',
'User.mobile' => '手机号',
'User.avatar' => '头像',
'Logo' => 'Logo',
'Name' => '申请人姓名|机构名称',
'Image' => '封面图',
'Images' => '环境图片',
'Address_city' => '城市选择',
'Province' => '省编号',
'City' => '市编号',
'District' => '县区编号',
'Address' => '地址',
'Address_detail' => '详细地址',
'Longitude' => '经度',
'Latitude' => '纬度',
'Yyzzdm' => '企业统一信用代码(个人认证不需要)',
'Yyzz_images' => '营业执照照片(个人认证不需要)',
'hidden' => '禁用',
'Tel' => '服务电话',
'Content' => '详情',
'Status' => '审核状态',
'Status 0' => '待审核',
'Status 1' => '审核通过',
'Status 2' => '审核失败',
'Reason' => '审核不通过原因',
'Create_time' => '创建时间',
'Update_time' => '修改时间',
"Establish_time" => '成立时间',
"People" => '员工人数',
"Legal_entity" => '法人姓名',
"Gender" => '性别',
"Nation" => '民族',
"Out_look" => '政治面貌',
"Birthtime" => '出生日期',
"Native_place" => '籍贯',
"Card_number" => '身份证号码',
"Diploma" => '学历',
"Post" => '职务',
"Social_position" => '社会职务',
//Male'), '0'=>__('Female'
'Male' => '男',
'Female' => '女',
];

View File

@ -0,0 +1,57 @@
<?php
return [
'Title' => '标题',
'Search menu' => '搜索菜单',
'Layout Options' => '布局设定',
'Fixed Layout' => '固定布局',
'You can\'t use fixed and boxed layouts together' => '盒子模型和固定布局不能同时启作用',
'Boxed Layout' => '盒子布局',
'Activate the boxed layout' => '盒子布局最大宽度将被限定为1250px',
'Toggle Sidebar' => '切换菜单栏',
'Toggle the left sidebar\'s state (open or collapse)' => '切换菜单栏的展示或收起',
'Sidebar Expand on Hover' => '菜单栏自动展开',
'Let the sidebar mini expand on hover' => '鼠标移到菜单栏自动展开',
'Toggle Right Sidebar Slide' => '切换右侧操作栏',
'Toggle between slide over content and push content effects' => '切换右侧操作栏覆盖或独占',
'Toggle Right Sidebar Skin' => '切换右侧操作栏背景',
'Toggle between dark and light skins for the right sidebar' => '将右侧操作栏背景亮色或深色切换',
'Show sub menu' => '显示菜单栏子菜单',
'Always show sub menu' => '菜单栏子菜单将始终显示',
'Disable top menu badge' => '禁用顶部彩色小角标',
'Disable top menu badge without left menu' => '左边菜单栏的彩色小角标不受影响',
'Skins' => '皮肤',
'You\'ve logged in, do not login again' => '你已经登录,无需重复登录',
'Username or password can not be empty' => '用户名密码不能为空',
'Username or password is incorrect' => '用户名或密码不正确',
'Username is incorrect' => '用户名不正确',
'Password is incorrect' => '密码不正确',
'Admin is forbidden' => '管理员已经被禁止登录',
'Please try again after 1 day' => '请于1天后再尝试登录',
'Login successful' => '登录成功!',
'Logout successful' => '退出成功!',
'Verification code is incorrect' => '验证码不正确',
'Wipe cache completed' => '清除缓存成功',
'Wipe cache failed' => '清除缓存失败',
'Wipe cache' => '清空缓存',
'Wipe all cache' => '一键清除缓存',
'Wipe content cache' => '清空内容缓存',
'Wipe template cache' => '清除模板缓存',
'Wipe addons cache' => '清除插件缓存',
'Check for updates' => '检测更新',
'Discover new version' => '发现新版本',
'Go to download' => '去下载更新',
'Currently is the latest version' => '当前已经是最新版本',
'Ignore this version' => '忽略此次更新',
'Do not remind again' => '不再提示',
'Your current version' => '你的版本是',
'New version' => '新版本',
'Release notes' => '更新说明',
'Latest news' => '最新消息',
'View more' => '查看更多',
'Links' => '相关链接',
'Docs' => '官方文档',
'Forum' => '交流社区',
'QQ qun' => 'QQ交流群',
'Captcha' => '验证码',
];

View File

@ -0,0 +1,42 @@
<?php
return [
'Id' => 'ID',
'Shop_id' => '机构店铺id',
'User_id' => '机构前端用户',
'Name' => '店铺名称',
'Logo' => '品牌LOGO',
'Image' => '封面图',
'Images' => '店铺环境照片',
'Address_city' => '城市选择',
'Province' => '省编号',
'City' => '市编号',
'District' => '县区编号',
'Address' => '店铺地址',
'Address_detail' => '店铺详细地址',
'Longitude' => '经度',
'Latitude' => '纬度',
'Yyzzdm' => '营业执照',
'Yyzz_images' => '营业执照照片',
'Front_idcard_image' => '法人身份证正面',
'Reverse_idcard_image' => '法人身份证反面',
'Tel' => '服务电话',
'Content' => '店铺详情',
'Type' => '类型',
'Type 1' => '个人',
'Type 2' => '机构',
'Desc' => '申请备注',
'Status' => '审核状态',
'Status 0' => '待审核',
'Status 1' => '审核通过',
'Status 2' => '审核失败',
'Reason' => '审核不通过原因',
'Auth_time' => '审核时间',
'Admin_id' => '审核管理员id',
'Create_time' => '创建时间',
'Update_time' => '修改时间',
'Manystoreshop.name' => '店铺名称',
'User.nickname' => '昵称',
'User.mobile' => '手机号',
'User.avatar' => '头像'
];

View File

@ -0,0 +1,21 @@
<?php
return [
'Shop_id' => '机构shopid',
'User_id' => '授权前台用户',
'Status' => '授权状态',
'Status 0' => '待确认',
'Status 1' => '通过',
'Status 2' => '拒绝',
'Add' => '添加用户授权申请',
'Delete'=>'取消授权',
'Del'=>'取消授权',
'User.mobile'=>'授权前台用户手机号',
'Auth_time' => '授权确认时间',
'Createtime' => '发起时间',
'Update_time' => '修改时间',
'Manystoreshop.name' => '机构名称',
'User.nickname' => '授权前台用户昵称',
'User.avatar' => '授权前台用户头像'
];

View File

@ -0,0 +1,73 @@
<?php
return [
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'Title' => '标题',
'Headimage' => '头图',
'Images' => '轮播图',
'Address_type' => '地址类型',
'Address_type 1' => '按机构',
'Address_type 2' => '独立位置',
'Address_city' => '城市选择',
'Province' => '省编号',
'City' => '市编号',
'District' => '县区编号',
'Address' => '活动地址',
'Address_detail' => '活动详细地址',
'Longitude' => '经度',
'Latitude' => '纬度',
'Start_time' => '活动开始时间',
'End_time' => '活动结束时间',
'Sign_start_time' => '报名开始时间',
'Sign_end_time' => '报名结束时间',
'Price' => '报名费用',
'People_num' => '活动人数',
'Item' => '活动项目',
'Content' => '活动详情',
'Status' => '状态',
'Status 1' => '上架',
'Status 2' => '下架',
'Status 3' => '平台下架',
'Weigh' => '权重',
'Recommend' => '平台推荐',
'Recommend 0' => '否',
'Recommend 1' => '是',
'Hot' => '平台热门',
'Hot 0' => '否',
'Hot 1' => '是',
'New' => '平台最新',
'New 0' => '否',
'New 1' => '是',
'Selfhot' => '机构热门',
'Selfhot 0' => '否',
'Selfhot 1' => '是',
'Sale' => '总销量',
'Stock' => '限制总人数',
'Views' => '浏览量',
'Expirestatus' => '过期状态',
'Expirestatus 1' => '进行中',
'Expirestatus 2' => '已过期',
'Add_type' => '添加人类型',
'Add_type 1' => '机构',
'Add_type 2' => '总后台',
'Add_id' => '添加人id',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'Sex' => '性别限制',
'Sex 1' => '男',
'Sex 2' => '女',
'Sex 3' => '男女不限',
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '活动是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
'OK' => '确认',
'Has_sign_expire' => '报名是否过期',
];

View File

@ -0,0 +1,80 @@
<?php
return [
'Classes_activity_id' => '课程活动id',
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'Title' => '标题',
'Headimage' => '头图',
'Images' => '轮播图',
'Address_type' => '地址类型',
'Address_type 1' => '按机构',
'Address_type 2' => '独立位置',
'Address_city' => '城市选择',
'Province' => '省编号',
'City' => '市编号',
'District' => '县区编号',
'Address' => '活动地址',
'Address_detail' => '活动详细地址',
'Longitude' => '经度',
'Latitude' => '纬度',
'Start_time' => '活动开始时间',
'End_time' => '活动结束时间',
'Sign_start_time' => '报名开始时间',
'Sign_end_time' => '报名结束时间',
'Price' => '报名费用',
'People_num' => '活动人数',
'Item' => '活动项目',
'Content' => '活动详情',
'Status' => '状态',
'Status 1' => '上架',
'Status 2' => '下架',
'Status 3' => '平台下架',
'Weigh' => '权重',
'Recommend' => '平台推荐',
'Recommend 0' => '否',
'Recommend 1' => '是',
'Hot' => '平台热门',
'Hot 0' => '否',
'Hot 1' => '是',
'New' => '平台最新',
'New 0' => '否',
'New 1' => '是',
'Selfhot' => '机构热门',
'Selfhot 0' => '否',
'Selfhot 1' => '是',
'Auth_status' => '审核状态',
'Auth_status 0' => '待审核',
'Auth_status 1' => '审核通过',
'Auth_status 2' => '审核不通过',
'Reason' => '审核不通过原因',
'Sale' => '总销量',
'Stock' => '限制总人数',
'Views' => '浏览量',
'Expirestatus' => '过期状态',
'Expirestatus 1' => '进行中',
'Expirestatus 2' => '已过期',
'Add_type' => '添加人类型',
'Add_type 1' => '机构',
'Add_type 2' => '总后台',
'Add_id' => '添加人id',
'Admin_id' => '审核管理员id',
'Auth_time' => '审核时间',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'Sex' => '性别限制',
'Sex 1' => '男',
'Sex 2' => '女',
'Sex 3' => '男女不限',
'Limit_num' => '本项目限定人数',
'Age' => '年龄限制描述',
'Item_json' => '活动项目',
'Has_expire' => '是否过期',
'Has_expire 1' => '往期活动',
'Has_expire 2' => '进行中活动',
'OK' => '确认提交',
];

View File

@ -0,0 +1,29 @@
<?php
return [
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'Classes_activity_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' => '删除时间',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'Schoolclassesactivity.title' => '标题',
'Schoolclassesactivity.headimage' => '头图'
];

View File

@ -0,0 +1,29 @@
<?php
return [
'Manystore_id' => '机构账号id',
'Shop_id' => '机构店铺id',
'Classes_activity_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' => '删除时间',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'Schoolclassesactivity.title' => '标题',
'Schoolclassesactivity.headimage' => '头图'
];

View File

@ -0,0 +1,79 @@
<?php
return [
'Order_no' => '订单号',
'Pay_no' => '微信支付单号',
'User_id' => '下单人用户id',
'Manystore_id' => '机构账号id',
'Shop_id' => '机构id',
'Code' => '核销码',
'Codeimage' => '核销二维码图片',
'Codeoneimage' => '核销一维码图片',
'Classes_activity_id' => '课程活动id',
'Activity_order_detail_id' => '订单课程活动id',
'Beforeprice' => '订单优惠前金额',
'Totalprice' => '订单应付金额',
'Payprice' => '订单实付金额',
'Pay_type' => '支付方式',
'Pay_type yue' => '余额',
'Pay_type wechat' => '微信',
'Status' => '订单状态',
'Status -3' => '已取消',
'Status 0' => '待支付',
'Status 2' => '已报名待审核',
'Status 3' => '已预约',
'Status 4' => '售后中',
'Status 5' => '退款结算中',
'Status 6' => '已退款',
'Status 9' => '已完成',
'Before_status' => '售后前状态',
'Before_status -3' => '已取消',
'Before_status 0' => '未售后',
'Before_status 2' => '已报名待审核',
'Before_status 3' => '已预约',
'Before_status 4' => '售后中',
'Before_status 6' => '已退款',
'Before_status 9' => '已完成',
'Server_status' => '售后订单状态',
'Server_status 0' => '正常',
'Server_status 3' => '售后中',
'Server_status 6' => '售后完成',
'Canceltime' => '取消时间',
'Paytime' => '支付时间',
'Auth_time' => '审核时间',
'Reservation_time' => '预约时间',
'Finishtime' => '完成时间',
'Refundtime' => '退款时间',
'Total_refundprice' => '应退款金额',
'Real_refundprice' => '实际退款金额',
'Sub_refundprice' => '剩余未退金额',
'Pay_json' => '三方支付信息json',
'Platform' => '支付平台',
'Verification_user_id' => '核销人用户id',
'Verification_type' => '核销用户类型',
'Reason' => '审核不通过原因',
'Auth_status' => '审核状态',
'Auth_status 0' => '待审核',
'Auth_status 1' => '审核通过',
'Auth_status 2' => '审核失败',
'Auth_user_id' => '审核用户id',
'Auth_type' => '审核用户类型',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'User.nickname' => '昵称',
'User.realname' => '真实姓名',
'User.mobile' => '手机号',
'User.avatar' => '头像',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'Schoolclassesactivity.title' => '标题',
'Schoolclassesactivity.headimage' => '头图',
'Schoolclassesactivityorderdetail.title' => '标题',
'Schoolclassesactivityorderdetail.headimage' => '头图',
'Orderitem.name' => '活动规格',
'Feel' => '是否免费',
'Feel 0' => '否',
'Feel 1' => '是',
];

View File

@ -0,0 +1,72 @@
<?php
return [
'Classes_activity_order_id' => '课程活动订单id',
'Classes_activity_id' => '课程活动id',
'Manystore_id' => '机构账号id',
'Shop_id' => '机构id',
'User_id' => '下单用户id',
'Title' => '标题',
'Headimage' => '头图',
'Images' => '轮播图',
'Address_type' => '地址类型',
'Address_type 1' => '按机构',
'Address_type 2' => '独立位置',
'Address_city' => '城市选择',
'Province' => '省编号',
'City' => '市编号',
'District' => '县区编号',
'Address' => '活动地址',
'Address_detail' => '活动详细地址',
'Longitude' => '经度',
'Latitude' => '纬度',
'Start_time' => '活动开始时间',
'End_time' => '活动结束时间',
'Sign_start_time' => '报名开始时间',
'Sign_end_time' => '报名结束时间',
'Price' => '报名费用',
'People_num' => '活动人数',
'Item' => '活动项目',
'Content' => '活动详情',
'Status' => '状态',
'Status 1' => '上架',
'Status 2' => '下架',
'Status 3' => '平台下架',
'Weigh' => '权重',
'Recommend' => '平台推荐',
'Recommend 0' => '否',
'Recommend 1' => '是',
'Hot' => '平台热门',
'Hot 0' => '否',
'Hot 1' => '是',
'New' => '平台最新',
'New 0' => '否',
'New 1' => '是',
'Selfhot' => '机构热门',
'Selfhot 0' => '否',
'Selfhot 1' => '是',
'Sale' => '总销量',
'Stock' => '限制总人数',
'Views' => '浏览量',
'Expirestatus' => '过期状态',
'Expirestatus 1' => '进行中',
'Expirestatus 2' => '已过期',
'Add_type' => '添加人类型',
'Add_type 1' => '机构',
'Add_type 2' => '总后台',
'Add_id' => '添加人id',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Schoolclassesactivityorder.order_no' => '订单号',
'Schoolclassesactivityorder.pay_no' => '微信支付单号',
'Schoolclassesactivity.title' => '标题',
'Schoolclassesactivity.headimage' => '头图',
'Manystore.nickname' => '昵称',
'Manystoreshop.name' => '店铺名称',
'Manystoreshop.logo' => '品牌LOGO',
'User.nickname' => '昵称',
'User.realname' => '真实姓名',
'User.mobile' => '手机号',
'User.avatar' => '头像'
];

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

@ -0,0 +1,22 @@
<?php
return [
'Classes_activity_order_id' => '课程活动订单id',
'Status' => '订单状态',
'Status -3' => '已取消',
'Status 0' => '待支付',
'Status 2' => '已报名待审核',
'Status 3' => '已预约',
'Status 4' => '售后中',
'Status 5' => '退款结算中',
'Status 6' => '已退款',
'Status 9' => '已完成',
'Log_text' => '记录内容',
'Oper_type' => '记录人类型',
'Oper_id' => '记录人id',
'Createtime' => '创建时间',
'Updatetime' => '修改时间',
'Deletetime' => '删除时间',
'Schoolclassesactivityorder.order_no' => '订单号',
'Schoolclassesactivityorder.pay_no' => '微信支付单号'
];

Some files were not shown because too many files have changed in this diff Show More