error('参数错误'); $app_type = input('post.app_type',1); $app_info = [ 'user_id' =>$this->user_id, 'app_id' =>$app_id, 'app_type' =>$app_type, 'create_at' =>date('Y-m-d H:i:s'), ]; Data::save('UserAppointment',$app_info,'user_id',[ 'user_id' =>$this->user_id, 'app_id' =>$app_id,'app_type' =>input('post.app_type',1)]); $this->success('预约成功'); } /** * @title 获取预约记录 * @desc 获取预约记录 * @author qc * @method GET * @url /api/Appointment/user_info * @header name:Authorization require:1 desc:Token * @param name:id type:int default:0 desc:视频id(不传查全部的视频商品) * @param name:page type:int default:1 desc:页数 * @param name:page_num type:int default:20 desc:每页数量 * @return name:id type:int default:-- desc:预约记录id * @return name:app_id type:int default:-- desc:预约商品id * @return name:name type:string default:-- desc:商品名称 * @return name:cover type:string default:-- desc:商品封面 * @return name:create_at type:string default:-- desc:时间 */ public function getUserAppointmentList() { $list = UserAppointment::field('a.id,a.app_id,a.create_at,g.name,g.cover') ->alias('a') ->leftJoin('StoreGoods g','g.id = a.app_id') ->order('a.create_at desc ,a.id desc') ->limit($this->off_set,$this->page_num) ->select()->toArray(); $this->success('ok',['list'=>$list]); } /** * @title 取消预约 * @desc 取消预约 * @author qc * @method POST * @url /api/Appointment/cancelAppointment * @header name:Authorization require:1 desc:Token * @param name:ids type:string : default:'' desc:需要删除的id记录(用逗号隔开) */ public function cancelAppointment() { $ids = input('post.ids',''); if(!$ids) $this->error('请选择要取消预约的记录'); UserAppointment::where('id','in',$ids)->where('user_id','=',$this->user_id)->delete(); $this->success('取消成功'); } }