...
|
...
|
@@ -527,12 +527,16 @@ class User extends Api |
|
|
* @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": "1600081718",
|
|
|
"data": [{
|
|
|
"data": {
|
|
|
"total": 1, // 数据总数
|
|
|
"list": [{
|
|
|
"id": 9, //课程订单ID
|
|
|
"pay_price": "50.00", //实际支付金额
|
|
|
"course": { //课程信息
|
...
|
...
|
@@ -543,9 +547,12 @@ class User extends Api |
|
|
"is_have_qi": 0 //是否有企字:0=否,1=是
|
|
|
"is_have_appraise": 0 //是否已评价:0=否,1=是
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function myCourse(){
|
|
|
$page = $this->request->param('page', 1, 'intval');
|
|
|
$page_num = $this->request->param('page_num', 10, 'intval');
|
|
|
// 我加入的企业购买的课程
|
|
|
$company_course_list = CourseOrder::alias('co')
|
|
|
->join('mobile_company_user cu','cu.company_id = co.company_id')
|
...
|
...
|
@@ -570,13 +577,14 @@ class User extends Api |
|
|
}
|
|
|
}
|
|
|
// 查找所有课程
|
|
|
$list = CourseOrder::with(['course'])
|
|
|
$data = CourseOrder::with(['course'])
|
|
|
->where(function($query)use($course_id_arr){
|
|
|
$query->where('user_id', $this->auth->id)->whereor('id', 'in', $course_id_arr);
|
|
|
})
|
|
|
->where('pay_status','1')
|
|
|
->select();
|
|
|
foreach ($list as $v) {
|
|
|
->order('createtime desc')
|
|
|
->paginate($page_num,false,['page'=>$page])
|
|
|
->each(function($v)use($course_id_arr){
|
|
|
// 是否有企字
|
|
|
$v['is_have_qi'] = in_array($v['id'], $course_id_arr) ? 1 : 0;
|
|
|
// 是否已评价
|
...
|
...
|
@@ -588,8 +596,8 @@ class User extends Api |
|
|
$v['is_have_appraise'] = !empty($have_appraise) ? 1 : 0;
|
|
|
$v->visible(['id','pay_price','course'])->append(['is_have_qi','is_have_appraise']);
|
|
|
$v->getRelation('course')->visible(['id','cover','title']);
|
|
|
}
|
|
|
$this->success('成功',$list);
|
|
|
})->toArray();
|
|
|
$this->success('成功',['total'=>$data['total'],'list'=>$data['data']]);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -676,12 +684,16 @@ class User extends Api |
|
|
* @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": "1600081718",
|
|
|
"data": [{
|
|
|
"data": {
|
|
|
"total": 1, // 数据总数
|
|
|
"list": [{
|
|
|
"id": 9, //密卷订单ID
|
|
|
"pay_price": "50.00", //实际支付金额
|
|
|
"secret": { //密卷信息
|
...
|
...
|
@@ -691,9 +703,12 @@ class User extends Api |
|
|
},
|
|
|
"is_have_qi": 0 //是否有企字:0=否,1=是
|
|
|
}]
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function mySecret(){
|
|
|
$page = $this->request->param('page', 1, 'intval');
|
|
|
$page_num = $this->request->param('page_num', 10, 'intval');
|
|
|
// 我加入的企业购买的密卷
|
|
|
$company_secret_list = SecretOrder::alias('a')
|
|
|
->join('mobile_company_user b','b.company_id = a.company_id')
|
...
|
...
|
@@ -718,18 +733,20 @@ class User extends Api |
|
|
}
|
|
|
}
|
|
|
// 查找所有密卷
|
|
|
$list = SecretOrder::with(['secret'])
|
|
|
$data = SecretOrder::with(['secret'])
|
|
|
->where(function($query)use($secret_id_arr){
|
|
|
$query->where('user_id', $this->auth->id)->whereor('id', 'in', $secret_id_arr);
|
|
|
})
|
|
|
->where('pay_status','1')
|
|
|
->select();
|
|
|
foreach ($list as $v) {
|
|
|
->order('createtime desc')
|
|
|
->paginate($page_num,false,['page'=>$page])
|
|
|
->each(function($v)use($secret_id_arr){
|
|
|
// 是否有企字
|
|
|
$v['is_have_qi'] = in_array($v['id'], $secret_id_arr) ? 1 : 0;
|
|
|
$v->visible(['id','pay_price','secret'])->append(['is_have_qi']);
|
|
|
$v->getRelation('secret')->visible(['id','title']);
|
|
|
}
|
|
|
$this->success('成功',$list);
|
|
|
})->toArray();
|
|
|
$this->success('成功',['total'=>$data['total'],'list'=>$data['data']]);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|