切换导航条
此项目
正在载入...
登录
郭盛
/
enterprise
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
何书鹏
4 years ago
提交
b6c2d5cde142e1e612b7591a3abc01faae5c12a8
1 个父辈
6a58a305
1 个管道 的构建
通过
耗费 0 秒
二维码邀请
变更
4
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
97 行增加
和
0 行删除
application/mobile/controller/Company.php
application/mobile/controller/Index.php
application/mobile/model/Company.php
public/mobile.html
application/mobile/controller/Company.php
查看文件 @
b6c2d5c
...
...
@@ -19,6 +19,7 @@ use app\mobile\model\UserJob;
use
app\mobile\model\CompanyJobResume
;
use
app\mobile\model\UserJobDownload
;
use
addons\epay\library\Service
;
use
Endroid\QrCode\QrCode
;
/**
* 我的(企业)接口
...
...
@@ -317,6 +318,54 @@ class Company extends Api
}
/**
* @ApiWeigh (85)
* @ApiTitle (企业成员管理-二维码邀请)
* @ApiSummary (企业成员管理-二维码邀请)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1600167441",
"data": {
"invite_qrcode": "http://www.enterprise.top/qrcode/20201017/52b77af2efe121e124c1b26d4d0d7f43.png", //二维码地址
}
})
*/
public
function
inviteQrcode
()
{
$company
=
$this
->
model
->
get
(
$this
->
company_id
);
if
(
empty
(
$company
[
'invite_qrcode'
])){
$qrCode
=
new
QrCode
();
$qrCode
->
setText
(
$this
->
company_id
)
->
setSize
(
300
)
->
setPadding
(
10
)
->
setErrorCorrection
(
'high'
)
->
setForegroundColor
([
'r'
=>
0
,
'g'
=>
0
,
'b'
=>
0
,
'a'
=>
0
])
->
setBackgroundColor
([
'r'
=>
255
,
'g'
=>
255
,
'b'
=>
255
,
'a'
=>
0
])
->
setLabelFontSize
(
16
)
->
setImageType
(
QrCode
::
IMAGE_TYPE_PNG
)
;
$dir
=
'qrcode/'
.
date
(
'Ymd'
);
if
(
!
file_exists
(
$dir
)){
mkdir
(
$dir
,
0777
,
true
);
}
$url
=
$dir
.
'/'
.
md5
(
microtime
(
true
))
.
'.png'
;
// save it to a file
$qrCode
->
save
(
$url
);
$company
->
save
([
'invite_qrcode'
=>
'/'
.
$url
]);
}
$this
->
success
(
'成功'
,[
'invite_qrcode'
=>
$company
->
invite_qrcode
]);
}
/**
* @ApiWeigh (83)
* @ApiTitle (企业套餐)
* @ApiSummary (企业套餐)
...
...
application/mobile/controller/Index.php
查看文件 @
b6c2d5c
...
...
@@ -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
...
...
application/mobile/model/Company.php
查看文件 @
b6c2d5c
...
...
@@ -12,4 +12,9 @@ class Company extends Model
// 定义时间戳字段名
protected
$createTime
=
'createtime'
;
protected
$updateTime
=
'updatetime'
;
// 格式化二维码
public
function
getInviteQrcodeAttr
(
$value
){
return
!
empty
(
$value
)
?
request
()
->
domain
()
.
$value
:
''
;
}
}
\ No newline at end of file
...
...
public/mobile.html
查看文件 @
b6c2d5c
此 diff 太大无法显示。
请
注册
或
登录
后发表评论