Compare commits
2 Commits
13404abe30
...
466b57196e
Author | SHA1 | Date | |
---|---|---|---|
466b57196e | |||
e111aa3053 |
12
application/admin/model/Manystore.php
Normal file
12
application/admin/model/Manystore.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Manystore extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'manystore';
|
||||
|
||||
}
|
@ -52,6 +52,27 @@
|
||||
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('成就或经历')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<dl class="fieldlist" data-name="row[achievement_json]">
|
||||
<dd>
|
||||
<ins>{:__('Key')}</ins>
|
||||
<ins>{:__('Value')}</ins>
|
||||
</dd>
|
||||
<dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
|
||||
<textarea name="row[achievement_json]" class="form-control hide" cols="30" rows="5"></textarea>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
@ -52,6 +52,27 @@
|
||||
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('成就或经历')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<dl class="fieldlist" data-name="row[achievement_json]">
|
||||
<dd>
|
||||
<ins>{:__('Key')}</ins>
|
||||
<ins>{:__('Value')}</ins>
|
||||
</dd>
|
||||
<dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
|
||||
<textarea name="row[achievement_json]" class="form-control hide" cols="30" rows="5">{$row.achievement_json|htmlentities}</textarea>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
@ -926,6 +926,8 @@ $user_unpaid_order = $user_paid_order =null;
|
||||
$row['classes_cate'] = $classes_cate;
|
||||
$row['classes_type_name'] = $classes_type;
|
||||
|
||||
|
||||
$row["spec_number"] = ClassesSpec::where("classes_lib_id",$row->id)->count();
|
||||
}
|
||||
// var_dump(self::getLastSql());die;
|
||||
|
||||
|
@ -153,6 +153,7 @@ class Teacher extends BaseModel
|
||||
public static function allList($page, $limit,$params=[]){
|
||||
$with_field = [
|
||||
'user'=>['nickname','mobile','avatar','realname'],
|
||||
"shop"=>["name","logo","image","images","address_city","province","city","district","address","address_detail","longitude","latitude","tel"],
|
||||
'base'=>['*'],
|
||||
];
|
||||
$alisa = (new self)->getWithAlisaName();
|
||||
|
@ -1687,6 +1687,245 @@ class Activity extends BaseModel
|
||||
}
|
||||
|
||||
|
||||
protected function update_check(&$params,$row=null)
|
||||
{
|
||||
|
||||
|
||||
// try {
|
||||
if($row){
|
||||
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
|
||||
if($params["status"] != '3' && $row["status"] == '3'){
|
||||
throw new \Exception("已被平台下架!无法操作上架状态!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$classesLib = new \app\common\model\school\classes\activity\Activity();
|
||||
$classesLib->no_auth_fields = $this->no_auth_fields;
|
||||
$classesLib->need_auth = $this->need_auth;
|
||||
$classesLib->have_auth = $this->have_auth;
|
||||
|
||||
$classesLib->activityCheck($params,null,$row);
|
||||
|
||||
$this->need_auth = $classesLib->need_auth;
|
||||
$this->have_auth = $classesLib->have_auth;
|
||||
|
||||
|
||||
// }catch (\Exception $e){
|
||||
// $this->error($e->getMessage());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//修改
|
||||
if($row){
|
||||
|
||||
}else{
|
||||
//新增
|
||||
//新增
|
||||
$params["add_type"] = '1';
|
||||
$params["add_id"] = $this->auth->id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/** 小程序端操作课程修改
|
||||
* @param bool $check
|
||||
* @param bool $trans
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updateActivityByOper($params,$ids,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
//用户操作权限检测
|
||||
$shop_id = Activity::checkOptionAuth($ids, $oper_id,$oper_type);
|
||||
$params["shop_id"] = $shop_id;
|
||||
|
||||
$row = self::where('id',$ids)->where("shop_id",$shop_id)->find();
|
||||
if(!$row) throw new \Exception("活动不存在!");
|
||||
|
||||
|
||||
|
||||
//判断逻辑
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
//事务逻辑
|
||||
|
||||
|
||||
$this->update_check($params,$row);
|
||||
|
||||
if($this->have_auth){
|
||||
(new \app\common\model\school\classes\activity\Activity)->applyAuth($row["id"],$params);
|
||||
$result = true;
|
||||
}else{
|
||||
// var_dump($this->have_auth);
|
||||
|
||||
$spec = $params["item_json"] ?? [];
|
||||
|
||||
// var_dump($spec);
|
||||
|
||||
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
|
||||
unset($params["item_json"]);
|
||||
unset($params["delete_spec_ids"]);
|
||||
|
||||
$result = $row->allowField(true)->save($params);
|
||||
|
||||
//添加课程规格
|
||||
foreach ($spec as $k=>$v){
|
||||
$v["classes_activity_id"] = $row["id"];
|
||||
$v["manystore_id"] = $row["manystore_id"];
|
||||
$v["shop_id"] = $row["shop_id"];
|
||||
//有id更新,否则新增
|
||||
if(isset($v["id"]) && $v["id"]){
|
||||
\app\common\model\school\classes\activity\ActivityItem::update((new \app\common\model\school\classes\activity\ActivityItem)->checkAssemblyParameters($v));
|
||||
}else{
|
||||
|
||||
\app\common\model\school\classes\activity\ActivityItem::create((new \app\common\model\school\classes\activity\ActivityItem)->checkAssemblyParameters($v));
|
||||
}
|
||||
|
||||
}
|
||||
//删除规格
|
||||
foreach ($delete_spec_ids as $k=>$delete_spec){
|
||||
|
||||
|
||||
(new \app\common\model\school\classes\activity\ActivityItem)->updateCheck($delete_spec["id"]);
|
||||
|
||||
$delete_spec->delete();
|
||||
}
|
||||
|
||||
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
|
||||
$specss = \app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$row["id"])->select();
|
||||
foreach ($specss as $k=>$specs){
|
||||
|
||||
$params =$specs->toArray();
|
||||
(new \app\common\model\school\classes\activity\ActivityItem)->specCheck($params,null,$specs);
|
||||
}
|
||||
|
||||
}
|
||||
$this->update_classes($row["id"]);
|
||||
|
||||
|
||||
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** 小程序端操作课程修改
|
||||
* @param bool $check
|
||||
* @param bool $trans
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteActivityByOper($ids,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
//用户操作权限检测
|
||||
$shop_id = Activity::checkOptionAuth($ids, $oper_id,$oper_type);
|
||||
|
||||
$row = self::where('id',$ids)->where("shop_id",$shop_id)->find();
|
||||
if(!$row) throw new \Exception("活动不存在!");
|
||||
|
||||
|
||||
$list = self::where("id", 'in', $ids)->select();
|
||||
foreach ($list as $item) {
|
||||
$this->updateCheck($item->id);
|
||||
}
|
||||
//判断逻辑
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
$count = 0;
|
||||
//事务逻辑
|
||||
//删除前检测
|
||||
foreach ($list as $k => $v) {
|
||||
//删除课程规格
|
||||
\app\common\model\school\classes\activity\ActivityItem::where("classes_activity_id",$item->id)->delete();
|
||||
//删除课程规格
|
||||
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_id",$item->id)->delete();
|
||||
\app\common\model\school\classes\activity\ActivityAuth::where("classes_activity_id",$item->id)->delete();
|
||||
|
||||
$count += $v->delete();
|
||||
}
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** 小程序端操作课程上下架
|
||||
* @param bool $check
|
||||
* @param bool $trans
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updateStatusByOper($status,$ids,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
//用户操作权限检测
|
||||
if($check){
|
||||
$shop_id = self::checkOptionAuth($ids, $oper_id,$oper_type);
|
||||
if(!in_array($status,['1','2'] ))throw new \Exception("状态参数错误!");
|
||||
//审核中无法操作上下架
|
||||
$row = self::where('id',$ids)->where("shop_id",$shop_id)->find();
|
||||
if(!$row) throw new \Exception("活动不存在或无权限!");
|
||||
if($row["status"] == '3') throw new \Exception("已平台下架无法操作!");
|
||||
if($row["auth_status"] != '1' && $status =="1")throw new \Exception("审核通过才能上架!");
|
||||
}else{
|
||||
$row = self::where('id',$ids)->find();
|
||||
if(!$row) throw new \Exception("课程不存在或无权限!");
|
||||
}
|
||||
|
||||
//判断逻辑
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
//事务逻辑
|
||||
$params = [
|
||||
"status"=>$status,
|
||||
];
|
||||
$result = $row->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 $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ use app\common\model\BaseModel;
|
||||
use app\common\model\dyqc\ManystoreShop;
|
||||
use app\common\model\school\Area;
|
||||
use app\common\model\school\classes\ClassesSpec;
|
||||
use app\common\model\school\classes\Collect;
|
||||
use app\manystore\model\Manystore;
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
@ -644,6 +645,56 @@ class ActivityAuth extends BaseModel
|
||||
|
||||
|
||||
|
||||
protected function update_check(&$params,$row=null)
|
||||
{
|
||||
|
||||
//只要提交,就审核
|
||||
$params["auth_status"] = 0;
|
||||
$params["classes_activity_id"] = $params["classes_activity_id"] ?? 0;
|
||||
|
||||
if($row){
|
||||
if(empty($params["shop_id"]))$params["shop_id"] = $row["shop_id"];
|
||||
//查询是否存在活动,如果存在,附上活动id
|
||||
$activity = \app\common\model\school\classes\activity\Activity::where("id",$row["classes_activity_id"])->find();
|
||||
if($activity && empty($params["classes_activity_id"])){
|
||||
$params["classes_activity_id"] = $activity["id"];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// try {
|
||||
$classesLib = new \app\common\model\school\classes\activity\ActivityAuth();
|
||||
$classesLib->no_auth_fields = $this->no_auth_fields;
|
||||
$classesLib->need_auth = $this->need_auth;
|
||||
$classesLib->have_auth = $this->have_auth;
|
||||
|
||||
$classesLib->activityCheck($params,null,$row);
|
||||
|
||||
$this->need_auth = $classesLib->need_auth;
|
||||
$this->have_auth = $classesLib->have_auth;
|
||||
|
||||
// }catch (\Exception $e){
|
||||
// $this->error($e->getMessage());
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//修改
|
||||
if($row){
|
||||
|
||||
}else{
|
||||
//新增
|
||||
//新增
|
||||
$params["add_type"] = '1';
|
||||
$params["add_id"] = $this->auth->id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** 小程序端操作活动审核添加
|
||||
* @param bool $check
|
||||
@ -651,7 +702,7 @@ class ActivityAuth extends BaseModel
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function createActivityByOper(&$params,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
public function createActivityAuthByOper(&$params,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
|
||||
$model = new self;
|
||||
@ -668,7 +719,52 @@ class ActivityAuth extends BaseModel
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
$this->update_check($params,$row=null);
|
||||
$spec = $params["item_json"];
|
||||
unset($params["item_json"]);
|
||||
// $params["status"] = "2";
|
||||
$result = $model->allowField(true)->save($params);
|
||||
// $this->model = new \app\manystore\model\school\classes\activity\Activity;
|
||||
// $this->itemmodel = new \app\manystore\model\school\classes\activity\ActivityItem();
|
||||
|
||||
$activity = \app\manystore\model\school\classes\activity\Activity::where("title",$params["title"])->find();
|
||||
if(!$activity){
|
||||
$params["status"] = "3";
|
||||
$params["classes_activity_auth_id"] = $model["id"];
|
||||
$activity = new \app\manystore\model\school\classes\activity\Activity;
|
||||
$result2 = $activity->allowField(true)->save($params);
|
||||
}
|
||||
|
||||
//添加课程规格
|
||||
foreach ($spec as $k=>$v){
|
||||
$v["classes_activity_auth_id"] = $model["id"];
|
||||
|
||||
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($model->classes_activity_id ?? 0);
|
||||
|
||||
$v["manystore_id"] = $model["manystore_id"];
|
||||
$v["shop_id"] = $model["shop_id"];
|
||||
|
||||
unset($v["id"]);
|
||||
(new \app\common\model\school\classes\activity\ActivityItemAuth())->allowField(true)->save($v);
|
||||
if(isset($result2)){
|
||||
(new \app\common\model\school\classes\activity\ActivityItem())->allowField(true)->save($v);
|
||||
}
|
||||
}
|
||||
|
||||
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
|
||||
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$model["id"])->select();
|
||||
foreach ($specss as $k=>$specs){
|
||||
$params =$specs->toArray();
|
||||
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
|
||||
}
|
||||
|
||||
|
||||
$this->update_classes($model["classes_activity_id"] ?? 0,$model);
|
||||
|
||||
|
||||
//调用事件
|
||||
$data = ['activity' => $model];
|
||||
\think\Hook::listen('activity_auth_need_after', $data);
|
||||
|
||||
|
||||
|
||||
@ -687,4 +783,589 @@ class ActivityAuth extends BaseModel
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function update_classes($classes_activity_id,$row=null){
|
||||
if($classes_activity_id && $row){
|
||||
$activity = \app\common\model\school\classes\activity\Activity::where("id",$classes_activity_id)->find();
|
||||
if($activity && in_array($row["auth_status"],[0,2])){
|
||||
$activity["classes_activity_auth_id"] = $row["id"];
|
||||
$activity->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** 小程序端操作课程修改
|
||||
* @param bool $check
|
||||
* @param bool $trans
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function updateActivityAuthByOper($params,$ids,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
$activityAuth = self::get($ids);
|
||||
if(!$activityAuth) throw new \Exception("活动不存在或已下架!");
|
||||
// $ids = $activityAuth["classes_activity_id"];
|
||||
//用户操作权限检测
|
||||
$shop_id = Activity::checkOptionAuth($activityAuth["classes_activity_id"], $oper_id,$oper_type);
|
||||
$params["shop_id"] = $shop_id;
|
||||
|
||||
$row = self::where('id',$ids)->where("shop_id",$shop_id)->find();
|
||||
if(!$row) throw new \Exception("活动不存在!");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//判断逻辑
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
//事务逻辑
|
||||
$this->update_check($params,$row);
|
||||
$spec = $params["item_json"] ?? [];
|
||||
|
||||
// var_dump($spec);
|
||||
|
||||
$delete_spec_ids = $params["delete_spec_ids"] ?? [];
|
||||
unset($params["item_json"]);
|
||||
unset($params["delete_spec_ids"]);
|
||||
|
||||
$result = $row->allowField(true)->save($params);
|
||||
|
||||
//添加课程规格
|
||||
foreach ($spec as $k=>$v){
|
||||
$v["classes_activity_auth_id"] = $row["id"];
|
||||
$v["classes_activity_id"] = $v["classes_activity_id"] ?? ($row->classes_activity_id ?? 0);
|
||||
|
||||
|
||||
$v["manystore_id"] = $row["manystore_id"];
|
||||
$v["shop_id"] = $row["shop_id"];
|
||||
//有id更新,否则新增
|
||||
if(isset($v["id"]) && $v["id"]){
|
||||
\app\common\model\school\classes\activity\ActivityItemAuth::update((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
|
||||
}else{
|
||||
|
||||
\app\common\model\school\classes\activity\ActivityItemAuth::create((new \app\common\model\school\classes\activity\ActivityItemAuth)->checkAssemblyParameters($v));
|
||||
}
|
||||
|
||||
}
|
||||
//删除规格
|
||||
foreach ($delete_spec_ids as $k=>$delete_spec){
|
||||
|
||||
|
||||
(new \app\common\model\school\classes\activity\ActivityItemAuth)->updateCheck($delete_spec["id"]);
|
||||
|
||||
$delete_spec->delete();
|
||||
}
|
||||
|
||||
//因为是批量添加,所有规格重新进行检测,防止出现时间重叠
|
||||
$specss = \app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$row["id"])->select();
|
||||
foreach ($specss as $k=>$specs){
|
||||
|
||||
$params =$specs->toArray();
|
||||
(new \app\common\model\school\classes\activity\ActivityItemAuth)->specCheck($params,null,$specs);
|
||||
}
|
||||
|
||||
|
||||
$this->update_classes($row["classes_activity_id"],$row);
|
||||
|
||||
//调用事件
|
||||
$data = ['activity' => $row];
|
||||
\think\Hook::listen('activity_auth_need_after', $data);
|
||||
|
||||
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/** 小程序端操作课程修改
|
||||
* @param bool $check
|
||||
* @param bool $trans
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteActivityAuthByOper($ids,$check=false,$oper_type='user',$oper_id=0,$trans=false){
|
||||
|
||||
$activityAuth = self::get($ids);
|
||||
if(!$activityAuth) throw new \Exception("活动不存在或已下架!");
|
||||
//用户操作权限检测
|
||||
$shop_id = Activity::checkOptionAuth($activityAuth["classes_activity_id"], $oper_id,$oper_type);
|
||||
|
||||
$row = self::where('id',$ids)->where("shop_id",$shop_id)->find();
|
||||
if(!$row) throw new \Exception("活动不存在!");
|
||||
|
||||
|
||||
$list = self::where("id", 'in', $ids)->select();
|
||||
foreach ($list as $item) {
|
||||
$this->updateCheck($item->id);
|
||||
}
|
||||
//判断逻辑
|
||||
if($trans){
|
||||
self::beginTrans();
|
||||
}
|
||||
$res = true;
|
||||
try{
|
||||
$count = 0;
|
||||
//事务逻辑
|
||||
//删除前检测
|
||||
foreach ($list as $k => $v) {
|
||||
\app\common\model\school\classes\activity\ActivityItemAuth::where("classes_activity_auth_id",$item->id)->delete();
|
||||
$count += $v->delete();
|
||||
}
|
||||
if($trans){
|
||||
self::commitTrans();
|
||||
}
|
||||
}catch (\Exception $e){
|
||||
if($trans){
|
||||
self::rollbackTrans();
|
||||
}
|
||||
throw new \Exception($e->getMessage().$e->getFile().$e->getLine());
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**得到基础条件
|
||||
* @param $status
|
||||
* @param null $model
|
||||
* @param string $alisa
|
||||
*/
|
||||
public static function getBaseWhere($whereData = [], $model = null, $alisa = '',$with = false)
|
||||
{
|
||||
|
||||
if (!$model) {
|
||||
$model = new static;
|
||||
if ($alisa&&!$with) $model = $model->alias($alisa);
|
||||
}
|
||||
if ($alisa) $alisa = $alisa . '.';
|
||||
$tableFields = (new static)->getTableFields();
|
||||
foreach ($tableFields as $fields)
|
||||
{
|
||||
if(in_array($fields, ['status','title','address_city','address','address_detail','start_time','end_time','sign_start_time','sign_end_time']))continue;
|
||||
// if (isset($whereData[$fields]) && $whereData[$fields]) $model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
|
||||
|
||||
if (isset($whereData[$fields]) && $whereData[$fields]){
|
||||
if(is_array($whereData[$fields])){
|
||||
$model = $model->where("{$alisa}{$fields}", $whereData[$fields][0], $whereData[$fields][1]);
|
||||
}else{
|
||||
$model = $model->where("{$alisa}{$fields}", '=', $whereData[$fields]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (isset($whereData['status']) && $whereData['status']) $model = $model->where("{$alisa}status", 'in', $whereData['status']);
|
||||
if (isset($whereData['not_status']) && $whereData['not_status']) $model = $model->where("{$alisa}status", 'not in', $whereData['not_status']);
|
||||
|
||||
|
||||
if (isset($whereData['keywords'])&&$whereData['keywords']) $model = $model->where("{$alisa}title|{$alisa}id|{$alisa}address|{$alisa}address_detail", '=', $whereData['keywords']);
|
||||
if (isset($whereData['time'])&&$whereData['time']){
|
||||
$model = $model->time(["{$alisa}createtime",$whereData['time']]);
|
||||
}
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** 活动详情
|
||||
* @param $id
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public function detail($id,$user_id=0,$oper_type='user',$trans=false){
|
||||
$self = $this->get($id,['shop','itemauths']);
|
||||
|
||||
//是否收藏
|
||||
$self['is_collect'] = 0;
|
||||
//是否购买
|
||||
$self['have_buy'] = 0;
|
||||
if($user_id){
|
||||
//判断是否收藏
|
||||
$self['is_collect'] = Collect::where("user_id",$user_id)->where("classes_activity_id",$self["classes_activity_id"])->count() ? 1:0 ;
|
||||
|
||||
//判断用户是否已报名
|
||||
$self['have_buy'] = Order::where("classes_activity_id",$self["classes_activity_id"])
|
||||
->where("user_id",$user_id)
|
||||
->where("status","not in",["-3","6","9"])
|
||||
->count() ? 1 : 0 ;
|
||||
}
|
||||
|
||||
//
|
||||
// $this->setViews($id,$user_id,$oper_type,$user_id,$trans);
|
||||
// $self->getRelation('user')->visible(['nickname','realname','mobile','avatar']);
|
||||
//参与人数 = 虚拟人数 + 平台人数
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**活动规格
|
||||
* @param $id
|
||||
*
|
||||
*/
|
||||
public function spec($id,$user_id=0){
|
||||
//课程规格
|
||||
$spec_data = ActivityItemAuth::where("classes_activity_auth_id",$id)->where("status",'1')->order("weigh desc,id desc")->select();
|
||||
foreach ($spec_data as &$spec){
|
||||
//默认未下单预约
|
||||
$spec["user_reservation"] = null;
|
||||
if($user_id){
|
||||
$spec["user_reservation"] = Order::where("classes_activity_item_id",$spec['classes_activity_item_id'])->where("user_id",$user_id)->where("status","not in",["-3","6","9"])->find();
|
||||
}
|
||||
|
||||
}
|
||||
return $spec_data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有活动列表
|
||||
*/
|
||||
public static function getVaildList($params) {
|
||||
extract($params);
|
||||
$a = (new self)->getWithAlisaName().'.';
|
||||
$with = ['items',"itemauths"];
|
||||
// if (isset($has_shop) && $has_shop) {
|
||||
$with[] = 'shop';
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// $cate_list = Cate::where("status",'1')->column("name","id");
|
||||
// $label_list = Label::where("status",'1')->column("name","id");
|
||||
// $type_list = Type::where("status",'1')->column("name","id");
|
||||
$selfetch = self::with($with);
|
||||
// 查询自提点
|
||||
if($status == "-2"){
|
||||
$selfetch = $selfetch->where($a.'status', '1');
|
||||
}
|
||||
|
||||
// if($auth_status == "-2"){
|
||||
// $selfetch = $selfetch->where("{$a}auth_status",1);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
$order = $order?? 'normal';
|
||||
$per_page = $limit ?? 10;
|
||||
|
||||
|
||||
$field = "{$a}start_time,{$a}end_time,{$a}sign_start_time,{$a}sign_end_time,{$a}id,{$a}shop_id,{$a}title,{$a}headimage,{$a}images,{$a}address_type,{$a}province,{$a}city,{$a}district,{$a}address,{$a}address_detail,{$a}longitude,{$a}latitude,{$a}sale,{$a}price,{$a}status,{$a}weigh,{$a}recommend,{$a}hot,{$a}new,{$a}selfhot,{$a}createtime,{$a}feel,{$a}sign_num,{$a}verification_num";
|
||||
|
||||
//得到距离
|
||||
if (isset($latitude) && isset($longitude) && $latitude && $longitude) {
|
||||
$field .= ', '.getDistanceBuilder($latitude, $longitude,$a);
|
||||
}else{
|
||||
$field .= ', 0 as distance';
|
||||
}
|
||||
|
||||
//得到每个
|
||||
|
||||
|
||||
$selfetch = $selfetch->field($field);
|
||||
if (isset($keywords) && $keywords) {
|
||||
$selfetch = $selfetch->where("{$a}title|{$a}address|{$a}address_detail|{$a}address_city", 'like', '%' . $keywords . '%');
|
||||
}
|
||||
|
||||
|
||||
if(isset($start_time) && isset($end_time) && ($end_time || $start_time)) {
|
||||
if($start_time){
|
||||
$selfetch = $selfetch->where("{$a}start_time", '>=', $start_time);
|
||||
}
|
||||
if($end_time){
|
||||
$selfetch = $selfetch->where("{$a}end_time", '<=', $end_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(isset($sign_start_time) && isset($sign_end_time) && ($sign_end_time || $sign_start_time)) {
|
||||
if($sign_start_time){
|
||||
$selfetch = $selfetch->where("{$a}sign_start_time", '>=', $sign_start_time);
|
||||
}
|
||||
if($sign_end_time){
|
||||
$selfetch = $selfetch->where("{$a}sign_end_time", '<=', $sign_end_time);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// is_expire 是否查过期:1只查过期,2只查不过期,0全查
|
||||
if(isset($is_expire) && $is_expire) {
|
||||
if($is_expire == 1){
|
||||
$selfetch = $selfetch->where("{$a}end_time", '<', time());
|
||||
}else{
|
||||
$selfetch = $selfetch->where("{$a}end_time", '>=', time());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// is_expire 是否查过期:1只查过期,2只查不过期,0全查
|
||||
if(isset($is_sign_expire) && $is_sign_expire) {
|
||||
if($is_sign_expire == 1){
|
||||
$selfetch = $selfetch->where("{$a}sign_end_time", '<', time());
|
||||
}else{
|
||||
$selfetch = $selfetch->where("{$a}sign_end_time", '>=', time());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (isset($manystore_id) && $manystore_id) {
|
||||
$selfetch = $selfetch->where("{$a}manystore_id", 'in', ''.$manystore_id);
|
||||
}
|
||||
|
||||
if (isset($shop_id) && $shop_id) {
|
||||
$selfetch = $selfetch->where("{$a}shop_id", 'in', ''.$shop_id);
|
||||
}
|
||||
|
||||
if (isset($user_id) && $user_id) {
|
||||
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$user_id);
|
||||
}
|
||||
|
||||
if (isset($my) && $my && isset($my_user_id) && $my_user_id) {
|
||||
$selfetch = $selfetch->where("{$a}user_id", 'in', ''.$my_user_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (isset($teacher_id) && $teacher_id) {
|
||||
// $selfetch = $selfetch->where("{$a}teacher_id", 'in', ''.$teacher_id);
|
||||
// }
|
||||
|
||||
// if (isset($type) && $type) {
|
||||
// $selfetch = $selfetch->where("{$a}type", 'in', ''.$type);
|
||||
// }
|
||||
|
||||
if (isset($address_type) && $address_type) {
|
||||
$selfetch = $selfetch->where("{$a}address_type", 'in', ''.$address_type);
|
||||
}
|
||||
|
||||
|
||||
if (isset($recommend) && $recommend) {
|
||||
$selfetch = $selfetch->where("{$a}recommend", 'in', ''.$recommend);
|
||||
}
|
||||
|
||||
|
||||
if (isset($hot) && $hot) {
|
||||
$selfetch = $selfetch->where("{$a}hot", 'in', ''.$hot);
|
||||
}
|
||||
|
||||
|
||||
if (isset($new) && $new) {
|
||||
$selfetch = $selfetch->where("{$a}new", 'in', ''.$new);
|
||||
}
|
||||
|
||||
if (isset($feel) && $feel) {
|
||||
$selfetch = $selfetch->where("{$a}feel", 'in', ''.$feel);
|
||||
}
|
||||
|
||||
// //设置订单信息
|
||||
// if(isset($auth_status) && $auth_status != -1 && $auth_status != -2){
|
||||
// $selfetch = $selfetch->where("{$a}auth_status", 'in', ''.$auth_status);
|
||||
// }
|
||||
|
||||
//设置订单信息
|
||||
if(isset($status) && $status != -1 && $status != -2){
|
||||
$selfetch = $selfetch->where("{$a}status", 'in', ''.$status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//区域搜索
|
||||
if (isset($province) && $province) {
|
||||
$selfetch = $selfetch->where("{$a}province", 'in', ''.$province);
|
||||
}
|
||||
|
||||
|
||||
if (isset($city) && $city) {
|
||||
$selfetch = $selfetch->where("{$a}city", 'in', ''.$city);
|
||||
}
|
||||
|
||||
if (isset($district) && $district) {
|
||||
$selfetch = $selfetch->where("{$a}district", 'in', ''.$district);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// if (isset($self_label_tag) && $self_label_tag) {
|
||||
// $self_label_tag = implode("|",explode(',',$self_label_tag));
|
||||
// $selfetch = $selfetch->whereRaw(" {$a}self_label_tag REGEXP '({$self_label_tag})'");
|
||||
// }
|
||||
//
|
||||
// if (isset($classes_type) && $classes_type) {
|
||||
// $classes_type = implode("|",explode(',',$classes_type));
|
||||
// $selfetch = $selfetch->whereRaw(" {$a}classes_type REGEXP '({$classes_type})'");
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
// if (isset($classes_cate_ids) && $classes_cate_ids) {
|
||||
// $classes_cate_ids = implode("|",explode(',',$classes_cate_ids));
|
||||
// $selfetch = $selfetch->whereRaw(" {$a}classes_cate_ids REGEXP '({$classes_cate_ids})'");
|
||||
// }
|
||||
//
|
||||
// if (isset($classes_label_ids) && $classes_label_ids) {
|
||||
// $classes_label_ids = implode("|",explode(',',$classes_label_ids));
|
||||
// $selfetch = $selfetch->whereRaw(" {$a}classes_label_ids REGEXP '({$classes_label_ids})'");
|
||||
// }
|
||||
// $collect_classes_lib_ids = [-1];
|
||||
// //需登录查询条件:
|
||||
// if(isset($my_user_id) && $my_user_id){
|
||||
// //得到我收藏的课程ids
|
||||
// $collect_classes_lib_ids = Collect::where("user_id",$my_user_id)->column("classes_activity_id");
|
||||
// //专查我的收藏
|
||||
// if(isset($collect) && $collect){
|
||||
// $selfetch = $selfetch->where("{$a}id","in",$collect_classes_lib_ids);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
if(isset($order) && $order == "distance"){
|
||||
$selfetch = $selfetch->where("{$a}longitude","not null")
|
||||
->where("{$a}latitude","not null")
|
||||
->where("{$a}longitude","<>","")
|
||||
->where("{$a}latitude","<>","")
|
||||
->where("{$a}longitude","<>","null")
|
||||
->where("{$a}latitude","<>","null");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//排序
|
||||
switch ($order) {
|
||||
case "normal": //综合排序(推薦優先)
|
||||
$selfetch = $selfetch->order("{$a}recommend desc,{$a}hot desc,{$a}new desc,{$a}weigh desc,{$a}start_time desc,{$a}id desc");
|
||||
break;
|
||||
case "distance": //距离优先 权重
|
||||
$selfetch = $selfetch->order("distance asc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
|
||||
break;
|
||||
case "hot": //熱門优先
|
||||
$selfetch = $selfetch->order("{$a}hot desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
|
||||
break;
|
||||
|
||||
case "new": //平台最新优先
|
||||
$selfetch = $selfetch->order("{$a}new desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
|
||||
break;
|
||||
case "selfhot": //机构热门优先
|
||||
$selfetch = $selfetch->order("{$a}selfhot desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
|
||||
break;
|
||||
|
||||
case "recommend": //推薦优先
|
||||
$selfetch = $selfetch->order("{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc,{$a}sign_num desc");
|
||||
break;
|
||||
|
||||
case "sale": //銷量优先
|
||||
$selfetch = $selfetch->order("{$a}sale desc,{$a}verification_num desc,{$a}sign_num desc,{$a}recommend desc,{$a}weigh desc");
|
||||
break;
|
||||
|
||||
case "views": //浏览量优先
|
||||
$selfetch = $selfetch->order("{$a}views desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc");
|
||||
break;
|
||||
case "collect": //收藏量优先
|
||||
$selfetch = $selfetch->order("{$a}collect desc,{$a}recommend desc,{$a}weigh desc,{$a}verification_num desc,{$a}sale desc");
|
||||
break;
|
||||
default:
|
||||
throw new \Exception("不支持的排序类型");
|
||||
}
|
||||
|
||||
if(isset($nearby) && $nearby) {
|
||||
// throw new \Exception("现版本不支持");
|
||||
$selfetch = $selfetch->having("distance <= {$nearby}");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$selfetch = $selfetch->page($page,$limit)->select();
|
||||
|
||||
|
||||
foreach ($selfetch as $row) {
|
||||
|
||||
// $row->getRelation('manystore')->visible(['nickname']);
|
||||
$row->getRelation('shop')->visible(['name','logo']);
|
||||
}
|
||||
$rows = $selfetch;
|
||||
// $total = $selfetch->total();
|
||||
|
||||
|
||||
|
||||
//额外附加数据
|
||||
foreach ($rows as &$row) { //迭代器魔术方法遍历,填值自动引用传值
|
||||
//设置是否已收藏
|
||||
$row->is_collect = in_array($row->id,$collect_classes_lib_ids) ? 1 : 0;
|
||||
|
||||
if($row->is_collect){
|
||||
$row["collect"] = Collect::where("user_id",$my_user_id)->where("classes_activity_id",$row->classes_activity_id)->find();
|
||||
}
|
||||
// $classes_label_ids = $row['classes_label_ids'];
|
||||
// $classes_cate_ids = $row['classes_cate_ids'];
|
||||
// $classes_type_ids = $row['classes_type'];
|
||||
// $classes_label = $classes_cate = $classes_type = [];
|
||||
// foreach (explode(",", $classes_label_ids) as $classes_label_id){
|
||||
// if(isset($label_list[$classes_label_id]))$classes_label[] = $label_list[$classes_label_id];
|
||||
// }
|
||||
// foreach (explode(",", $classes_cate_ids) as $classes_cate_id){
|
||||
// if(isset($cate_list[$classes_cate_id]))$classes_cate[] = $cate_list[$classes_cate_id];
|
||||
// }
|
||||
//
|
||||
// foreach (explode(",", $classes_type_ids) as $classes_type_id){
|
||||
// if(isset($type_list[$classes_type_id]))$classes_type[] = $type_list[$classes_type_id];
|
||||
// }
|
||||
//
|
||||
//
|
||||
// $row['classes_label'] = $classes_label;
|
||||
// $row['classes_cate'] = $classes_cate;
|
||||
// $row['classes_type_name'] = $classes_type;
|
||||
|
||||
}
|
||||
$result = array("data" => $rows);
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -937,7 +937,8 @@ class Order extends BaseModel
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//将空格转义去掉(要考虑unicode解码)
|
||||
|
||||
|
||||
|
||||
//判断是否是免费课
|
||||
|
@ -18,7 +18,7 @@ return [
|
||||
// 应用命名空间
|
||||
'app_namespace' => 'app',
|
||||
// 应用调试模式
|
||||
'app_debug' => Env::get('app.debug', true),
|
||||
'app_debug' => Env::get('app.debug', false),
|
||||
// 应用Trace
|
||||
'app_trace' => Env::get('app.trace', false),
|
||||
// 应用模式状态
|
||||
@ -159,7 +159,7 @@ return [
|
||||
// 错误显示信息,非调试模式有效
|
||||
'error_message' => '你所浏览的页面暂时无法访问',
|
||||
// 显示错误信息
|
||||
'show_error_msg' => true,
|
||||
'show_error_msg' => false,
|
||||
// 异常处理handle类 留空使用 \think\exception\Handle
|
||||
'exception_handle' => '',
|
||||
// +----------------------------------------------------------------------
|
||||
|
@ -22,7 +22,7 @@ return [
|
||||
/**
|
||||
* 可上传的文件类型
|
||||
*/
|
||||
'mimetype' => 'jpg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm,p12,pem,doc,docx,xls,xlsx,pdf,txt,md,xml',
|
||||
'mimetype' => 'jpg,svg,png,bmp,jpeg,gif,webp,zip,rar,wav,mp4,mp3,webm,p12,pem,doc,docx,xls,xlsx,pdf,txt,md,xml',
|
||||
/**
|
||||
* 是否支持批量上传
|
||||
*/
|
||||
|
@ -50,6 +50,27 @@
|
||||
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('成就或经历')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<dl class="fieldlist" data-name="row[achievement_json]">
|
||||
<dd>
|
||||
<ins>{:__('Key')}</ins>
|
||||
<ins>{:__('Value')}</ins>
|
||||
</dd>
|
||||
<dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
|
||||
<textarea name="row[achievement_json]" class="form-control hide" cols="30" rows="5"></textarea>
|
||||
</dl>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
@ -47,6 +47,25 @@
|
||||
<textarea id="c-content" class="form-control editor" rows="5" name="row[content]" cols="50">{$row.content}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('成就或经历')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
||||
<dl class="fieldlist" data-name="row[achievement_json]">
|
||||
<dd>
|
||||
<ins>{:__('Key')}</ins>
|
||||
<ins>{:__('Value')}</ins>
|
||||
</dd>
|
||||
<dd><a href="javascript:;" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> {:__('Append')}</a></dd>
|
||||
<textarea name="row[achievement_json]" class="form-control hide" cols="30" rows="5">{$row.achievement_json|htmlentities}</textarea>
|
||||
</dl>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
|
||||
<div class="col-xs-12 col-sm-8">
|
||||
|
715
application/manystoreapi/controller/Activity.php
Normal file
715
application/manystoreapi/controller/Activity.php
Normal file
@ -0,0 +1,715 @@
|
||||
<?php
|
||||
|
||||
namespace app\manystoreapi\controller;
|
||||
|
||||
use app\common\controller\ManystoreApiBase;
|
||||
use app\common\model\school\classes\activity\Activity as ActivityModel;
|
||||
use app\common\model\school\classes\activity\ActivityAuth as ActivityAuthModel;
|
||||
|
||||
/**
|
||||
* 机构API后台:机构活动和审核活动管理
|
||||
*
|
||||
*
|
||||
*/
|
||||
class Activity extends ManystoreApiBase
|
||||
{
|
||||
|
||||
protected $model = null;
|
||||
protected $auth_model = null;
|
||||
|
||||
/**
|
||||
* 初始化操作
|
||||
* @access protected
|
||||
*/
|
||||
public function _initialize()
|
||||
{
|
||||
|
||||
$this->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]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -85,6 +85,7 @@ class Attachment extends ManystoreApiBase
|
||||
->where($mimetypeQuery)
|
||||
->whereRaw("`filename` NOT REGEXP '^[0-9A-Fa-f]{32}'")
|
||||
->where($where)
|
||||
// ->where("{$as}.shop_id", $this->auth->shop_id)
|
||||
->where(...$wherekeyword)
|
||||
->order("{$as}.id desc")
|
||||
->paginate($limit);
|
||||
|
@ -1,4 +1,4 @@
|
||||
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
define(['jquery', 'bootstrap', 'backend', 'csmtable', 'form'], function ($, undefined, Backend, Table, Form) {
|
||||
|
||||
var Controller = {
|
||||
index: function () {
|
||||
@ -24,6 +24,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||
sortName: 'weigh',
|
||||
fixedColumns: true,
|
||||
fixedRightNumber: 1,
|
||||
asyndownload: true,
|
||||
columns: [
|
||||
[
|
||||
{checkbox: true},
|
||||
|
18
test.php
Normal file
18
test.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
function removeUtf8Bom($text) {
|
||||
$bom = pack('H*', 'EFBBBF');
|
||||
if (0 === strpos($text, $bom)) {
|
||||
$text = substr($text, 3);
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
//function removeUtf8Bom($text) {
|
||||
// return mb_convert_encoding($text, 'UTF-8', 'UTF-8');
|
||||
//}
|
||||
|
||||
|
||||
$content = file_get_contents('C:\Users\jiaoyukun\Desktop\orders.csv');
|
||||
var_dump($content);
|
||||
//保存到本地
|
||||
$file = fopen('C:\Users\jiaoyukun\Desktop\orders_2.csv', 'w');
|
Loading…
x
Reference in New Issue
Block a user