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

合并分支 'heshupeng' 到 'master'

收藏笔记



查看合并请求 !4
@@ -18,6 +18,8 @@ use app\mobile\model\SecretOrder; @@ -18,6 +18,8 @@ use app\mobile\model\SecretOrder;
18 use app\mobile\model\ScoreSpec; 18 use app\mobile\model\ScoreSpec;
19 use app\mobile\model\ScoreOrder; 19 use app\mobile\model\ScoreOrder;
20 use app\mobile\model\QuestionCollect; 20 use app\mobile\model\QuestionCollect;
  21 +use app\mobile\model\CourseCollect;
  22 +use app\mobile\model\QuestionNote;
21 use addons\epay\library\Service; 23 use addons\epay\library\Service;
22 24
23 /** 25 /**
@@ -861,4 +863,115 @@ class User extends Api @@ -861,4 +863,115 @@ class User extends Api
861 })->toArray(); 863 })->toArray();
862 $this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]); 864 $this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
863 } 865 }
  866 +
  867 + /**
  868 + * @ApiWeigh (49)
  869 + * @ApiTitle (我的收藏-课程)
  870 + * @ApiSummary (我的收藏-课程)
  871 + * @ApiMethod (POST)
  872 + *
  873 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  874 + * @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
  875 + * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
  876 + *
  877 + * @ApiReturn({
  878 + "code": 1,
  879 + "msg": "成功",
  880 + "time": "1600164731",
  881 + "data": {
  882 + "total": 1, //数据总数
  883 + "list": [{
  884 + "id": 1,
  885 + "user_id": 16, //用户ID
  886 + "course_id": 1, //课程ID
  887 + "createtime": "2020.09.03 19:25", //收藏时间
  888 + "course": { //课程信息
  889 + "title": "测试课程", //课程标题
  890 + "cover": "", //课程封面图
  891 + "current_price": "50.00", //现价
  892 + "original_price": "100.00" //原价
  893 + }
  894 + }]
  895 + }
  896 + })
  897 + */
  898 + public function collectCourseList()
  899 + {
  900 + $page = $this->request->param('page', 1, 'intval');
  901 + $page_num = $this->request->param('page_num', 10, 'intval');
  902 + $data = CourseCollect::with(['course'])
  903 + ->where('user_id',$this->auth->id)
  904 + ->order('createtime desc')
  905 + ->paginate($page_num,false,['page'=>$page])
  906 + ->each(function($v){
  907 + $v['createtime'] = date('Y.m.d H:i',$v['createtime']);
  908 + $v->getRelation('course')->visible(['cover','title','current_price','original_price','study_num']);
  909 + })->toArray();
  910 + $this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
  911 + }
  912 +
  913 + /**
  914 + * @ApiWeigh (47)
  915 + * @ApiTitle (我的收藏-笔记)
  916 + * @ApiSummary (我的收藏-笔记)
  917 + * @ApiMethod (POST)
  918 + *
  919 + * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
  920 + * @ApiParams (name="page", type="inter", required=false, description="当前页(默认1)")
  921 + * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
  922 + *
  923 + * @ApiReturn({
  924 + "code": 1,
  925 + "msg": "成功",
  926 + "time": "1600164731",
  927 + "data": {
  928 + "total": 1, //数据总数
  929 + "list": [{
  930 + "id": 1,
  931 + "user_id": 16, //用户ID
  932 + "course_id": 1, //课程ID
  933 + "createtime": "2020.09.03 19:25", //收藏时间
  934 + "course": { //课程信息
  935 + "title": "测试课程", //课程标题
  936 + "cover": "", //课程封面图
  937 + "current_price": "50.00", //现价
  938 + "original_price": "100.00" //原价
  939 + }
  940 + }]
  941 + }
  942 + }{
  943 + "code": 1,
  944 + "msg": "成功",
  945 + "time": "1600165190",
  946 + "data": {
  947 + "total": 1, //数据总数
  948 + "list": [{
  949 + "id": 3,
  950 + "user_id": 16, //用户ID
  951 + "question_id": 5, //题目ID
  952 + "content": "这就是街舞", //笔记内容
  953 + "createtime": "2020.09.10 19:15", //收藏时间
  954 + "updatetime": 1599736531,
  955 + "question": { //题目信息
  956 + "title": "测试多选", //题目标题
  957 + "type": "2" //题目类型:1=单选题,2=多选题,3=判断题,4=简答题
  958 + }
  959 + }]
  960 + }
  961 +})
  962 + */
  963 + public function collectNoteList()
  964 + {
  965 + $page = $this->request->param('page', 1, 'intval');
  966 + $page_num = $this->request->param('page_num', 10, 'intval');
  967 + $data = QuestionNote::with(['question'])
  968 + ->where('user_id',$this->auth->id)
  969 + ->order('createtime desc')
  970 + ->paginate($page_num,false,['page'=>$page])
  971 + ->each(function($v){
  972 + $v['createtime'] = date('Y.m.d H:i',$v['createtime']);
  973 + $v->getRelation('question')->visible(['title','type']);
  974 + })->toArray();
  975 + $this->success('成功', ['total'=>$data['total'],'list'=>$data['data']]);
  976 + }
864 } 977 }
  1 +<?php
  2 +namespace app\mobile\model;
  3 +
  4 +use think\Model;
  5 +
  6 +class CourseCollect extends Model
  7 +{
  8 + // 表名
  9 + protected $name = 'mobile_course_collect';
  10 + // 开启自动写入时间戳字段
  11 + protected $autoWriteTimestamp = 'int';
  12 + // 定义时间戳字段名
  13 + protected $createTime = 'createtime';
  14 + protected $updateTime = false;
  15 +
  16 + // 课程
  17 + public function course(){
  18 + return $this->belongsTo('Course');
  19 + }
  20 +}
@@ -12,4 +12,9 @@ class QuestionNote extends Model @@ -12,4 +12,9 @@ class QuestionNote extends Model
12 // 定义时间戳字段名 12 // 定义时间戳字段名
13 protected $createTime = 'createtime'; 13 protected $createTime = 'createtime';
14 protected $updateTime = 'updatetime'; 14 protected $updateTime = 'updatetime';
  15 +
  16 + // 题目信息
  17 + public function question(){
  18 + return $this->belongsTo('Question');
  19 + }
15 } 20 }
@@ -238,6 +238,8 @@ @@ -238,6 +238,8 @@
238 <a href="javascript:;" data-id="72" class="list-group-item">积分充值预览</a> 238 <a href="javascript:;" data-id="72" class="list-group-item">积分充值预览</a>
239 <a href="javascript:;" data-id="73" class="list-group-item">充值积分</a> 239 <a href="javascript:;" data-id="73" class="list-group-item">充值积分</a>
240 <a href="javascript:;" data-id="74" class="list-group-item">我的收藏-题目</a> 240 <a href="javascript:;" data-id="74" class="list-group-item">我的收藏-题目</a>
  241 + <a href="javascript:;" data-id="75" class="list-group-item">我的收藏-课程</a>
  242 + <a href="javascript:;" data-id="76" class="list-group-item">我的收藏-笔记</a>
