修复bug,写api后台框架
This commit is contained in:
parent
53be594d64
commit
3ed8ce6bbb
|
@ -105,8 +105,17 @@ class Teacher extends Backend
|
|||
|
||||
|
||||
protected function updateCheck($id,$params=[],$row=null){
|
||||
if($params && $row){
|
||||
|
||||
// 课程存在售后订单则不允许操作
|
||||
if(!$this->no_auth_fields_check($params,$row)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 课程存在未完成订单则不允许操作
|
||||
$classesLib = \app\common\model\school\classes\ClassesLib::where("teacher_id",$id)->find();
|
||||
|
||||
if($classesLib)$this->error("存在正在教授的课程无法继续操作!请将课程讲师更换成其他人或者删除该课程后再操作!");
|
||||
}
|
||||
|
||||
|
||||
|
@ -262,6 +271,16 @@ class Teacher extends Backend
|
|||
}
|
||||
$this->update_check($params,$row);
|
||||
$result = $row->allowField(true)->save($params);
|
||||
|
||||
//执行课程修改
|
||||
$classesLibs = \app\common\model\school\classes\ClassesLib::where( ['teacher_id'=>$row["id"]])->select();
|
||||
foreach ($classesLibs as $classesLib){
|
||||
$classesLib->user_id = $row["user_id"];
|
||||
$classesLib->save();
|
||||
//执行课程订单更新
|
||||
\app\common\model\school\classes\ClassesLib::update_classes($classesLib["id"]);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException|PDOException|Exception $e) {
|
||||
Db::rollback();
|
||||
|
@ -306,7 +325,7 @@ class Teacher extends Backend
|
|||
Db::startTrans();
|
||||
try {
|
||||
foreach ($list as $item) {
|
||||
$count += $item->delete();
|
||||
// $count += $item->delete();
|
||||
}
|
||||
Db::commit();
|
||||
} catch (PDOException|Exception $e) {
|
||||
|
|
|
@ -44,7 +44,7 @@ class Visit extends Backend
|
|||
{
|
||||
//当前是否为关联查询
|
||||
$this->relationSearch = true;
|
||||
$this->searchFields = ["id","classes_lib_id","classes_activity_id","lib.title","user.nickname","user.realname","user.mobile","activity.title"];
|
||||
$this->searchFields = ["id","classes_lib_id","helparticle.title","classes_activity_id","lib.title","user.nickname","user.realname","user.mobile","activity.title"];
|
||||
//设置过滤方法
|
||||
$this->request->filter(['strip_tags', 'trim']);
|
||||
if ($this->request->isAjax()) {
|
||||
|
@ -55,7 +55,7 @@ class Visit extends Backend
|
|||
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
||||
|
||||
$list = $this->model
|
||||
->with(['lib','activity',"user"])
|
||||
->with(['lib','activity',"user","helparticle"])
|
||||
->where($where)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
@ -65,6 +65,7 @@ class Visit extends Backend
|
|||
$row->getRelation('lib')->visible(['title','headimage']);
|
||||
$row->getRelation('activity')->visible(['title','headimage']);
|
||||
$row->getRelation('user')->visible(['nickname', 'realname', 'mobile', 'avatar']);
|
||||
$row->getRelation('helparticle')->visible(['title']);
|
||||
}
|
||||
|
||||
$result = array("total" => $list->total(), "rows" => $list->items());
|
||||
|
|
|
@ -77,7 +77,12 @@ class Article extends Backend
|
|||
->whereRaw(...$expireWhere)
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
||||
$rows = $list->items();
|
||||
foreach ($rows as &$row){
|
||||
|
||||
}
|
||||
|
||||
$result = ['total' => $list->total(), 'rows' => $rows];
|
||||
return json($result);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ class Cate extends Backend
|
|||
// $v['name'] = str_replace(' ', ' ', $v['name']);
|
||||
$ruledata[$v['id']] = $v['name'];
|
||||
|
||||
|
||||
|
||||
}
|
||||
unset($v);
|
||||
$this->view->assign('ruledata', $ruledata);
|
||||
|
@ -89,9 +91,12 @@ class Cate extends Backend
|
|||
$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']) {
|
||||
$parent = \app\admin\model\school\help\Cate::get($params['pid']);
|
||||
if ($parent && $parent['level_num'] > 1) {
|
||||
$this->error(__('分类不能超过二级!'));
|
||||
}
|
||||
}
|
||||
$result = $this->model->save($params);
|
||||
if ($result === false) {
|
||||
$this->error($this->model->getError());
|
||||
|
@ -129,6 +134,13 @@ class Cate extends Backend
|
|||
$this->error(__('Can not change the parent to child'));
|
||||
}
|
||||
}
|
||||
if ($params['pid']) {
|
||||
$parent = \app\admin\model\school\help\Cate::get($params['pid']);
|
||||
if ($parent && $parent['level_num'] > 1) {
|
||||
$this->error(__('分类不能超过二级!'));
|
||||
}
|
||||
}
|
||||
|
||||
//这里需要针对name做唯一验证
|
||||
$ruleValidate = \app\admin\model\school\help\Cate::where( 'name' , $params['name'] )-> where( 'id' , '<>' , $row['id'] )->find();
|
||||
|
||||
|
|
|
@ -8,6 +8,9 @@ return [
|
|||
'Set status to 1' => '设为课程',
|
||||
'Status 2' => '活动',
|
||||
'Set status to 2' => '设为活动',
|
||||
'Status 3' => '帮助文章',
|
||||
'Set status to 3' => '设为帮助文章',
|
||||
|
||||
'Createtime' => '访问时间',
|
||||
'Lib.title' => '课程标题',
|
||||
'Lib.headimage' => '课程头图',
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace app\admin\model\school\classes;
|
||||
|
||||
use app\common\model\school\help\Article;
|
||||
use think\Model;
|
||||
|
||||
|
||||
|
@ -32,7 +33,7 @@ class Visit extends Model
|
|||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3')];
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,4 +62,7 @@ class Visit extends Model
|
|||
{
|
||||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
public function helparticle(){
|
||||
return $this->belongsTo(Article::class, 'help_article_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,8 @@ class Cate extends Model
|
|||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
'status_text',
|
||||
'level_num',
|
||||
];
|
||||
|
||||
|
||||
|
@ -54,6 +55,19 @@ class Cate extends Model
|
|||
}
|
||||
|
||||
|
||||
public function getLevelNumAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['id']) ? $data['id'] : '');
|
||||
if(!$value) return 0;
|
||||
$level = 0;
|
||||
while($value)
|
||||
{
|
||||
$value = $this->where('id', $value)->value('pid');
|
||||
$level++;
|
||||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
</ul>
|
||||
</div>
|
||||
<a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
|
||||
<br> <span style="color: red">( 注意:帮助文章只能在子分类下添加!如果分类只有一级,请先添加子分类再添加文章!)</span>
|
||||
</div>
|
||||
<table id="table1" class="table table-bordered table-hover"
|
||||
data-operate-edit="0"
|
||||
|
|
|
@ -11,9 +11,12 @@ use app\common\model\ManystoreConfig;
|
|||
use app\manystore\model\Manystore;
|
||||
use think\Config;
|
||||
use think\Controller;
|
||||
use think\exception\HttpResponseException;
|
||||
use think\Hook;
|
||||
use think\Lang;
|
||||
use think\Loader;
|
||||
use think\Request;
|
||||
use think\Response;
|
||||
use think\Session;
|
||||
use fast\Tree;
|
||||
use think\Validate;
|
||||
|
@ -114,6 +117,13 @@ class ManystoreApiBase extends Controller
|
|||
'setShopAutoRelation',
|
||||
];
|
||||
|
||||
/**
|
||||
* 默认响应输出类型,支持json/xml
|
||||
* @var string
|
||||
*/
|
||||
protected $responseType = 'json';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -243,6 +253,13 @@ class ManystoreApiBase extends Controller
|
|||
|
||||
public function _initialize()
|
||||
{
|
||||
|
||||
//跨域请求检测
|
||||
check_cors_request();
|
||||
|
||||
// 检测IP是否允许
|
||||
check_ip_allowed();
|
||||
|
||||
//移除HTML标签
|
||||
$this->request->filter('trim');
|
||||
$modulename = $this->request->module();
|
||||
|
@ -261,21 +278,26 @@ class ManystoreApiBase extends Controller
|
|||
!defined('IS_AJAX') && define('IS_AJAX', $this->request->isAjax());
|
||||
|
||||
$this->auth = Auth::instance();
|
||||
$token = $this->request->server('HTTP_TOKEN', $this->request->request('token', \think\Cookie::get('token')));
|
||||
|
||||
// 设置当前请求的URI
|
||||
$this->auth->setRequestUri($path);
|
||||
// 检测是否需要验证登录
|
||||
if (!$this->auth->match($this->noNeedLogin)) {
|
||||
//初始化
|
||||
$this->auth->init($token);
|
||||
//检测是否登录
|
||||
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]));
|
||||
// $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]));
|
||||
|
||||
$this->error(__('Please login first'), ['errcode'=>30002], 401);
|
||||
}
|
||||
|
||||
|
||||
|
@ -286,10 +308,15 @@ class ManystoreApiBase extends Controller
|
|||
// 判断控制器和方法判断是否有对应权限
|
||||
if (!$this->auth->check($path)) {
|
||||
Hook::listen('manystore_nopermission', $this);
|
||||
$this->error(__('You have no permission'), '');
|
||||
$this->error(__('You have no permission'), null, 403);
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
// 如果有传递token才验证是否登录状态
|
||||
if ($token) {
|
||||
$this->auth->init($token);
|
||||
}
|
||||
}
|
||||
|
||||
if(!defined('SHOP_ID')){
|
||||
|
@ -297,14 +324,14 @@ class ManystoreApiBase extends Controller
|
|||
}
|
||||
$manystoreShop = ManystoreShop::where("id",$this->auth->shop_id)->find();
|
||||
if($manystoreShop){
|
||||
$url = Session::get('referer');
|
||||
$url = $url ? $url : $this->request->url();
|
||||
// $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($manystore["status"]!="normal") $this->error(__('账号正处于审核中,无法进行任何操作!!'), null, 403);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,25 +350,25 @@ class ManystoreApiBase extends Controller
|
|||
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;
|
||||
}
|
||||
// // 非选项卡时重定向
|
||||
// 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;
|
||||
// // 设置面包屑导航数据
|
||||
// $breadcrumb = $this->auth->getBreadCrumb($path);
|
||||
// array_pop($breadcrumb);
|
||||
// $this->view->breadcrumb = $breadcrumb;
|
||||
|
||||
// 如果有使用模板布局
|
||||
if ($this->layout) {
|
||||
|
@ -773,11 +800,11 @@ class ManystoreApiBase extends Controller
|
|||
*/
|
||||
protected function token()
|
||||
{
|
||||
$token = $this->request->post('__token__');
|
||||
$token = $this->request->param('__token__');
|
||||
|
||||
//验证Token
|
||||
if (!Validate::is($token, "token", ['__token__' => $token])) {
|
||||
$this->error(__('Token verification error'), '', ['__token__' => $this->request->token()]);
|
||||
if (!Validate::make()->check(['__token__' => $token], ['__token__' => 'require|token'])) {
|
||||
$this->error(__('Token verification error'),"", ['__token__' => $this->request->token()]);
|
||||
}
|
||||
|
||||
//刷新Token
|
||||
|
@ -799,4 +826,66 @@ class ManystoreApiBase extends Controller
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 操作成功返回的数据
|
||||
* @param string $msg 提示信息
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param int $code 错误码,默认为1
|
||||
* @param string $type 输出类型
|
||||
* @param array $header 发送的 Header 信息
|
||||
*/
|
||||
protected function apisuccess($msg = '', $data = null, $code = 1, $type = null, array $header = [])
|
||||
{
|
||||
$this->apiresult($msg, $data, $code, $type, $header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作失败返回的数据
|
||||
* @param string $msg 提示信息
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param int $code 错误码,默认为0
|
||||
* @param string $type 输出类型
|
||||
* @param array $header 发送的 Header 信息
|
||||
*/
|
||||
protected function apierror($msg = '', $data = null, $code = 0, $type = null, array $header = [])
|
||||
{
|
||||
$this->apiresult($msg, $data, $code, $type, $header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回封装后的 API 数据到客户端
|
||||
* @access protected
|
||||
* @param mixed $msg 提示信息
|
||||
* @param mixed $data 要返回的数据
|
||||
* @param int $code 错误码,默认为0
|
||||
* @param string $type 输出类型,支持json/xml/jsonp
|
||||
* @param array $header 发送的 Header 信息
|
||||
* @return void
|
||||
* @throws HttpResponseException
|
||||
*/
|
||||
protected function apiresult($msg, $data = null, $code = 0, $type = null, array $header = [])
|
||||
{
|
||||
$result = [
|
||||
'code' => $code,
|
||||
'msg' => $msg,
|
||||
'time' => Request::instance()->server('REQUEST_TIME'),
|
||||
'data' => $data,
|
||||
];
|
||||
// 如果未设置类型则使用默认类型判断
|
||||
$type = $type ? : $this->responseType;
|
||||
|
||||
if (isset($header['statuscode'])) {
|
||||
$code = $header['statuscode'];
|
||||
unset($header['statuscode']);
|
||||
} else {
|
||||
//未设置状态码,根据code值判断
|
||||
$code = $code >= 1000 || $code < 200 ? 200 : $code;
|
||||
}
|
||||
$response = Response::create($result, $type, $code)->header($header);
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,6 +232,12 @@ $activityOrderHooks = [
|
|||
|
||||
];
|
||||
|
||||
//活动审核事件钩子
|
||||
$helpHooks = [
|
||||
'help_article_view_after' => [ // 活动触发浏览后
|
||||
'app\\common\\listener\\help\\HelpHook'
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
@ -247,6 +253,8 @@ $defaultHooks = array_merge_recursive($defaultHooks, $serviceHooks);
|
|||
|
||||
$defaultHooks = array_merge_recursive($defaultHooks, $activityHooks);
|
||||
$defaultHooks = array_merge_recursive($defaultHooks, $activityOrderHooks);
|
||||
$defaultHooks = array_merge_recursive($defaultHooks, $helpHooks);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ class Redis extends Driver
|
|||
$expire = $expire < 0 ? 365 * 86400 : $expire;
|
||||
$expiretime = time() + $expire;
|
||||
//解决使用redis方式储存token时api接口Token刷新与检测因expires_in拼写错误报错的BUG
|
||||
$result = ['token' => $token, 'user_id' => $value, 'expiretime' => $expiretime, 'expires_in' => $expire];
|
||||
$result = ['token' => $token, 'user_id' => $value,'id' => $value, 'expiretime' => $expiretime, 'expires_in' => $expire];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
namespace app\common\listener\help;
|
||||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\school\classes\Teacher;
|
||||
use app\common\model\school\classes\Visit;
|
||||
use app\common\model\school\Message;
|
||||
use app\common\model\school\MessageConfig;
|
||||
|
||||
class HelpHook
|
||||
{
|
||||
|
||||
|
||||
public function helpArticleViewAfter(&$params)
|
||||
{
|
||||
['help_article' => $help_article,"user_id"=>$user_id,"oper_type"=>$oper_type,"oper_id"=>$oper_id] = $params;
|
||||
//访问记录
|
||||
Visit::create([
|
||||
"help_article_id"=>$help_article["id"],
|
||||
"classes_lib_id"=>0,
|
||||
"shop_id"=>0,
|
||||
"classes_activity_id"=>0,
|
||||
"status"=>'3',
|
||||
"user_id"=>$user_id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1249,6 +1249,8 @@ $user_unpaid_order = $user_paid_order =null;
|
|||
$params["feel"] = "1";
|
||||
}else{
|
||||
|
||||
if(!config("site.school_classes_paid_switch")) throw new \Exception("收费课程已关闭,无法发布付费课程!");
|
||||
|
||||
//个人认证无法下付费课程
|
||||
$shop = ManystoreShop::where("id",$shop_id)->find();
|
||||
if($shop["type"]=="1"){
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace app\common\model\school\classes;
|
|||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\school\classes\activity\Activity;
|
||||
use app\common\model\school\help\Article;
|
||||
use think\Model;
|
||||
|
||||
|
||||
|
@ -34,7 +35,7 @@ class Visit extends BaseModel
|
|||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2')];
|
||||
return ['1' => __('Status 1'), '2' => __('Status 2'), '3' => __('Status 3')];
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,4 +65,8 @@ class Visit extends BaseModel
|
|||
return $this->belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function helparticle(){
|
||||
return $this->belongsTo(Article::class, 'help_article_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,9 +26,23 @@ class Cate extends BaseModel
|
|||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
'status_text',
|
||||
'level_num',
|
||||
];
|
||||
|
||||
public function getLevelNumAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['id']) ? $data['id'] : '');
|
||||
if(!$value) return 0;
|
||||
$level = 0;
|
||||
while($value)
|
||||
{
|
||||
$value = $this->where('id', $value)->value('pid');
|
||||
$level++;
|
||||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
|
|
|
@ -263,7 +263,15 @@ return [
|
|||
// 加密方式
|
||||
'hashalgo' => 'ripemd160',
|
||||
// 缓存有效期 0表示永久缓存
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
'password' => '',
|
||||
'select' => 4,
|
||||
'timeout' => 0,
|
||||
'expire' => 0,
|
||||
'persistent' => false,
|
||||
'userprefix' => 'up:',
|
||||
'tokenprefix' => 'tp:',
|
||||
],
|
||||
//FastAdmin配置
|
||||
'fastadmin' => [
|
||||
|
|
|
@ -95,6 +95,18 @@ class Teacher extends ManystoreBase
|
|||
protected function updateCheck($id,$params=[],$row=null){
|
||||
|
||||
// 课程存在售后订单则不允许操作
|
||||
if($params && $row){
|
||||
|
||||
if(!$this->no_auth_fields_check($params,$row)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 课程存在未完成订单则不允许操作
|
||||
$classesLib = \app\common\model\school\classes\ClassesLib::where("teacher_id",$id)->find();
|
||||
if($classesLib)$this->error("存在正在教授的课程无法继续操作!请将课程讲师更换成其他人或者删除该课程后再操作!");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -247,6 +259,16 @@ class Teacher extends ManystoreBase
|
|||
|
||||
|
||||
$result = $row->allowField(true)->save($params);
|
||||
|
||||
$classesLibs = \app\common\model\school\classes\ClassesLib::where( ['teacher_id'=>$row["id"]])->select();
|
||||
foreach ($classesLibs as $classesLib){
|
||||
$classesLib->user_id = $row["user_id"];
|
||||
$classesLib->save();
|
||||
//执行课程订单更新
|
||||
\app\common\model\school\classes\ClassesLib::update_classes($classesLib["id"]);
|
||||
}
|
||||
|
||||
|
||||
Db::commit();
|
||||
} catch (ValidateException $e) {
|
||||
Db::rollback();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace app\manystore\behavior;
|
||||
namespace app\manystoreapi\behavior;
|
||||
|
||||
class ManystoreLog
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace app\manystore\controller;
|
||||
namespace app\manystoreapi\controller;
|
||||
|
||||
use app\common\controller\ManystoreBase;
|
||||
use fast\Random;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace app\manystore\controller;
|
||||
namespace app\manystoreapi\controller;
|
||||
|
||||
use app\common\controller\ManystoreBase;
|
||||
use think\Config;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace app\manystore\controller;
|
||||
namespace app\manystoreapi\controller;
|
||||
|
||||
use app\manystore\model\ManystoreLog;
|
||||
use app\common\controller\ManystoreBase;
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace app\manystoreapi\controller;
|
||||
|
||||
use app\common\controller\Api;
|
||||
use fast\Random;
|
||||
|
||||
/**
|
||||
* Token接口
|
||||
*/
|
||||
class Token extends Api
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = '*';
|
||||
|
||||
/**
|
||||
* 检测Token是否过期
|
||||
*
|
||||
*/
|
||||
public function check()
|
||||
{
|
||||
$token = $this->auth->getToken();
|
||||
$tokenInfo = \app\common\library\Token::get($token);
|
||||
$this->success('', ['token' => $tokenInfo['token'], 'expires_in' => $tokenInfo['expires_in']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新Token
|
||||
*
|
||||
*/
|
||||
public function refresh()
|
||||
{
|
||||
//删除源Token
|
||||
$token = $this->auth->getToken();
|
||||
\app\common\library\Token::delete($token);
|
||||
//创建新Token
|
||||
$token = Random::uuid();
|
||||
\app\common\library\Token::set($token, $this->auth->id, 2592000);
|
||||
$tokenInfo = \app\common\library\Token::get($token);
|
||||
$this->success('', ['token' => $tokenInfo['token'], 'expires_in' => $tokenInfo['expires_in']]);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,544 @@
|
|||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use addons\xilufitness\services\login\LoginService;
|
||||
use app\common\controller\Api;
|
||||
use app\common\library\Ems;
|
||||
use app\common\library\Sms;
|
||||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\manystore\UserAuth;
|
||||
use fast\Random;
|
||||
use think\Cache;
|
||||
use think\Config;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
use think\Validate;
|
||||
use app\admin\library\Wechat;
|
||||
|
||||
/**
|
||||
* 会员接口
|
||||
*/
|
||||
class User extends Api
|
||||
{
|
||||
protected $noNeedLogin = ["registerLogin",'getOpenid','decodeData','login', 'mobilelogin', 'register', 'resetpwd', 'changeemail', 'changemobile', 'third'];
|
||||
protected $noNeedRight = '*';
|
||||
|
||||
protected $miniConfig;
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
$this->miniConfig = (new Wechat)->getMiniConfig();
|
||||
parent::_initialize();
|
||||
// if (!Config::get('fastadmin.usercenter')) {
|
||||
// $this->error(__('User center already closed'));
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(获取小程序openid信息)
|
||||
* @ApiSummary(根据前端code换取openid信息)
|
||||
* @ApiRoute(/api/user/getOpenid)
|
||||
* @ApiMethod(GET)
|
||||
* @ApiParams(name="code",type="string",required=true,description="前端code值")
|
||||
* @ApiHeaders(name = "brand-key", type = "string",require = true, description = "应用key")
|
||||
* @ApiHeaders(name = "token", type = "string", require = true, description = "Token")
|
||||
* @ApiReturnParams(name="code", type="integer",required=true, sample="0")
|
||||
* @ApiReturnParams(name="msg", type="string",required=true, sample="获取成功")
|
||||
* @ApiReturnParams(name="data", type="bject",required=true, description= "扩展数据")
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {}
|
||||
*})
|
||||
*/
|
||||
|
||||
public function getOpenid(){
|
||||
$code = $this->request->param('code/s');
|
||||
|
||||
try {
|
||||
$result = LoginService::getInstance(['mini_config' => $this->miniConfig])->getOpenid($code);
|
||||
} catch (\WeChat\Exceptions\LocalCacheException $e){
|
||||
$this->error($e->getMessage());
|
||||
} catch (\Exception $e){
|
||||
$this->error($e->getMessage());
|
||||
}
|
||||
if(empty($result['openid'])){
|
||||
$this->error(__('获取openid失败'),$result);
|
||||
}
|
||||
|
||||
Cache::set('wechat_miniapp_code'.$code.$result['openid'],"1",60);
|
||||
$this->success('',$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ApiTitle(加密信息解密)
|
||||
* @ApiSummary(解密微信信息)
|
||||
* @ApiRoute(/api/user/decodeData)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams(name = "iv", type = "string",required=true)
|
||||
* @ApiParams(name = "encryptedData", type = "string",required=true)
|
||||
* @ApiParams(name = "sessionKey", type = "string",required=true)
|
||||
* @ApiHeaders(name = "brand-key", type = "string",require = true, description = "应用key")
|
||||
* @ApiHeaders(name = "token", type = "string", require = true, description = "Token")
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {}
|
||||
*})
|
||||
*/
|
||||
public function decodeData() {
|
||||
$iv = $this->request->param('iv/s');
|
||||
$encryptedData = $this->request->param('encryptedData/s');
|
||||
$sessionKey = $this->request->param('sessionKey/s');
|
||||
if(empty($iv) || empty($encryptedData) || empty($sessionKey)){
|
||||
$this->error(__('Params error'));
|
||||
}
|
||||
$result = LoginService::getInstance(['mini_config' => $this->miniConfig])->decodeData($iv,$sessionKey,$encryptedData);
|
||||
$info = empty($result["phoneNumber"]) ? ($result["purePhoneNumber"] ?? '' ) : $result["phoneNumber"];
|
||||
Cache::set('wechat_miniapp_core'.$info,"1",60);
|
||||
$this->success('',$result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ApiTitle(微信小程序授权登录注册通用[支持静默登录])
|
||||
* @ApiSummary(登录注册通用-支持静默登录)
|
||||
* @ApiRoute(/api/user/registerLogin)
|
||||
* @ApiMethod(POST)
|
||||
* @ApiParams(name = "mobile", type = "string",required=false,description = "mobile 静默非必传,手机授权必传")
|
||||
* @ApiParams(name = "unionid", type = "string",required=false, description = "unionid 非必传")
|
||||
* @ApiParams(name = "apptype", type = "string",required=false, description = "应用类型默认miniapp")
|
||||
* @ApiParams(name = "platform", type = "string",require=false, description = "平台标识默认wechat")
|
||||
* @ApiParams(name = "openid", type = "string", require=true, description = "授权的openid")
|
||||
* @ApiParams(name = "keeptime", type = "string", require=false, description = "token保持时间,默认0永久")
|
||||
* @ApiParams(name = "code", type = "string", require=true, description = "授权的code")
|
||||
* @ApiReturn({
|
||||
"code" => 1,
|
||||
"msg" => "获取成功",
|
||||
"data" => {‘token’:xxxxx,'errcode':0(如果为30001则是需要重新授权)}
|
||||
*})
|
||||
*/
|
||||
public function registerLogin(){
|
||||
$extend= $params = [];
|
||||
$extend['mobile'] = $this->request->param('mobile/s','');
|
||||
$params['unionid'] = $this->request->param('unionid/s','');
|
||||
$params['apptype'] = $this->request->param('apptype/s','miniapp');
|
||||
$params['openid'] = $this->request->param('openid/s','');
|
||||
$platform = $this->request->param('platform/s','wechat');
|
||||
$code = $this->request->param('code/s','');
|
||||
if(empty($code)){
|
||||
$this->error(__('缺少code'));
|
||||
}
|
||||
//手机号变必填
|
||||
// if(empty($extend['mobile'])){
|
||||
// $this->error(__('未传手机号'));
|
||||
// }
|
||||
|
||||
|
||||
$wechat_mini_code = Cache::get("{$platform}_{$params['apptype']}_code".$code.$params['openid']);
|
||||
if(!$wechat_mini_code)$this->error("授权code已过期或已使用,请重新发起授权!",['errcode'=>30002]);
|
||||
|
||||
if($extend['mobile']){
|
||||
$wechat_mini_mobile = Cache::get("{$platform}_{$params['apptype']}_core".$extend['mobile']);
|
||||
if(!$wechat_mini_mobile)$this->error("授权手机号已过期或已使用,请重新发起授权!",['errcode'=>30002]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//推荐人:逻辑未实现
|
||||
$rec_user_id = $this->request->param('rec_user_id',0,'xilufitness_get_id_value');
|
||||
$keeptime = $this->request->param('keeptime/d',0);
|
||||
//access_token
|
||||
|
||||
try {
|
||||
\addons\third\library\Service::loginAndRegisterByMobile($platform, $params, $extend, $keeptime);
|
||||
} catch (\Exception $e){
|
||||
Log::log($e->getMessage());
|
||||
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
||||
}
|
||||
Cache::rm("{$platform}_{$params['apptype']}_code".$code.$params['openid']);
|
||||
|
||||
if($extend['mobile']){
|
||||
Cache::rm("{$platform}_{$params['apptype']}_core".$extend['mobile']);
|
||||
}
|
||||
|
||||
$this->success('获取成功', ['token' => $this->auth->getToken()]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 会员中心
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
$data = [
|
||||
'welcome' => $this->auth->nickname,
|
||||
'user_info'=>$this->auth->getUserinfo()
|
||||
];
|
||||
//是否有核销按钮展示权
|
||||
$data['have_auth'] = \app\common\model\User::verificationAuth($this->auth->id);
|
||||
$data['have_teacher'] = \app\common\model\User::teacherAuth($this->auth->id);
|
||||
//机构认证信息
|
||||
$data['shop_auth_info'] = ManystoreShop::getAuthInfo($this->auth->id);
|
||||
|
||||
$data['user_info']["avatar"] = $data['user_info']["avatar"]? cdnurl($data['user_info']["avatar"],true):$data['user_info']["avatar"];
|
||||
$this->success('调用成功',$data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员登录
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="account", type="string", required=true, description="账号")
|
||||
* @ApiParams (name="password", type="string", required=true, description="密码")
|
||||
*/
|
||||
public function login()
|
||||
{
|
||||
$account = $this->request->post('account');
|
||||
$password = $this->request->post('password');
|
||||
if (!$account || !$password) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
$ret = $this->auth->login($account, $password);
|
||||
if ($ret) {
|
||||
$data = ['userinfo' => $this->auth->getUserinfo()];
|
||||
$this->success(__('Logged in successful'), $data);
|
||||
} else {
|
||||
$this->error($this->auth->getError());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 手机验证码登录
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="mobile", type="string", required=true, description="手机号")
|
||||
* @ApiParams (name="captcha", type="string", required=true, description="验证码")
|
||||
*/
|
||||
public function mobilelogin()
|
||||
{
|
||||
$mobile = $this->request->post('mobile');
|
||||
$captcha = $this->request->post('captcha');
|
||||
if (!$mobile || !$captcha) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
||||
$this->error(__('Mobile is incorrect'));
|
||||
}
|
||||
if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
$user = \app\common\model\User::getByMobile($mobile);
|
||||
if ($user) {
|
||||
if ($user->status != 'normal') {
|
||||
$this->error(__('Account is locked'));
|
||||
}
|
||||
//如果已经有账号则直接登录
|
||||
$ret = $this->auth->direct($user->id);
|
||||
} else {
|
||||
$ret = $this->auth->register($mobile, Random::alnum(), '', $mobile, []);
|
||||
}
|
||||
if ($ret) {
|
||||
Sms::flush($mobile, 'mobilelogin');
|
||||
$data = ['userinfo' => $this->auth->getUserinfo()];
|
||||
$this->success(__('Logged in successful'), $data);
|
||||
} else {
|
||||
$this->error($this->auth->getError());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册会员
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="username", type="string", required=true, description="用户名")
|
||||
* @ApiParams (name="password", type="string", required=true, description="密码")
|
||||
* @ApiParams (name="email", type="string", required=true, description="邮箱")
|
||||
* @ApiParams (name="mobile", type="string", required=true, description="手机号")
|
||||
* @ApiParams (name="code", type="string", required=true, description="验证码")
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$username = $this->request->post('username');
|
||||
$password = $this->request->post('password');
|
||||
$email = $this->request->post('email');
|
||||
$mobile = $this->request->post('mobile');
|
||||
$code = $this->request->post('code');
|
||||
if (!$username || !$password) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
if ($email && !Validate::is($email, "email")) {
|
||||
$this->error(__('Email is incorrect'));
|
||||
}
|
||||
if ($mobile && !Validate::regex($mobile, "^1\d{10}$")) {
|
||||
$this->error(__('Mobile is incorrect'));
|
||||
}
|
||||
$ret = Sms::check($mobile, $code, 'register');
|
||||
if (!$ret) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
$ret = $this->auth->register($username, $password, $email, $mobile, []);
|
||||
if ($ret) {
|
||||
$data = ['userinfo' => $this->auth->getUserinfo()];
|
||||
$this->success(__('Sign up successful'), $data);
|
||||
} else {
|
||||
$this->error($this->auth->getError());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @ApiMethod (POST)
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
if (!$this->request->isPost()) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
$this->auth->logout();
|
||||
$this->success(__('Logout successful'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员个人信息
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="update_fields", type="json", required=true, description="本次需要更新的用户字段json格式:更新谁传谁的字段名,比如:只更新头像和昵称 则 json=['avatar','nickname']")
|
||||
* @ApiParams (name="avatar", type="string", required=true, description="头像地址")
|
||||
* @ApiParams (name="username", type="string", required=true, description="用户名")
|
||||
* @ApiParams (name="nickname", type="string", required=true, description="昵称")
|
||||
* @ApiParams (name="realname", type="string", required=true, description="姓名")
|
||||
* @ApiParams (name="gender", type="int", required=true, description="性别:0女 1男")
|
||||
* @ApiParams (name="birthday", type="string", required=true, description="出生日期:日期字符串 比如”1995-9-20")
|
||||
* @ApiParams (name="work", type="string", required=true, description="职业")
|
||||
* @ApiParams (name="bio", type="string", required=true, description="个人简介")
|
||||
*/
|
||||
public function profile()
|
||||
{
|
||||
$user = $this->auth->getUser();
|
||||
$update_fields = $this->request->post('update_fields/a',[]);
|
||||
// var_dump($update_fields);die;
|
||||
|
||||
if(!$update_fields)$this->error(__('请指定要更新的字段!'));
|
||||
$username = $this->request->post('username/s');
|
||||
$nickname = $this->request->post('nickname/s');
|
||||
$realname = $this->request->post('realname/s');
|
||||
$gender = $this->request->post('gender/d');
|
||||
$birthday = $this->request->post('birthday/s');
|
||||
$work = $this->request->post('work/s');
|
||||
$bio = $this->request->post('bio/s',null);
|
||||
$avatar = $this->request->post('avatar', null, 'trim,strip_tags,htmlspecialchars');
|
||||
|
||||
|
||||
if ($username && in_array('username', $update_fields)) {
|
||||
$exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find();
|
||||
if ($exists) {
|
||||
$this->error(__('Username already exists'));
|
||||
}
|
||||
$user->username = $username;
|
||||
}
|
||||
if ($nickname && in_array('nickname', $update_fields)) {
|
||||
$exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $this->auth->id)->find();
|
||||
if ($exists) {
|
||||
$this->error(__('Nickname already exists'));
|
||||
}
|
||||
$user->nickname = $nickname;
|
||||
}
|
||||
if(in_array('bio', $update_fields))$user->bio = $bio;
|
||||
if($avatar!==null && in_array('avatar', $update_fields))$user->avatar = $avatar;
|
||||
if(in_array('realname', $update_fields))$user->realname = $realname;
|
||||
if(in_array('gender', $update_fields)){
|
||||
if(!in_array($gender, [1,0]))$this->error(__('请输入正确的性别!'));
|
||||
$user->gender = $gender;
|
||||
}
|
||||
if(in_array('birthday', $update_fields))$user->birthday = $birthday;
|
||||
if(in_array('work', $update_fields))$user->work = $work;
|
||||
$user->save();
|
||||
//调用事件
|
||||
$datas = ['user' => $user];
|
||||
\think\Hook::listen('user_update_after', $datas);
|
||||
|
||||
|
||||
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改邮箱
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="email", type="string", required=true, description="邮箱")
|
||||
* @ApiParams (name="captcha", type="string", required=true, description="验证码")
|
||||
*/
|
||||
public function changeemail()
|
||||
{
|
||||
$user = $this->auth->getUser();
|
||||
$email = $this->request->post('email');
|
||||
$captcha = $this->request->post('captcha');
|
||||
if (!$email || !$captcha) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
if (!Validate::is($email, "email")) {
|
||||
$this->error(__('Email is incorrect'));
|
||||
}
|
||||
if (\app\common\model\User::where('email', $email)->where('id', '<>', $user->id)->find()) {
|
||||
$this->error(__('Email already exists'));
|
||||
}
|
||||
$result = Ems::check($email, $captcha, 'changeemail');
|
||||
if (!$result) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
$verification = $user->verification;
|
||||
$verification->email = 1;
|
||||
$user->verification = $verification;
|
||||
$user->email = $email;
|
||||
$user->save();
|
||||
|
||||
Ems::flush($email, 'changeemail');
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改手机号
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="mobile", type="string", required=true, description="手机号")
|
||||
* @ApiParams (name="captcha", type="string", required=true, description="验证码")
|
||||
*/
|
||||
public function changemobile()
|
||||
{
|
||||
$user = $this->auth->getUser();
|
||||
$mobile = $this->request->post('mobile');
|
||||
$captcha = $this->request->post('captcha');
|
||||
if (!$mobile || !$captcha) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
||||
$this->error(__('Mobile is incorrect'));
|
||||
}
|
||||
if (\app\common\model\User::where('mobile', $mobile)->where('id', '<>', $user->id)->find()) {
|
||||
$this->error(__('Mobile already exists'));
|
||||
}
|
||||
$result = Sms::check($mobile, $captcha, 'changemobile');
|
||||
if (!$result) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
$verification = $user->verification;
|
||||
$verification->mobile = 1;
|
||||
$user->verification = $verification;
|
||||
$user->mobile = $mobile;
|
||||
$user->save();
|
||||
|
||||
Sms::flush($mobile, 'changemobile');
|
||||
$this->success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方登录
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="platform", type="string", required=true, description="平台名称")
|
||||
* @ApiParams (name="code", type="string", required=true, description="Code码")
|
||||
*/
|
||||
public function third()
|
||||
{
|
||||
$url = url('user/index');
|
||||
$platform = $this->request->post("platform");
|
||||
$code = $this->request->post("code");
|
||||
$config = get_addon_config('third');
|
||||
if (!$config || !isset($config[$platform])) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
$app = new \addons\third\library\Application($config);
|
||||
//通过code换access_token和绑定会员
|
||||
$result = $app->{$platform}->getUserInfo(['code' => $code]);
|
||||
if ($result) {
|
||||
$loginret = \addons\third\library\Service::connect($platform, $result);
|
||||
if ($loginret) {
|
||||
$data = [
|
||||
'userinfo' => $this->auth->getUserinfo(),
|
||||
'thirdinfo' => $result
|
||||
];
|
||||
$this->success(__('Logged in successful'), $data);
|
||||
}
|
||||
}
|
||||
$this->error(__('Operation failed'), $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*
|
||||
* @ApiMethod (POST)
|
||||
* @ApiParams (name="mobile", type="string", required=true, description="手机号")
|
||||
* @ApiParams (name="newpassword", type="string", required=true, description="新密码")
|
||||
* @ApiParams (name="captcha", type="string", required=true, description="验证码")
|
||||
*/
|
||||
public function resetpwd()
|
||||
{
|
||||
$type = $this->request->post("type", "mobile");
|
||||
$mobile = $this->request->post("mobile");
|
||||
$email = $this->request->post("email");
|
||||
$newpassword = $this->request->post("newpassword");
|
||||
$captcha = $this->request->post("captcha");
|
||||
if (!$newpassword || !$captcha) {
|
||||
$this->error(__('Invalid parameters'));
|
||||
}
|
||||
//验证Token
|
||||
if (!Validate::make()->check(['newpassword' => $newpassword], ['newpassword' => 'require|regex:\S{6,30}'])) {
|
||||
$this->error(__('Password must be 6 to 30 characters'));
|
||||
}
|
||||
if ($type == 'mobile') {
|
||||
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
||||
$this->error(__('Mobile is incorrect'));
|
||||
}
|
||||
$user = \app\common\model\User::getByMobile($mobile);
|
||||
if (!$user) {
|
||||
$this->error(__('User not found'));
|
||||
}
|
||||
$ret = Sms::check($mobile, $captcha, 'resetpwd');
|
||||
if (!$ret) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
Sms::flush($mobile, 'resetpwd');
|
||||
} else {
|
||||
if (!Validate::is($email, "email")) {
|
||||
$this->error(__('Email is incorrect'));
|
||||
}
|
||||
$user = \app\common\model\User::getByEmail($email);
|
||||
if (!$user) {
|
||||
$this->error(__('User not found'));
|
||||
}
|
||||
$ret = Ems::check($email, $captcha, 'resetpwd');
|
||||
if (!$ret) {
|
||||
$this->error(__('Captcha is incorrect'));
|
||||
}
|
||||
Ems::flush($email, 'resetpwd');
|
||||
}
|
||||
//模拟一次登录
|
||||
$this->auth->direct($user->id);
|
||||
$ret = $this->auth->changepwd($newpassword, '', true);
|
||||
if ($ret) {
|
||||
$this->success(__('Reset password successful'));
|
||||
} else {
|
||||
$this->error($this->auth->getError());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,299 +0,0 @@
|
|||
<?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'));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,264 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
}
|
|
@ -1,134 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,325 +0,0 @@
|
|||
<?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" ) ;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
<?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);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
<?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]);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,155 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,336 +0,0 @@
|
|||
<?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'));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?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中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -1,707 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,311 +0,0 @@
|
|||
<?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'));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,300 +0,0 @@
|
|||
<?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'));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?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中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -1,372 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?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中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -1,310 +0,0 @@
|
|||
<?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'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
<?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中对应的方法复制到当前控制器,然后进行修改
|
||||
*/
|
||||
|
||||
|
||||
}
|
|
@ -1,197 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,520 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,462 +0,0 @@
|
|||
<?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'));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,211 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,324 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,235 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
<?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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,244 +0,0 @@
|
|||
<?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(' ', ' ', $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]);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
<?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文件',
|
||||
];
|
|
@ -1,8 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'No file upload or server upload limit exceeded' => '未上传文件或超出服务器上传限制',
|
||||
'Uploaded file format is limited' => '上传文件格式受限制',
|
||||
'Uploaded file is not a valid image' => '上传文件不是有效的图片文件',
|
||||
'Upload successful' => '上传成功',
|
||||
];
|
|
@ -1,12 +0,0 @@
|
|||
<?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' => '父组别不能是它的子组别及本身',
|
||||
];
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Group' => '所属组别',
|
||||
'Loginfailure' => '登录失败次数',
|
||||
'Login time' => '最后登录',
|
||||
'Please input correct username' => '用户名只能由3-12位数字、字母、下划线组合',
|
||||
'Please input correct password' => '密码长度必须在6-16位之间,不能包含空格',
|
||||
];
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => '编号',
|
||||
'Shop_id' => '商家编号',
|
||||
'Store_id' => '管理员编号',
|
||||
'Username' => '管理员名字',
|
||||
'Url' => '操作页面',
|
||||
'Title' => '日志标题',
|
||||
'Content' => '内容',
|
||||
'Ip' => 'IP地址',
|
||||
'Useragent' => '浏览器',
|
||||
'Createtime' => '操作时间',
|
||||
];
|
|
@ -1,20 +0,0 @@
|
|||
<?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规则只能是小写字母、数字、下划线和/组成',
|
||||
];
|
|
@ -1,18 +0,0 @@
|
|||
<?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' => '状态'
|
||||
];
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Id' => 'ID',
|
||||
'Type' => '类型',
|
||||
'Params' => '参数',
|
||||
'Command' => '命令',
|
||||
'Content' => '返回结果',
|
||||
'Executetime' => '执行时间',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '更新时间',
|
||||
'Execute again' => '再次执行',
|
||||
'Successed' => '成功',
|
||||
'Failured' => '失败',
|
||||
'Status' => '状态'
|
||||
];
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'name' => '变量名称',
|
||||
'intro' => '描述',
|
||||
'group' => '分组',
|
||||
'type' => '类型',
|
||||
'value' => '变量值'
|
||||
];
|
|
@ -1,48 +0,0 @@
|
|||
<?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>',
|
||||
];
|
|
@ -1,45 +0,0 @@
|
|||
<?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' => '上传用户头像',
|
||||
];
|
|
@ -1,65 +0,0 @@
|
|||
<?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' => '请输入正确的邮箱地址',
|
||||
];
|
|
@ -1,43 +0,0 @@
|
|||
<?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]失败'
|
||||
];
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?php
|
||||
return [
|
||||
'Url' => '链接',
|
||||
'Ip' => 'IP地址',
|
||||
'Userame' => '用户名',
|
||||
'Createtime' => '操作时间',
|
||||
'Click to edit' => '点击编辑',
|
||||
'Admin log' => '操作日志',
|
||||
];
|
|
@ -1,65 +0,0 @@
|
|||
<?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' => '女',
|
||||
];
|
|
@ -1,57 +0,0 @@
|
|||
<?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' => '验证码',
|
||||
];
|
|
@ -1,42 +0,0 @@
|
|||
<?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' => '头像'
|
||||
];
|
|
@ -1,21 +0,0 @@
|
|||
<?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' => '授权前台用户头像'
|
||||
];
|
|
@ -1,73 +0,0 @@
|
|||
<?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' => '报名是否过期',
|
||||
];
|
|
@ -1,80 +0,0 @@
|
|||
<?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' => '确认提交',
|
||||
];
|
|
@ -1,29 +0,0 @@
|
|||
<?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' => '头图'
|
||||
];
|
|
@ -1,29 +0,0 @@
|
|||
<?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' => '头图'
|
||||
];
|
|
@ -1,79 +0,0 @@
|
|||
<?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' => '是',
|
||||
];
|
|
@ -1,72 +0,0 @@
|
|||
<?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' => '头像'
|
||||
];
|
|
@ -1,38 +0,0 @@
|
|||
<?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为免费)'
|
||||
];
|
|
@ -1,22 +0,0 @@
|
|||
<?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' => '微信支付单号'
|
||||
];
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Name' => '分类名',
|
||||
'Status' => '状态',
|
||||
'Status 1' => '上架',
|
||||
'Status 2' => '下架',
|
||||
'Weigh' => '权重',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '修改时间',
|
||||
'Deletetime' => '删除时间'
|
||||
];
|
|
@ -1,95 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Manystore_id' => '机构账号id',
|
||||
'Shop_id' => '机构',
|
||||
'User_id' => '主讲师用户',
|
||||
'Classes_cate_ids' => '标签',
|
||||
'Classes_label_ids' => '热门',
|
||||
|
||||
'Has_expire' => '是否过期',
|
||||
'Has_expire 1' => '往期课程',
|
||||
'Has_expire 2' => '进行中课程',
|
||||
|
||||
'Start_time' => '开始时间',
|
||||
'End_time' => '结束时间',
|
||||
|
||||
|
||||
'Self_label_tag' => '机构特色标签',
|
||||
'Add_type' => '添加人类型',
|
||||
'Add_type 1' => '机构',
|
||||
'Add_type 2' => '总后台',
|
||||
'Add_id' => '添加人id',
|
||||
'Title' => '课程名称',
|
||||
'Headimage' => '课程头图',
|
||||
'Images' => '课程轮播图',
|
||||
'Type' => '课程地点类型',
|
||||
'Type out' => '户外',
|
||||
'Type in' => '室内',
|
||||
'Classes_num' => '核销次数',
|
||||
'Address_type' => '地址类型',
|
||||
'Address_type 1' => '机构内授课',
|
||||
'Address_type 2' => '特定位置授课',
|
||||
'Address_city' => '城市选择',
|
||||
'Province' => '省编号',
|
||||
'City' => '市编号',
|
||||
'District' => '县区编号',
|
||||
'Address' => '地址',
|
||||
'Address_detail' => '详细地址',
|
||||
'Longitude' => '经度',
|
||||
'Latitude' => '纬度',
|
||||
'Classes_date_text' => '上课日期',
|
||||
'Classes_time_text' => '上课时间',
|
||||
'Content' => '课程详情',
|
||||
'Notice' => '课程须知',
|
||||
'Virtual_num' => '虚拟报名人数',
|
||||
'Sale' => '总销量',
|
||||
'Price' => '售价',
|
||||
'Underline_price' => '划线价',
|
||||
'Virtual_collect' => '虚拟收藏量',
|
||||
'Status' => '状态',
|
||||
'Status 1' => '上架',
|
||||
'Status 2' => '下架',
|
||||
'Status 3' => '(审核中课程)平台下架',
|
||||
'Auth_status' => '审核状态',
|
||||
'Auth_status 0' => '待审核',
|
||||
'Auth_status 1' => '审核通过',
|
||||
'Auth_status 2' => '审核失败',
|
||||
'Reason' => '审核不通过原因',
|
||||
'Auth_time' => '审核时间',
|
||||
'Admin_id' => '审核管理员id',
|
||||
'Weigh' => '权重',
|
||||
'Recommend' => '平台推荐',
|
||||
'Recommend 0' => '否',
|
||||
'Recommend 1' => '是',
|
||||
'Hot' => '平台热门',
|
||||
'Hot 0' => '否',
|
||||
'Hot 1' => '是',
|
||||
'New' => '平台最新',
|
||||
'New 0' => '否',
|
||||
'New 1' => '是',
|
||||
'Selfhot' => '机构热门',
|
||||
'Selfhot 0' => '否',
|
||||
'Selfhot 1' => '是',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '修改时间',
|
||||
'Deletetime' => '删除时间',
|
||||
'Manystore.nickname' => '机构账号昵称',
|
||||
'Manystoreshop.name' => '机构名称',
|
||||
'Manystoreshop.image' => '机构封面图',
|
||||
'Manystoreshop.address_city' => '机构城市选择',
|
||||
'Manystoreshop.province' => '机构省编号',
|
||||
'Manystoreshop.city' => '机构市编号',
|
||||
'Manystoreshop.district' => '机构县区编号',
|
||||
'Manystoreshop.address' => '机构地址',
|
||||
'Manystoreshop.address_detail' => '机构详细地址',
|
||||
'User.nickname' => '讲师用户昵称',
|
||||
'User.realname' => '讲师用户真实姓名',
|
||||
'User.mobile' => '讲师用户手机号',
|
||||
'User.avatar' => '讲师用户头像',
|
||||
'Admin.nickname' => '管理员昵称',
|
||||
'Admin.avatar' => '管理员头像',
|
||||
'Limit_num' => '总限定人数',
|
||||
'Sign_num' => '总已报名人数',
|
||||
'Verification_num' => '总已核销人数',
|
||||
];
|
|
@ -1,21 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Classes_lib_id' => '课程id',
|
||||
'Name' => '每节课名',
|
||||
'Time' => '课时开始结束时间',
|
||||
'Start_time' => '开始时间',
|
||||
'End_time' => '结束时间',
|
||||
'Limit_num' => '本课时限定人数',
|
||||
'Sign_num' => '已报名人数',
|
||||
'Verification_num' => '已核销人数',
|
||||
'Status' => '状态',
|
||||
'Status 1' => '上架',
|
||||
'Status 2' => '下架',
|
||||
'Weigh' => '权重',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '修改时间',
|
||||
'Deletetime' => '删除时间',
|
||||
'Schoolclasseslib.title' => '课程名称',
|
||||
'Schoolclasseslib.headimage' => '课程头图'
|
||||
];
|
|
@ -1,14 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'User_id' => '用户id',
|
||||
'Classes_lib_id' => '课程id',
|
||||
'Weigh' => '权重',
|
||||
'Createtime' => '创建时间',
|
||||
'User.nickname' => '收藏人昵称',
|
||||
'User.realname' => '收藏人真实姓名',
|
||||
'User.mobile' => '收藏人手机号',
|
||||
'User.avatar' => '收藏人头像',
|
||||
'Schoolclasseslib.title' => '课程名称',
|
||||
'Schoolclasseslib.headimage' => '课程头图'
|
||||
];
|
|
@ -1,38 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'User_id' => '评价用户',
|
||||
'Classes_lib_id' => '课程',
|
||||
'Classes_order_id' => '课程订单',
|
||||
'Manystore_id' => '机构账号',
|
||||
'Shop_id' => '机构店铺',
|
||||
'Teacher_id' => '老师',
|
||||
'Image' => '评价人头像',
|
||||
'Nickname' => '评价人昵称',
|
||||
'Classes_star' => '课程评分',
|
||||
'Teacher_star' => '讲师评分',
|
||||
'Shop_star' => '教师环境',
|
||||
'Message_text' => '评价内容',
|
||||
'Evaluate_time' => '评价时间',
|
||||
'Status' => '状态',
|
||||
'Status 1' => '上架',
|
||||
'Status 2' => '下架',
|
||||
'Top' => '是否置顶',
|
||||
'Top 0' => '否',
|
||||
'Top 1' => '是',
|
||||
'Weigh' => '权重',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '修改时间',
|
||||
'User.nickname' => '评价人昵称',
|
||||
'User.realname' => '评价人真实姓名',
|
||||
'User.mobile' => '评价人手机号',
|
||||
'User.avatar' => '评价人头像',
|
||||
'Schoolclasseslib.title' => '课程名称',
|
||||
'Schoolclasseslib.headimage' => '课程头图',
|
||||
'Schoolclassesorder.order_no' => '课程单号',
|
||||
'Manystore.nickname' => '机构账号昵称',
|
||||
'Manystoreshop.name' => '机构名称',
|
||||
'Manystoreshop.logo' => '机构LOGO',
|
||||
'Schoolteacher.name' => '教师名',
|
||||
'Schoolteacher.head_image' => '教师头像'
|
||||
];
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Order_no' => '预约单号',
|
||||
|
||||
'Edit'=>'修改用户预约的课时',
|
||||
'Add'=>'帮用户预约课时',
|
||||
'Delete'=>'帮用户取消预约',
|
||||
'Del'=>'帮用户取消预约',
|
||||
'Auth_status' => '审核状态',
|
||||
'Auth_status 0' => '待审核',
|
||||
'Auth_status 1' => '审核通过',
|
||||
'Auth_status 2' => '审核失败',
|
||||
'Reason' => '审核不通过原因',
|
||||
'Auth_time' => '审核时间',
|
||||
'Admin_id' => '审核管理员id',
|
||||
|
||||
'Classes_order_id' => '课程订单id',
|
||||
'Classes_lib_spec_id' => '选择要预约的课时',
|
||||
'User_id' => '下单人id',
|
||||
'Classes_order_detail_id' => '订单课程id',
|
||||
'Classes_lib_id' => '课程id',
|
||||
'Name' => '本节课名',
|
||||
'Start_time' => '开始时间',
|
||||
'End_time' => '结束时间',
|
||||
'Limit_num' => '本课时限定人数(0不限制)',
|
||||
'Sign_num' => '下单时已报名人数',
|
||||
'Verification_num' => '下单时已核销人数',
|
||||
'Status' => '订单状态',
|
||||
'Status -3' => '已取消',
|
||||
'Status -1' => '已报名待审核',
|
||||
'Status 0' => '已预约',
|
||||
'Status 3' => '已完成',
|
||||
'Verification_user_id' => '核销人用户id',
|
||||
'Reservation_time' => '预约时间',
|
||||
'Finish_time' => '完成时间',
|
||||
'Cancel_time' => '取消时间',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '修改时间',
|
||||
'Deletetime' => '删除时间',
|
||||
'Schoolclassesorder.order_no' => '课程单号',
|
||||
'Schoolclasseslibspec.name' => '本节课名',
|
||||
'User.nickname' => '预约用户昵称',
|
||||
'User.realname' => '预约用户真实姓名',
|
||||
'User.mobile' => '预约用户手机号',
|
||||
'User.avatar' => '预约用户头像',
|
||||
'Schoolclassesorderdetail.title' => '课程名称',
|
||||
'Schoolclassesorderdetail.headimage' => '课程头图',
|
||||
'Schoolclasseslib.title' => '课程名称'
|
||||
];
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Classes_hour_order_id' => '课时订单id',
|
||||
'Status' => '订单状态',
|
||||
'Status -3' => '已取消',
|
||||
'Status -1' => '已报名待审核',
|
||||
'Status 0' => '已预约',
|
||||
'Status 3' => '已完成',
|
||||
'Log_text' => '记录内容',
|
||||
'Createtime' => '创建时间',
|
||||
'Schoolclasseshourorder.order_no' => '订单号'
|
||||
];
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'Name' => '类型标签名',
|
||||
'Status' => '状态',
|
||||
'Status 1' => '上架',
|
||||
'Status 2' => '下架',
|
||||
'Weigh' => '权重',
|
||||
'Createtime' => '创建时间',
|
||||
'Updatetime' => '修改时间',
|
||||
'Deletetime' => '删除时间'
|
||||
];
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue