作者 潘浩文
1 个管道 的构建 失败 耗费 2 秒

测试

... ... @@ -281,4 +281,39 @@ class CoachController extends RestBaseController
});
$this->success("获取数据成功", $data);
}
/**
* @title 教练审核编辑(新)
* @description
* @author Pan Haowen
* @url /home/coach/edit
* @method POST
* @header name:XX-Token require:1 default: desc:token
*/
public function edit(){
$userId = $this->getUserId();
$data=Db::name('coach')->where('user_id',$userId)->find();
$data['product_id']=implode(',',$data['product_id']);
$data['type']=implode(',',$data['type']);
$this->success("获取数据成功", $data);
}
/**
* @title 教练审核编辑提交(新)
* @description
* @author Pan Haowen
* @url /home/coach/editPost
* @method POST
* @header name:XX-Token require:1 default: desc:token
*/
public function editPost(){
$userId = $this->getUserId();
$param = $this->request->param();
$param['create_time']=time();
$param['status']=0;
$param['product']=substr($param['product'],1,strlen($param['product'])-2);
Db::name('coach')->where('user_id', $userId)->update($param);
$this->success('操作成功');
}
}
... ...
... ... @@ -49,12 +49,20 @@ class CoachIndexController extends RestBaseController
$param=$this->request->param();
$coach=Db::name('coach')->where(['user_id'=>$userId,'status'=>1])->find();
$class=Db::name('class')->where('id',$param['class_id'])->find();
if ($class['type']==1){
$class['type']='团体课程';
}else{
$class['type']='私教课程';
}
if (!$coach){
$this->error(['code'=>'40001','msg'=>'未认证']);
}
if (!in_array($class['product_id'],explode(',',$coach['product']))){
$this->error(['code'=>'40002','msg'=>'授课类型不符']);
}
if (!in_array($class['type'],explode(',',$coach['type']))){
$this->error(['code'=>'40002','msg'=>'授课类型不符']);
}
$re1=Db::name('coach_class_apply')->where(['coach_id'=>$coach['id'],'class_id'=>$class['id'],'status'=>1])->find();
if ($re1){
$this->error('您的申请已通过');
... ...