559 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			559 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						||
 | 
						||
namespace app\api\controller\school;
 | 
						||
 | 
						||
 | 
						||
use app\common\model\school\activity\Activity;
 | 
						||
use app\common\model\school\activity\Cate;
 | 
						||
use app\common\model\school\activity\order\SettleLog;
 | 
						||
use app\common\model\school\activity\Refund;
 | 
						||
 | 
						||
/**
 | 
						||
 * 新活动接口
 | 
						||
 */
 | 
						||
class NewActivity extends Base
 | 
						||
{
 | 
						||
    protected $noNeedLogin = ['cate_list',"activity_list","detail","refund_list","add"];
 | 
						||
    protected $noNeedRight = '*';
 | 
						||
 | 
						||
    protected $model = null;
 | 
						||
 | 
						||
    /**
 | 
						||
     * 初始化操作
 | 
						||
     * @access protected
 | 
						||
     */
 | 
						||
    protected function _initialize()
 | 
						||
    {
 | 
						||
 | 
						||
        $this->model = new \app\common\model\school\activity\Activity();
 | 
						||
        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 = "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 = "platform", type = "string",required=false,description = "上架平台:wechat_miniapp=微信小程序,tt_miniapp=抖音小程序")
 | 
						||
     * @ApiParams(name = "my", type = "string",required=true,description = "是否查自己(需登录) 1是 0否")
 | 
						||
     * @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 = "auth_status", type = "int",required=false,description = "审核状态:0=待审核,1=审核通过,2=审核不通过  ,不传查所有,可按多值逗号拼接")
 | 
						||
     * @ApiParams(name = "cate_ids", type = "string",required=false,description = "平台分类ids 多值逗号拼接")
 | 
						||
     * @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=待开始,4=进行中,5=已结束,-1=已取消  ,不传查所有,可按多值逗号拼接")
 | 
						||
     * @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=平台最新优先,sale=銷量优先,views=浏览量优先,collect=收藏量优先")
 | 
						||
     * @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
 | 
						||
     * @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
 | 
						||
     * @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function activity_list()
 | 
						||
    {
 | 
						||
        $user_id = 0;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        $params =[];
 | 
						||
 | 
						||
        $params["platform"] =  $this->request->get('platform/s', ''); //搜索关键字
 | 
						||
 | 
						||
        $params["my"] =  $this->request->get('my/d', 0); //机构店铺id
 | 
						||
        $params["my_user_id"] = $user_id;
 | 
						||
        $params["collect"]  =  $this->request->get('collect/d', 0); //页数
 | 
						||
        $params["page"]  =  $this->request->get('page/d', 1); //页数
 | 
						||
        $params["limit"] =  $this->request->get('limit/d', 10); //条数
 | 
						||
        $params["keywords"] =  $this->request->get('keywords/s', ''); //搜索关键字
 | 
						||
        $params["shop_id"] =  $this->request->get('shop_id/d', ''); //机构店铺id
 | 
						||
 | 
						||
        $params["cate_ids"] =  $this->request->get('cate_ids/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', ''); //机构店铺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/s', ''); //机构店铺id
 | 
						||
 | 
						||
 | 
						||
 | 
						||
//        $type =  $this->request->get('type/s', ''); //筛选学员和教练单
 | 
						||
 | 
						||
        try{
 | 
						||
            //当前申请状态
 | 
						||
            $res = $this->model::getVaildList($params);
 | 
						||
            $count = $this->model::getVaildList($params,true);
 | 
						||
//            if($user_id =='670153'){
 | 
						||
//               file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
 | 
						||
//            }
 | 
						||
        }catch (\Exception $e){
 | 
						||
 | 
						||
            $this->error($e->getMessage());
 | 
						||
        }
 | 
						||
        $this->success('查询成功', ["list"=>$res,"count"=>$count]);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * @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->error(__('缺少必要参数'));
 | 
						||
        }
 | 
						||
 | 
						||
        try {
 | 
						||
            $res =  $this->model->detail($id,$user_id);
 | 
						||
        } catch (\Exception $e){
 | 
						||
//            Log::log($e->getMessage());
 | 
						||
            $this->error($e->getMessage(),['errcode'=>$e->getCode()]);
 | 
						||
        }
 | 
						||
        $this->success('获取成功', ['detail' => $res]);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * @ApiTitle( 设置活动收藏和取消收藏)
 | 
						||
     * @ApiSummary(设置活动收藏和取消收藏)
 | 
						||
     * @ApiMethod(POST)
 | 
						||
     * @ApiParams(name = "id", type = "int",required=true,description = "活动id")
 | 
						||
     * @ApiParams(name = "is_collect", type = "int",required=true,description = "收藏操作:0取消收藏,1收藏")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function collect(){
 | 
						||
        $user_id = 0;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
 | 
						||
        $id =  $this->request->post('id/d', 0); //搜索关键字
 | 
						||
        $collect =  $this->request->post('is_collect/d', 0); //搜索关键字
 | 
						||
 | 
						||
        try{
 | 
						||
            $res = $this->model->collect($id,$user_id,$collect,'user',$user_id,true);
 | 
						||
        }catch (\Throwable $e){
 | 
						||
            $this->error($e->getMessage());
 | 
						||
        }
 | 
						||
        $this->success('查询成功', $res);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * @ApiTitle(活动添加)
 | 
						||
     * @ApiSummary(活动添加)
 | 
						||
     * @ApiMethod(POST)
 | 
						||
     * @ApiParams(name = "cate_ids", type = "string",required=true,description = "平台分类ids 多值逗号拼接")
 | 
						||
     * @ApiParams(name = "refund_id", type = "int",required=true,description = "退款策略id")
 | 
						||
     * @ApiParams(name = "original_activity_id", type = "int",required=false,description = "复制活动需要传的原活动id-非必填")
 | 
						||
     * @ApiParams(name = "activity_drafts_id", type = "int",required=false,description = "根据草稿箱添加的草稿箱id-非必填")
 | 
						||
     * @ApiParams(name = "title", type = "string",required=true,description = "标题")
 | 
						||
     * @ApiParams(name = "sign_time", type = "string",required=true,description = "报名区间示例: 2025-04-08 00:01:00 - 2025-04-08 15:29:00")
 | 
						||
     * @ApiParams(name = "time", type = "string",required=true,description = "活动区间示例: 2025-04-09 00:01:00 - 2025-04-09 15:29:00")
 | 
						||
     * @ApiParams(name = "platform", type = "string",required=false,description = "上架平台:wechat_miniapp=微信小程序,tt_miniapp=抖音小程序")
 | 
						||
     * @ApiParams(name = "images", type = "string",required=true,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 = "price", type = "string",required=false,description = "报名单价 0为免费")
 | 
						||
     * @ApiParams(name = "stock", type = "string",required=false,description = "活动限制人数")
 | 
						||
     * @ApiParams(name = "image", type = "string",required=false,description = "入群二维码")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function add(){
 | 
						||
 | 
						||
        $this->transactionCheck();
 | 
						||
 | 
						||
        //敏感词过滤
 | 
						||
        $this->checkSensitivewords(["title","content"]);
 | 
						||
 | 
						||
        $user_id = 73;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        $params = [];
 | 
						||
        $params["user_id"]  = $user_id; //老师id
 | 
						||
        $params["cate_ids"] =  $this->request->post('cate_ids/s', ''); //课程标签
 | 
						||
        $params["refund_id"] =  $this->request->post('refund_id/d', ''); //课程标签
 | 
						||
 | 
						||
        $params["platform"] =  $this->request->post('platform/s', 'wechat_miniapp'); //课程标签
 | 
						||
        $params["original_activity_id"] =  $this->request->post('original_activity_id/d', 0); //课程标签
 | 
						||
 | 
						||
        $params["activity_drafts_id"] =  $this->request->post('activity_drafts_id/d', 0); //课程标签
 | 
						||
        $params["title"] =  $this->request->post('title/s', ''); //老师id
 | 
						||
        $params["images"] =  $this->request->post('images/s', ''); //老师id
 | 
						||
        $params["image"] =  $this->request->post('image/s', ''); //老师id
 | 
						||
 | 
						||
        $params["stock"] =  $this->request->post('stock/d', 0); //核销次数
 | 
						||
        //
 | 
						||
 | 
						||
 | 
						||
        $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["price"] =  $this->request->post('price/f', 0); //老师id
 | 
						||
 | 
						||
 | 
						||
        $params["sign_time"] =  $this->request->post('sign_time/s', 0);
 | 
						||
        $params["time"] =  $this->request->post('time/s', 0);
 | 
						||
 | 
						||
 | 
						||
        //classes_type
 | 
						||
 | 
						||
        try{
 | 
						||
            if(!config("site.miniapp_activity_swtich")) $this->error("已关闭发布渠道,请联系管理员后台添加!");
 | 
						||
 | 
						||
            $res = $this->model->add($params,$user_id,'user',$user_id,true);
 | 
						||
        }catch (\Throwable $e){
 | 
						||
            $this->error($e->getMessage(),[
 | 
						||
                "errcode"=>$e->getCode()
 | 
						||
            ]);
 | 
						||
        }
 | 
						||
        $this->success('添加成功', $res);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * @ApiTitle(活动编辑)
 | 
						||
     * @ApiSummary(活动编辑)
 | 
						||
     * @ApiMethod(POST)
 | 
						||
     * @ApiRoute (/api/school.new_activity/edit/ids/{ids})
 | 
						||
     * @ApiParams (name="ids", type="string", required=true, description="需要编辑的id")
 | 
						||
     * @ApiParams(name = "cate_ids", type = "string",required=true,description = "平台分类ids 多值逗号拼接")
 | 
						||
     * @ApiParams(name = "refund_id", type = "int",required=true,description = "退款策略id")
 | 
						||
     * @ApiParams(name = "original_activity_id", type = "int",required=false,description = "复制活动需要传的原活动id-非必填")
 | 
						||
     * @ApiParams(name = "activity_drafts_id", type = "int",required=false,description = "根据草稿箱添加的草稿箱id-非必填")
 | 
						||
     * @ApiParams(name = "title", type = "string",required=true,description = "标题")
 | 
						||
     * @ApiParams(name = "sign_time", type = "string",required=true,description = "报名区间示例: 2025-04-08 00:01:00 - 2025-04-08 15:29:00")
 | 
						||
     * @ApiParams(name = "time", type = "string",required=true,description = "活动区间示例: 2025-04-09 00:01:00 - 2025-04-09 15:29:00")
 | 
						||
     * @ApiParams(name = "platform", type = "string",required=false,description = "上架平台:wechat_miniapp=微信小程序,tt_miniapp=抖音小程序")
 | 
						||
     * @ApiParams(name = "images", type = "string",required=true,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 = "price", type = "string",required=false,description = "报名单价 0为免费")
 | 
						||
     * @ApiParams(name = "stock", type = "string",required=false,description = "活动限制人数")
 | 
						||
     * @ApiParams(name = "image", type = "string",required=false,description = "入群二维码")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function edit($ids = null){
 | 
						||
        if(!$ids) $ids = $this->request->post('ids/d', 0);
 | 
						||
 | 
						||
        $this->transactionCheck();
 | 
						||
 | 
						||
        //敏感词过滤
 | 
						||
        $this->checkSensitivewords(["title","content"]);
 | 
						||
 | 
						||
        $user_id = 73;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        $params = [];
 | 
						||
        $params["user_id"]  = $user_id; //老师id
 | 
						||
        $params["cate_ids"] =  $this->request->post('cate_ids/s', ''); //课程标签
 | 
						||
        $params["refund_id"] =  $this->request->post('refund_id/d', ''); //课程标签
 | 
						||
 | 
						||
        $params["platform"] =  $this->request->post('platform/s', 'wechat_miniapp'); //课程标签
 | 
						||
        $params["original_activity_id"] =  $this->request->post('original_activity_id/d', 0); //课程标签
 | 
						||
 | 
						||
        $params["activity_drafts_id"] =  $this->request->post('activity_drafts_id/d', 0); //课程标签
 | 
						||
        $params["title"] =  $this->request->post('title/s', ''); //老师id
 | 
						||
        $params["images"] =  $this->request->post('images/s', ''); //老师id
 | 
						||
        $params["image"] =  $this->request->post('image/s', ''); //老师id
 | 
						||
 | 
						||
        $params["stock"] =  $this->request->post('stock/d', 0); //核销次数
 | 
						||
        //
 | 
						||
 | 
						||
 | 
						||
        $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["price"] =  $this->request->post('price/f', 0); //老师id
 | 
						||
 | 
						||
 | 
						||
        $params["sign_time"] =  $this->request->post('sign_time/s', 0);
 | 
						||
        $params["time"] =  $this->request->post('time/s', 0);
 | 
						||
 | 
						||
 | 
						||
        //classes_type
 | 
						||
 | 
						||
        try{
 | 
						||
            if(!config("site.miniapp_activity_swtich")) $this->error("已关闭发布渠道,请联系管理员后台添加!");
 | 
						||
 | 
						||
            $res = $this->model->edit($ids,$params,$user_id,'user',$user_id,true);
 | 
						||
        }catch (\Throwable $e){
 | 
						||
            $this->error($e->getMessage(),[
 | 
						||
                "errcode"=>$e->getCode()
 | 
						||
            ]);
 | 
						||
        }
 | 
						||
        $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 refund_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 = Refund::showList($page, $limit,$keywords);
 | 
						||
//            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(POST)
 | 
						||
     * @ApiParams(name = "id", type = "string",required=true,description = "活动id")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function cancel(){
 | 
						||
        $this->transactionCheck();
 | 
						||
        $user_id = 0;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        $id =  $this->request->post('id/d', ''); //订单号
 | 
						||
        try{
 | 
						||
            //当前申请状态
 | 
						||
            $res = $this->model->cancel($id,"2",true,'user',$user_id,true);
 | 
						||
        }catch (\Throwable $e){
 | 
						||
            $this->error($e->getMessage());
 | 
						||
        }
 | 
						||
        $this->success('活动取消成功', $res);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * @ApiTitle( 活动更换入群二维码)
 | 
						||
     * @ApiSummary(活动更换入群二维码))
 | 
						||
     * @ApiMethod(POST)
 | 
						||
     * @ApiParams(name = "id", type = "string",required=true,description = "活动id")
 | 
						||
     * @ApiParams(name = "image", type = "string",required=true,description = "加群二维码")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function edit_qrcode(){
 | 
						||
//        $this->transactionCheck();
 | 
						||
        $user_id = 0;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        $id =  $this->request->post('id/d', ''); //订单号
 | 
						||
        $image =  $this->request->post('image/s', ''); //订单号
 | 
						||
        try{
 | 
						||
            //当前申请状态
 | 
						||
            $res = $this->model->editQrcode($user_id,$id,$image,true);
 | 
						||
        }catch (\Throwable $e){
 | 
						||
            $this->error($e->getMessage());
 | 
						||
        }
 | 
						||
        $this->success('活动更换入群二维码成功', $res);
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * @ApiTitle( 活动删除)
 | 
						||
     * @ApiSummary(活动删除))
 | 
						||
     * @ApiMethod(POST)
 | 
						||
     * @ApiParams(name = "id", type = "string",required=true,description = "活动id")
 | 
						||
     * @ApiReturn({
 | 
						||
     *
 | 
						||
     *})
 | 
						||
     */
 | 
						||
    public function del(){
 | 
						||
        $this->transactionCheck();
 | 
						||
        $user_id = 0;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        $id =  $this->request->post('id/d', 0); //订单号
 | 
						||
        if(!$id) $this->error("请传入活动id");
 | 
						||
        try{
 | 
						||
            //当前申请状态
 | 
						||
            $res = $this->model->activity_delete($id,'user',$user_id,true);
 | 
						||
        }catch (\Throwable $e){
 | 
						||
            $this->error($e->getMessage().$e->getFile() .$e->getLine());
 | 
						||
        }
 | 
						||
        $this->success('活动删除成功');
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
    /**
 | 
						||
     * 用户活动及订单主动触发检测
 | 
						||
     */
 | 
						||
    public function activity_check()
 | 
						||
    {
 | 
						||
        $user_id = 0;
 | 
						||
        $user = $this->auth->getUser();//登录用户
 | 
						||
        if($user)$user_id = $user['id'];
 | 
						||
        try{
 | 
						||
 | 
						||
            \app\common\model\school\activity\order\Order::timeoutCheck(0,$user_id,true);
 | 
						||
            Activity::userTimeoutCheck($user_id,true);
 | 
						||
            SettleLog::timeoutCheck(null,$user_id,true);
 | 
						||
 | 
						||
        }catch (\Exception $e){
 | 
						||
            $this->error("执行失败:".$e->getMessage());
 | 
						||
        }
 | 
						||
        $this->success("执行成功");
 | 
						||
    }
 | 
						||
 | 
						||
 | 
						||
 | 
						||
 | 
						||
}
 | 
						||
 |