...
|
...
|
@@ -60,36 +60,156 @@ class Teacher extends Api |
|
|
'name' => 'require',
|
|
|
'sex' => 'require',
|
|
|
'birth' => 'require',
|
|
|
'idcard'=>'require',
|
|
|
'before'=>'require',
|
|
|
'behind'=>'require',
|
|
|
'phone'=>'require',
|
|
|
'thumbnail'=>'require',
|
|
|
'address'=>'require',
|
|
|
'honor'=>'require',
|
|
|
'content'=>'require',
|
|
|
'show'=>'require',
|
|
|
'desc'=>'require',
|
|
|
'online'=>'require',
|
|
|
'territory_id'=>"require"
|
|
|
'idcard' => 'require',
|
|
|
'before' => 'require',
|
|
|
'behind' => 'require',
|
|
|
'phone' => 'require',
|
|
|
'thumbnail' => 'require',
|
|
|
'address' => 'require',
|
|
|
'honor' => 'require',
|
|
|
'content' => 'require',
|
|
|
'show' => 'require',
|
|
|
'desc' => 'require',
|
|
|
'online' => 'require',
|
|
|
'territory_id' => "require"
|
|
|
]);
|
|
|
if (!$validate->check($param)) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
$qiniu = get_addon_config('qiniu');
|
|
|
$http = $qiniu['cdnurl'];
|
|
|
$param['before'] = str_replace($http,'',$param['before']);
|
|
|
$param['behind'] = str_replace($http,'',$param['behind']);
|
|
|
$param['thumbnail'] = str_replace($http,'',$param['thumbnail']);
|
|
|
$param['before'] = str_replace($http, '', $param['before']);
|
|
|
$param['behind'] = str_replace($http, '', $param['behind']);
|
|
|
$param['thumbnail'] = str_replace($http, '', $param['thumbnail']);
|
|
|
$param['createtime'] = time();
|
|
|
$data = Db::name('teacher')->insertGetId($param);
|
|
|
if(empty($data)){
|
|
|
if (empty($data)) {
|
|
|
$this->error('提交失败');
|
|
|
}else{
|
|
|
} else {
|
|
|
$this->success('提交成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (成为老师表单详情)
|
|
|
* @ApiSummary (成为老师表单详情)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/teacher/tea_detail)
|
|
|
*
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1571492001",
|
|
|
"data": {
|
|
|
"id"://老师ID
|
|
|
"name"://真实姓名
|
|
|
"sex"://性别(1男2女)
|
|
|
"birth"://出生日期
|
|
|
"idcard"://身份证号
|
|
|
"before"://身份证正面照
|
|
|
"behind"://身份证反面照
|
|
|
"phone"://手机号
|
|
|
"thumbnail"://大头照
|
|
|
"address"://常住地
|
|
|
"honor"://头衔
|
|
|
"content"://个人履历
|
|
|
"show"://展示在最前
|
|
|
"desc"://个人简历
|
|
|
"online"://在线时段
|
|
|
"status"://状态(0待审核1审核通过2未通过)
|
|
|
"territory_id"://擅长领域ID
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function tea_detail()
|
|
|
{
|
|
|
$user_id = $this->getUserId();
|
|
|
$data = Db::name('teacher')
|
|
|
->where('user_id',$user_id)
|
|
|
->find();
|
|
|
$qiniu = get_addon_config('qiniu')['cdnurl'];
|
|
|
$data['before'] = $qiniu.$data['before'];
|
|
|
$data['behind'] = $qiniu.$data['behind'];
|
|
|
$data['thumbnail'] = $qiniu.$data['thumbnail'];
|
|
|
$this->success('success',$data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (成为老师表单提交)
|
|
|
* @ApiSummary (成为老师表单提交)
|
|
|
* @ApiMethod (POST)
|
|
|
* @ApiRoute (/api/teacher/update)
|
|
|
*
|
|
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
|
|
*
|
|
|
* @ApiParams (name="id", type="int", required=true, description="老师ID")
|
|
|
* @ApiParams (name="name", type="string", required=true, description="真实姓名")
|
|
|
* @ApiParams (name="sex", type="int", required=true, description="性别(1男2女)")
|
|
|
* @ApiParams (name="birth", type="string", required=true, description="出生日期")
|
|
|
* @ApiParams (name="idcard", type="string", required=true, description="身份证号")
|
|
|
* @ApiParams (name="before", type="string", required=true, description="身份证正面")
|
|
|
* @ApiParams (name="behind", type="string", required=true, description="身份证反面")
|
|
|
* @ApiParams (name="phone", type="string", required=true, description="手机号")
|
|
|
* @ApiParams (name="thumbnail", type="string", required=true, description="头像")
|
|
|
* @ApiParams (name="address", type="string", required=true, description="常住地")
|
|
|
* @ApiParams (name="honor", type="string", required=true, description="头衔")
|
|
|
* @ApiParams (name="content", type="string", required=true, description="个人履历")
|
|
|
* @ApiParams (name="show", type="string", required=true, description="展示在最前")
|
|
|
* @ApiParams (name="desc", type="string", required=true, description="个人简历")
|
|
|
* @ApiParams (name="online", type="string", required=true, description="在线时段")
|
|
|
* @ApiParams (name="territory_id", type="string", required=true, description="擅长领域ID")
|
|
|
*
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1571492001",
|
|
|
"data": {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
*/
|
|
|
public function update()
|
|
|
{
|
|
|
$user_id = $this->getUserId();
|
|
|
$param = $this->request->param();
|
|
|
if(empty($param['id'])){
|
|
|
$this->error('缺少必要参数');
|
|
|
}
|
|
|
$validate = new Validate([
|
|
|
'name' => 'require',
|
|
|
'sex' => 'require',
|
|
|
'birth' => 'require',
|
|
|
'idcard' => 'require',
|
|
|
'before' => 'require',
|
|
|
'behind' => 'require',
|
|
|
'phone' => 'require',
|
|
|
'thumbnail' => 'require',
|
|
|
'address' => 'require',
|
|
|
'honor' => 'require',
|
|
|
'content' => 'require',
|
|
|
'show' => 'require',
|
|
|
'desc' => 'require',
|
|
|
'online' => 'require',
|
|
|
'territory_id' => "require"
|
|
|
]);
|
|
|
if (!$validate->check($param)) {
|
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
$qiniu = get_addon_config('qiniu');
|
|
|
$http = $qiniu['cdnurl'];
|
|
|
$param['before'] = str_replace($http, '', $param['before']);
|
|
|
$param['behind'] = str_replace($http, '', $param['behind']);
|
|
|
$param['thumbnail'] = str_replace($http, '', $param['thumbnail']);
|
|
|
$param['updatetime'] = time();
|
|
|
$data = Db::name('teacher')->where('id',$param['id'])->update($param);
|
|
|
if (empty($data)) {
|
|
|
$this->error('提交失败');
|
|
|
} else {
|
|
|
$this->success('提交成功');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|