241 </div> 243 </div>
242 <a href="#支付异步接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">支付异步接口 <i class="fa fa-caret-down"></i></a> 244 <a href="#支付异步接口" class="list-group-item" data-toggle="collapse" data-parent="#sidebar">支付异步接口 <i class="fa fa-caret-down"></i></a>
243 <div class="child collapse" id="支付异步接口"> 245 <div class="child collapse" id="支付异步接口">
@@ -10252,6 +10254,340 @@ @@ -10252,6 +10254,340 @@
10252 </div> 10254 </div>
10253 </div> 10255 </div>
10254 </div> 10256 </div>
  10257 + <div class="panel panel-default">
  10258 + <div class="panel-heading" id="heading-75">
  10259 + <h4 class="panel-title">
  10260 + <span class="label label-primary">POST</span>
  10261 + <a data-toggle="collapse" data-parent="#accordion75" href="#collapseOne75"> 我的收藏-课程 <span class="text-muted">/mobile/user/collectCourseList</span></a>
  10262 + </h4>
  10263 + </div>
  10264 + <div id="collapseOne75" class="panel-collapse collapse">
  10265 + <div class="panel-body">
  10266 +
  10267 + <!-- Nav tabs -->
  10268 + <ul class="nav nav-tabs" id="doctab75">
  10269 + <li class="active"><a href="#info75" data-toggle="tab">基础信息</a></li>
  10270 + <li><a href="#sandbox75" data-toggle="tab">在线测试</a></li>
  10271 + <li><a href="#sample75" data-toggle="tab">返回示例</a></li>
  10272 + </ul>
  10273 +
  10274 + <!-- Tab panes -->
  10275 + <div class="tab-content">
  10276 +
  10277 + <div class="tab-pane active" id="info75">
  10278 + <div class="well">
  10279 + 我的收藏-课程 </div>
  10280 + <div class="panel panel-default">
  10281 + <div class="panel-heading"><strong>Headers</strong></div>
  10282 + <div class="panel-body">
  10283 + <table class="table table-hover">
  10284 + <thead>
  10285 + <tr>
  10286 + <th>名称</th>
  10287 + <th>类型</th>
  10288 + <th>必选</th>
  10289 + <th>描述</th>
  10290 + </tr>
  10291 + </thead>
  10292 + <tbody>
  10293 + <tr>
  10294 + <td>token</td>
  10295 + <td>string</td>
  10296 + <td></td>
  10297 + <td>请求的Token</td>
  10298 + </tr>
  10299 + </tbody>
  10300 + </table>
  10301 + </div>
  10302 + </div>
  10303 + <div class="panel panel-default">
  10304 + <div class="panel-heading"><strong>参数</strong></div>
  10305 + <div class="panel-body">
  10306 + <table class="table table-hover">
  10307 + <thead>
  10308 + <tr>
  10309 + <th>名称</th>
  10310 + <th>类型</th>
  10311 + <th>必选</th>
  10312 + <th>描述</th>
  10313 + </tr>
  10314 + </thead>
  10315 + <tbody>
  10316 + <tr>
  10317 + <td>page</td>
  10318 + <td>inter</td>
  10319 + <td></td>
  10320 + <td>当前页(默认1</td>
  10321 + </tr>
  10322 + <tr>
  10323 + <td>page_num</td>
  10324 + <td>inter</td>
  10325 + <td></td>
  10326 + <td>每页显示数据个数(默认10)</td>
  10327 + </tr>
  10328 + </tbody>
  10329 + </table>
  10330 + </div>
  10331 + </div>
  10332 + <div class="panel panel-default">
  10333 + <div class="panel-heading"><strong>正文</strong></div>
  10334 + <div class="panel-body">
  10335 +</div>
  10336 + </div>
  10337 + </div><!-- #info -->
  10338 +
  10339 + <div class="tab-pane" id="sandbox75">
  10340 + <div class="row">
  10341 + <div class="col-md-12">
  10342 + <div class="panel panel-default">
  10343 + <div class="panel-heading"><strong>Headers</strong></div>
  10344 + <div class="panel-body">
  10345 + <div class="headers">
  10346 + <div class="form-group">
  10347 + <label class="control-label" for="token">token</label>
  10348 + <input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
  10349 + </div>
  10350 + </div>
  10351 + </div>
  10352 + </div>
  10353 + <div class="panel panel-default">
  10354 + <div class="panel-heading"><strong>参数</strong></div>
  10355 + <div class="panel-body">
  10356 + <form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/user/collectCourseList" method="POST" name="form75" id="form75">
  10357 + <div class="form-group">
  10358 + <label class="control-label" for="page">page</label>
  10359 + <input type="inter" class="form-control input-sm" id="page" placeholder="当前页(默认1" name="page">
  10360 + </div>
  10361 + <div class="form-group">
  10362 + <label class="control-label" for="page_num">page_num</label>
  10363 + <input type="inter" class="form-control input-sm" id="page_num" placeholder="每页显示数据个数(默认10)" name="page_num">
  10364 + </div>
  10365 + <div class="form-group">
  10366 + <button type="submit" class="btn btn-success send" rel="75">提交</button>
  10367 + <button type="reset" class="btn btn-info" rel="75">重置</button>
  10368 + </div>
  10369 + </form>
  10370 + </div>
  10371 + </div>
  10372 + <div class="panel panel-default">
  10373 + <div class="panel-heading"><strong>响应输出</strong></div>
  10374 + <div class="panel-body">
  10375 + <div class="row">
  10376 + <div class="col-md-12" style="overflow-x:auto">
  10377 + <pre id="response_headers75"></pre>
  10378 + <pre id="response75"></pre>
  10379 + </div>
  10380 + </div>
  10381 + </div>
  10382 + </div>
  10383 + <div class="panel panel-default">
  10384 + <div class="panel-heading"><strong>返回参数</strong></div>
  10385 + <div class="panel-body">
  10386 +
  10387 + </div>
  10388 + </div>
  10389 + </div>
  10390 + </div>
  10391 + </div><!-- #sandbox -->
  10392 +
  10393 + <div class="tab-pane" id="sample75">
  10394 + <div class="row">
  10395 + <div class="col-md-12">
  10396 + <pre id="sample_response75">{
  10397 + "code": 1,
  10398 + "msg": "成功",
  10399 + "time": "1600164731",
  10400 + "data": {
  10401 + "total": 1, //数据总数
  10402 + "list": [{
  10403 + "id": 1,
  10404 + "user_id": 16, //用户ID
  10405 + "course_id": 1, //课程ID
  10406 + "createtime": "2020.09.03 19:25", //收藏时间
  10407 + "course": { //课程信息
  10408 + "title": "测试课程", //课程标题
  10409 + "cover": "", //课程封面图
  10410 + "current_price": "50.00", //现价
  10411 + "original_price": "100.00" //原价
  10412 + }
  10413 + }]
  10414 + }
  10415 + }</pre>
  10416 + </div>
  10417 + </div>
  10418 + </div><!-- #sample -->
  10419 +
  10420 + </div><!-- .tab-content -->
  10421 + </div>
  10422 + </div>
  10423 + </div>
  10424 + <div class="panel panel-default">
  10425 + <div class="panel-heading" id="heading-76">
  10426 + <h4 class="panel-title">
  10427 + <span class="label label-primary">POST</span>
  10428 + <a data-toggle="collapse" data-parent="#accordion76" href="#collapseOne76"> 我的收藏-笔记 <span class="text-muted">/mobile/user/collectNoteList</span></a>
  10429 + </h4>
  10430 + </div>
  10431 + <div id="collapseOne76" class="panel-collapse collapse">
  10432 + <div class="panel-body">
  10433 +
  10434 + <!-- Nav tabs -->
  10435 + <ul class="nav nav-tabs" id="doctab76">
  10436 + <li class="active"><a href="#info76" data-toggle="tab">基础信息</a></li>
  10437 + <li><a href="#sandbox76" data-toggle="tab">在线测试</a></li>
  10438 + <li><a href="#sample76" data-toggle="tab">返回示例</a></li>
  10439 + </ul>
  10440 +
  10441 + <!-- Tab panes -->
  10442 + <div class="tab-content">
  10443 +
  10444 + <div class="tab-pane active" id="info76">
  10445 + <div class="well">
  10446 + 我的收藏-笔记 </div>
  10447 + <div class="panel panel-default">
  10448 + <div class="panel-heading"><strong>Headers</strong></div>
  10449 + <div class="panel-body">
  10450 + <table class="table table-hover">
  10451 + <thead>
  10452 + <tr>
  10453 + <th>名称</th>
  10454 + <th>类型</th>
  10455 + <th>必选</th>
  10456 + <th>描述</th>
  10457 + </tr>
  10458 + </thead>
  10459 + <tbody>
  10460 + <tr>
  10461 + <td>token</td>
  10462 + <td>string</td>
  10463 + <td></td>
  10464 + <td>请求的Token</td>
  10465 + </tr>
  10466 + </tbody>
  10467 + </table>
  10468 + </div>
  10469 + </div>
  10470 + <div class="panel panel-default">
  10471 + <div class="panel-heading"><strong>参数</strong></div>
  10472 + <div class="panel-body">
  10473 + <table class="table table-hover">
  10474 + <thead>
  10475 + <tr>
  10476 + <th>名称</th>
  10477 + <th>类型</th>
  10478 + <th>必选</th>
  10479 + <th>描述</th>
  10480 + </tr>
  10481 + </thead>
  10482 + <tbody>
  10483 + <tr>
  10484 + <td>page</td>
  10485 + <td>inter</td>
  10486 + <td></td>
  10487 + <td>当前页(默认1</td>
  10488 + </tr>
  10489 + <tr>
  10490 + <td>page_num</td>
  10491 + <td>inter</td>
  10492 + <td></td>
  10493 + <td>每页显示数据个数(默认10)</td>
  10494 + </tr>
  10495 + </tbody>
  10496 + </table>
  10497 + </div>
  10498 + </div>
  10499 + <div class="panel panel-default">
  10500 + <div class="panel-heading"><strong>正文</strong></div>
  10501 + <div class="panel-body">
  10502 +</div>
  10503 + </div>
  10504 + </div><!-- #info -->
  10505 +
  10506 + <div class="tab-pane" id="sandbox76">
  10507 + <div class="row">
  10508 + <div class="col-md-12">
  10509 + <div class="panel panel-default">
  10510 + <div class="panel-heading"><strong>Headers</strong></div>
  10511 + <div class="panel-body">
  10512 + <div class="headers">
  10513 + <div class="form-group">
  10514 + <label class="control-label" for="token">token</label>
  10515 + <input type="string" class="form-control input-sm" id="token" required placeholder="请求的Token - Ex: " name="token">
  10516 + </div>
  10517 + </div>
  10518 + </div>
  10519 + </div>
  10520 + <div class="panel panel-default">
  10521 + <div class="panel-heading"><strong>参数</strong></div>
  10522 + <div class="panel-body">
  10523 + <form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/user/collectNoteList" method="POST" name="form76" id="form76">
  10524 + <div class="form-group">
  10525 + <label class="control-label" for="page">page</label>
  10526 + <input type="inter" class="form-control input-sm" id="page" placeholder="当前页(默认1" name="page">
  10527 + </div>
  10528 + <div class="form-group">
  10529 + <label class="control-label" for="page_num">page_num</label>
  10530 + <input type="inter" class="form-control input-sm" id="page_num" placeholder="每页显示数据个数(默认10)" name="page_num">
  10531 + </div>
  10532 + <div class="form-group">
  10533 + <button type="submit" class="btn btn-success send" rel="76">提交</button>
  10534 + <button type="reset" class="btn btn-info" rel="76">重置</button>
  10535 + </div>
  10536 + </form>
  10537 + </div>
  10538 + </div>
  10539 + <div class="panel panel-default">
  10540 + <div class="panel-heading"><strong>响应输出</strong></div>
  10541 + <div class="panel-body">
  10542 + <div class="row">
  10543 + <div class="col-md-12" style="overflow-x:auto">
  10544 + <pre id="response_headers76"></pre>
  10545 + <pre id="response76"></pre>
  10546 + </div>
  10547 + </div>
  10548 + </div>
  10549 + </div>
  10550 + <div class="panel panel-default">
  10551 + <div class="panel-heading"><strong>返回参数</strong></div>
  10552 + <div class="panel-body">
  10553 +
  10554 + </div>
  10555 + </div>
  10556 + </div>
  10557 + </div>
  10558 + </div><!-- #sandbox -->
  10559 +
  10560 + <div class="tab-pane" id="sample76">
  10561 + <div class="row">
  10562 + <div class="col-md-12">
  10563 + <pre id="sample_response76">{
  10564 + "code": 1,
  10565 + "msg": "成功",
  10566 + "time": "1600164731",
  10567 + "data": {
  10568 + "total": 1, //数据总数
  10569 + "list": [{
  10570 + "id": 1,
  10571 + "user_id": 16, //用户ID
  10572 + "course_id": 1, //课程ID
  10573 + "createtime": "2020.09.03 19:25", //收藏时间
  10574 + "course": { //课程信息
  10575 + "title": "测试课程", //课程标题
  10576 + "cover": "", //课程封面图
  10577 + "current_price": "50.00", //现价
  10578 + "original_price": "100.00" //原价
  10579 + }
  10580 + }]
  10581 + }
  10582 + }</pre>
  10583 + </div>
  10584 + </div>
  10585 + </div><!-- #sample -->
  10586 +
  10587 + </div><!-- .tab-content -->
  10588 + </div>
  10589 + </div>
  10590 + </div>
10255 <h2>支付异步接口</h2> 10591 <h2>支付异步接口</h2>
10256 <hr> 10592 <hr>
10257 <h2>手机短信接口</h2> 10593 <h2>手机短信接口</h2>
@@ -10382,7 +10718,7 @@ @@ -10382,7 +10718,7 @@
10382 10718
10383 <div class="row mt0 footer"> 10719 <div class="row mt0 footer">
10384 <div class="col-md-6" align="left"> 10720 <div class="col-md-6" align="left">
10385 - Generated on 2020-09-15 17:53:19 </div> 10721 + Generated on 2020-09-15 18:19:37 </div>
10386 <div class="col-md-6" align="right"> 10722 <div class="col-md-6" align="right">
10387 <a href="./" target="_blank">企智帮</a> 10723 <a href="./" target="_blank">企智帮</a>
10388 </div> 10724 </div>