From ec5768e9cf49f23cda3911986f0e6ac312d6e740 Mon Sep 17 00:00:00 2001
From: qinzexin <“731344816@qq.com”>
Date: Wed, 4 Jun 2025 18:31:54 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=B1=E4=B9=90=E9=83=A8=E7=94=B3=E8=AF=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../admin/controller/school/SportApply.php | 71 ++
.../admin/lang/zh-cn/school/sport_apply.php | 16 +
application/admin/model/school/SportApply.php | 44 ++
.../admin/validate/school/SportApply.php | 27 +
.../admin/view/school/sport_apply/add.html | 51 ++
.../admin/view/school/sport_apply/edit.html | 54 ++
.../admin/view/school/sport_apply/index.html | 29 +
.../view/school/sport_apply/recyclebin.html | 25 +
.../api/controller/school/SporApply.php | 68 ++
.../common/model/school/SportApply.php | 94 +++
.../common/model/school/activity/Activity.php | 111 ++-
.../model/school/activity/order/Order.php | 20 +-
.../model/school/activity/order/SettleLog.php | 3 +
.../common/validate/school/SportApply.php | 61 ++
.../manystoreapi/controller/Activity.php | 715 ------------------
.../manystoreapi/controller/ActivityOrder.php | 296 --------
.../manystoreapi/controller/ClassesLib.php | 631 ----------------
.../manystoreapi/controller/ClassesOrder.php | 278 -------
.../manystoreapi/controller/Evaluate.php | 118 ---
.../manystoreapi/controller/HourOrder.php | 399 ----------
.../manystoreapi/controller/ServiceOrder.php | 218 ------
.../manystoreapi/controller/Teacher.php | 414 ----------
.../manystoreapi/controller/UserAuth.php | 314 --------
.../manystoreapi/controller/Verification.php | 360 ---------
.../assets/js/backend/school/sport_apply.js | 124 +++
25 files changed, 783 insertions(+), 3758 deletions(-)
create mode 100644 application/admin/controller/school/SportApply.php
create mode 100644 application/admin/lang/zh-cn/school/sport_apply.php
create mode 100644 application/admin/model/school/SportApply.php
create mode 100644 application/admin/validate/school/SportApply.php
create mode 100644 application/admin/view/school/sport_apply/add.html
create mode 100644 application/admin/view/school/sport_apply/edit.html
create mode 100644 application/admin/view/school/sport_apply/index.html
create mode 100644 application/admin/view/school/sport_apply/recyclebin.html
create mode 100644 application/api/controller/school/SporApply.php
create mode 100644 application/common/model/school/SportApply.php
create mode 100644 application/common/validate/school/SportApply.php
delete mode 100644 application/manystoreapi/controller/Activity.php
delete mode 100644 application/manystoreapi/controller/ActivityOrder.php
delete mode 100644 application/manystoreapi/controller/ClassesLib.php
delete mode 100644 application/manystoreapi/controller/ClassesOrder.php
delete mode 100644 application/manystoreapi/controller/Evaluate.php
delete mode 100644 application/manystoreapi/controller/HourOrder.php
delete mode 100644 application/manystoreapi/controller/ServiceOrder.php
delete mode 100644 application/manystoreapi/controller/Teacher.php
delete mode 100644 application/manystoreapi/controller/UserAuth.php
delete mode 100644 application/manystoreapi/controller/Verification.php
create mode 100644 public/assets/js/backend/school/sport_apply.js
diff --git a/application/admin/controller/school/SportApply.php b/application/admin/controller/school/SportApply.php
new file mode 100644
index 0000000..6e56be6
--- /dev/null
+++ b/application/admin/controller/school/SportApply.php
@@ -0,0 +1,71 @@
+model = new \app\admin\model\school\SportApply;
+
+ }
+
+
+
+ /**
+ * 默认生成的控制器所继承的父类中有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'])
+ ->where($where)
+ ->order($sort, $order)
+ ->paginate($limit);
+
+ foreach ($list as $row) {
+
+ $row->getRelation('user')->visible(['nickname','mobile','avatar']);
+ }
+
+ $result = array("total" => $list->total(), "rows" => $list->items());
+
+ return json($result);
+ }
+ return $this->view->fetch();
+ }
+
+}
diff --git a/application/admin/lang/zh-cn/school/sport_apply.php b/application/admin/lang/zh-cn/school/sport_apply.php
new file mode 100644
index 0000000..54b5726
--- /dev/null
+++ b/application/admin/lang/zh-cn/school/sport_apply.php
@@ -0,0 +1,16 @@
+ '用户id(0为未登录)',
+ 'Name' => '联系人',
+ 'Mobile' => '联系电话',
+ 'Enterprise_name' => '企业名称',
+ 'Enterprise_addr' => '企业地址',
+ 'Outdoor_sport' => '经营/热爱的户外运动',
+ 'Createtime' => '创建时间',
+ 'Updatetime' => '修改时间',
+ 'Deletetime' => '删除时间',
+ 'User.nickname' => '昵称',
+ 'User.mobile' => '手机号',
+ 'User.avatar' => '头像'
+];
diff --git a/application/admin/model/school/SportApply.php b/application/admin/model/school/SportApply.php
new file mode 100644
index 0000000..e59113e
--- /dev/null
+++ b/application/admin/model/school/SportApply.php
@@ -0,0 +1,44 @@
+belongsTo('app\admin\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+ }
+}
diff --git a/application/admin/validate/school/SportApply.php b/application/admin/validate/school/SportApply.php
new file mode 100644
index 0000000..957e111
--- /dev/null
+++ b/application/admin/validate/school/SportApply.php
@@ -0,0 +1,27 @@
+ [],
+ 'edit' => [],
+ ];
+
+}
diff --git a/application/admin/view/school/sport_apply/add.html b/application/admin/view/school/sport_apply/add.html
new file mode 100644
index 0000000..2573784
--- /dev/null
+++ b/application/admin/view/school/sport_apply/add.html
@@ -0,0 +1,51 @@
+
diff --git a/application/admin/view/school/sport_apply/edit.html b/application/admin/view/school/sport_apply/edit.html
new file mode 100644
index 0000000..65f63aa
--- /dev/null
+++ b/application/admin/view/school/sport_apply/edit.html
@@ -0,0 +1,54 @@
+
diff --git a/application/admin/view/school/sport_apply/index.html b/application/admin/view/school/sport_apply/index.html
new file mode 100644
index 0000000..fd3cb04
--- /dev/null
+++ b/application/admin/view/school/sport_apply/index.html
@@ -0,0 +1,29 @@
+
+ {:build_heading()}
+
+
+
diff --git a/application/admin/view/school/sport_apply/recyclebin.html b/application/admin/view/school/sport_apply/recyclebin.html
new file mode 100644
index 0000000..027bb77
--- /dev/null
+++ b/application/admin/view/school/sport_apply/recyclebin.html
@@ -0,0 +1,25 @@
+
+ {:build_heading()}
+
+
+
diff --git a/application/api/controller/school/SporApply.php b/application/api/controller/school/SporApply.php
new file mode 100644
index 0000000..27f500d
--- /dev/null
+++ b/application/api/controller/school/SporApply.php
@@ -0,0 +1,68 @@
+model = new \app\common\model\school\SportApply();
+ parent::_initialize();
+
+ //判断登录用户是否是员工
+ $this->setUrlLock();
+ }
+
+
+
+ /**
+ * @ApiTitle( 户外运动招募申请表单)
+ * @ApiSummary(户外运动招募申请表单)
+ * @ApiMethod(POST)
+ * @ApiParams(name = "name", type = "string",required=true,description = "联系人")
+ * @ApiParams(name = "mobile", type = "string",required=true,description = "联系电话")
+ * @ApiParams(name = "enterprise_name", type = "string",required=true,description = "企业名称")
+ * @ApiParams(name = "enterprise_addr", type = "string",required=true,description = "企业地址")
+ * @ApiParams(name = "outdoor_sport", type = "string",required=true,description = "经营/热爱的户外运动")
+ * @ApiReturn({
+ *
+ *})
+ */
+ public function add(){
+ $user_id = 0;
+ $user = $this->auth->getUser();//登录用户
+ if($user)$user_id = $user['id'];
+ $params = [
+ "user_id" =>$user_id,
+ ];
+ $params["name"] = $this->request->post('name/s', ''); //搜索关键字
+ $params["mobile"] = $this->request->post('mobile/s', ''); //搜索关键字
+ $params["enterprise_name"] = $this->request->post('enterprise_name/s', ''); //搜索关键字
+ $params["enterprise_addr"] = $this->request->post('enterprise_addr/s', ''); //搜索关键字
+ $params["outdoor_sport"] = $this->request->post('outdoor_sport/s', ''); //搜索关键字.
+
+ try{
+ $res = $this->model->add($params,true);
+ }catch (\Throwable $e){
+ $this->error($e->getMessage());
+ }
+ $this->success('添加成功', $res);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/application/common/model/school/SportApply.php b/application/common/model/school/SportApply.php
new file mode 100644
index 0000000..ebb4008
--- /dev/null
+++ b/application/common/model/school/SportApply.php
@@ -0,0 +1,94 @@
+belongsTo('app\common\model\User', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
+ }
+
+
+
+
+
+ /** 通用新增(后台api版本)
+ * @param $params
+ * @param $trans
+ * @return $this
+ * @throws \Exception
+ */
+ public function add($params,$trans=false){
+
+ if (empty($params)) {
+ throw new \Exception(__('Parameter %s can not be empty', ''));
+ }
+
+ if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+ $params[$this->dataLimitField] = $this->auth->id;
+ }
+//判断逻辑
+ if($trans){
+ self::beginTrans();
+ }
+ $res = true;
+ try{
+
+ //是否采用模型验证
+ if ($this->modelValidate) {
+ $name = str_replace("\\model\\", "\\validate\\", get_class($this));
+ $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
+ $this->validateFailException()->validate($validate);
+ }
+
+ $result = $this->allowField(true)->save($params);
+
+ if($trans){
+ self::commitTrans();
+ }
+ }catch (\Exception $e){
+ if($trans){
+ self::rollbackTrans();
+ }
+ throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
+ }
+ return $this;
+ }
+
+
+}
diff --git a/application/common/model/school/activity/Activity.php b/application/common/model/school/activity/Activity.php
index 71e74f1..6e4c315 100644
--- a/application/common/model/school/activity/Activity.php
+++ b/application/common/model/school/activity/Activity.php
@@ -7,6 +7,7 @@ use app\common\library\Virtual;
use app\common\model\BaseModel;
use app\common\model\school\activity\order\Order;
use app\common\model\school\activity\order\OrderCode;
+use app\common\model\school\activity\order\SettleLog;
use app\common\model\school\classes\Collect;
use app\common\model\User;
use think\Model;
@@ -364,14 +365,14 @@ class Activity extends BaseModel
$end_time = $params["end_time"];
if(empty($start_time) || empty($end_time)){
- throw new \Exception("{$params["title"]}请选择开始和结束时间".$time);
+ throw new \Exception("请选择开始和结束时间".$time);
}
//转化时间戳
$start_time = $params["start_time"] && !is_numeric($params["start_time"]) ? strtotime($params["start_time"]) : $params["start_time"];
$end_time = $params["end_time"] && !is_numeric($params["end_time"]) ? strtotime($params["end_time"]) : $params["end_time"];
//结束时间不能小于开始时间
if($end_time<=$start_time){
- throw new \Exception("{$params["title"]}结束时间不能小于开始时间");
+ throw new \Exception("结束时间不能小于开始时间");
}
@@ -392,14 +393,14 @@ class Activity extends BaseModel
$sign_end_time = $params["sign_end_time"];
if(empty($sign_start_time) || empty($sign_end_time)){
- throw new \Exception("{$params["title"]}请选择报名开始和结束时间".$time);
+ throw new \Exception("请选择报名开始和结束时间".$time);
}
//转化时间戳
$sign_start_time = $params["sign_start_time"] && !is_numeric($params["sign_start_time"]) ? strtotime($params["sign_start_time"]) : $params["sign_start_time"];
$sign_end_time = $params["sign_end_time"] && !is_numeric($params["sign_end_time"]) ? strtotime($params["sign_end_time"]) : $params["sign_end_time"];
//结束时间不能小于开始时间
if($sign_end_time<=$sign_start_time){
- throw new \Exception("{$params["title"]}报名结束时间不能小于开始时间");
+ throw new \Exception("报名结束时间不能小于开始时间");
}
@@ -409,23 +410,23 @@ class Activity extends BaseModel
($start_time<=$sign_end_time && $sign_end_time<=$end_time) ||
($sign_start_time<=$start_time && $end_time<=$sign_end_time) ||
($sign_start_time>=$start_time && $sign_end_time<=$end_time)){
- throw new \Exception("{$params["title"]}报名时间段和开始时间段有交叉请修改");
+ throw new \Exception("报名时间段和开始时间段有交叉请修改");
}
//报名时间必须早于开始时间
if($sign_start_time>$start_time){
- throw new \Exception("{$params["title"]}报名时间必须早于开始时间");
+ throw new \Exception("报名时间必须早于开始时间");
}
//新增时,报名时间需晚于当前时间
$now_time = time();
if(!$row && $now_time>$sign_start_time){
- throw new \Exception("{$params["title"]}报名时间必须是未来时间!");
+ throw new \Exception("报名时间必须是未来时间!");
}
//活动开始和结束时间不能跨天
if(date('Y-m-d',$start_time)!=date('Y-m-d',$end_time)){
- throw new \Exception("{$params["title"]}活动开始和结束时间不能跨天");
+ throw new \Exception("活动开始和结束时间不能跨天");
}
//settlement_time 最后结算时间等于活动结束时间往后延长n秒,n取配置
@@ -434,8 +435,8 @@ class Activity extends BaseModel
}else{
- if(!$row && empty($params["time"])) throw new \Exception("{$params["title"]}请选择开始和结束时间");
- if(!$row && empty($params["sign_time"])) throw new \Exception("{$params["title"]}请选择报名开始和结束时间");
+ if(!$row && empty($params["time"])) throw new \Exception("请选择开始和结束时间");
+ if(!$row && empty($params["sign_time"])) throw new \Exception("请选择报名开始和结束时间");
if($row){
if(empty($params["time"])){
$params["start_time"] = $row["start_time"];
@@ -526,6 +527,10 @@ class Activity extends BaseModel
if(count($images) < 3 || count($images) > 5){
throw new \Exception("轮播图至少3张,最多5张");
}
+ foreach ($images as $image){
+ if(!$image) throw new \Exception("轮播图不能为空");
+ }
+
if($params["price"]>0){
@@ -1207,6 +1212,11 @@ class Activity extends BaseModel
$params["verification_num"] = OrderCode::where("activity_id",$id)->where("status","=","6")->count();
//设置课程收藏
$params["collect"] = Collect::where("classes_activity_id",$id)->count();
+
+
+
+
+
if($params){
$res = $row->allowField(true)->save($params);
}
@@ -1503,4 +1513,85 @@ class Activity extends BaseModel
return Virtual::getMiniQrcodeLink("activity",["activity_id"=>$id]);
}
+
+
+
+
+ //更新活动结算状态
+ public function updateSettleStatus($id=null,$trans=false){
+//判断逻辑
+ if($trans){
+ self::beginTrans();
+ }
+ $res = true;
+ try{
+ $self = new self;
+ if($id)$self = self::where("id",$id);
+ $list = $self->select();
+ if(!$list)return false;
+
+ foreach ($list as $row){
+
+ //免费活动直接返回 `feel` enum('0','1') DEFAULT '0' COMMENT '是否免费:0=否,1=是',
+ if($row["feel"] == "1"){
+ return false;
+ }
+
+ $params = [
+ "settlestatus"=>'1'
+ ];
+ //结算状态:1=未结算,2=结算中,3=已结算
+ if($row["status"] == "5"){
+ $time = time();
+ //到达结算时间为结算中
+ $settlement_time= $params["settlement_time"];
+ if($time >= $settlement_time){
+ $params["settlestatus"] = '2';
+ }else{
+ $params["settlestatus"] = '1';
+ }
+ //没人下单则为已结算
+ $orders = Order::where("activity_id",$id)
+ ->where("sub_refundprice" ,">",0)
+ ->where("status","not in",["-3","0"])->select();
+ if(!$orders){
+ $params["settlestatus"] = '3';
+ }else{
+ //不存在待结算记录为结算完成
+ $count = SettleLog::where("activity_id" ,$id)->where("status","not in",["-1"])->count();
+ if($count){
+ $count = SettleLog::where("activity_id" ,$id)->where("status","in",["1"])->count();
+ if(!$count){
+ $params["settlestatus"] = '3';
+ }
+
+ }
+ }
+
+
+ }
+
+
+ if($params){
+ $res = $row->allowField(true)->save($params);
+ }
+
+ //将课程信息和课时信息同步到所有已下单的订单信息中
+// self::orderInfoSync($id);
+
+ }
+
+ if($trans){
+ self::commitTrans();
+ }
+ }catch (\Exception $e){
+ if($trans){
+ self::rollbackTrans();
+ }
+ throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
+ }
+ return $row;
+ }
+
+
}
diff --git a/application/common/model/school/activity/order/Order.php b/application/common/model/school/activity/order/Order.php
index 1764d48..10c6754 100644
--- a/application/common/model/school/activity/order/Order.php
+++ b/application/common/model/school/activity/order/Order.php
@@ -2212,7 +2212,7 @@ class Order extends BaseModel
//得到机构售后提交确认订单
$order = self::getHaveShopConfirmationOrder($order_no);
- $this->timeoutSuspension($order['id'],$trans);
+ $this->timeoutSuspension($order['id'],0,true,$trans);
//得到机构售后提交确认订单
$order = self::getHaveShopConfirmationOrder($order_no);
if($check){
@@ -2341,7 +2341,7 @@ class Order extends BaseModel
* @return true
* @throws \Exception
*/
- public function timeoutSuspension($id=0,$trans=false){
+ public function timeoutSuspension($id=0,$activity_id=0,$check=true,$trans=false){
//去超时时间戳配置
$timeout = config('site.activity_end_sales');
//当前时间
@@ -2357,8 +2357,12 @@ class Order extends BaseModel
if($id){
$model = $model->where("{$as}.id",$id);
}
+ if($activity_id){
+ $model = $model->where("{$as}.activity_id",$activity_id);
+ }
+
//查询条件2:过了活动结束时间加延期时间的订单
- $model = $model->where("detail.end_time","<",$delay_time);
+ if($check)$model = $model->where("detail.end_time","<",$delay_time);
$list = $model->select();
if($trans){
@@ -2376,8 +2380,14 @@ class Order extends BaseModel
$row["auth_time"] = time();
$row->save();
- //写订单日志
- OrderLog::log($row['id'],"活动订单售后超时自动驳回,订单挂起,等待官方处理",'admin', 0);
+ if($check){
+ //写订单日志
+ OrderLog::log($row['id'],"活动订单售后超时自动驳回,订单挂起,等待官方处理",'admin', 0);
+ }else{
+ //写订单日志
+ OrderLog::log($row['id'],"活动提前结算,活动订单售后中自动驳回,订单挂起,等待官方处理",'admin', 0);
+ }
+
//调用挂起事件
$data = ['order' => self::where("id",$row['id'])->find(),"user_id"=>0,"oper_type"=>"admin","oper_id"=>0];
\think\Hook::listen('activity_order_timeout_reject_after', $data);
diff --git a/application/common/model/school/activity/order/SettleLog.php b/application/common/model/school/activity/order/SettleLog.php
index f97002b..e948475 100644
--- a/application/common/model/school/activity/order/SettleLog.php
+++ b/application/common/model/school/activity/order/SettleLog.php
@@ -198,6 +198,9 @@ class SettleLog extends BaseModel
//检测更新所有结算订状态
SettleLog::timeoutCheck(null,null);
+ //检测活动状态
+ (new Activity)->updateSettleStatus();
+
if ($trans) {
self::commitTrans();
}
diff --git a/application/common/validate/school/SportApply.php b/application/common/validate/school/SportApply.php
new file mode 100644
index 0000000..a71090a
--- /dev/null
+++ b/application/common/validate/school/SportApply.php
@@ -0,0 +1,61 @@
+ 'require',
+ 'mobile' => 'require',
+ 'enterprise_name' => 'require',
+ 'enterprise_addr' => 'require',
+ 'outdoor_sport' => 'require',
+ ];
+ /**
+ * 提示消息
+ */
+ protected $message = [
+ 'name.require' => '联系人不能为空',
+ 'mobile.require' => '联系电话不能为空',
+ 'enterprise_name.require' => '企业名称不能为空',
+ 'enterprise_addr.require' => '企业地址不能为空',
+ 'outdoor_sport.require' => '经营/热爱的户外运动不能为空',
+ ];
+ /**
+ * 验证场景
+ */
+ protected $scene = [
+ 'add' => [
+ 'name',
+ 'mobile',
+ 'enterprise_name',
+ 'enterprise_addr',
+ 'outdoor_sport',
+ ],
+ 'edit' => [
+ 'name',
+ 'mobile',
+ 'enterprise_name',
+ 'enterprise_addr',
+ 'outdoor_sport',
+ ],
+ ];
+
+
+}
diff --git a/application/manystoreapi/controller/Activity.php b/application/manystoreapi/controller/Activity.php
deleted file mode 100644
index 3687991..0000000
--- a/application/manystoreapi/controller/Activity.php
+++ /dev/null
@@ -1,715 +0,0 @@
-model = new ActivityModel;
- $this->auth_model = new ActivityAuthModel;
- parent::_initialize();
-
-// //判断登录用户是否是员工
-// $this->setUrlLock();
- // 判断员工权限
- $this->check_worker_auth();
- }
-
-
-
-
-
-
-
- /**
- *
- * @ApiTitle( 活动跳转链接)
- * @ApiSummary(活动跳转链接)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "活动id")
- * @ApiReturn({
- *
- *})
- */
- public function url($ids = ''){
- $param = $this->request->param();
- if($this->request->isPost()){
- try{
- if(isset($param['ids']))$ids = $param['id'];
- //设置模拟资格
- $url = ActivityModel::getPath($ids);
-
- }catch (\Exception $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess($url);
- }
- }
-
-
-
-
- /**
- *
- * @ApiTitle( 活动微信小程序码)
- * @ApiSummary(活动微信小程序码)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "活动id")
- * @ApiReturn({
- *
- *})
- */
- public function miniqrcode($ids = ''){
- $param = $this->request->param();
- try{
- if(isset($param['ids']))$ids = $param['id'];
- //设置模拟资格
- $url = ActivityModel::getMiniQrcodeLink($ids);
-
- }catch (\Exception $e){
- $this->apierror($e->getMessage());
- }
-
- return $url["response"];
- }
-
-
-
-
-
-
-
- /**
- * @ApiTitle(活动添加)
- * @ApiSummary(活动添加)
- * @ApiMethod(POST)
- * @ApiParams(name = "status", type = "string",required=true,description = "上架状态:1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "title", type = "string",required=true,description = "活动标题")
- * @ApiParams(name = "headimage", type = "string",required=true,description = "活动头图")
- * @ApiParams(name = "images", type = "string",required=true,description = "活动轮播图多值逗号拼接")
- * @ApiParams(name = "type", type = "string",required=true,description = "地点类型:out=户外,in=室内")
- * @ApiParams(name = "item_json", type = "string",required=true,description = "活动多规格:[{'id':17,'classes_activity_id':10,'name':'xxxxx','price':'0.00','age':'18-60','sex':'3','limit_num':30,'status':'1','weigh':1}] ")
- * @ApiParams(name = "address_type", type = "string",required=true,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "address", type = "string",required=false,description = "地图定位地址")
- * @ApiParams(name = "address_detail", type = "string",required=false,description = "手录详细地址")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "经度")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "纬度")
- * @ApiParams(name = "content", type = "string",required=false,description = "活动详情")
- * @ApiParams(name = "time", type = "string",required=false,description = "活动开始结束时间 Y/m/d H:M:S-Y/m/d H:M:S ")
- * @ApiParams(name = "sign_time", type = "string",required=false,description = "活动報名开始结束时间 Y/m/d H:M:S-Y/m/d H:M:S ")
- * @ApiParams(name = "price", type = "string",required=false,description = "活动參考价格")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiReturn({
- *
- *})
- */
- public function add(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params = [];
- $params["status"] = $this->request->post('status/s', 0); //上架状态:1=上架,2=下架,3=平台下架
- $params["title"] = $this->request->post('title/s', ''); //老师id
- $params["headimage"] = $this->request->post('headimage/s', ''); //老师id
- $params["images"] = $this->request->post('images/s', ''); //老师id
- $params["type"] = $this->request->post('type/s', ''); //老师id
- $params["item_json"] = $this->request->post('item_json/s', ''); //老师id
-
- $params["address_type"] = $this->request->post('address_type/s', ''); //老师id
- $params["province"] = $this->request->post('province/d', 0); //老师id
- $params["city"] = $this->request->post('city/d', 0); //老师id
- $params["district"] = $this->request->post('district/d', 0); //老师id
- $params["address"] = $this->request->post('address/s', ''); //老师id
- $params["address_detail"] = $this->request->post('address_detail/s', ''); //老师id
- $params["longitude"] = $this->request->post('longitude/s', 0); //老师id
- $params["latitude"] = $this->request->post('latitude/s', 0); //老师id
- $params["content"] = $this->request->post('content/s', ''); //老师id
- $params["time"] = $this->request->post('time/s', ''); //老师id
- $params["sign_time"] = $this->request->post('sign_time/s', ''); //老师id
- $params["price"] = $this->request->post('price/f', 0); //老师id
- $params["selfhot"] = $this->request->post('selfhot/s', ''); //老师id
-
-
- //classes_type
-
- try{
- $res = $this->auth_model->createActivityAuthByOper($params,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('添加成功', $res);
- }
-
-
-
-
-
-
- /**
- * @ApiTitle(活动编辑)
- * @ApiSummary(活动编辑)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "string",required=true,description = "活动id")
- * @ApiParams(name = "status", type = "string",required=true,description = "上架状态:1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "title", type = "string",required=true,description = "活动标题")
- * @ApiParams(name = "headimage", type = "string",required=true,description = "活动头图")
- * @ApiParams(name = "images", type = "string",required=true,description = "活动轮播图多值逗号拼接")
- * @ApiParams(name = "type", type = "string",required=true,description = "地点类型:out=户外,in=室内")
- * @ApiParams(name = "item_json", type = "string",required=true,description = "活动多规格:[{'id':17,'classes_activity_id':10,'name':'xxxxx','price':'0.00','age':'18-60','sex':'3','limit_num':30,'status':'1','weigh':1}] ")
- * @ApiParams(name = "address_type", type = "string",required=true,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "address", type = "string",required=false,description = "地图定位地址")
- * @ApiParams(name = "address_detail", type = "string",required=false,description = "手录详细地址")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "经度")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "纬度")
- * @ApiParams(name = "content", type = "string",required=false,description = "活动详情")
- * @ApiParams(name = "time", type = "string",required=false,description = "活动开始结束时间 Y/m/d H:M:S-Y/m/d H:M:S ")
- * @ApiParams(name = "sign_time", type = "string",required=false,description = "活动報名开始结束时间 Y/m/d H:M:S-Y/m/d H:M:S ")
- * @ApiParams(name = "price", type = "string",required=false,description = "活动參考价格")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiReturn({
- *
- *})
- */
- public function edit(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params = [];
- $id = $this->request->post('id/d', 0);
- $params["status"] = $this->request->post('status/s', 0); //上架状态:1=上架,2=下架,3=平台下架
- $params["title"] = $this->request->post('title/s', ''); //老师id
- $params["headimage"] = $this->request->post('headimage/s', ''); //老师id
- $params["images"] = $this->request->post('images/s', ''); //老师id
- $params["type"] = $this->request->post('type/s', ''); //老师id
- $params["item_json"] = $this->request->post('item_json/s', ''); //老师id
-
- $params["address_type"] = $this->request->post('address_type/s', ''); //老师id
- $params["province"] = $this->request->post('province/d', 0); //老师id
- $params["city"] = $this->request->post('city/d', 0); //老师id
- $params["district"] = $this->request->post('district/d', 0); //老师id
- $params["address"] = $this->request->post('address/s', ''); //老师id
- $params["address_detail"] = $this->request->post('address_detail/s', ''); //老师id
- $params["longitude"] = $this->request->post('longitude/s', 0); //老师id
- $params["latitude"] = $this->request->post('latitude/s', 0); //老师id
- $params["content"] = $this->request->post('content/s', ''); //老师id
- $params["time"] = $this->request->post('time/s', ''); //老师id
- $params["sign_time"] = $this->request->post('sign_time/s', ''); //老师id
- $params["price"] = $this->request->post('price/f', 0); //老师id
- $params["selfhot"] = $this->request->post('selfhot/s', ''); //老师id
-
-
- //classes_type
-
- try{
- $res = $this->model->updateActivityByOper($params,$id,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('编辑成功', $res);
- }
-
-
-
-
- /**
- * @ApiTitle(审核活动编辑)
- * @ApiSummary(审核活动编辑)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "string",required=true,description = "审核活动id")
- * @ApiParams(name = "status", type = "string",required=true,description = "上架状态:1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "title", type = "string",required=true,description = "活动标题")
- * @ApiParams(name = "headimage", type = "string",required=true,description = "活动头图")
- * @ApiParams(name = "images", type = "string",required=true,description = "活动轮播图多值逗号拼接")
- * @ApiParams(name = "type", type = "string",required=true,description = "地点类型:out=户外,in=室内")
- * @ApiParams(name = "item_json", type = "string",required=true,description = "活动多规格:[{'id':17,'classes_activity_id':10,'name':'xxxxx','price':'0.00','age':'18-60','sex':'3','limit_num':30,'status':'1','weigh':1}] ")
- * @ApiParams(name = "address_type", type = "string",required=true,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "address", type = "string",required=false,description = "地图定位地址")
- * @ApiParams(name = "address_detail", type = "string",required=false,description = "手录详细地址")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "经度")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "纬度")
- * @ApiParams(name = "content", type = "string",required=false,description = "活动详情")
- * @ApiParams(name = "time", type = "string",required=false,description = "活动开始结束时间 Y/m/d H:M:S-Y/m/d H:M:S ")
- * @ApiParams(name = "sign_time", type = "string",required=false,description = "活动報名开始结束时间 Y/m/d H:M:S-Y/m/d H:M:S ")
- * @ApiParams(name = "price", type = "string",required=false,description = "活动參考价格")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiReturn({
- *
- *})
- */
- public function authedit(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params = [];
- $id = $this->request->post('id/d', 0);
- $params["status"] = $this->request->post('status/s', 0); //上架状态:1=上架,2=下架,3=平台下架
- $params["title"] = $this->request->post('title/s', ''); //老师id
- $params["headimage"] = $this->request->post('headimage/s', ''); //老师id
- $params["images"] = $this->request->post('images/s', ''); //老师id
- $params["type"] = $this->request->post('type/s', ''); //老师id
- $params["item_json"] = $this->request->post('item_json/s', ''); //老师id
-
- $params["address_type"] = $this->request->post('address_type/s', ''); //老师id
- $params["province"] = $this->request->post('province/d', 0); //老师id
- $params["city"] = $this->request->post('city/d', 0); //老师id
- $params["district"] = $this->request->post('district/d', 0); //老师id
- $params["address"] = $this->request->post('address/s', ''); //老师id
- $params["address_detail"] = $this->request->post('address_detail/s', ''); //老师id
- $params["longitude"] = $this->request->post('longitude/s', 0); //老师id
- $params["latitude"] = $this->request->post('latitude/s', 0); //老师id
- $params["content"] = $this->request->post('content/s', ''); //老师id
- $params["time"] = $this->request->post('time/s', ''); //老师id
- $params["sign_time"] = $this->request->post('sign_time/s', ''); //老师id
- $params["price"] = $this->request->post('price/f', 0); //老师id
- $params["selfhot"] = $this->request->post('selfhot/s', ''); //老师id
-
-
- //classes_type
-
- try{
- $res = $this->auth_model->updateActivityAuthByOper($params,$id,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('编辑成功', $res);
- }
-
-
-
-
-
- /**
- * @ApiTitle(活动批量删除)
- * @ApiSummary(活动批量删除)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "string",required=true,description = "需要删除的一组活动id,多值逗号拼接")
- * @ApiReturn({
- *
- *})
- */
- public function del(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $ids = $this->request->post('ids/s', '');
-
- try{
- $res = $this->model->deleteActivityByOper($ids,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess("成功删除{$res}条数据",["delete_number"=>$res]);
- }
-
-
-
-
- /**
- * @ApiTitle(审核活动批量删除)
- * @ApiSummary(审核活动批量删除)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "string",required=true,description = "需要删除的一组审核活动id,多值逗号拼接")
- * @ApiReturn({
- *
- *})
- */
- public function authdel(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $ids = $this->request->post('ids/s', '');
-
- try{
- $res = $this->auth_model->deleteActivityAuthByOper($ids,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess("成功删除{$res}条数据",["delete_number"=>$res]);
- }
-
-
-
-
- /**
- * @ApiTitle(活动更改状态)
- * @ApiSummary(活动更改状态)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "string",required=true,description = "需要更改状态的活动id")
- * @ApiParams(name = "status", type = "string",required=true,description = "需要更改状态:1=上架,2=下架")
- * @ApiReturn({
- *
- *})
- */
- public function update_status(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $id = $this->request->post('id/s', '');
- $status = $this->request->post('status/s', '');
- try{
- $res = $this->model->updateStatusByOper($status,$id,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess("状态更改成功",["self"=>$res]);
- }
-
-
-
- /**
- * @ApiTitle(活动详情接口)
- * @ApiSummary(活动详情接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "活动id")
- * @ApiReturn({
-
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
-// if($user)$user_id = $user['id'];
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model->detail($id,$user_id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
- /**
- * @ApiTitle(审核活动详情接口)
- * @ApiSummary(审核活动详情接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "审核活动id")
- * @ApiReturn({
-
- *
- *})
- */
- public function authdetail(){
- $id = $this->request->get('id/d','');
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
-// if($user)$user_id = $user['id'];
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->auth_model->detail($id,$user_id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
- /**
- * @ApiTitle(活动规格)
- * @ApiSummary(活动规格)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "活动id")
- * @ApiReturn({ })
- */
- public function spec(){
- $id = $this->request->get('id/d','');
- $user = $this->auth->getUser();//登录用户
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
-
-
- $res = $this->model->spec($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['spec'=>$res]);
- }
-
-
-
- /**
- * @ApiTitle(审核活动规格)
- * @ApiSummary(审核活动规格)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "审核活动id")
- * @ApiReturn({ })
- */
- public function authspec(){
- $id = $this->request->get('id/d','');
- $user = $this->auth->getUser();//登录用户
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
-
-
- $res = $this->auth_model->spec($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['spec'=>$res]);
- }
-
-
-
-
- /**
- * @ApiTitle( 通用活动大索索列表)
- * @ApiSummary(通用活动大索索列表)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "start_time", type = "int",required=false,description = "开始时间10位秒级时间戳")
- * @ApiParams(name = "end_time", type = "int",required=false,description = "结束时间10位秒级时间戳")
- * @ApiParams(name = "sign_start_time", type = "int",required=false,description = "报名开始时间10位秒级时间戳")
- * @ApiParams(name = "sign_end_time", type = "int",required=false,description = "报名结束时间10位秒级时间戳")
- * @ApiParams(name = "has_shop", type = "int",required=false,description = "是否查机构")
- * @ApiParams(name = "is_expire", type = "int",required=false,description = "是否查过期:1只查过期,2只查不过期,0全查")
- * @ApiParams(name = "is_sign_expire", type = "int",required=false,description = "是否查报名过期:1只查过期,2只查不过期,0全查")
- * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
- * @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索")
- * @ApiParams(name = "address_type", type = "string",required=false,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 状态: 1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "recommend", type = "string",required=false,description = "平台推荐:0=否,1=是")
- * @ApiParams(name = "hot", type = "string",required=false,description = "平台热门:0=否,1=是")
- * @ApiParams(name = "new", type = "string",required=false,description = "平台最新:0=否,1=是")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiParams(name = "feel", type = "string",required=false,description = "是否免费:0=否,1=是")
- * @ApiParams(name = "collect", type = "int",required=false,description = "是否专查我的收藏(需登录):1=是")
- * @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序推薦優先,distance=距离优先,hot=熱門优先,new=平台最新优先,selfhot=机构热门优先,sale=銷量优先,views=浏览量优先,collect=收藏量优先")
- * @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
- * @ApiReturn({
- *
- *})
- */
- public function activity_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
- $params =[];
- $params["my_user_id"] = $user_id;
- $params["collect"] = $this->request->get('collect/d', 0); //页数
- $params["page"] = $this->request->get('page/d', 1); //页数
- $params["limit"] = $this->request->get('limit/d', 10); //条数
- $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
- $params["shop_id"] = $this->auth->shop_id; //机构店铺id
-
- $params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id
-
- $params["address_type"] = $this->request->get('address_type/s', ''); //机构店铺id
- $params["province"] = $this->request->get('province/s', ''); //机构店铺id
-
- $params["classes_type"] = $this->request->get('classes_type/s', ''); //机构店铺id
-
- $params["city"] = $this->request->get('city/s', ''); //机构店铺id
- $params["district"] = $this->request->get('district/s', ''); //机构店铺id
- $params["status"] = $this->request->get('status/s', '-2'); //机构店铺id
- $params["recommend"] = $this->request->get('recommend/s', ''); //机构店铺id
- $params["hot"] = $this->request->get('hot/s', ''); //机构店铺id
- $params["new"] = $this->request->get('new/s', ''); //机构店铺id
- $params["selfhot"] = $this->request->get('selfhot/s', ''); //机构店铺id
- $params["feel"] = $this->request->get('feel/s', ''); //机构店铺id
-
- $params["is_expire"] = $this->request->get('is_expire/d', 0); //机构店铺id
- $params["is_sign_expire"] = $this->request->get('is_sign_expire/d', 0); //机构店铺id
-
-
- $params["order"] = $this->request->get('order/s', ''); //机构店铺id
- $params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id
- $params["has_shop"] = $this->request->get('has_shop/d', ''); //主讲师用户id
-
- $params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id
- $params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id
-
-
- $params["sign_start_time"] = $this->request->get('sign_start_time/d', ''); //主讲师用户id
- $params["sign_end_time"] = $this->request->get('sign_end_time/d', ''); //机构店铺id
-
- $params["start_time"] = $this->request->get('start_time/d', ''); //主讲师用户id
- $params["end_time"] = $this->request->get('end_time/d', ''); //机构店铺id
-
-// $params["auth_status"] = $this->request->get('auth_status/d', '-2'); //机构店铺id
-
-
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = ActivityModel::getVaildList($params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', ["list"=>$res]);
- }
-
-
-
-
- /**
- * @ApiTitle( 审核活动大索索列表)
- * @ApiSummary(审核活动大索索列表)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "start_time", type = "int",required=false,description = "开始时间10位秒级时间戳")
- * @ApiParams(name = "end_time", type = "int",required=false,description = "结束时间10位秒级时间戳")
- * @ApiParams(name = "sign_start_time", type = "int",required=false,description = "报名开始时间10位秒级时间戳")
- * @ApiParams(name = "sign_end_time", type = "int",required=false,description = "报名结束时间10位秒级时间戳")
- * @ApiParams(name = "has_shop", type = "int",required=false,description = "是否查机构")
- * @ApiParams(name = "is_expire", type = "int",required=false,description = "是否查过期:1只查过期,2只查不过期,0全查")
- * @ApiParams(name = "is_sign_expire", type = "int",required=false,description = "是否查报名过期:1只查过期,2只查不过期,0全查")
- * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
- * @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索")
- * @ApiParams(name = "address_type", type = "string",required=false,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 状态: 1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "recommend", type = "string",required=false,description = "平台推荐:0=否,1=是")
- * @ApiParams(name = "hot", type = "string",required=false,description = "平台热门:0=否,1=是")
- * @ApiParams(name = "new", type = "string",required=false,description = "平台最新:0=否,1=是")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiParams(name = "feel", type = "string",required=false,description = "是否免费:0=否,1=是")
- * @ApiParams(name = "collect", type = "int",required=false,description = "是否专查我的收藏(需登录):1=是")
- * @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序推薦優先,distance=距离优先,hot=熱門优先,new=平台最新优先,selfhot=机构热门优先,sale=銷量优先,views=浏览量优先,collect=收藏量优先")
- * @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
- * @ApiReturn({
- *
- *})
- */
- public function auth_activity_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
- $params =[];
- $params["my_user_id"] = $user_id;
- $params["collect"] = $this->request->get('collect/d', 0); //页数
- $params["page"] = $this->request->get('page/d', 1); //页数
- $params["limit"] = $this->request->get('limit/d', 10); //条数
- $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
- $params["shop_id"] = $this->auth->shop_id; //机构店铺id
-
- $params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id
-
- $params["address_type"] = $this->request->get('address_type/s', ''); //机构店铺id
- $params["province"] = $this->request->get('province/s', ''); //机构店铺id
-
- $params["classes_type"] = $this->request->get('classes_type/s', ''); //机构店铺id
-
- $params["city"] = $this->request->get('city/s', ''); //机构店铺id
- $params["district"] = $this->request->get('district/s', ''); //机构店铺id
- $params["status"] = $this->request->get('status/s', '-2'); //机构店铺id
- $params["recommend"] = $this->request->get('recommend/s', ''); //机构店铺id
- $params["hot"] = $this->request->get('hot/s', ''); //机构店铺id
- $params["new"] = $this->request->get('new/s', ''); //机构店铺id
- $params["selfhot"] = $this->request->get('selfhot/s', ''); //机构店铺id
- $params["feel"] = $this->request->get('feel/s', ''); //机构店铺id
-
- $params["is_expire"] = $this->request->get('is_expire/d', 0); //机构店铺id
- $params["is_sign_expire"] = $this->request->get('is_sign_expire/d', 0); //机构店铺id
-
-
- $params["order"] = $this->request->get('order/s', ''); //机构店铺id
- $params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id
- $params["has_shop"] = $this->request->get('has_shop/d', ''); //主讲师用户id
-
- $params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id
- $params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id
-
-
- $params["sign_start_time"] = $this->request->get('sign_start_time/d', ''); //主讲师用户id
- $params["sign_end_time"] = $this->request->get('sign_end_time/d', ''); //机构店铺id
-
- $params["start_time"] = $this->request->get('start_time/d', ''); //主讲师用户id
- $params["end_time"] = $this->request->get('end_time/d', ''); //机构店铺id
-
-// $params["auth_status"] = $this->request->get('auth_status/d', '-2'); //机构店铺id
-
-
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = ActivityAuthModel::getVaildList($params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', ["list"=>$res]);
- }
-
-
-
-}
\ No newline at end of file
diff --git a/application/manystoreapi/controller/ActivityOrder.php b/application/manystoreapi/controller/ActivityOrder.php
deleted file mode 100644
index 7bed557..0000000
--- a/application/manystoreapi/controller/ActivityOrder.php
+++ /dev/null
@@ -1,296 +0,0 @@
-model = new OrderModel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- $this->setUrlLock();
- // 判断员工权限
- $this->check_worker_auth();
- }
-
-
-
- /**
- * @ApiTitle( 订单详情)
- * @ApiSummary(订单详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "订单id或订单号")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->error(__('缺少必要参数'));
- }
-
- try {
- $res = OrderModel::getDetail($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-
- /**
- * @ApiTitle( 课程活动订单列表接口)
- * @ApiSummary(课程活动订单列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,2=已报名待审核,3=已预约,4=售后中,6=已退款,9=已完成")
- * @ApiParams(name = "auth_status", type = "string",required=false,description = "审核状态:0=待审核,1=审核通过,2=审核失败")
- * @ApiParams(name = "classes_activity_id", type = "int",required=false,description = "课程活动id")
- * @ApiReturn({
- *
- *})
- */
- public function order_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $auth_status = $this->request->get('auth_status/s', ''); //搜索关键字
- $classes_activity_id = $this->request->get('classes_activity_id/s', ''); //搜索关键字
-
- $has_evaluate = $this->request->get('has_evaluate/d', 0); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
- $params = [
- "shop_id"=>$this->auth->shop_id,
- ];
- try{
- //当前申请状态
- $res = $this->model::allList($user_id,$page, $limit,$keywords,$status,$classes_activity_id,$has_evaluate,$auth_status,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
- /**
- * @ApiTitle( 课程活动订单数量接口)
- * @ApiSummary(返回订单各个数量)
- * @ApiMethod(GET)
- * @ApiParams(name = "classes_activity_id", type = "int",required=false,description = "课程活动id(非必填)")
- * @ApiReturn({
- *
- *})
- */
- public function order_count(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $classes_activity_id = $this->request->get('classes_activity_id/s', ''); //搜索关键字
- $params = [
- "shop_id"=>$this->auth->shop_id,
- ];
-
- try{
- $res = $this->model::orderCount($user_id,$classes_activity_id,$params);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
- /**
- * @ApiTitle(活动单取消接口)
- * @ApiSummary(活动单取消接口(已完成的单无法取消))
- * @ApiMethod(POST)
- * @ApiParams(name = "order_no", type = "string",required=true,description = "订单号")
- * @ApiReturn({
- *
- *})
- */
- public function cancel(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $order_no = $this->request->post('order_no/s', ''); //订单号
- try{
- //当前申请状态
- $res = $this->model->cancel($order_no,0,true,'shop',$this->auth->id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('活动取消成功', $res);
- }
-
-
-
-
- /**
- * @ApiTitle(预约审核)
- * @ApiSummary(预约审核)
- * @ApiMethod(POST)
- * @ApiParams(name = "auth_status", type = "string",required=true,description = "审核状态:0=待审核,1=审核通过,2=审核失败")
- * @ApiParams(name = "reason", type = "string",required=true,description = "审核不通过原因")
- * @ApiParams(name = "id", type = "string",required=true,description = "订单id")
- * @ApiReturn({
- *
- *})
- */
- public function examine(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $id = $this->request->post('id/s', ''); //订单号
- $reason = $this->request->post('reason/s', ''); //订单号
- $auth_status = $this->request->post('auth_status/s', ''); //订单号
- try{
- //当前申请状态
- $res = $this->model->examine($id,$auth_status,$reason,0,true,'shop',$this->auth->id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('预约审核完成', $res);
- }
-
-
-
- /**
- * @ApiTitle(活动单后台核销接口)
- * @ApiSummary(活动单后台核销接口)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "string",required=true,description = "订单id")
- * @ApiReturn({
- *
- *})
- */
- public function verification(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $ids = $this->request->post('ids/s', ''); //订单号
- try{
- //当前申请状态
- $res = $this->model->verification($ids,0,true,'shop',$this->auth->id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('活动核销成功', $res);
- }
-
-
-
- /**
- * @ApiTitle(活动单退款重试)
- * @ApiSummary(活动单退款重试)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "string",required=true,description = "订单id")
- * @ApiReturn({
- *
- *})
- */
- public function refund(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $ids = $this->request->post('ids/s', ''); //订单号
- try{
- //当前申请状态
- $res = $this->model->orderRefund($ids,null,'shop',$this->auth->id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('已重新发起退款,如果是第三方支付请等待回调!', $res);
- }
-
-
-
-
-
-
-
- /**
- * @ApiTitle( 订单日志接口)
- * @ApiSummary(订单日志接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,2=已报名待审核,3=已预约,4=售后中,5=退款结算中,6=已退款,9=已完成")
- * @ApiParams(name = "classes_activity_order_id", type = "int",required=false,description = "课程活动订单id")
- * @ApiReturn({
- *
- *})
- */
- public function log_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $params=[
-// "shop_id"=>$this->auth->shop_id,
- ];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $classes_activity_order_id = $this->request->get('classes_activity_order_id/s', ''); //搜索关键字
-
- $params["keywords"] = $keywords;
- $params["status"] = $status;
- $params["classes_activity_order_id"] = $classes_activity_order_id;
- if(empty($classes_activity_order_id)) $this->apierror( __('课程活动订单id必传'));
-
- try{
- //当前申请状态
- $res = \app\common\model\school\classes\activity\order\OrderLog::allList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-}
\ No newline at end of file
diff --git a/application/manystoreapi/controller/ClassesLib.php b/application/manystoreapi/controller/ClassesLib.php
deleted file mode 100644
index 5ec64db..0000000
--- a/application/manystoreapi/controller/ClassesLib.php
+++ /dev/null
@@ -1,631 +0,0 @@
-model = new ClassesLibModel;
- parent::_initialize();
-
-// //判断登录用户是否是员工
-// $this->setUrlLock();
- // 判断员工权限
- $this->check_worker_auth();
- }
-
-
-
-
-
- /**
- *
- * @ApiTitle( 课程跳转链接)
- * @ApiSummary(课程跳转链接)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "课程id")
- * @ApiReturn({
- *
- *})
- */
- public function url($ids = ''){
- $param = $this->request->param();
- if($this->request->isPost()){
- try{
- if(isset($param['ids']))$ids = $param['id'];
- //设置模拟资格
- $url = \app\common\model\school\classes\ClassesLib::getPath($ids);
-
- }catch (\Exception $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess($url);
- }
- }
-
-
-
-
- /**
- *
- * @ApiTitle( 课程微信小程序码)
- * @ApiSummary(课程微信小程序码)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "课程id")
- * @ApiReturn({
- *
- *})
- */
- public function miniqrcode($ids = ''){
- $param = $this->request->param();
- try{
- if(isset($param['ids']))$ids = $param['id'];
- //设置模拟资格
- $url = \app\common\model\school\classes\ClassesLib::getMiniQrcodeLink($ids);
-
- }catch (\Exception $e){
- $this->apierror($e->getMessage());
- }
-
- return $url["response"];
- }
-
-
-
-
-
-
- /**
- * @ApiTitle(员工课程添加)
- * @ApiSummary(员工课程添加)
- * @ApiMethod(POST)
- * @ApiParams(name = "classes_num", type = "int",required=true,description = "核销次数")
- * @ApiParams(name = "status", type = "string",required=true,description = "上架状态:1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "teacher_id", type = "int",required=true,description = "老师id")
- * @ApiParams(name = "classes_type", type = "string",required=true,description = "课程类型")
- * @ApiParams(name = "classes_cate_ids", type = "string",required=true,description = "课程标签ids 多值逗号拼接")
- * @ApiParams(name = "classes_label_ids", type = "string",required=true,description = "课程热门标签")
- * @ApiParams(name = "self_label_tag", type = "string",required=true,description = "机构热门标签:多值逗号拼接")
- * @ApiParams(name = "title", type = "string",required=true,description = "课程标题")
- * @ApiParams(name = "headimage", type = "string",required=true,description = "课程头图")
- * @ApiParams(name = "images", type = "string",required=true,description = "课程轮播图多值逗号拼接")
- * @ApiParams(name = "type", type = "string",required=true,description = "地点类型:out=户外,in=室内")
- * @ApiParams(name = "spec", type = "string",required=true,description = "课时多规格:[{'id':665,'classes_lib_id':570,'name':'xxxxx','limit_num':100,'status':'1','weigh':665,'time':'2024\/12\/12 19:00 - 2024\/12\/12 20:00'}] ")
- * @ApiParams(name = "address_type", type = "string",required=true,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "address", type = "string",required=false,description = "地图定位地址")
- * @ApiParams(name = "address_detail", type = "string",required=false,description = "手录详细地址")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "经度")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "纬度")
- * @ApiParams(name = "content", type = "string",required=false,description = "课程详情")
- * @ApiParams(name = "notice", type = "string",required=false,description = "课程须知")
- * @ApiParams(name = "price", type = "string",required=false,description = "课程价格 0为免费")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiReturn({
- *
- *})
- */
- public function add(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params = [];
- $params["status"] = $this->request->post('status/s', 0); //上架状态:1=上架,2=下架,3=平台下架
- $params["teacher_id"] = $this->request->post('teacher_id/d', 0); //老师id
- $params["classes_type"] = $this->request->post('classes_type/s', ''); //老师id
- $params["classes_cate_ids"] = $this->request->post('classes_cate_ids/s', ''); //课程标签
- $params["classes_label_ids"] = $this->request->post('classes_label_ids/s', ''); //课程热门标签
- $params["self_label_tag"] = $this->request->post('self_label_tag/s', ''); //老师id
- $params["title"] = $this->request->post('title/s', ''); //老师id
- $params["headimage"] = $this->request->post('headimage/s', ''); //老师id
- $params["images"] = $this->request->post('images/s', ''); //老师id
- $params["type"] = $this->request->post('type/s', ''); //老师id
- $params["spec"] = $this->request->post('spec/s', ''); //老师id
- $params["classes_num"] = $this->request->post('classes_num/d', 0); //核销次数
- //
- $params["address_type"] = $this->request->post('address_type/s', ''); //老师id
- $params["province"] = $this->request->post('province/d', 0); //老师id
- $params["city"] = $this->request->post('city/d', 0); //老师id
- $params["district"] = $this->request->post('district/d', 0); //老师id
- $params["address"] = $this->request->post('address/s', ''); //老师id
- $params["address_detail"] = $this->request->post('address_detail/s', ''); //老师id
- $params["longitude"] = $this->request->post('longitude/s', 0); //老师id
- $params["latitude"] = $this->request->post('latitude/s', 0); //老师id
- $params["content"] = $this->request->post('content/s', ''); //老师id
- $params["notice"] = $this->request->post('notice/s', ''); //老师id
- $params["price"] = $this->request->post('price/f', 0); //老师id
- $params["selfhot"] = $this->request->post('selfhot/s', ''); //老师id
-
-
- //classes_type
-
- try{
- $res = $this->model->createClassesByOper($params,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('添加成功', $res);
- }
-
-
-
-
-
-
- /**
- * @ApiTitle(员工课程编辑)
- * @ApiSummary(员工课程编辑)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "string",required=true,description = "课程id")
- * @ApiParams(name = "status", type = "string",required=true,description = "上架状态:1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "teacher_id", type = "int",required=true,description = "老师id")
- * @ApiParams(name = "classes_type", type = "string",required=true,description = "课程类型")
- * @ApiParams(name = "classes_cate_ids", type = "string",required=true,description = "课程标签ids 多值逗号拼接")
- * @ApiParams(name = "classes_label_ids", type = "string",required=true,description = "课程热门标签")
- * @ApiParams(name = "self_label_tag", type = "string",required=true,description = "机构热门标签:多值逗号拼接")
- * @ApiParams(name = "title", type = "string",required=true,description = "课程标题")
- * @ApiParams(name = "headimage", type = "string",required=true,description = "课程头图")
- * @ApiParams(name = "images", type = "string",required=true,description = "课程轮播图多值逗号拼接")
- * @ApiParams(name = "type", type = "string",required=true,description = "地点类型:out=户外,in=室内")
- * @ApiParams(name = "spec", type = "string",required=true,description = "课时多规格:[{'id':665,'classes_lib_id':570,'name':'xxxxx','limit_num':100,'status':'1','weigh':665,'time':'2024\/12\/12 19:00 - 2024\/12\/12 20:00'}] ")
- * @ApiParams(name = "address_type", type = "string",required=true,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "address", type = "string",required=false,description = "地图定位地址")
- * @ApiParams(name = "address_detail", type = "string",required=false,description = "手录详细地址")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "经度")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "纬度")
- * @ApiParams(name = "content", type = "string",required=false,description = "课程详情")
- * @ApiParams(name = "notice", type = "string",required=false,description = "课程须知")
- * @ApiParams(name = "price", type = "string",required=false,description = "课程价格 0为免费")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiReturn({
- *
- *})
- */
- public function edit(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params = [];
- $id = $this->request->post('id/d', 0);
- $params["status"] = $this->request->post('status/s', ''); //上架状态:1=上架,2=下架,3=平台下架
- $params["teacher_id"] = $this->request->post('teacher_id/d', 0); //老师id
- $params["classes_type"] = $this->request->post('classes_type/s', ''); //老师id
- $params["classes_cate_ids"] = $this->request->post('classes_cate_ids/s', ''); //课程标签
- $params["classes_label_ids"] = $this->request->post('classes_label_ids/s', ''); //课程热门标签
- $params["self_label_tag"] = $this->request->post('self_label_tag/s', ''); //老师id
- $params["title"] = $this->request->post('title/s', ''); //老师id
- $params["headimage"] = $this->request->post('headimage/s', ''); //老师id
- $params["images"] = $this->request->post('images/s', ''); //老师id
- $params["type"] = $this->request->post('type/s', ''); //老师id
- $params["spec"] = $this->request->post('spec/s', ''); //老师id
- $params["address_type"] = $this->request->post('address_type/s', ''); //老师id
- $params["province"] = $this->request->post('province/d', 0); //老师id
- $params["city"] = $this->request->post('city/d', 0); //老师id
- $params["district"] = $this->request->post('district/d', 0); //老师id
- $params["address"] = $this->request->post('address/s', ''); //老师id
- $params["address_detail"] = $this->request->post('address_detail/s', ''); //老师id
- $params["longitude"] = $this->request->post('longitude/s', 0); //老师id
- $params["latitude"] = $this->request->post('latitude/s', 0); //老师id
- $params["content"] = $this->request->post('content/s', ''); //老师id
- $params["notice"] = $this->request->post('notice/s', ''); //老师id
- $params["price"] = $this->request->post('price/f', 0); //老师id
- $params["selfhot"] = $this->request->post('selfhot/s', ''); //老师id
-
-
- //classes_type
-
- try{
- $res = $this->model->updateClassesByOper($params,$id,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('编辑成功', $res);
- }
-
-
-
-
-
- /**
- * @ApiTitle(员工课程批量删除)
- * @ApiSummary(员工课程批量删除)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "string",required=true,description = "需要删除的一组课程id,多值逗号拼接")
- * @ApiReturn({
- *
- *})
- */
- public function del(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $ids = $this->request->post('ids/s', '');
-
- try{
- $res = $this->model->deleteClassesByOper($ids,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess("成功删除{$res}条数据",["delete_number"=>$res]);
- }
-
-
-
-
- /**
- * @ApiTitle(课程更改状态)
- * @ApiSummary(课程更改状态)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "string",required=true,description = "需要更改状态的课程id")
- * @ApiParams(name = "status", type = "string",required=true,description = "需要更改状态:1=上架,2=下架")
- * @ApiReturn({
- *
- *})
- */
- public function update_status(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $id = $this->request->post('id/s', '');
- $status = $this->request->post('status/s', '');
- try{
- $res = $this->model->updateStatusByOper($status,$id,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess("状态更改成功",["self"=>$res]);
- }
-
-
-
- /**
- * @ApiTitle(课程详情接口)
- * @ApiSummary(课程详情接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "课程id")
- * @ApiReturn({
-
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
-// if($user)$user_id = $user['id'];
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model->detail($id,$user_id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-
- /**
- * @ApiTitle(课程参与者和报名者)
- * @ApiSummary(课程参与者和报名者)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "课程id")
- * @ApiParams(name = "have_real", type = "int",required=true,description = "是否只查真實的 1是 0否")
- * @ApiReturn({ unpaid_user_data 参与中 paid_user_data 已报名 })
- */
- public function people(){
- $id = $this->request->get('id/d','');
- $have_real = $this->request->get('have_real/d','');
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
-// if($user)$user_id = $user['id'];
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model->virtualParticipants($id,$user_id,$have_real);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', $res);
- }
-
-
- /**
- * @ApiTitle(课程课时规格)
- * @ApiSummary(课程课时规格)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "课程id")
- * @ApiParams(name = "user_id", type = "int",required=true,description = "需要查询是否下单的用户id")
- * @ApiReturn({ spec 课时规格 })
- */
- public function spec(){
- $user_id = $this->request->get('user_id/d',0);
- $id = $this->request->get('id/d','');
- $user = $this->auth->getUser();//登录用户
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- //如果是员工端操作
- if($user_id && $id && $user){
- //判断是否有操作权限
- $classes_lib_ids = (new \app\common\model\school\classes\ClassesLib)->getClassesAuthIds($user['user_id']);
- //判断当前订单课程是否在此课程授权范围内
- if(!in_array($id,$classes_lib_ids)) throw new \Exception("该课程不在您的授权范围内,无法查看!");
-
- }
-
-
- if($user && !$user_id)$user_id = $user['id'];
-
-
- $res = $this->model->spec($id,$user_id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['spec'=>$res]);
- }
-
-
-
-
-
-
- /**
- * @ApiTitle( 课程分类列表)
- * @ApiSummary(课程分类列表)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "hot", type = "string",required=false,description = "状态搜索条件:-1=全部分类,0=非热门分类,1=热门分类")
- * @ApiReturn({
- *
- *})
- */
- public function cate_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $hot = $this->request->get('hot/s', '-1'); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = Cate::showList($page, $limit,$keywords,$hot);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->error($e->getMessage());
- }
- $this->success('查询成功', $res);
- }
-
-
-
- /**
- * @ApiTitle( 课程类型列表)
- * @ApiSummary(课程类型列表)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiReturn({
- *
- *})
- */
- public function type_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = Type::showList($page, $limit,$keywords);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
- /**
- * @ApiTitle( 课程标签列表)
- * @ApiSummary(课程标签列表)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiReturn({
- *
- *})
- */
- public function label_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = Label::showList($page, $limit,$keywords);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
-
-
-
- /**
- * @ApiTitle( 通用课程大索索列表)
- * @ApiSummary(通用课程大索索列表)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "start_time", type = "int",required=false,description = "开始时间10位秒级时间戳")
- * @ApiParams(name = "end_time", type = "int",required=false,description = "结束时间10位秒级时间戳")
- * @ApiParams(name = "has_shop", type = "int",required=false,description = "是否查机构")
- * @ApiParams(name = "is_expire", type = "int",required=false,description = "是否查过期:1只查过期,2只查不过期,0全查")
- * @ApiParams(name = "user_id", type = "int",required=false,description = "主讲师用户id")
- * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
- * @ApiParams(name = "teacher_id", type = "int",required=false,description = "老师id")
- * @ApiParams(name = "classes_cate_ids", type = "string",required=false,description = "平台课程分类ids")
- * @ApiParams(name = "classes_label_ids", type = "string",required=false,description = "平台课程热门标签ids")
- * @ApiParams(name = "self_label_tag", type = "string",required=false,description = "机构特色标签")
- * @ApiParams(name = "classes_type", type = "string",required=false,description = "平台课程类型")
- * @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索")
- * @ApiParams(name = "type", type = "string",required=false,description = "地点类型:out=户外,in=室内")
- * @ApiParams(name = "address_type", type = "string",required=false,description = "地址类型:1=按机构,2=独立位置")
- * @ApiParams(name = "province", type = "string",required=false,description = "省编号")
- * @ApiParams(name = "city", type = "string",required=false,description = "市编号")
- * @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
- * @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 状态: 1=上架,2=下架,3=平台下架")
- * @ApiParams(name = "recommend", type = "string",required=false,description = "平台推荐:0=否,1=是")
- * @ApiParams(name = "hot", type = "string",required=false,description = "平台热门:0=否,1=是")
- * @ApiParams(name = "new", type = "string",required=false,description = "平台最新:0=否,1=是")
- * @ApiParams(name = "selfhot", type = "string",required=false,description = "机构热门:0=否,1=是")
- * @ApiParams(name = "feel", type = "string",required=false,description = "是否免费:0=否,1=是")
- * @ApiParams(name = "collect", type = "int",required=false,description = "是否专查我的收藏(需登录):1=是")
- * @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序推薦優先,distance=距离优先,hot=熱門优先,new=平台最新优先,selfhot=机构热门优先,sale=銷量优先,views=浏览量优先,collect=收藏量优先")
- * @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
- * @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
- * @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
- * @ApiParams(name = "auth_status", type = "string",required=false,description = "审核状态:-1=不计入条件 ,0=待审核,1=审核通过,2=审核失败")
- * @ApiReturn({
- *
- *})
- */
- public function classes_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
- $params =[];
- $params["my_user_id"] = $user_id;
- $params["collect"] = $this->request->get('collect/d', 0); //页数
- $params["page"] = $this->request->get('page/d', 1); //页数
- $params["limit"] = $this->request->get('limit/d', 10); //条数
- $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
- $params["user_id"] = $this->request->get('user_id/d', ''); //主讲师用户id
- $params["shop_id"] = $this->request->get('shop_id/d', ''); //机构店铺id
- $params["teacher_id"] = $this->request->get('teacher_id/d', ''); //机构店铺id
- $params["classes_cate_ids"] = $this->request->get('classes_cate_ids/s', ''); //机构店铺id
- $params["classes_label_ids"] = $this->request->get('classes_label_ids/s', ''); //机构店铺id
- $params["self_label_tag"] = $this->request->get('self_label_tag/s', ''); //机构店铺id
- $params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id
- $params["type"] = $this->request->get('type/s', ''); //机构店铺id
- $params["address_type"] = $this->request->get('address_type/s', ''); //机构店铺id
- $params["province"] = $this->request->get('province/s', ''); //机构店铺id
-
- $params["classes_type"] = $this->request->get('classes_type/s', ''); //机构店铺id
-
- $params["city"] = $this->request->get('city/s', ''); //机构店铺id
- $params["district"] = $this->request->get('district/s', ''); //机构店铺id
- $params["status"] = $this->request->get('status/s', '-2'); //机构店铺id
- $params["recommend"] = $this->request->get('recommend/s', ''); //机构店铺id
- $params["hot"] = $this->request->get('hot/s', ''); //机构店铺id
- $params["new"] = $this->request->get('new/s', ''); //机构店铺id
- $params["selfhot"] = $this->request->get('selfhot/s', ''); //机构店铺id
- $params["feel"] = $this->request->get('feel/s', ''); //机构店铺id
-
- $params["is_expire"] = $this->request->get('is_expire/d', 0); //机构店铺id
-
-
- $params["order"] = $this->request->get('order/s', ''); //机构店铺id
- $params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id
- $params["has_shop"] = $this->request->get('has_shop/d', ''); //主讲师用户id
-
- $params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id
- $params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id
-
-
- $params["start_time"] = $this->request->get('start_time/d', ''); //主讲师用户id
- $params["end_time"] = $this->request->get('end_time/d', ''); //机构店铺id
- $params["auth_status"] = $this->request->get('auth_status/d', '-2'); //机构店铺id
-
-
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = \app\common\model\school\classes\ClassesLib::getVaildList($params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', ["list"=>$res]);
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/application/manystoreapi/controller/ClassesOrder.php b/application/manystoreapi/controller/ClassesOrder.php
deleted file mode 100644
index 0c56273..0000000
--- a/application/manystoreapi/controller/ClassesOrder.php
+++ /dev/null
@@ -1,278 +0,0 @@
-model = new OrderModel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- }
-
-
- /**
- * @ApiTitle( 订单详情)
- * @ApiSummary(订单详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "订单id或订单号")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = OrderModel::getDetail($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
- /**
- * @ApiTitle( 我的订单列表接口)
- * @ApiSummary(我的订单列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "状态搜索条件:-3=已取消,0=待支付,3=使用中,4=售后中,6=已退款,9=已完成")
- * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
- * @ApiParams(name = "has_evaluate", type = "int",required=false,description = "是否评价:默认0全部 ,1查已评价 2查未评价")
- * @ApiReturn({
- *
- *})
- */
- public function order_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params=[
- "shop_id"=>$this->auth->shop_id,
- ];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $classes_lib_id = $this->request->get('classes_lib_id/s', ''); //搜索关键字
-
- $has_evaluate = $this->request->get('has_evaluate/d', 0); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
- $params["keywords"] = $keywords;
- $params["status"] = $status;
- $params["classes_lib_id"] = $classes_lib_id;
- $params["has_evaluate"] = $has_evaluate;
-
- try{
- //当前申请状态
- $res = $this->model::allShopList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
- /**
- * @ApiTitle( 订单日志接口)
- * @ApiSummary(订单日志接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,0=待支付,3=使用中,4=售后中,6=已退款,9=已完成")
- * @ApiParams(name = "classes_order_id", type = "int",required=false,description = "课程订单id")
- * @ApiReturn({
- *
- *})
- */
- public function log_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $params=[
-// "shop_id"=>$this->auth->shop_id,
- ];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $classes_order_id = $this->request->get('classes_order_id/s', ''); //搜索关键字
-
- $params["keywords"] = $keywords;
- $params["status"] = $status;
- $params["classes_order_id"] = $classes_order_id;
- if(empty($classes_order_id)) $this->apierror( __('课程订单id必传'));
-
- try{
- //当前申请状态
- $res = \app\common\model\school\classes\order\OrderLog::allList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
- /**
- * @ApiTitle( 我的订单列表数量统计)
- * @ApiSummary(我的订单列表数量统计)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
- * @ApiParams(name = "has_evaluate", type = "int",required=false,description = "是否评价:默认0全部 ,1查已评价 2查未评价")
- * @ApiReturn({
- *
- *})
- */
- public function order_count()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params=[
- "shop_id"=>$this->auth->shop_id,
- ];
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
-// $status = $this->request->get('status/s', ''); //搜索关键字
- $classes_lib_id = $this->request->get('classes_lib_id/s', ''); //搜索关键字
-
- $has_evaluate = $this->request->get('has_evaluate/d', 0); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
- $params["keywords"] = $keywords;
-// $params["status"] = $status;
- $params["classes_lib_id"] = $classes_lib_id;
- $params["has_evaluate"] = $has_evaluate;
-
- try{
- //当前申请状态
- $res = $this->model::baseCount($params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
-
-
- /**
- * @ApiTitle( 课程订单取消)
- * @ApiSummary(课程订单取消)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "int",required=true,description = "课程订单id")
- * @ApiReturn({
- *
- *})
- */
- 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->apierror($e->getMessage());
- }
- $this->apisuccess('取消成功!');
- }
-
- }
-
-
-
- /**
- * @ApiTitle( 课程订单发起售后)
- * @ApiSummary(课程订单发起售后)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "int",required=true,description = "课程订单id")
- * @ApiParams(name = "reason", type = "int",required=true,description = "申请售后原因")
- * @ApiParams(name = "price", type = "int",required=true,description = "退款金额")
- * @ApiReturn({
- *
- *})
- */
- public function after_sales($ids = ""){
-
- if($this->request->isPost())
- {
- try{
- $params = $this->request->post();
- $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->apierror($e->getMessage());
- }
- $this->apisuccess("执行成功");
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/application/manystoreapi/controller/Evaluate.php b/application/manystoreapi/controller/Evaluate.php
deleted file mode 100644
index 1b41391..0000000
--- a/application/manystoreapi/controller/Evaluate.php
+++ /dev/null
@@ -1,118 +0,0 @@
-model = new EvaluateModel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- }
-
-
-
-
- /**
- * @ApiTitle( 评价列表接口)
- * @ApiSummary(评价列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "my", type = "string",required=false,description = "是否查我的评价(需登录)")
- * @ApiParams(name = "classes_lib_id", type = "string",required=false,description = "课程id")
- * @ApiParams(name = "classes_order_id", type = "string",required=false,description = "课程订单id")
- * @ApiParams(name = "teacher_id", type = "string",required=false,description = "老师id")
- * @ApiParams(name = "time", type = "string",required=false,description = "复合时间查询:today今天,week本周,month本月,year本年,yesterday昨天,last year上一年,last week上周,last month上個月,lately7最近7天 , lately30最近30天,按开始时间区间查传值格式:Y/m/d H:M:S-Y/m/d H:M:S")
- *
- * @ApiReturn({
- *
- *})
- */
- public function evaluate_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
-
- $params = [
- "shop_id"=>$this->auth->shop_id,
- ];
- $my = $this->request->get('my/d', 0); //我的评价
- if($my && $user_id){
- $params['user_id'] = $user_id;
- }
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
- $params["classes_lib_id"] = $this->request->get('classes_lib_id/d', ''); //搜索关键字
- $params["classes_order_id"] = $this->request->get('classes_order_id/d', ''); //搜索关键字
-// $params["shop_id"] = $this->request->get('shop_id/d', ''); //时间
- $params["teacher_id"] = $this->request->get('teacher_id/d', ''); //时间
- $params["time"] = $this->request->get('time/s', ''); //时间
-
- try{
- //当前申请状态
- $res = $this->model::evaluateList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
- /**
- * @ApiTitle( 评价详情)
- * @ApiSummary(评价详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "评价id")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->error(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model::detail($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-}
-
diff --git a/application/manystoreapi/controller/HourOrder.php b/application/manystoreapi/controller/HourOrder.php
deleted file mode 100644
index dda18da..0000000
--- a/application/manystoreapi/controller/HourOrder.php
+++ /dev/null
@@ -1,399 +0,0 @@
-model = new OrderModel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- $this->setUrlLock();
- // 判断员工权限
- $this->check_worker_auth();
- }
-
-
-
-
-
-
- /**
- * @ApiTitle( 机构代下预约单)
- * @ApiSummary(机构代下预约单)
- * @ApiMethod(POST)
- * @ApiParams(name = "classes_order_id", type = "int",required=true,description = "课程订单id")
- * @ApiParams(name = "classes_lib_spec_id", type = "int",required=false,description = "课时规格id")
- * @ApiReturn({
- *
- *})
- */
- public function add(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $classes_order_id = $this->request->post('classes_order_id/d', 0); //课程id
- $classes_lib_spec_id = $this->request->post('classes_lib_spec_id/d', 0); //课程id
-
-// $order_no = $this->request->post('order_no/s', ''); //订单号
-// $is_compute = $this->request->post('is_compute/d', 1); //是否重新计算并更新缓存
- try{
-
-
- //记录代下单人信息
- $param = [
- "type" =>'2',
- "help_user_id" =>$this->auth->id,
- "help_type" => 'shop',
- ];
- //确认订单
- $res = $this->model->confirm($this->auth->id,$classes_order_id,null, $classes_lib_spec_id,$param, true);
- $remark = "总后台管理员帮忙下课时预约";
- //创建订单
- $result = $this->model->cacheCreateOrder($res['order_no'], $this->auth->id,$remark, true);
-
-
- }catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('预约成功', $result);
- }
-
-
-
-
-
-
- /**
- * @ApiTitle( 机构代修改预约单预约课时)
- * @ApiSummary(机构代修改预约单预约课时)
- * @ApiMethod(POST)
- * @ApiParams(name = "id", type = "int",required=true,description = "预约id")
- * @ApiParams(name = "classes_lib_spec_id", type = "int",required=false,description = "课时规格id")
- * @ApiReturn({
- *
- *})
- */
- public function edit(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $id = $this->request->post('id/d', 0); //课程id
- $classes_lib_spec_id = $this->request->post('classes_lib_spec_id/d', 0); //课程id
-
-// $order_no = $this->request->post('order_no/s', ''); //订单号
-// $is_compute = $this->request->post('is_compute/d', 1); //是否重新计算并更新缓存
- try{
- $result = $this->model->updateClassesSpec($id,$classes_lib_spec_id,0,true,'shop',$this->auth->id,true);
- }catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('预约修改成功', $result);
- }
-
-
-
-
-
- /**
- * @ApiTitle( 机构代取消预约单)
- * @ApiSummary(机构代取消预约单)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "string",required=true,description = "预约id,多值逗号拼接")
- * @ApiReturn({
- *
- *})
- */
- public function cancel($ids = "")
- {
- if (!$this->request->isPost()) {
- $this->apierror(__("Invalid parameters"));
- }
- $ids = $ids ? $ids : $this->request->post("ids/s","");
- 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 = $this->model->cancel($v["id"],0,true,'shop',$this->auth->id,true);
-
- $count ++;
- }
-
- } catch (PDOException $e) {
-
- $this->apierror($e->getMessage());
- } catch (\Exception $e) {
-
- $this->apierror($e->getMessage());
- }
- if ($count) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were deleted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', 'ids'));
- }
-
-
-
-
-
- /**
- * @ApiTitle( 机构代操作:预约课时单审核接口)
- * @ApiSummary(预约课时单审核接口)
- * @ApiMethod(POST)
- * @ApiParams(name = "order_no", type = "string",required=true,description = "预约订单号")
- * @ApiParams(name = "auth_status", type = "int",required=true,description = "审核状态:1=审核通过,2=审核失败")
- * @ApiParams(name = "reason", type = "string",required=false,description = "审核失败理由")
- * @ApiReturn({
- *
- *})
- */
- public function examine(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $order_no = $this->request->post('order_no/s', ''); //订单号
- $auth_status = $this->request->post('auth_status/d', ''); //审核状态
- $reason = $this->request->post('reason/s', ''); //审核失败理由
- try{
- //当前申请状态
- $res = $this->model->examine($order_no,$auth_status,$reason,0,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('预约课时取消成功', $res);
- }
-
-
-
-
- /**
- * @ApiTitle( 机构代操作:预约课时单核销完成接口)
- * @ApiSummary(预约课时单核销完成接口)
- * @ApiMethod(POST)
- * @ApiParams(name = "order_no", type = "string",required=true,description = "预约订单号")
- * @ApiReturn({
- *
- *})
- */
- public function verification(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $order_no = $this->request->post('order_no/s', ''); //订单号
- try{
- //当前申请状态
- $res = $this->model->verification($order_no,0,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('预约课时核销成功', $res);
- }
-
-
-
-
-
-
-
-
-
- /**
- * @ApiTitle( 课时订单详情)
- * @ApiSummary(课时订单详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "订单id或订单号")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->error(__('缺少必要参数'));
- }
-
- try {
- $res = OrderModel::getDetail($id,$this->classes_lib_ids);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-
- /**
- * @ApiTitle( 课时订单列表接口)
- * @ApiSummary(课时订单列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "订单状态:-3=已取消,-1=已报名待审核,0=已预约,3=已完成")
- * @ApiParams(name = "classes_order_id", type = "string",required=false,description = "课程订单id")
- * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
- * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构shopid")
- * @ApiParams(name = "start_time", type = "string",required=false,description = "按开始时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
- * @ApiParams(name = "createtime", type = "string",required=false,description = "按创建时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
- * @ApiParams(name = "time", type = "string",required=false,description = "按开始和结束时间区间查(传值格式:Y/m/d H:M:S-Y/m/d H:M:S)")
- * @ApiReturn({
- *
- *})
- */
- public function order_list()
- {
-
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
-
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $classes_order_id = $this->request->get('classes_order_id/d', 0); //搜索关键字
- $classes_lib_ids = $this->request->get('classes_lib_id/s', 0); //搜索关键字
- $shop_id = $this->request->get('shop_id/d', 0); //搜索关键字
-
- $start_time = $this->request->get('start_time/s', ''); //搜索关键字
- $createtime = $this->request->get('createtime/s', ''); //搜索关键字
- $time = $this->request->get('time/s', ''); //搜索关键字
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-// var_dump($this->classes_lib_ids);die;
- try{
- //当前申请状态
- $res = $this->model::workList($page, $limit,$keywords,$status,$classes_order_id,0,$classes_lib_ids,$this->classes_lib_ids,$start_time,$createtime,$time,$shop_id);
-// var_dump($this->model->getLastSql());die;
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
- /**
- * @ApiTitle( 课时订单数量接口)
- * @ApiSummary(课时订单各个数量)
- * @ApiMethod(GET)
- * @ApiParams(name = "classes_order_id", type = "int",required=true,description = "课程订单id")
- * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
- * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构shopid")
- * @ApiReturn({
- *
- *})
- */
- public function order_count(){
-
-
- $classes_order_id = $this->request->get('classes_order_id/d', 0); //搜索关键字
- $classes_lib_ids = $this->request->get('classes_lib_id/s', 0); //搜索关键字
- $shop_id = $this->request->get('shop_id/d', 0); //搜索关键字
-
- try{
- $res = $this->model::workCount($classes_lib_ids,$this->classes_lib_ids,$classes_order_id,$shop_id);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
-
-
- /**
- * @ApiTitle( 预约订单记录列表接口)
- * @ApiSummary(预约订单记录列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "状态搜索条件:-3=已取消,-1=已报名待审核,0=已预约,3=已完成")
- * @ApiParams(name = "auth_status", type = "string",required=false,description = "审核状态:0=待审核,1=审核通过,2=审核失败")
- * @ApiParams(name = "classes_hour_order_id", type = "int",required=false,description = "课时预约订单id")
- * @ApiReturn({
- *
- *})
- */
- public function order_log_list()
- {
- $user_id = 0;
-// $user = $this->auth->getUser();//登录用户
-// if($user)$user_id = $user['user_id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $auth_status = $this->request->get('auth_status/s', ''); //搜索关键字
-
- $classes_hour_order_id = $this->request->get('classes_hour_order_id/s', ''); //搜索关键字
- if(!$classes_hour_order_id) $this->apierror('缺少课时预约订单id');
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = OrderLog::allList($user_id,$page, $limit,$keywords,$status,$auth_status,$classes_hour_order_id);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-}
\ No newline at end of file
diff --git a/application/manystoreapi/controller/ServiceOrder.php b/application/manystoreapi/controller/ServiceOrder.php
deleted file mode 100644
index 4c1d9e1..0000000
--- a/application/manystoreapi/controller/ServiceOrder.php
+++ /dev/null
@@ -1,218 +0,0 @@
-model = new OrderModel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- $this->setUrlLock();
- // 判断员工权限
- $this->check_worker_auth();
- }
-
-
- /**
- * @ApiTitle( 用户售后订单详情)
- * @ApiSummary(用户售后订单详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "售后订单id或售后订号")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model::getDetail($id,$this->classes_lib_ids);
- if(!$res)throw new \Exception('您无操作权限!',40003);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
- /**
- * @ApiTitle( 用户售后订单列表接口)
- * @ApiSummary(用户售后订单列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "状态搜索条件:售后状态:1=待处理,4=处理中,7=已结单,-3=已取消")
- * @ApiParams(name = "service_stauts", type = "string",required=false,description = "售后处理状态:1=待机构处理,4=待用户确认,7=售后通过结单中,10=售后结单完成,-3=售后驳回结单")
- * @ApiParams(name = "sales_type", type = "string",required=false,description = "结单类型:-3=未结单,1=机构驳回,4=用户驳回,7=平台驳回,10=成功退款")
- * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
- * @ApiParams(name = "classes_order_id", type = "int",required=false,description = "课程订单id")
- * @ApiParams(name = "classes_order_detail_id", type = "int",required=false,description = "订单课程id")
- * @ApiReturn({
- *
- *})
- */
- public function order_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $service_stauts = $this->request->get('service_stauts/s', ''); //搜索关键字
- $sales_type = $this->request->get('sales_type/s', ''); //搜索关键字
- $classes_order_id = $this->request->get('classes_order_id/s', ''); //搜索关键字
- $classes_order_detail_id = $this->request->get('classes_order_detail_id/s', ''); //搜索关键字
- $classes_lib_id = $this->request->get('classes_lib_id/s', ''); //搜索关键字
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = $this->model::workList($page, $limit,$keywords,$status,$service_stauts,$sales_type,$classes_order_id,$classes_order_detail_id,$classes_lib_id,$this->classes_lib_ids);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
- /**
- * @ApiTitle( 用户售后订单数量接口)
- * @ApiSummary(返回售后订单各个数量)
- * @ApiMethod(GET)
- * @ApiParams(name = "classes_lib_id", type = "int",required=false,description = "课程id")
- * @ApiParams(name = "classes_order_id", type = "int",required=false,description = "课程订单id")
- * @ApiReturn({
- *
- *})
- */
- public function order_count(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
-
- $classes_lib_id = $this->request->get('classes_lib_id/s', ''); //搜索关键字
- $classes_order_id = $this->request->get('classes_order_id/s', '');
- try{
- $res = $this->model::workCount($classes_order_id,$classes_lib_id,$this->classes_lib_ids);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
- /**
- * @ApiTitle( 售后订单记录列表接口)
- * @ApiSummary(售后订单记录列表接口)
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "状态搜索条件:售后状态:1=待处理,4=处理中,7=已结单,-3=已取消")
- * @ApiParams(name = "service_stauts", type = "string",required=false,description = "售后处理状态:1=待机构处理,4=待用户确认,7=售后通过结单中,10=售后结单完成,-3=售后驳回结单")
- * @ApiParams(name = "sales_type", type = "string",required=false,description = "结单类型:-3=未结单,1=机构驳回,4=用户驳回,7=平台驳回,10=成功退款")
- * @ApiParams(name = "classes_service_order_id", type = "int",required=false,description = "售后订单id")
- * @ApiReturn({
- *
- *})
- */
- public function order_log_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['user_id'];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $keywords = $this->request->get('keywords/s', ''); //搜索关键字
- $status = $this->request->get('status/s', ''); //搜索关键字
- $service_stauts = $this->request->get('service_stauts/s', ''); //搜索关键字
- $sales_type = $this->request->get('sales_type/s', ''); //搜索关键字
- $classes_service_order_id = $this->request->get('classes_service_order_id/s', ''); //搜索关键字
- if(!$classes_service_order_id) $this->apierror('售后订单id不能为空');
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = ServiceOrderLog::workList($page, $limit,$keywords,$status,$service_stauts,$sales_type,$classes_service_order_id,$this->classes_lib_ids);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
-
- /**
- * @ApiTitle( 机构处理售后接口)
- * @ApiSummary(机构处理售后接口)
- * @ApiMethod(POST)
- * @ApiParams(name = "order_no", type = "string",required=true,description = "售后订单id或售后订号")
- * @ApiParams(name = "status", type = "string",required=true,description = "yes=同意,no=驳回")
- * @ApiParams(name = "price", type = "string",required=false,description = "同意的售后金额")
- * @ApiParams(name = "reject_reason", type = "string",required=false,description = "驳回原因")
- * @ApiParams(name = "reject_images", type = "string",required=false,description = "(非必填)驳回图片说明:多图逗号拼接")
- * @ApiReturn({
- *
- *})
- */
- public function shop_confirmation(){
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $order_no = $this->request->post('order_no/s', ''); //订单号
- $status = $this->request->post('status/s', 0); //审核状态
- $price = $this->request->post('price/f', 0);
- $reject_reason = $this->request->post('reject_reason/s', '');
- $reject_images = $this->request->post('reject_images/s', '');
-
- try{
- //当前申请状态
- $res = $this->model->shopConfirmation($order_no,$status,$price,$reject_reason,$reject_images,0,true,'shop',$user_id,true);
- }catch (\Throwable $e){
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('调用成功', $res);
- }
-
-
-
-
-
-}
\ No newline at end of file
diff --git a/application/manystoreapi/controller/Teacher.php b/application/manystoreapi/controller/Teacher.php
deleted file mode 100644
index b77679c..0000000
--- a/application/manystoreapi/controller/Teacher.php
+++ /dev/null
@@ -1,414 +0,0 @@
-model = new Teachermodel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- }
-
-
- /**
- * @ApiTitle( 老师详情)
- * @ApiSummary(老师详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "老师id")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model->detail($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-
-
-
- /**
- * @ApiTitle( 老师或专家列表(取决于搜索条件))
- * @ApiSummary(老师或专家列表(取决于搜索条件))
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "查展示专家请传1,非专家也查请传0")
- * @ApiParams(name = "recommend", type = "string",required=false,description = "平台首页推荐:0=否,1=是")
- * @ApiParams(name = "shop_id", type = "string",required=false,description = "机构店铺id")
- * @ApiParams(name = "user_id", type = "string",required=false,description = "教师用户id")
- * @ApiReturn({
- *
- *})
- */
- public function teacher_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params=[
- "shop_id"=>$this->auth->shop_id,
- ];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $params['keywords'] = $this->request->get('keywords/s', ''); //搜索关键字
- $params['status'] = $this->request->get('status/s', ''); //搜索关键字
- $params['recommend'] = $this->request->get('recommend/s', ''); //搜索关键字
- $params['shop_id'] = $this->request->get('shop_id/d', ''); //搜索关键字
- $params['user_id'] = $this->request->get('user_id/d', ''); //搜索关键字
-
-
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = $this->model::allList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
- /**
- * @ApiTitle( 微信小程序码)
- * @ApiSummary(微信小程序码)
- * @ApiMethod(GET)
- * @ApiParams(name = "ids", type = "int",required=true,description = "老师id")
- * @ApiReturn({
- * 微信小程序码图片流
- *})
- */
- 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->apierror($e->getMessage());
- }
-
- return $url["response"];
- }
-
- 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->apierror("存在正在教授的课程无法继续操作!请将课程讲师更换成其他人或者删除该课程后再操作!");
-
-
- }
-
- /**
- * @ApiTitle( 老师删除)
- * @ApiSummary(老师删除)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "int",required=true,description = "老师id")
- * @ApiReturn({
- * 微信小程序码图片流
- *})
- */
- public function del($ids = "")
- {
- if (!$this->request->isPost()) {
- $this->apierror(__("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->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($count) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were deleted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', 'ids'));
- }
-
-
-
- protected function update_check(&$params,$row=null)
- {
-
- $shop_id = SHOP_ID;
- $manystore = Manystore::where("shop_id", $shop_id)->find();
- if (!$manystore) {
- $this->apierror("店铺不存在");
- }
- $params["manystore_id"] = $manystore["id"];
- $params["shop_id"] = $shop_id;
- $user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
- if(!$user) $this->apierror("未找到用户请先让用户登录小程序再提交表单");
-
-
- //添加用户机构认证
- 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->apierror("用户未授权当前机构!请先让用户授权同意您再操作!");
- }
-
-
-
- $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->apierror("用户已存在或已是其他授权机构教师!");
- }
- }else{
- //新增
- //用户已是教师(搜索)
- $teacher_user = $this->model->where("user_id",$user_id)->find();
- if($teacher_user){
- $this->apierror("用户已存在或已是其他授权机构教师!");
- }
- }
-
-
- }
-
-
-
- /**
- * @ApiTitle( 老师添加)
- * @ApiSummary(老师添加)
- * @ApiMethod(POST)
- * @ApiParams(name = "user_id", type = "int",required=true,description = "教师前台用户id")
- * @ApiParams(name = "name", type = "int",required=true,description = "教师名")
- * @ApiParams(name = "head_image", type = "int",required=true,description = "教师头像")
- * @ApiParams(name = "content", type = "int",required=true,description = "教师简介")
- * @ApiParams(name = "status", type = "int",required=true,description = "机构展示专家信息:1=上架,2=下架")
- * @ApiParams(name = "recommend", type = "int",required=true,description = "平台首页推荐:0=否,1=是")
- * @ApiParams(name = "expert_image", type = "int",required=true,description = "专家头像")
- * @ApiParams(name = "expert_content", type = "int",required=true,description = "专家介绍")
- * @ApiParams(name = "weigh", type = "int",required=true,description = "weigh")
- * @ApiReturn({
- *
- *})
- */
- public function add()
- {
- if ($this->request->isPost()) {
- $params = $this->request->post();
- if ($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->apierror($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->apierror($e->getMessage());
- } catch (PDOException $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($result !== false) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were inserted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', ''));
- }
- }
-
- /**
- * @ApiTitle( 老师编辑)
- * @ApiSummary(老师编辑)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "int",required=true,description = "教师id")
- * @ApiParams(name = "user_id", type = "int",required=true,description = "教师前台用户id")
- * @ApiParams(name = "name", type = "int",required=true,description = "教师名")
- * @ApiParams(name = "head_image", type = "int",required=true,description = "教师头像")
- * @ApiParams(name = "content", type = "int",required=true,description = "教师简介")
- * @ApiParams(name = "status", type = "int",required=true,description = "机构展示专家信息:1=上架,2=下架")
- * @ApiParams(name = "recommend", type = "int",required=true,description = "平台首页推荐:0=否,1=是")
- * @ApiParams(name = "expert_image", type = "int",required=true,description = "专家头像")
- * @ApiParams(name = "expert_content", type = "int",required=true,description = "专家介绍")
- * @ApiParams(name = "weigh", type = "int",required=true,description = "weigh")
- * @ApiReturn({
- *
- *})
- */
- public function edit($ids = null)
- {
- $ids = $ids ? $ids : $this->request->post("ids");
-
- if ($this->request->isPost()) {
- if($this->shopIdAutoCondition){
- $this->model->where(array('shop_id'=>SHOP_ID));
- }
- $row = $this->model->where(array('id'=>$ids))->find();
- if (!$row) {
- $this->apierror(__('No Results were found'));
- }
-
- $params = $this->request->post();
- if ($params) {
- $result = false;
- try {
- $this->update_check($params,$row);
- } catch (ValidateException|PDOException|Exception $e) {
- $this->apierror($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);
-
- $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();
- $this->apierror($e->getMessage());
- } catch (PDOException $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($result !== false) {
- $this->apisuccess("更新成功");
- } else {
- $this->apierror(__('No rows were updated'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', ''));
- }
- }
-
-
-
-
-}
-
diff --git a/application/manystoreapi/controller/UserAuth.php b/application/manystoreapi/controller/UserAuth.php
deleted file mode 100644
index 82501c6..0000000
--- a/application/manystoreapi/controller/UserAuth.php
+++ /dev/null
@@ -1,314 +0,0 @@
-model = new UserAuthmodel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- }
-
-
- /**
- * @ApiTitle( 认证详情)
- * @ApiSummary(认证详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "认证id")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model->detail($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-
-
-
- /**
- * @ApiTitle( 授权信息列表(取决于搜索条件))
- * @ApiSummary(授权信息列表(取决于搜索条件))
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "授权状态:1=通过,2=拒绝")
- * @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
- * @ApiReturn({
- *
- *})
- */
- public function auth_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params=[
- "shop_id"=>$this->auth->shop_id,
- ];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $params['status'] = $this->request->get('status/s', ''); //搜索关键字
- $params['shop_id'] = $this->request->get('shop_id/d', ''); //搜索关键字
- $params['user_id'] = $user_id; //搜索关键字
- $params['keywords'] = $this->request->get('keywords/s', ''); //搜索关键字
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = $this->model::allList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
-
-
- /**
- * @ApiTitle( 生成用户账号)
- * @ApiSummary(根据手机号和昵称生成用户账号)
- * @ApiMethod(POST)
- * @ApiParams(name = "people_name", type = "string",required=false,description = "姓名")
- * @ApiParams(name = "people_mobile", type = "string",required=true,description = "手机号")
- * @ApiReturn({
- *
- *})
- */
- 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->apierror($e->getMessage());
- }
- //退押金
- $this->apisuccess("已成功创建{$people_name}");
- }
-
- }
-
-
-
-
-
- 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->apierror("店铺不存在");
- }
-// $params["manystore_id"] = $manystore["id"];
- $params["shop_id"] = $shop_id;
- $user = User::where("nickname|realname|mobile", $params["user_id"])->find();
- if(!$user) $this->apierror("未找到用户请先让用户登录小程序再提交表单");
- $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->apierror("已向用户发起过授权申请!");
- }
- }else{
- //新增
- //用户已是教师(搜索)
- $teacher_user = $this->model->where("user_id",$user_id)->where("shop_id",$shop_id)->find();
- if($teacher_user){
- $this->apierror("已向用户发起过授权申请!");
- }
- }
-
-
- }
-
-
-
- /**
- * @ApiTitle( 添加认证)
- * @ApiSummary(添加认证)
- * @ApiMethod(POST)
- * @ApiParams(name = "user_id", type = "int",required=true,description = "认证用户id")
- * @ApiReturn({
- *
- *})
- */
- public function add()
- {
- if ($this->request->isPost()) {
- $params = $this->request->post();
- if ($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->apierror($e->getMessage());
- } catch (PDOException $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- } catch (\Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($result !== false) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were inserted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', ''));
- }
-
- }
-
-
- /**
- * @ApiTitle( 认证删除)
- * @ApiSummary(认证删除)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "int",required=true,description = "认证id")
- * @ApiReturn({
- * 微信小程序码图片流
- *})
- */
- public function del($ids = "")
- {
- if (!$this->request->isPost()) {
- $this->apierror(__("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->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($count) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were deleted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', 'ids'));
- }
-
-
-
-
-
-
-}
-
diff --git a/application/manystoreapi/controller/Verification.php b/application/manystoreapi/controller/Verification.php
deleted file mode 100644
index ae422bc..0000000
--- a/application/manystoreapi/controller/Verification.php
+++ /dev/null
@@ -1,360 +0,0 @@
-model = new Verificationmodel;
- parent::_initialize();
-
- //判断登录用户是否是员工
- }
-
-
- /**
- * @ApiTitle( 机构核销员详情)
- * @ApiSummary(机构核销员详情)
- * @ApiMethod(GET)
- * @ApiParams(name = "id", type = "int",required=true,description = "机构核销员id")
- * @ApiReturn({
- *
- *})
- */
- public function detail(){
- $id = $this->request->get('id/d','');
-
- if(empty($id)){
- $this->apierror(__('缺少必要参数'));
- }
-
- try {
- $res = $this->model->detail($id);
- } catch (\Exception $e){
-// Log::log($e->getMessage());
- $this->apierror($e->getMessage(),['errcode'=>$e->getCode()]);
- }
- $this->apisuccess('获取成功', ['detail' => $res]);
- }
-
-
-
-
-
-
-
- /**
- * @ApiTitle( 机构核销员列表(取决于搜索条件))
- * @ApiSummary(机构核销员列表(取决于搜索条件))
- * @ApiMethod(GET)
- * @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
- * @ApiParams(name = "page", type = "string",required=true,description = "页数")
- * @ApiParams(name = "limit", type = "string",required=true,description = "条数")
- * @ApiParams(name = "status", type = "string",required=false,description = "状态:1=开启,2=关闭")
- * @ApiParams(name = "shop_id", type = "string",required=false,description = "机构店铺id")
- * @ApiParams(name = "user_id", type = "string",required=false,description = "教师用户id")
- * @ApiReturn({
- *
- *})
- */
- public function verification_list()
- {
- $user_id = 0;
- $user = $this->auth->getUser();//登录用户
- if($user)$user_id = $user['id'];
- $params=[
- "shop_id"=>$this->auth->shop_id,
- ];
- $page = $this->request->get('page/d', 0); //页数
- $limit = $this->request->get('limit/d', 0); //条数
- $params['keywords'] = $this->request->get('keywords/s', ''); //搜索关键字
- $params['status'] = $this->request->get('status/s', ''); //搜索关键字
- $params['shop_id'] = $this->request->get('shop_id/d', ''); //搜索关键字
- $params['user_id'] = $this->request->get('user_id/d', ''); //搜索关键字
-
-
-
-// $type = $this->request->get('type/s', ''); //筛选学员和教练单
-
- try{
- //当前申请状态
- $res = $this->model::allList($page, $limit,$params);
-// if($user_id =='670153'){
-// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
-// }
- }catch (\Exception $e){
-
- $this->apierror($e->getMessage());
- }
- $this->apisuccess('查询成功', $res);
- }
-
-
-
- protected function updateCheck($id,$params=[],$row=null){
-
- }
-
- /**
- * @ApiTitle( 核销员删除)
- * @ApiSummary(核销员删除)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "int",required=true,description = "核销员id")
- * @ApiReturn({
- * 微信小程序码图片流
- *})
- */
- public function del($ids = "")
- {
- if (!$this->request->isPost()) {
- $this->apierror(__("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->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($count) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were deleted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', 'ids'));
- }
-
-
-
-
- protected function update_check(&$params,$row=null)
- {
-
- $shop_id = SHOP_ID;
- $manystore = Manystore::where("shop_id", $shop_id)->find();
- if (!$manystore) {
- $this->apierror("店铺不存在");
- }
- $params["manystore_id"] = $manystore["id"];
- $params["shop_id"] = $shop_id;
- $user = User::where("id|nickname|realname|mobile", $params["user_id"])->find();
- if(!$user) $this->apierror("未找到用户请先让用户登录小程序再提交表单".$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->apierror("用户未授权当前机构!请先让用户授权同意您再操作!");
- }
-
- $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->apierror("用户已存在或已是其他授权机构核销员!");
- }
- }else{
- //新增
- //用户已是教师(搜索)
- $teacher_user = $this->model->where("user_id",$user_id)->find();
- if($teacher_user){
- $this->apierror("用户已存在或已是其他授权机构核销员!");
- }
- }
-
-
- }
-
-
- /**
- * @ApiTitle( 核销员添加)
- * @ApiSummary(核销员添加)
- * @ApiMethod(POST)
- * @ApiParams(name = "user_id", type = "int",required=true,description = "核销员前台用户id")
- * @ApiParams(name = "status", type = "int",required=true,description = "状态:1=开启,2=关闭")
- * @ApiReturn({
- *
- *})
- */
- public function add()
- {
- if ($this->request->isPost()) {
- $params = $this->request->post();
- if ($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->apierror($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->apierror($e->getMessage());
- } catch (PDOException $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($result !== false) {
- $this->apisuccess();
- } else {
- $this->apierror(__('No rows were inserted'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', ''));
- }
- }
-
- /**
- * @ApiTitle( 核销员编辑)
- * @ApiSummary(核销员编辑)
- * @ApiMethod(POST)
- * @ApiParams(name = "ids", type = "int",required=true,description = "核销员id")
- * @ApiParams(name = "user_id", type = "int",required=true,description = "核销员前台用户id")
- * @ApiParams(name = "status", type = "int",required=true,description = "状态:1=开启,2=关闭")
- * @ApiReturn({
- *
- *})
- */
- public function edit($ids = null)
- {
- $ids = $ids ? $ids : $this->request->post("ids");
-
- if ($this->request->isPost()) {
- if($this->shopIdAutoCondition){
- $this->model->where(array('shop_id'=>SHOP_ID));
- }
- $row = $this->model->where(array('id'=>$ids))->find();
- if (!$row) {
- $this->apierror(__('No Results were found'));
- }
-
- $params = $this->request->post();
- if ($params) {
- $result = false;
- try {
- $this->update_check($params,$row);
- } catch (ValidateException|PDOException|Exception $e) {
- $this->apierror($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);
-
- $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();
- $this->apierror($e->getMessage());
- } catch (PDOException $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- } catch (Exception $e) {
- Db::rollback();
- $this->apierror($e->getMessage());
- }
- if ($result !== false) {
- $this->apisuccess("更新成功");
- } else {
- $this->apierror(__('No rows were updated'));
- }
- }
- $this->apierror(__('Parameter %s can not be empty', ''));
- }
- }
-
-
-
-
-}
-
diff --git a/public/assets/js/backend/school/sport_apply.js b/public/assets/js/backend/school/sport_apply.js
new file mode 100644
index 0000000..b6afcb7
--- /dev/null
+++ b/public/assets/js/backend/school/sport_apply.js
@@ -0,0 +1,124 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+ var Controller = {
+ index: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ index_url: 'school/sport_apply/index' + location.search,
+ add_url: 'school/sport_apply/add',
+ edit_url: 'school/sport_apply/edit',
+ del_url: 'school/sport_apply/del',
+ multi_url: 'school/sport_apply/multi',
+ import_url: 'school/sport_apply/import',
+ table: 'school_sport_apply',
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
+ pk: 'id',
+ sortName: 'id',
+ fixedColumns: true,
+ fixedRightNumber: 1,
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'user_id', title: __('User_id')},
+ {field: 'name', title: __('Name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'mobile', title: __('Mobile'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'enterprise_name', title: __('Enterprise_name'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'enterprise_addr', title: __('Enterprise_addr'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'outdoor_sport', title: __('Outdoor_sport'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
+ {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
+ {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
+ {field: 'user.avatar', title: __('User.avatar'), operate: 'LIKE', events: Table.api.events.image, formatter: Table.api.formatter.image},
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+ recyclebin: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ 'dragsort_url': ''
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: 'school/sport_apply/recyclebin' + location.search,
+ pk: 'id',
+ sortName: 'id',
+ columns: [
+ [
+ {checkbox: true},
+ {field: 'id', title: __('Id')},
+ {field: 'name', title: __('Name'), align: 'left'},
+ {
+ field: 'deletetime',
+ title: __('Deletetime'),
+ operate: 'RANGE',
+ addclass: 'datetimerange',
+ formatter: Table.api.formatter.datetime
+ },
+ {
+ field: 'operate',
+ width: '140px',
+ title: __('Operate'),
+ table: table,
+ events: Table.api.events.operate,
+ buttons: [
+ {
+ name: 'Restore',
+ text: __('Restore'),
+ classname: 'btn btn-xs btn-info btn-ajax btn-restoreit',
+ icon: 'fa fa-rotate-left',
+ url: 'school/sport_apply/restore',
+ refresh: true
+ },
+ {
+ name: 'Destroy',
+ text: __('Destroy'),
+ classname: 'btn btn-xs btn-danger btn-ajax btn-destroyit',
+ icon: 'fa fa-times',
+ url: 'school/sport_apply/destroy',
+ refresh: true
+ }
+ ],
+ formatter: Table.api.formatter.operate
+ }
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+
+ add: function () {
+ Controller.api.bindevent();
+ },
+ edit: function () {
+ Controller.api.bindevent();
+ },
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ }
+ }
+ };
+ return Controller;
+});