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

bug修改

@@ -64,6 +64,7 @@ class Company extends Api @@ -64,6 +64,7 @@ class Company extends Api
64 "id": 10, //密卷订单ID 64 "id": 10, //密卷订单ID
65 "pay_price": "500.00", //实际支付金额 65 "pay_price": "500.00", //实际支付金额
66 "people_num": 20, //密卷规格人数(斜杠后数字) 66 "people_num": 20, //密卷规格人数(斜杠后数字)
  67 + "is_top": "1", //是否顶配:0=否,1=是
67 "secret": { 68 "secret": {
68 "title": "测试密卷", 69 "title": "测试密卷",
69 "do_num": 20 70 "do_num": 20
@@ -86,7 +87,7 @@ class Company extends Api @@ -86,7 +87,7 @@ class Company extends Api
86 foreach ($list as $v) { 87 foreach ($list as $v) {
87 // 当前企业下员工含管理员人数 88 // 当前企业下员工含管理员人数
88 $v['user_count'] = $user_count + 1; 89 $v['user_count'] = $user_count + 1;
89 - $v->visible(['id','pay_price','people_num','secret'])->append(['user_count']); 90 + $v->visible(['id','pay_price','people_num','is_top','secret'])->append(['user_count']);
90 $v->getRelation('secret')->visible(['title']); 91 $v->getRelation('secret')->visible(['title']);
91 } 92 }
92 $this->success('成功',$list); 93 $this->success('成功',$list);
@@ -107,6 +108,8 @@ class Company extends Api @@ -107,6 +108,8 @@ class Company extends Api
107 "data": [{ 108 "data": [{
108 "id": 9, //密卷订单ID 109 "id": 9, //密卷订单ID
109 "pay_price": "50.00", //实际支付金额 110 "pay_price": "50.00", //实际支付金额
  111 + "people_num": 20, //限制人数
  112 + "is_top": "0", //是否顶配:0=否,1=是
110 "secret": { //密卷信息 113 "secret": { //密卷信息
111 "title": "测试密卷", //密卷标题 114 "title": "测试密卷", //密卷标题
112 "do_num": "" //做过人数 115 "do_num": "" //做过人数
@@ -128,7 +131,7 @@ class Company extends Api @@ -128,7 +131,7 @@ class Company extends Api
128 foreach ($list as $v) { 131 foreach ($list as $v) {
129 // 当前企业下员工含管理员人数 132 // 当前企业下员工含管理员人数
130 $v['user_count'] = $user_count + 1; 133 $v['user_count'] = $user_count + 1;
131 - $v->visible(['id','pay_price','people_num','course'])->append(['user_count']); 134 + $v->visible(['id','pay_price','people_num','is_top','course'])->append(['user_count']);
132 $v->getRelation('course')->visible(['cover','title']); 135 $v->getRelation('course')->visible(['cover','title']);
133 } 136 }
134 $this->success('成功',$list); 137 $this->success('成功',$list);
@@ -146,32 +149,32 @@ class Company extends Api @@ -146,32 +149,32 @@ class Company extends Api
146 * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)") 149 * @ApiParams (name="page_num", type="inter", required=false, description="每页显示数据个数(默认10)")
147 * 150 *
148 * @ApiReturn({ 151 * @ApiReturn({
149 - "code": 1,  
150 - "msg": "成功",  
151 - "time": "1600167441", 152 + "code": 1,
  153 + "msg": "成功",
  154 + "time": "1600511589",
152 "data": { 155 "data": {
153 - "id": 7, //消息ID  
154 - "user_id": 16, //用户ID  
155 - "title": "这是个消息", //消息标题  
156 - "content": "这个消息还不错Q", //消息内容  
157 - "is_read": "1", //是否已读:0=否,1=是  
158 - "createtime": 1599914736,  
159 - "updatetime": 1600167441 156 + "total": 2, //数据总数
  157 + "list": [
  158 + {
  159 + "id": 1, //申请ID
  160 + "name": "何先生", //申请人名称
  161 + "createtime": "2020.09.12" //申请时间
  162 + }
  163 + ]
160 } 164 }
161 }) 165 })
162 */ 166 */
163 public function companyUser() 167 public function companyUser()
164 { 168 {
165 - $status = $this->request->param('status'); 169 + $status = $this->request->param('status','0');
166 $page = $this->request->param('page', 1, 'intval'); 170 $page = $this->request->param('page', 1, 'intval');
167 $page_num = $this->request->param('page_num', 10, 'intval'); 171 $page_num = $this->request->param('page_num', 10, 'intval');
168 - $data = CompanyUser::with(['user'])  
169 - ->where('company_id',$this->company_id) 172 + $data = CompanyUser::where('company_id',$this->company_id)
170 ->where('status',$status) 173 ->where('status',$status)
171 ->paginate($page_num,false,['page'=>$page]) 174 ->paginate($page_num,false,['page'=>$page])
172 ->each(function($v){ 175 ->each(function($v){
173 $v['createtime'] = date('Y.m.d',$v['createtime']); 176 $v['createtime'] = date('Y.m.d',$v['createtime']);
174 - $v->visible(['id','title','createtime']); 177 + $v->visible(['id','name','createtime']);
175 })->toArray(); 178 })->toArray();
176 $this->success('成功',['total'=>$data['total'],'list'=>$data['data']]); 179 $this->success('成功',['total'=>$data['total'],'list'=>$data['data']]);
177 } 180 }
@@ -189,15 +192,7 @@ class Company extends Api @@ -189,15 +192,7 @@ class Company extends Api
189 "code": 1, 192 "code": 1,
190 "msg": "成功", 193 "msg": "成功",
191 "time": "1600167441", 194 "time": "1600167441",
192 - "data": {  
193 - "id": 7, //消息ID  
194 - "user_id": 16, //用户ID  
195 - "title": "这是个消息", //消息标题  
196 - "content": "这个消息还不错Q", //消息内容  
197 - "is_read": "1", //是否已读:0=否,1=是  
198 - "createtime": 1599914736,  
199 - "updatetime": 1600167441  
200 - } 195 + "data": null
201 }) 196 })
202 */ 197 */
203 public function companyUserAgree() 198 public function companyUserAgree()
@@ -223,15 +218,7 @@ class Company extends Api @@ -223,15 +218,7 @@ class Company extends Api
223 "code": 1, 218 "code": 1,
224 "msg": "成功", 219 "msg": "成功",
225 "time": "1600167441", 220 "time": "1600167441",
226 - "data": {  
227 - "id": 7, //消息ID  
228 - "user_id": 16, //用户ID  
229 - "title": "这是个消息", //消息标题  
230 - "content": "这个消息还不错Q", //消息内容  
231 - "is_read": "1", //是否已读:0=否,1=是  
232 - "createtime": 1599914736,  
233 - "updatetime": 1600167441  
234 - } 221 + "data": null
235 }) 222 })
236 */ 223 */
237 public function companyUserRefuse() 224 public function companyUserRefuse()
@@ -257,15 +244,7 @@ class Company extends Api @@ -257,15 +244,7 @@ class Company extends Api
257 "code": 1, 244 "code": 1,
258 "msg": "成功", 245 "msg": "成功",
259 "time": "1600167441", 246 "time": "1600167441",
260 - "data": {  
261 - "id": 7, //消息ID  
262 - "user_id": 16, //用户ID  
263 - "title": "这是个消息", //消息标题  
264 - "content": "这个消息还不错Q", //消息内容  
265 - "is_read": "1", //是否已读:0=否,1=是  
266 - "createtime": 1599914736,  
267 - "updatetime": 1600167441  
268 - } 247 + "data": null
269 }) 248 })
270 */ 249 */
271 public function companyUserRemove() 250 public function companyUserRemove()
@@ -285,7 +264,6 @@ class Company extends Api @@ -285,7 +264,6 @@ class Company extends Api
285 * @ApiMethod (POST) 264 * @ApiMethod (POST)
286 * 265 *
287 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 266 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
288 - * @ApiParams (name="company_user_id", type="string", required=false, description="申请ID")  
289 * 267 *
290 * @ApiReturn({ 268 * @ApiReturn({
291 "code": 1, 269 "code": 1,
@@ -309,7 +287,6 @@ class Company extends Api @@ -309,7 +287,6 @@ class Company extends Api
309 * @ApiMethod (POST) 287 * @ApiMethod (POST)
310 * 288 *
311 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token") 289 * @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
312 - * @ApiParams (name="company_user_id", type="string", required=false, description="申请ID")  
313 * 290 *
314 * @ApiReturn({ 291 * @ApiReturn({
315 "code": 1, 292 "code": 1,
@@ -307,7 +307,7 @@ class Course extends Api @@ -307,7 +307,7 @@ class Course extends Api
307 if($v['is_top'] == '1'){ 307 if($v['is_top'] == '1'){
308 $v['is_pay'] = 1; 308 $v['is_pay'] = 1;
309 }else{ 309 }else{
310 - $v['is_pay'] = $v['people_num'] < $people_num ? 0 : 1; 310 + $v['is_pay'] = $v['people_num'] <= $people_num ? 0 : 1;
311 } 311 }
312 } 312 }
313 $this->success('成功',$list); 313 $this->success('成功',$list);
@@ -135,7 +135,7 @@ class Secret extends Api @@ -135,7 +135,7 @@ class Secret extends Api
135 if($order['people_num'] > $people_num){ 135 if($order['people_num'] > $people_num){
136 $people_num = $order['people_num']; 136 $people_num = $order['people_num'];
137 } 137 }
138 - $v['current_price'] = $v['current_price']-$order['course_price']; 138 + $v['current_price'] = $v['current_price']-$order['secret_price'];
139 } 139 }
140 if($v['is_top'] == '1'){ 140 if($v['is_top'] == '1'){
141 $v['is_pay'] = 1; 141 $v['is_pay'] = 1;
@@ -431,7 +431,10 @@ class User extends Api @@ -431,7 +431,10 @@ class User extends Api
431 ->find(); 431 ->find();
432 empty($company) && $this->error('邀请码错误,请输入正确的邀请码'); 432 empty($company) && $this->error('邀请码错误,请输入正确的邀请码');
433 // 验证申请状态 433 // 验证申请状态
434 - $company_user = CompanyUser::where('company_id',$company['id'])->field('status')->find(); 434 + $company_user = CompanyUser::where('company_id',$company['id'])
  435 + ->where('user_id',$this->auth->id)
  436 + ->field('status')
  437 + ->find();
435 if($company_user){ 438 if($company_user){
436 if($company_user['status'] == '0'){ 439 if($company_user['status'] == '0'){
437 $this->error('正在申请中,请勿重复提交申请'); 440 $this->error('正在申请中,请勿重复提交申请');
@@ -459,7 +462,7 @@ class User extends Api @@ -459,7 +462,7 @@ class User extends Api
459 $find = Company::where('invite_code',$code)->field('id')->find(); 462 $find = Company::where('invite_code',$code)->field('id')->find();
460 if(!$find){ 463 if(!$find){
461 Company::where('id',$company_id)->setField('invite_code',$code); 464 Company::where('id',$company_id)->setField('invite_code',$code);
462 - return true; 465 + return $code;
463 }else{ 466 }else{
464 $this->setInviteCode($company_id); 467 $this->setInviteCode($company_id);
465 } 468 }
@@ -500,6 +503,10 @@ class User extends Api @@ -500,6 +503,10 @@ class User extends Api
500 // 查询我是否可以享受企业课程(按企业审核时间排队,没在队伍里就无法享受企业课程) 503 // 查询我是否可以享受企业课程(按企业审核时间排队,没在队伍里就无法享受企业课程)
501 $course_id_arr = []; 504 $course_id_arr = [];
502 foreach ($company_course_list as $v) { 505 foreach ($company_course_list as $v) {
  506 + if($v['is_top'] == '1'){
  507 + $course_id_arr[] = $v['id'];
  508 + continue;
  509 + }
503 $user_id_arr = CompanyUser::where('company_id',$v['company_id']) 510 $user_id_arr = CompanyUser::where('company_id',$v['company_id'])
504 ->where('status','1') 511 ->where('status','1')
505 ->order('updatetime asc') 512 ->order('updatetime asc')
@@ -643,6 +650,10 @@ class User extends Api @@ -643,6 +650,10 @@ class User extends Api
643 // 查询我是否可以享受企业密卷(按企业审核时间排队,没在队伍里就无法享受企业密卷) 650 // 查询我是否可以享受企业密卷(按企业审核时间排队,没在队伍里就无法享受企业密卷)
644 $secret_id_arr = []; 651 $secret_id_arr = [];
645 foreach ($company_secret_list as $v) { 652 foreach ($company_secret_list as $v) {
  653 + if($v['is_top'] == '1'){
  654 + $secret_id_arr[] = $v['id'];
  655 + continue;
  656 + }
646 $user_id_arr = CompanyUser::where('company_id',$v['company_id']) 657 $user_id_arr = CompanyUser::where('company_id',$v['company_id'])
647 ->where('status','1') 658 ->where('status','1')
648 ->order('updatetime asc') 659 ->order('updatetime asc')
@@ -12217,17 +12217,18 @@ @@ -12217,17 +12217,18 @@
12217 <div class="row"> 12217 <div class="row">
12218 <div class="col-md-12"> 12218 <div class="col-md-12">
12219 <pre id="sample_response11">{ 12219 <pre id="sample_response11">{
12220 - "code": 1,  
12221 - "msg": "成功",  
12222 - "time": "1600167441", 12220 + "code": 1,
  12221 + "msg": "成功",
  12222 + "time": "1600511589",
12223 "data": { 12223 "data": {
12224 - "id": 7, //消息ID  
12225 - "user_id": 16, //用户ID  
12226 - "title": "这是个消息", //消息标题  
12227 - "content": "这个消息还不错Q", //消息内容  
12228 - "is_read": "1", //是否已读:0=否,1=是  
12229 - "createtime": 1599914736,  
12230 - "updatetime": 1600167441 12224 + "total": 2, //数据总数
  12225 + "list": [
  12226 + {
  12227 + "id": 1, //申请ID
  12228 + "name": "何先生", //申请人名称
  12229 + "createtime": "2020.09.12" //申请时间
  12230 + }
  12231 + ]
12231 } 12232 }
12232 }</pre> 12233 }</pre>
12233 </div> 12234 </div>
@@ -12371,15 +12372,7 @@ @@ -12371,15 +12372,7 @@
12371 "code": 1, 12372 "code": 1,
12372 "msg": "成功", 12373 "msg": "成功",
12373 "time": "1600167441", 12374 "time": "1600167441",
12374 - "data": {  
12375 - "id": 7, //消息ID  
12376 - "user_id": 16, //用户ID  
12377 - "title": "这是个消息", //消息标题  
12378 - "content": "这个消息还不错Q", //消息内容  
12379 - "is_read": "1", //是否已读:0=否,1=是  
12380 - "createtime": 1599914736,  
12381 - "updatetime": 1600167441  
12382 - } 12375 + "data": null
12383 }</pre> 12376 }</pre>
12384 </div> 12377 </div>
12385 </div> 12378 </div>
@@ -12522,15 +12515,7 @@ @@ -12522,15 +12515,7 @@
12522 "code": 1, 12515 "code": 1,
12523 "msg": "成功", 12516 "msg": "成功",
12524 "time": "1600167441", 12517 "time": "1600167441",
12525 - "data": {  
12526 - "id": 7, //消息ID  
12527 - "user_id": 16, //用户ID  
12528 - "title": "这是个消息", //消息标题  
12529 - "content": "这个消息还不错Q", //消息内容  
12530 - "is_read": "1", //是否已读:0=否,1=是  
12531 - "createtime": 1599914736,  
12532 - "updatetime": 1600167441  
12533 - } 12518 + "data": null
12534 }</pre> 12519 }</pre>
12535 </div> 12520 </div>
12536 </div> 12521 </div>
@@ -12673,15 +12658,7 @@ @@ -12673,15 +12658,7 @@
12673 "code": 1, 12658 "code": 1,
12674 "msg": "成功", 12659 "msg": "成功",
12675 "time": "1600167441", 12660 "time": "1600167441",
12676 - "data": {  
12677 - "id": 7, //消息ID  
12678 - "user_id": 16, //用户ID  
12679 - "title": "这是个消息", //消息标题  
12680 - "content": "这个消息还不错Q", //消息内容  
12681 - "is_read": "1", //是否已读:0=否,1=是  
12682 - "createtime": 1599914736,  
12683 - "updatetime": 1600167441  
12684 - } 12661 + "data": null
12685 }</pre> 12662 }</pre>
12686 </div> 12663 </div>
12687 </div> 12664 </div>
@@ -12740,24 +12717,7 @@ @@ -12740,24 +12717,7 @@
12740 <div class="panel panel-default"> 12717 <div class="panel panel-default">
12741 <div class="panel-heading"><strong>参数</strong></div> 12718 <div class="panel-heading"><strong>参数</strong></div>
12742 <div class="panel-body"> 12719 <div class="panel-body">
12743 - <table class="table table-hover">  
12744 - <thead>  
12745 - <tr>  
12746 - <th>名称</th>  
12747 - <th>类型</th>  
12748 - <th>必选</th>  
12749 - <th>描述</th>  
12750 - </tr>  
12751 - </thead>  
12752 - <tbody>  
12753 - <tr>  
12754 - <td>company_user_id</td>  
12755 - <td>string</td>  
12756 - <td></td>  
12757 - <td>申请ID</td>  
12758 - </tr>  
12759 - </tbody>  
12760 - </table> 12720 +
12761 </div> 12721 </div>
12762 </div> 12722 </div>
12763 <div class="panel panel-default"> 12723 <div class="panel panel-default">
@@ -12786,8 +12746,7 @@ @@ -12786,8 +12746,7 @@
12786 <div class="panel-body"> 12746 <div class="panel-body">
12787 <form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/company/inviteCode" method="POST" name="form15" id="form15"> 12747 <form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/company/inviteCode" method="POST" name="form15" id="form15">
12788 <div class="form-group"> 12748 <div class="form-group">
12789 - <label class="control-label" for="company_user_id">company_user_id</label>  
12790 - <input type="string" class="form-control input-sm" id="company_user_id" placeholder="申请ID" name="company_user_id"> 12749 +
12791 </div> 12750 </div>
12792 <div class="form-group"> 12751 <div class="form-group">
12793 <button type="submit" class="btn btn-success send" rel="15">提交</button> 12752 <button type="submit" class="btn btn-success send" rel="15">提交</button>
@@ -12885,24 +12844,7 @@ @@ -12885,24 +12844,7 @@
12885 <div class="panel panel-default"> 12844 <div class="panel panel-default">
12886 <div class="panel-heading"><strong>参数</strong></div> 12845 <div class="panel-heading"><strong>参数</strong></div>
12887 <div class="panel-body"> 12846 <div class="panel-body">
12888 - <table class="table table-hover">  
12889 - <thead>  
12890 - <tr>  
12891 - <th>名称</th>  
12892 - <th>类型</th>  
12893 - <th>必选</th>  
12894 - <th>描述</th>  
12895 - </tr>  
12896 - </thead>  
12897 - <tbody>  
12898 - <tr>  
12899 - <td>company_user_id</td>  
12900 - <td>string</td>  
12901 - <td></td>  
12902 - <td>申请ID</td>  
12903 - </tr>  
12904 - </tbody>  
12905 - </table> 12847 +
12906 </div> 12848 </div>
12907 </div> 12849 </div>
12908 <div class="panel panel-default"> 12850 <div class="panel panel-default">
@@ -12931,8 +12873,7 @@ @@ -12931,8 +12873,7 @@
12931 <div class="panel-body"> 12873 <div class="panel-body">
12932 <form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/company/setInviteCode" method="POST" name="form16" id="form16"> 12874 <form enctype="application/x-www-form-urlencoded" role="form" action="/mobile/company/setInviteCode" method="POST" name="form16" id="form16">
12933 <div class="form-group"> 12875 <div class="form-group">
12934 - <label class="control-label" for="company_user_id">company_user_id</label>  
12935 - <input type="string" class="form-control input-sm" id="company_user_id" placeholder="申请ID" name="company_user_id"> 12876 +
12936 </div> 12877 </div>
12937 <div class="form-group"> 12878 <div class="form-group">
12938 <button type="submit" class="btn btn-success send" rel="16">提交</button> 12879 <button type="submit" class="btn btn-success send" rel="16">提交</button>
@@ -13093,18 +13034,22 @@ @@ -13093,18 +13034,22 @@
13093 <div class="row"> 13034 <div class="row">
13094 <div class="col-md-12"> 13035 <div class="col-md-12">
13095 <pre id="sample_response9">{ 13036 <pre id="sample_response9">{
13096 - "code": 1,  
13097 - "msg": "成功",  
13098 - "time": "1600081718",  
13099 - "data": [{  
13100 - "id": 9, //密卷订单ID  
13101 - "pay_price": "50.00", //实际支付金额  
13102 - "secret": { //密卷信息  
13103 - "title": "测试密卷", //密卷标题  
13104 - "do_num": "" //做过人数  
13105 - },  
13106 - "is_have_qi": 0 //是否有企字:0=否,1=是  
13107 - }] 13037 + "code": 1,
  13038 + "msg": "成功",
  13039 + "time": "1600499807",
  13040 + "data": [
  13041 + {
  13042 + "id": 10, //密卷订单ID
  13043 + "pay_price": "500.00", //实际支付金额
  13044 + "people_num": 20, //密卷规格人数(斜杠后数字)
  13045 + "is_top": "1", //是否顶配:0=否,1=是
  13046 + "secret": {
  13047 + "title": "测试密卷",
  13048 + "do_num": 20
  13049 + },
  13050 + "user_count": 3 //当前企业下员工含管理员数量(斜杠前数字)
  13051 + }
  13052 + ]
13108 }</pre> 13053 }</pre>
13109 </div> 13054 </div>
13110 </div> 13055 </div>
@@ -13232,6 +13177,8 @@ @@ -13232,6 +13177,8 @@
13232 "data": [{ 13177 "data": [{
13233 "id": 9, //密卷订单ID 13178 "id": 9, //密卷订单ID
13234 "pay_price": "50.00", //实际支付金额 13179 "pay_price": "50.00", //实际支付金额
  13180 + "people_num": 20, //限制人数
  13181 + "is_top": "0", //是否顶配:0=否,1=是
13235 "secret": { //密卷信息 13182 "secret": { //密卷信息
13236 "title": "测试密卷", //密卷标题 13183 "title": "测试密卷", //密卷标题
13237 "do_num": "" //做过人数 13184 "do_num": "" //做过人数
@@ -13377,7 +13324,7 @@ @@ -13377,7 +13324,7 @@
13377 13324
13378 <div class="row mt0 footer"> 13325 <div class="row mt0 footer">
13379 <div class="col-md-6" align="left"> 13326 <div class="col-md-6" align="left">
13380 - Generated on 2020-09-19 15:02:32 </div> 13327 + Generated on 2020-09-19 18:43:44 </div>
13381 <div class="col-md-6" align="right"> 13328 <div class="col-md-6" align="right">
13382 <a href="./" target="_blank">企智帮</a> 13329 <a href="./" target="_blank">企智帮</a>
13383 </div> 13330 </div>