...
|
...
|
@@ -6,6 +6,7 @@ use app\mobile\model\IndexBanner; |
|
|
use app\mobile\model\News;
|
|
|
use app\mobile\model\Exam;
|
|
|
use app\mobile\model\UserExam;
|
|
|
use app\mobile\model\CompanyUser;
|
|
|
|
|
|
/**
|
|
|
* 首页接口
|
...
|
...
|
@@ -206,4 +207,46 @@ class Index extends Api |
|
|
News::where('id',$news_id)->setInc('read_num_real');
|
|
|
$this->success('成功',$info);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (扫描企业二维码-加入企业)
|
|
|
* @ApiSummary (扫描企业二维码-加入企业)
|
|
|
* @ApiMethod (POST)
|
|
|
*
|
|
|
* @ApiParams (name="company_id", type="int", required=true, description="公司ID")
|
|
|
*
|
|
|
* @ApiReturn({
|
|
|
"code": 1,
|
|
|
"msg": "成功",
|
|
|
"time": "1599026840",
|
|
|
"data": null
|
|
|
})
|
|
|
*/
|
|
|
public function joinCompanyInviteQrcode()
|
|
|
{
|
|
|
$user = $this->auth->getUser();
|
|
|
$company_id = $this->request->param('company_id');
|
|
|
// 验证申请状态
|
|
|
$company_user = CompanyUser::where('company_id',$company_id)
|
|
|
->where('user_id',$user['id'])
|
|
|
->field('status')
|
|
|
->find();
|
|
|
if($company_user){
|
|
|
if($company_user['status'] == '0'){
|
|
|
$company_user->status = '1';
|
|
|
$company_user->save();
|
|
|
}
|
|
|
if($company_user['status'] == '1'){
|
|
|
$this->error('加入企业成功,请勿重复提交申请');
|
|
|
}
|
|
|
}
|
|
|
CompanyUser::create([
|
|
|
'user_id' => $this->auth->id,
|
|
|
'company_id' => $company_id,
|
|
|
'name' => $user['nickname'],
|
|
|
'mobile' => $user['mobile'],
|
|
|
'status' => '1'
|
|
|
]);
|
|
|
$this->success('加入企业成功');
|
|
|
}
|
|
|
} |
|
|
\ No newline at end of file |
...
|
...
|
|