作者 何书鹏
1 个管道 的构建 通过 耗费 0 秒

合并分支 'heshupeng' 到 'master'

收藏笔记



查看合并请求 !4
... ... @@ -18,6 +18,8 @@ use app\mobile\model\SecretOrder;
use app\mobile\model\ScoreSpec;
use app\mobile\model\ScoreOrder;
use app\mobile\model\QuestionCollect;
use app\mobile\model\CourseCollect;
use app\mobile\model\QuestionNote;
use addons\epay\library\Service;
/**
... ... @@ -861,4 +863,115 @@ class User extends Api
})->toArray();
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
}
/**
* @ApiWeigh (49)
* @ApiTitle (我的收藏-课程)
* @ApiSummary (我的收藏-课程)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1600164731",
"data": {
"total": 1, //数据总数
"list": [{
"id": 1,
"user_id": 16, //用户ID
"course_id": 1, //课程ID
"createtime": "2020.09.03 19:25", //收藏时间
"course": { //课程信息
"title": "测试课程", //课程标题
"cover": "", //课程封面图
"current_price": "50.00", //现价
"original_price": "100.00" //原价
}
}]
}
})
*/
public function collectCourseList()
{
$page = $this->request->param('page', 1, 'intval');
$page_num = $this->request->param('page_num', 10, 'intval');
$data = CourseCollect::with(['course'])
->where('user_id',$this->auth->id)
->order('createtime desc')
->paginate($page_num,false,['page'=>$page])
->each(function($v){
$v['createtime'] = date('Y.m.d H:i',$v['createtime']);
$v->getRelation('course')->visible(['cover','title','current_price','original_price','study_num']);
})->toArray();
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
}
/**
* @ApiWeigh (47)
* @ApiTitle (我的收藏-笔记)
* @ApiSummary (我的收藏-笔记)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
* @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1600164731",
"data": {
"total": 1, //数据总数
"list": [{
"id": 1,
"user_id": 16, //用户ID
"course_id": 1, //课程ID
"createtime": "2020.09.03 19:25", //收藏时间
"course": { //课程信息
"title": "测试课程", //课程标题
"cover": "", //课程封面图
"current_price": "50.00", //现价
"original_price": "100.00" //原价
}
}]
}
}{
"code": 1,
"msg": "成功",
"time": "1600165190",
"data": {
"total": 1, //数据总数
"list": [{
"id": 3,
"user_id": 16, //用户ID
"question_id": 5, //题目ID
"content": "这就是街舞", //笔记内容
"createtime": "2020.09.10 19:15", //收藏时间
"updatetime": 1599736531,
"question": { //题目信息
"title": "测试多选", //题目标题
"type": "2" //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
}
}]
}
})
*/
public function collectNoteList()
{
$page = $this->request->param('page', 1, 'intval');
$page_num = $this->request->param('page_num', 10, 'intval');
$data = QuestionNote::with(['question'])
->where('user_id',$this->auth->id)
->order('createtime desc')
->paginate($page_num,false,['page'=>$page])
->each(function($v){
$v['createtime'] = date('Y.m.d H:i',$v['createtime']);
$v->getRelation('question')->visible(['title','type']);
})->toArray();
$this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
}
}
\ No newline at end of file
... ...
<?php
namespace app\mobile\model;
use think\Model;
class CourseCollect extends Model
{
// 表名
protected $name = 'mobile_course_collect';
// 开启自动写入时间戳字段
protected $autoWriteTimestamp = 'int';
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = false;
// 课程
public function course(){
return $this->belongsTo('Course');
}
}
\ No newline at end of file
... ...
... ... @@ -12,4 +12,9 @@ class QuestionNote extends Model
// 定义时间戳字段名
protected $createTime = 'createtime';
protected $updateTime = 'updatetime';
// 题目信息
public function question(){
return $this->belongsTo('Question');
}
}
\ No newline at end of file
... ...
... ... @@ -238,6 +238,8 @@
<a href="javascript:;" data-id="72" class="list-group-item">积分充值预览</a>
<a href="javascript:;" data-id="73" class="list-group-item">充值积分</a>
<a href="javascript:;" data-id="74" class="list-group-item">我的收藏-题目</a>
<a href="javascript:;" data-id="75" class="list-group-item">我的收藏-课程</a>
<a href="javascript:;" data-id="76" class="list-group-item">我的收藏-笔记</a>
</div>
<a href="#支付异步接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">支付异步接口 <i class="fa fa-caret-down"></i></a>
<div class="child collapse" id="支付异步接口">
... ... @@ -10252,6 +10254,340 @@
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-75">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion75" href="#collapseOne75"> 我的收藏-课程 <span class="text-muted">/mobile/user/collectCourseList</span></a>
</h4>
</div>
<div id="collapseOne75" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab75">
<li class="active"><a href="#info75" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox75" data-toggle="tab">在线测试</a></li>
<li><a href="#sample75" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info75">
<div class="well">
我的收藏-课程 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>token</td>
<td>string</td>
<td></td>
<td>请求的Token</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>page</td>
<td>inter</td>
<td></td>
<td>当前页(默认1</td>
</tr>
<tr>
<td>page_num</td>
<td>inter</td>
<td></td>
<td>每页显示数据个数(默认10)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox75">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<div class="headers">
<div class="form-group">
<label class="control-label" for="token">token</label>
<input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/user/collectCourseList" method="POST" name="form75" id="form75">
<div class="form-group">
<label class="control-label" for="page">page</label>
<input type="inter" class="form-control input-sm" id="page" placeholder="当前页(默认1" name="page">
</div>
<div class="form-group">
<label class="control-label" for="page_num">page_num</label>
<input type="inter" class="form-control input-sm" id="page_num" placeholder="每页显示数据个数(默认10)" name="page_num">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="75">提交</button>
<button type="reset" class="btn btn-info" rel="75">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers75"></pre>
<pre id="response75"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample75">
<div class="row">
<div class="col-md-12">
<pre id="sample_response75">{
"code": 1,
"msg": "成功",
"time": "1600164731",
"data": {
"total": 1, //数据总数
"list": [{
"id": 1,
"user_id": 16, //用户ID
"course_id": 1, //课程ID
"createtime": "2020.09.03 19:25", //收藏时间
"course": { //课程信息
"title": "测试课程", //课程标题
"cover": "", //课程封面图
"current_price": "50.00", //现价
"original_price": "100.00" //原价
}
}]
}
}</pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading" id="heading-76">
<h4 class="panel-title">
<span class="label label-primary">POST</span>
<a data-toggle="collapse" data-parent="#accordion76" href="#collapseOne76"> 我的收藏-笔记 <span class="text-muted">/mobile/user/collectNoteList</span></a>
</h4>
</div>
<div id="collapseOne76" class="panel-collapse collapse">
<div class="panel-body">
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="doctab76">
<li class="active"><a href="#info76" data-toggle="tab">基础信息</a></li>
<li><a href="#sandbox76" data-toggle="tab">在线测试</a></li>
<li><a href="#sample76" data-toggle="tab">返回示例</a></li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active" id="info76">
<div class="well">
我的收藏-笔记 </div>
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>token</td>
<td>string</td>
<td></td>
<td>请求的Token</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<table class="table table-hover">
<thead>
<tr>
<th>名称</th>
<th>类型</th>
<th>必选</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td>page</td>
<td>inter</td>
<td></td>
<td>当前页(默认1</td>
</tr>
<tr>
<td>page_num</td>
<td>inter</td>
<td></td>
<td>每页显示数据个数(默认10)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>正文</strong></div>
<div class="panel-body">
</div>
</div>
</div><!-- #info -->
<div class="tab-pane" id="sandbox76">
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading"><strong>Headers</strong></div>
<div class="panel-body">
<div class="headers">
<div class="form-group">
<label class="control-label" for="token">token</label>
<input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>参数</strong></div>
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/user/collectNoteList" method="POST" name="form76" id="form76">
<div class="form-group">
<label class="control-label" for="page">page</label>
<input type="inter" class="form-control input-sm" id="page" placeholder="当前页(默认1" name="page">
</div>
<div class="form-group">
<label class="control-label" for="page_num">page_num</label>
<input type="inter" class="form-control input-sm" id="page_num" placeholder="每页显示数据个数(默认10)" name="page_num">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="76">提交</button>
<button type="reset" class="btn btn-info" rel="76">重置</button>
</div>
</form>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>响应输出</strong></div>
<div class="panel-body">
<div class="row">
<div class="col-md-12" style="overflow-x:auto">
<pre id="response_headers76"></pre>
<pre id="response76"></pre>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading"><strong>返回参数</strong></div>
<div class="panel-body">
</div>
</div>
</div>
</div>
</div><!-- #sandbox -->
<div class="tab-pane" id="sample76">
<div class="row">
<div class="col-md-12">
<pre id="sample_response76">{
"code": 1,
"msg": "成功",
"time": "1600164731",
"data": {
"total": 1, //数据总数
"list": [{
"id": 1,
"user_id": 16, //用户ID
"course_id": 1, //课程ID
"createtime": "2020.09.03 19:25", //收藏时间
"course": { //课程信息
"title": "测试课程", //课程标题
"cover": "", //课程封面图
"current_price": "50.00", //现价
"original_price": "100.00" //原价
}
}]
}
}</pre>
</div>
</div>
</div><!-- #sample -->
</div><!-- .tab-content -->
</div>
</div>
</div>
<h2>支付异步接口</h2>
<hr>
<h2>手机短信接口</h2>
... ... @@ -10382,7 +10718,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-09-15 17:53:19 </div>
Generated on 2020-09-15 18:19:37 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">企智帮</a>
</div>
... ...