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

bug修改

... ... @@ -64,6 +64,7 @@ class Company extends Api
"id": 10, //密卷订单ID
"pay_price": "500.00", //实际支付金额
"people_num": 20, //密卷规格人数(斜杠后数字)
"is_top": "1", //是否顶配:0=否,1=是
"secret": {
"title": "测试密卷",
"do_num": 20
... ... @@ -86,7 +87,7 @@ class Company extends Api
foreach ($list as $v) {
// 当前企业下员工含管理员人数
$v['user_count'] = $user_count + 1;
$v->visible(['id','pay_price','people_num','secret'])->append(['user_count']);
$v->visible(['id','pay_price','people_num','is_top','secret'])->append(['user_count']);
$v->getRelation('secret')->visible(['title']);
}
$this->success('成功',$list);
... ... @@ -107,6 +108,8 @@ class Company extends Api
"data": [{
"id": 9, //密卷订单ID
"pay_price": "50.00", //实际支付金额
"people_num": 20, //限制人数
"is_top": "0", //是否顶配:0=否,1=是
"secret": { //密卷信息
"title": "测试密卷", //密卷标题
"do_num": "" //做过人数
... ... @@ -128,7 +131,7 @@ class Company extends Api
foreach ($list as $v) {
// 当前企业下员工含管理员人数
$v['user_count'] = $user_count + 1;
$v->visible(['id','pay_price','people_num','course'])->append(['user_count']);
$v->visible(['id','pay_price','people_num','is_top','course'])->append(['user_count']);
$v->getRelation('course')->visible(['cover','title']);
}
$this->success('成功',$list);
... ... @@ -146,32 +149,32 @@ class Company extends Api
* @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1600167441",
"code": 1,
"msg": "成功",
"time": "1600511589",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
"total": 2, //数据总数
"list": [
{
"id": 1, //申请ID
"name": "何先生", //申请人名称
"createtime": "2020.09.12" //申请时间
}
]
}
})
*/
public function companyUser()
{
$status = $this->request->param('status');
$status = $this->request->param('status','0');
$page = $this->request->param('page', 1, 'intval');
$page_num = $this->request->param('page_num', 10, 'intval');
$data = CompanyUser::with(['user'])
->where('company_id',$this->company_id)
$data = CompanyUser::where('company_id',$this->company_id)
->where('status',$status)
->paginate($page_num,false,['page'=>$page])
->each(function($v){
$v['createtime'] = date('Y.m.d',$v['createtime']);
$v->visible(['id','title','createtime']);
$v->visible(['id','name','createtime']);
})->toArray();
$this->success('成功',['total'=>$data['total'],'list'=>$data['data']]);
}
... ... @@ -189,15 +192,7 @@ class Company extends Api
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
}
"data": null
})
*/
public function companyUserAgree()
... ... @@ -223,15 +218,7 @@ class Company extends Api
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
}
"data": null
})
*/
public function companyUserRefuse()
... ... @@ -257,15 +244,7 @@ class Company extends Api
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
}
"data": null
})
*/
public function companyUserRemove()
... ... @@ -285,7 +264,6 @@ class Company extends Api
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="company_user_id", type="string", required=false, description="申请ID")
*
* @ApiReturn({
"code": 1,
... ... @@ -309,7 +287,6 @@ class Company extends Api
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="company_user_id", type="string", required=false, description="申请ID")
*
* @ApiReturn({
"code": 1,
... ...
... ... @@ -307,7 +307,7 @@ class Course extends Api
if($v['is_top'] == '1'){
$v['is_pay'] = 1;
}else{
$v['is_pay'] = $v['people_num'] < $people_num ? 0 : 1;
$v['is_pay'] = $v['people_num'] <= $people_num ? 0 : 1;
}
}
$this->success('成功',$list);
... ...
... ... @@ -135,7 +135,7 @@ class Secret extends Api
if($order['people_num'] > $people_num){
$people_num = $order['people_num'];
}
$v['current_price'] = $v['current_price']-$order['course_price'];
$v['current_price'] = $v['current_price']-$order['secret_price'];
}
if($v['is_top'] == '1'){
$v['is_pay'] = 1;
... ...
... ... @@ -431,7 +431,10 @@ class User extends Api
->find();
empty($company) && $this->error('邀请码错误,请输入正确的邀请码');
// 验证申请状态
$company_user = CompanyUser::where('company_id',$company['id'])->field('status')->find();
$company_user = CompanyUser::where('company_id',$company['id'])
->where('user_id',$this->auth->id)
->field('status')
->find();
if($company_user){
if($company_user['status'] == '0'){
$this->error('正在申请中,请勿重复提交申请');
... ... @@ -459,7 +462,7 @@ class User extends Api
$find = Company::where('invite_code',$code)->field('id')->find();
if(!$find){
Company::where('id',$company_id)->setField('invite_code',$code);
return true;
return $code;
}else{
$this->setInviteCode($company_id);
}
... ... @@ -500,6 +503,10 @@ class User extends Api
// 查询我是否可以享受企业课程(按企业审核时间排队,没在队伍里就无法享受企业课程)
$course_id_arr = [];
foreach ($company_course_list as $v) {
if($v['is_top'] == '1'){
$course_id_arr[] = $v['id'];
continue;
}
$user_id_arr = CompanyUser::where('company_id',$v['company_id'])
->where('status','1')
->order('updatetime asc')
... ... @@ -643,6 +650,10 @@ class User extends Api
// 查询我是否可以享受企业密卷(按企业审核时间排队,没在队伍里就无法享受企业密卷)
$secret_id_arr = [];
foreach ($company_secret_list as $v) {
if($v['is_top'] == '1'){
$secret_id_arr[] = $v['id'];
continue;
}
$user_id_arr = CompanyUser::where('company_id',$v['company_id'])
->where('status','1')
->order('updatetime asc')
... ...
... ... @@ -12217,17 +12217,18 @@
<div class="row">
<div class="col-md-12">
<pre id="sample_response11">{
"code": 1,
"msg": "成功",
"time": "1600167441",
"code": 1,
"msg": "成功",
"time": "1600511589",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
"total": 2, //数据总数
"list": [
{
"id": 1, //申请ID
"name": "何先生", //申请人名称
"createtime": "2020.09.12" //申请时间
}
]
}
}</pre>
</div>
... ... @@ -12371,15 +12372,7 @@
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
}
"data": null
}</pre>
</div>
</div>
... ... @@ -12522,15 +12515,7 @@
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
}
"data": null
}</pre>
</div>
</div>
... ... @@ -12673,15 +12658,7 @@
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"id": 7, //消息ID
"user_id": 16, //用户ID
"title": "这是个消息", //消息标题
"content": "这个消息还不错Q", //消息内容
"is_read": "1", //是否已读:0=否,1=是
"createtime": 1599914736,
"updatetime": 1600167441
}
"data": null
}</pre>
</div>
</div>
... ... @@ -12740,24 +12717,7 @@
<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>company_user_id</td>
<td>string</td>
<td></td>
<td>申请ID</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -12786,8 +12746,7 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/company/inviteCode" method="POST" name="form15" id="form15">
<div class="form-group">
<label class="control-label" for="company_user_id">company_user_id</label>
<input type="string" class="form-control input-sm" id="company_user_id" placeholder="申请ID" name="company_user_id">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="15">提交</button>
... ... @@ -12885,24 +12844,7 @@
<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>company_user_id</td>
<td>string</td>
<td></td>
<td>申请ID</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="panel panel-default">
... ... @@ -12931,8 +12873,7 @@
<div class="panel-body">
<form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/company/setInviteCode" method="POST" name="form16" id="form16">
<div class="form-group">
<label class="control-label" for="company_user_id">company_user_id</label>
<input type="string" class="form-control input-sm" id="company_user_id" placeholder="申请ID" name="company_user_id">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success send" rel="16">提交</button>
... ... @@ -13093,18 +13034,22 @@
<div class="row">
<div class="col-md-12">
<pre id="sample_response9">{
"code": 1,
"msg": "成功",
"time": "1600081718",
"data": [{
"id": 9, //密卷订单ID
"pay_price": "50.00", //实际支付金额
"secret": { //密卷信息
"title": "测试密卷", //密卷标题
"do_num": "" //做过人数
},
"is_have_qi": 0 //是否有企字:0=否,1=是
}]
"code": 1,
"msg": "成功",
"time": "1600499807",
"data": [
{
"id": 10, //密卷订单ID
"pay_price": "500.00", //实际支付金额
"people_num": 20, //密卷规格人数(斜杠后数字)
"is_top": "1", //是否顶配:0=否,1=是
"secret": {
"title": "测试密卷",
"do_num": 20
},
"user_count": 3 //当前企业下员工含管理员数量(斜杠前数字)
}
]
}</pre>
</div>
</div>
... ... @@ -13232,6 +13177,8 @@
"data": [{
"id": 9, //密卷订单ID
"pay_price": "50.00", //实际支付金额
"people_num": 20, //限制人数
"is_top": "0", //是否顶配:0=否,1=是
"secret": { //密卷信息
"title": "测试密卷", //密卷标题
"do_num": "" //做过人数
... ... @@ -13377,7 +13324,7 @@
<div class="row mt0 footer">
<div class="col-md-6" align="left">
Generated on 2020-09-19 15:02:32 </div>
Generated on 2020-09-19 18:43:44 </div>
<div class="col-md-6" align="right">
<a href="./" target="_blank">企智帮</a>
</div>
... ...