user_id,11); $search_arr = []; $where_str = 'b.id > 0'; foreach ($search_log as $t){ $search_arr[] = " b.title like '".'%'.$t."%'" .' '; $search_arr[] = " b.label like '".'%'.$t."%'" .' '; } if(!empty($search_arr)) $where_str = implode(' OR ',$search_arr); $field = 'a.id,cover,a.user_id,title,a.status,address,label,start_time,end_time,ladder,price,IFNULL(is_recommend,0) is_recommend '; $table = 'dd_activity'; $order_by_two = 'read_num'; $sql = "SELECT $field FROM " .$table . " a LEFT JOIN ( SELECT id,IF(id,1,1) is_recommend FROM $table b WHERE ( $where_str )) AS c ON c.id = a.id WHERE a.is_deleted = 0 AND a.status = 1 ORDER BY is_recommend DESC , $order_by_two desc LIMIT {$this->off_set},{$this->page_num}"; $list = Db::query($sql); array_walk($list,function (&$v,$k){ $v['is_apply'] = ActivityApply::checkApply($this->user_id,$v['id']); $v['label_name'] = $v['label'] ? explode(',',trim($v['label'],',')): null; }); $this->success('ok',['list'=>$list]); } /** * @title 获取活动列表 * @desc 获取活动列表 * @author qc * @method GET * @url /api/Activity/getActivityList * @header name:Authorization require:1 desc:Token * @param name:title type:string default:-- desc:标题 * @param name:page type:int default:0 desc:页数 * @param name:page_num type:int default:20 desc:每页数 * @param name:sort_type type:int default:1 desc:1默认2时间升序3时间降序 * @return name:title type:string default:-- desc:标题 * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:status type:int default:-- desc:活动状态1正常2取消 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:content type:string default:-- desc:详情 * @return name:create_at type:string default:-- desc:时间 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] * @return name:is_apply type:int default:0 desc:是否报名【0否1是】 */ public function getActivityList(){ $title = input('get.title'); $sort_type = input('get.sort_type',1); switch ($sort_type) { case 1: $order = ['sort'=>'desc','id'=>'desc']; break; case 2: $order = ['id'=>'asc','sort'=>'desc']; break; case 3: $order = ['id'=>'desc','sort'=>'desc']; break; } if($title && $this->user_id) UserSearch::saveSearchTitle($this->user_id,$title,11); $list = \app\common\model\Activity::where(['is_deleted'=>0,'status'=>1]) ->when($title,function ($query)use($title){ if($title) $query->where('title|label','like','%'.$title.'%'); })->order($order)->limit($this->off_set,$this->page_num)->select()->toArray(); foreach ($list as &$v) { $v['cover_arr'] = $v['cover'] ? explode('|',$v['cover']) : null; $v['label_name'] = $v['label'] ? explode(',',trim($v['label'],',')): null; $v['is_apply'] = ActivityApply::checkApply($this->user_id,$v['id']); $v['ladder_arr'] = json_decode($v['ladder'],true); } $this->success('ok',['list'=>$list]); } /** * @title 获取活动详情 * @desc 获取活动详情 * @author qc * @method GET * @url /api/Activity/getActivityDetail * @header name:Authorization require:1 desc:Token * @param name:id type:int default:-- desc:活动id * @return name:title type:string default:-- desc:标题 * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:status type:int default:-- desc:活动状态1正常2取消 * @return name:content type:string default:-- desc:详情 * @return name:create_at type:string default:-- desc:时间 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] * @return name:is_apply type:int default:0 desc:是否报名【0否1是】 * @return name:praise_num type:int default:-- desc:点赞量 * @return name:is_praise type:int default:-- desc:是否点赞【0否1是】 * @return name:is_collect type:int default:-- desc:是否收藏【0否1是】 * @return name:collect_num type:int default:-- desc:收藏量 * @return name:transmit_num type:int default:-- desc:转发量 * @return name:app_name type:string default:-- desc:发布方名称 * @return name:app_logo type:string default:-- desc:发布方头像 * @return name:ladder_arr type:array default:-- desc:价格阶梯设置 * @return name:ladder_arr.ladder_num type:int default:-- desc:人数 * @return name:ladder_arr.ladder_num type:float default:-- desc:价格 */ public function getActivityDetail() { $sel_where[] = ['id','=',input('get.id')]; $detail = \app\common\model\Activity::where($sel_where)->find()->toArray(); $detail['cover_arr'] = $detail['cover'] ? explode('|',$detail['cover']) : null; $detail['label_name'] = $detail['label'] ? explode(',',trim($detail['label'],',')): null; $detail['is_apply'] = ActivityApply::checkApply($this->user_id,$detail['id']); $detail['is_praise'] = PlatformLike::checkTags($this->user_id,$detail['id'],4); $detail['praise_num'] = PlatformLike::getPraiseNum($detail['id'],4); $detail['is_collect'] = UserCollect::checkCollectByType($this->user_id,7,$detail['id']); $detail['collect_num'] = UserCollect::getCollectNum(7,$detail['id']); $detail['ladder_arr'] = $detail['ladder'] ? json_decode($detail['ladder']): null; if(!$detail['user_id']){ $detail['app_name'] = sysconf('app_name'); $detail['app_logo'] = sysconf('app_logo'); }else{ $user_info = User::where('id',$detail['user_id'])->field('name,headimg')->find(); $detail['app_name'] = $user_info ? $user_info->name : ''; $detail['app_logo'] = $user_info ? $user_info->headimg : ''; } UserTrack::crateTrack($this->user_id,7,input('get.id'),0); $this->success('ok',['detail'=>$detail]); } /** * @title 以下接口调用验证登录【需要header传Authorization】 * @desc 以下接口调用验证登录 * @author qc * @method * @url /api/Activity/needLogin() */ public function needLogin(){} /** * @title 点赞||取消点赞 * @desc 点赞||取消点赞 * @author qc * @method POST * @url /api/Activity/activityTags * @header name:Authorization require:1 desc:Token * @param name:id type:int default:1 desc:活动id * @return name:tags type:int default:1 desc:0取消成功,1点赞成功 */ public function activityTags() { $ret_val = PlatformLike::userTags($this->user_id,input('post.id'),4); $this->success($ret_val == 1 ?'点赞成功':'取消成功',['tags'=>$ret_val]); } /** * @title 收藏||取消收藏 * @desc 用户收藏 * @author qc * @method POST * @url /api/Activity/activityCollect * @header name:Authorization require:1 desc:Token * @param name:id type:int require:1 default:-- desc:活动id * @param name:status type:int default:0 desc:收藏状态(0取消收藏【未收藏】,1收藏) */ public function activityCollect(){ $coll_status = UserCollect::plateCollect($this->user_id,7,input('post.id',0)); $coll_status ? $this->success('收藏成功',['status'=>1]) : $this->success('取消收藏成功',['status'=>0]); } /** * @title 活动转发(转发数量统计) * @desc 转发成功后调用 * @author qc * @method POST * @url /api/Activity/activityTransmit * @header name:Authorization require:1 desc:Token * @param name:id type:int default:-- desc:活动id */ public function activityTransmit() { $activity_id = input('post.id',0); \app\common\model\Activity::where('id',$activity_id)->setInc('transmit_num'); $this->success('ok'); } /** * @title 活动报名 * @desc 活动报名[生成订单(报名记录),返回支付信息] * @author qc * @method POST * @url /api/Activity/activityApply * @header name:Authorization require:1 desc:Token * @param name:act_id type:int default:-- desc:活动id * @param name:name type:string default:-- desc:联系人 * @param name:phone type:string default:-- desc:联系人电话 * @param name:email type:string default:-- desc:email * @param name:num type:int default:-- desc:报名人数 * @param name:phone_code type:int default:-- desc:短信验证码 * @param name:pay_type type:int require:1 default:0 desc:支付方式(1.h5微信,2.h5支付宝,3.app微信,4.app支付宝,5.h5微信内支付) * @param name:port type:int default:1 desc:来源【1:h5,2:安卓,3:ios】 * * @return name:pay_status type:int default:0 desc:该值为1:订单金额是0不需要支付!!! * @return name:config type:array default:0 desc:支付配置 * @return name:config.appId type:string default:-- desc:公众账号ID * @return name:config.signType type:string default:-- desc:签名类型 * @return name:config.paySign type:string default:-- desc:签名 * @return name:config.nonceStr type:string default:-- desc:随机字符串 * @return name:config.timestamp type:string default:-- desc:时间戳 * @return name:config.partnerid type:string default:-- desc:商户号 * @return name:config.prepayid type:string default:-- desc:唯一支付号 * @return name:config.package type:string default:-- desc:package * @return name:config.mch_id type:string default:-- desc:商户号(H5) * @return name:config.pay_no type:string default:-- desc:订单支付号(H5) * @return name:config.notify_url type:string default:-- desc:回调地址(H5) * @return name:config.total_fee type:int default:-- desc:支付金额(分!!!) * @return name:code_url type:string default:-- desc:付款码url * @return name:openid type:string default:-- desc:openid */ public function activityApply() { $act_id = input('post.act_id'); $name = input('post.name'); $phone = input('post.phone'); $email = input('post.email'); $num = input('post.num',1); $port = input('post.port',1); $phone_code = input('post.phone_code'); $pay_type = input('post.pay_type',1); if(!$name || !$phone || !$email) $this->error('请完善报名信息'); if(!in_array($pay_type,[1,2,3,4,5])) $this->error('支付方式错误'); if($num <= 0) $this->error('请输入报名人数'); $check_apply = ActivityApply::checkApply($this->user_id,$act_id); //if($check_apply) $this->error('已报名!'); $act_info = \app\common\model\Activity::where('id',$act_id)->where('is_deleted',0)->find(); if(!$act_info) $this->error('活动不存在'); if(strtotime($act_info->end_time) < time() ) $this->error('活动已经结束'); if(strtotime($act_info->start_time) < time() ) $this->error('活动已经开始'); if($act_info->status == 2) $this->error('活动已经取消'); $check_code = $this->checkPhoneCode($phone,$phone_code); // if(!$check_code) $this->error('验证码错误'); $this->updatePhoneCode($check_code); $ladder = $act_info->ladder ? json_decode($act_info->ladder,true) : []; $order_money = bcmul($act_info->price,$num,2); if(!empty($ladder)) { $ladder_set = array_column($ladder,null,'ladder_num'); krsort($ladder_set); $max_num = array_column($ladder_set,'ladder_num'); $min_num = array_column($ladder_set,'ladder_num'); if($max_num < $num) { $order_money = bcmul($ladder_set[$max_num]['ladder_price'],$num,2); }else if ($min_num > $num){ foreach ($ladder_set as $lk=>$lv) { if($lk <= $num){ $order_money = bcmul($lv['ladder_price'],$num,2); break; } } } } if($order_money < 0 )$this->error('报名费不能小于0'); $apply_info = [ 'user_id' => $this->user_id, 'order_no' => get_order_sn(), 'pay_no' => get_order_sn(), 'num' => $num, 'name' => $name, 'phone' => $phone, 'email' => $email, 'pay_type' => $pay_type, 'money' => $order_money, 'port' => $port, 'act_id' => $act_id, ]; $user_info = User::where('id',$this->user_id)->find(); $ret_data = ['pay_status'=>0,'config'=>[],'code_url'=>'','openid'=>$user_info['openid'],'order_id'=>0]; Db::startTrans(); try { $order_info = ActivityApply::create($apply_info)->toArray(); if($order_money == 0) { $back_res = OrderCallback::activityOrderCallBack($order_info);// 支付完成后回调 if(!$back_res['ret_val']) $this->exception('报名失败'); $ret_data['pay_status'] = 1; }else{ $ret_data['order_id'] = $order_info['id']; switch ($pay_type){ case 1: $notify_url = $this->request->root(true) . '/api/we_chat_pay/applyOrderNotify'; $pay_config = WeChatPay::wxPay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,'MWEB'); if($pay_config['code'] != 200) $this->exception($pay_config['msg']); $pay_config['config']['mch_id'] = config('app.wx_pay')['mch_id']; $pay_config['config']['pay_no'] = $order_info['pay_no']; $pay_config['config']['notify_url'] = $notify_url; $pay_config['config']['mweb_url'] = $pay_config['mweb_url']; $pay_config['config']['total_fee'] = $order_info['money'] * 100; $ret_data['config'] = $pay_config['config']; break; case 2: $notify_url = $this->request->root(true) . '/api/Alipay/applyOrderNotify'; $return_url ='https://'.$_SERVER['HTTP_HOST']."/dist/#/my"; $config = Alipay::ali_pay_pc('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,$return_url); $ret_data['config']['ali_url'] = $config; $ret_data['ali_url'] = $config; break; case 3: $notify_url = $this->request->root(true) . '/api/we_chat_pay/applyOrderNotify'; $pay_config = WeChatPay::wxPay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,'APP'); if($pay_config['code'] != 200) $this->exception($pay_config['msg']); $ret_data['config'] = $pay_config['config']; break; case 4: $notify_url = $this->request->root(true) . '/api/Alipay/LevelOrderNotify'; $config = Alipay::ali_pay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url); $ret_data['config']['ali_url'] = $config; $ret_data['ali_url'] = $config; $ret_data['money'] = $order_info['money']; break; case 5 : if(!$user_info['openid']) $this->exception('请绑定openid'); $notify_url = $this->request->root(true) . '/api/we_chat_pay/applyOrderNotify'; $pay_config = WeChatPay::wxPay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,'JSAPI',$user_info['openid']); if($pay_config['code'] != 200) $this->exception($pay_config['msg']); $ret_data['config'] = $pay_config['config']; break; } } Db::commit(); }catch (\Exception $e){ Db::rollback(); $this->error($e->getMessage()); } $this->success('报名成功',$ret_data); } /** * @title 活动报名订单支付 * @desc 活动报名订单支付 * @author qc * @method POST * @url /api/Activity/payApplyOrder * @header name:Authorization require:1 desc:Token * @param name:order_id type:int default:-- desc:订单id【报名记录id】 * * @return name:pay_status type:array default:0 desc:该值为1:订单金额是0不需要支付!!! * @return name:config type:array default:0 desc:支付配置 * @return name:config.appId type:string default:-- desc:公众账号ID * @return name:config.signType type:string default:-- desc:签名类型 * @return name:config.paySign type:string default:-- desc:签名 * @return name:config.nonceStr type:string default:-- desc:随机字符串 * @return name:config.timestamp type:string default:-- desc:时间戳 * @return name:config.partnerid type:string default:-- desc:商户号 * @return name:config.prepayid type:string default:-- desc:唯一支付号 * @return name:config.package type:string default:-- desc:package * @return name:config.mch_id type:string default:-- desc:商户号(H5) * @return name:config.pay_no type:string default:-- desc:订单支付号(H5) * @return name:config.notify_url type:string default:-- desc:回调地址(H5) * @return name:config.total_fee type:int default:-- desc:支付金额(分!!!) * @return name:code_url type:string default:-- desc:付款码url * @return name:openid type:string default:-- desc:openid */ public function payApplyOrder() { $order_id = input('post.order_id'); $order_info = ActivityApply::where('id',$order_id)->find()->toArray(); if($order_info['status'] != 0) $this->error('订单状态错误'); if($order_info['cancel_state'] != 0 || $order_info['is_deleted'] != 0) $this->error('订单异常'); if($order_info['money'] <= 0) $this->error('订单金额错误'); $pay_type = $order_info['pay_type']; $user_info = User::where('id',$this->user_id)->find(); $ret_data = ['pay_status'=>0,'config'=>[],'code_url'=>'','openid'=>$user_info['openid'],'order_id'=>0]; Db::startTrans(); try { switch ($pay_type){ case 1: $notify_url = $this->request->root(true) . '/api/we_chat_pay/applyOrderNotify'; $pay_config = WeChatPay::wxPay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,'MWEB'); if($pay_config['code'] != 200) $this->exception($pay_config['msg']); $pay_config['config']['mch_id'] = config('app.wx_pay')['mch_id']; $pay_config['config']['pay_no'] = $order_info['pay_no']; $pay_config['config']['notify_url'] = $notify_url; $pay_config['config']['mweb_url'] = $pay_config['mweb_url']; $pay_config['config']['total_fee'] = $order_info['money'] * 100; $ret_data['config'] = $pay_config['config']; break; case 2: $notify_url = $this->request->root(true) . '/api/Alipay/applyOrderNotify'; $return_url ='https://'.$_SERVER['HTTP_HOST']."/dist/#/my"; $config = Alipay::ali_pay_pc('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,$return_url); $ret_data['config']['ali_url'] = $config; $ret_data['ali_url'] = $config; break; case 3: $notify_url = $this->request->root(true) . '/api/we_chat_pay/applyOrderNotify'; $pay_config = WeChatPay::wxPay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,'APP'); if($pay_config['code'] != 200) $this->exception($pay_config['msg']); $ret_data['config'] = $pay_config['config']; break; case 4: $notify_url = $this->request->root(true) . '/api/Alipay/LevelOrderNotify'; $config = Alipay::ali_pay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url); $ret_data['config']['ali_url'] = $config; $ret_data['ali_url'] = $config; $ret_data['money'] = $order_info['money']; break; case 5 : if(!$user_info['openid']) $this->exception('请绑定openid'); $notify_url = $this->request->root(true) . '/api/we_chat_pay/applyOrderNotify'; $pay_config = WeChatPay::wxPay('订单支付',$order_info['pay_no'],$order_info['money'],$notify_url,'JSAPI',$user_info['openid']); if($pay_config['code'] != 200) $this->exception($pay_config['msg']); $ret_data['config'] = $pay_config['config']; break; } Db::commit(); }catch (\Exception $e){ Db::rollback(); $this->error($e->getMessage()); } $this->success('ok',$ret_data); } /** * @title 我的发布列表 * @desc 我的发布列表 * @author qc * @method GET * @url /api/Activity/getMyActivityList * @header name:Authorization require:1 desc:Token * @param name:title type:string default:-- desc:标题 * @param name:page type:int default:0 desc:页数 * @param name:page_num type:int default:20 desc:每页数 * @return name:title type:string default:-- desc:标题 * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:content type:string default:-- desc:详情 * @return name:create_at type:string default:-- desc:时间 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] */ public function getMyActivityList(){ $title = input('get.title'); $list = \app\common\model\Activity::where(['is_deleted'=>0,'user_id'=>$this->user_id]) ->when($title,function ($query)use($title){ if($title) $query->where('title|label','like','%'.$title.'%'); })->order( ['sort'=>'desc','id'=>'desc'])->limit($this->off_set,$this->page_num)->select()->toArray(); foreach ($list as &$v) { $v['cover_arr'] = $v['cover'] ? explode('|',$v['cover']) : null; $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null; } $this->success('ok',['list'=>$list]); } /** * @title 我的收藏【活动】 * @desc 我的收藏 * @author qc * @method GET * @url /api/Activity/getCollectActivity * @header name:Authorization require:1 desc:Token * @param name:title type:string default:-- desc:标题 * @param name:page type:int default:0 desc:页数 * @param name:page_num type:int default:20 desc:每页数 * @return name:title type:string default:-- desc:标题 * @return name:activity_id type:string default:-- desc:活动id * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:content type:string default:-- desc:详情 * @return name:create_at type:string default:-- desc:时间 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] */ public function getCollectActivity() { $sel_where = []; $title = input('get.title'); if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%']; $sel_where[] = ['t.user_id','=',$this->user_id]; $sel_where[] = ['t.coll_type','=',7]; $list = UserCollect::where($sel_where) ->alias('t') ->field('t.id,t.create_at,t.coll_id activity_id,i.title,i.cover,i.label,i.content,i.start_time,i.end_time,i.address,i.price') ->leftJoin('Activity i','t.coll_id = i.id') ->order('id desc') ->limit($this->off_set,$this->page_num) ->select()->toArray(); foreach ($list as &$v) { $v['cover_arr'] = $v['cover'] ? explode('|',$v['cover']) : null; $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null; } $this->success('ok',['list'=>$list]); } /** * @title 浏览记录【活动】 * @desc 浏览记录 * @author qc * @method GET * @url /api/Activity/getActivityTrack * @header name:Authorization require:1 desc:Token * @param name:title type:string default:-- desc:标题 * @param name:page type:int default:0 desc:页数 * @param name:page_num type:int default:20 desc:每页数 * @return name:title type:string default:-- desc:标题 * @return name:activity_id type:string default:-- desc:活动id * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:content type:string default:-- desc:详情 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] * @return name:time type:string default:-- desc:时间 */ public function getActivityTrack() { $sel_where = []; $sel_where[] = ['t.user_id','=',$this->user_id]; $sel_where[] = ['t.type','=',4]; $title = input('get.title'); if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%']; $list = UserTrack::where($sel_where) ->alias('t') ->field('t.id,t.update_int,t.first_id activity_id,i.title,i.cover,i.label,i.content,i.start_time,i.end_time,i.address,i.price') ->leftJoin('Activity i','t.first_id = i.id') ->order('update_int desc') ->limit($this->off_set,$this->page_num) ->select()->toArray(); foreach ($list as &$v) { $v['time'] = date("Y-m-d H:i:s",$v['update_int']); $v['cover_arr'] = $v['cover'] ? explode('|',$v['cover']) : null; $v['label_name'] = $v['label']? explode(',',trim($v['label'],',')) : null; } $this->success('ok',['list'=>$list]); } /** * @title 我的点赞【活动】 * @desc 我的点赞 * @author qc * @method GET * @url /api/Activity/getTagsActivity * @header name:Authorization require:1 desc:Token * @param name:title type:string default:-- desc:标题 * @param name:page type:int default:0 desc:页数 * @param name:page_num type:int default:20 desc:每页数 * @return name:title type:string default:-- desc:标题 * @return name:activity_id type:string default:-- desc:活动id * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:content type:string default:-- desc:详情 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] */ public function getTagsActivity() { $sel_where = []; $title = input('get.title'); if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%']; $sel_where[] = ['t.user_id','=',$this->user_id]; $sel_where[] = ['t.type','=',4]; $list = PlatformLike::where($sel_where) ->alias('t') ->field('t.id,t.create_at,t.like_id activity_id,i.title,i.cover,i.label,i.content,i.start_time,i.end_time,i.address,i.price') ->leftJoin('Activity i','t.like_id = i.id') ->order('id desc') ->limit($this->off_set,$this->page_num) ->select()->toArray(); foreach ($list as &$v) { $v['cover_arr'] = $v['cover'] ? explode('|',$v['cover']) : null; $v['label_name'] = $v['label'] ? explode(',',trim($v['label'],',')): null; } $this->success('ok',['list'=>$list]); } /** * @title 我的报名【活动】 * @desc 我的报名 * @author qc * @method GET * @url /api/Activity/getApplyList * @header name:Authorization require:1 desc:Token * @param name:title type:string default:-- desc:标题 * @param name:page type:int default:0 desc:页数 * @param name:page_num type:int default:20 desc:每页数 * @return name:title type:string default:-- desc:标题 * @return name:activity_id type:string default:-- desc:活动id * @return name:status type:int default:-- desc:活动状态1正常2取消 * @return name:cover type:string default:-- desc:图片多张|隔开 * @return name:cover_arr type:array default:-- desc:图片多张[数组] * @return name:content type:string default:-- desc:详情 * @return name:start_time type:string default:-- desc:开始时间 * @return name:end_time type:string default:-- desc:结束时间 * @return name:address type:string default:-- desc:地址 * @return name:price type:float default:-- desc:价格 * @return name:label type:string default:-- desc:标签[多个','隔开] * @return name:label_name type:array default:-- desc:标签[数组] */ public function getApplyList() { $sel_where = []; $title = input('get.title'); if($title) $sel_where[] = ['i.title|i.label','like','%'.$title.'%']; $sel_where[] = ['t.user_id','=',$this->user_id]; $sel_where[] = ['t.status','=',1]; $list = ActivityApply::where($sel_where) ->field('t.id,t.order_no,t.act_id activity_id,i.title,i.status,i.cover,i.label,i.content,i.start_time,i.end_time,i.address,i.price') ->alias('t') ->leftJoin('Activity i','t.act_id = i.id') ->order(['t.id'=>'desc']) ->limit($this->off_set,$this->page_num) ->select()->toArray(); foreach ($list as &$v) { $v['cover_arr'] = $v['cover'] ? explode('|',$v['cover']) : null; $v['label_name'] = $v['label'] ? explode(',',trim($v['label'],',')): null; } $this->success('ok',['list'=>$list]); } }