Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵增煜
/
tzt-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
6ea285f5
authored
Nov 21, 2024
by
赵增煜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.imohe.com/zhaozengyu/tzt-admin
parents
8f1c3e96
6cdb77f1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
19 deletions
+28
-19
.env.example
+1
-0
app/Admin/Controllers/AuthController.php
+7
-1
app/Admin/Controllers/DrugController.php
+1
-1
app/Admin/Controllers/PharmacyController.php
+16
-14
app/Models/DiagnosiModel.php
+1
-1
app/Models/DrugModel.php
+1
-1
resources/views/admin/loginstore.blade.php
+1
-1
No files found.
.env.example
View file @
6ea285f5
...
...
@@ -3,6 +3,7 @@ APP_ENV=local
APP_KEY=base64:X9/EwE4Bb65OLiZ54TizbwXD0cceNHFPTLNvP1xJQrY=
APP_DEBUG=true
APP_URL=http://localhost
APP_STORE_URL=https://药店域名
LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
...
...
app/Admin/Controllers/AuthController.php
View file @
6ea285f5
...
...
@@ -16,11 +16,17 @@ class AuthController extends BaseAuthController
public
function
getLogin
(
Content
$content
)
{
// 获取请求域名
$requestDomain
=
request
()
->
host
();
// 不带协议|不带端口
// env中配置的药店端域名
$parsedUrl
=
parse_url
(
env
(
'APP_STORE_URL'
));
$appStoreUrl
=
$parsedUrl
[
'host'
];
// 获取角色参数
$role
=
request
()
->
get
(
'role'
);
// 根据角色参数决定登录页面
if
(
$role
===
'store'
)
{
if
(
(
$requestDomain
==
$appStoreUrl
)
||
(
$role
===
'store'
)
)
{
$this
->
view
=
'admin.loginstore'
;
// 店铺管理员登录页面
}
else
{
$this
->
view
=
'admin.login'
;
// 默认管理员登录页面
...
...
app/Admin/Controllers/DrugController.php
View file @
6ea285f5
...
...
@@ -121,7 +121,7 @@ protected function form()
return
Form
::
make
(
new
DrugRepository
(
'tag'
),
function
(
Form
$form
)
{
$form
->
display
(
'id'
)
->
width
(
4
);
$form
->
text
(
'name'
)
->
width
(
4
)
->
required
()
->
maxLength
(
64
,
'最多输入64个字符'
);
$form
->
text
(
'code'
)
->
readonly
(
)
->
width
(
4
);
$form
->
display
(
'code'
)
->
width
(
4
);
$form
->
select
(
'unit'
)
->
options
(
DrugUnitModel
::
all
()
->
pluck
(
'name'
,
'name'
))
->
width
(
4
);
$form
->
text
(
'spec'
)
->
width
(
4
)
->
required
()
->
maxLength
(
128
,
'最多输入128个字符'
);
$form
->
text
(
'dosage_form'
)
->
width
(
4
)
->
required
()
->
maxLength
(
128
,
'最多输入128个字符'
);
...
...
app/Admin/Controllers/PharmacyController.php
View file @
6ea285f5
...
...
@@ -171,21 +171,23 @@ protected function form()
$admin
=
Administrator
::
where
(
'pharmacy_id'
,
$pharmacyId
)
->
first
();
if
(
$admin
)
{
// 如果存在,更新相应字段
$admin
->
username
=
$mobile
;
// 更新账号
$admin
->
name
=
$name
;
// 更新账号姓名
$admin
->
save
();
if
(
$mobile
&&
$name
)
{
$admin
->
username
=
$mobile
;
// 更新账号
$admin
->
name
=
$name
;
// 更新账号姓名
$admin
->
save
();
}
}
else
{
// 如果不存在,新增管理员
$admin
=
new
Administrator
();
$admin
->
username
=
$mobile
;
// 药店手机号作为管理员账号
$admin
->
name
=
$name
;
// 药店名称当做用户的姓名
$admin
->
password
=
bcrypt
(
Str
::
random
(
10
));
// 设置管理员密码
$admin
->
pharmacy_id
=
$pharmacyId
;
// 药店ID
$admin
->
save
();
// 保存新管理员
// 关联药店管理员角色
$admin
->
roles
()
->
attach
(
$role
->
id
);
if
(
$mobile
&&
$name
&&
$pharmacyId
)
{
$admin
=
new
Administrator
();
$admin
->
username
=
$mobile
;
// 药店手机号作为管理员账号
$admin
->
name
=
$name
;
// 药店名称当做用户的姓名
$admin
->
password
=
bcrypt
(
Str
::
random
(
10
));
// 设置管理员密码
$admin
->
pharmacy_id
=
$pharmacyId
;
// 药店ID
$admin
->
save
();
// 保存新管理员
// 关联药店管理员角色
$admin
->
roles
()
->
attach
(
$role
->
id
);
}
}
DB
::
commit
();
}
catch
(
\Exception
$e
)
{
...
...
app/Models/DiagnosiModel.php
View file @
6ea285f5
...
...
@@ -20,7 +20,7 @@ public function setNameAttribute($value)
$this
->
attributes
[
'name'
]
=
$value
;
$pinyin
=
new
Pinyin
();
$abbr
=
$pinyin
->
abbr
(
$
this
->
nam
e
)
->
join
(
''
);
// 获取拼音首字母
$abbr
=
$pinyin
->
abbr
(
$
valu
e
)
->
join
(
''
);
// 获取拼音首字母
$this
->
attributes
[
'code'
]
=
strtoupper
(
$abbr
);
}
}
app/Models/DrugModel.php
View file @
6ea285f5
...
...
@@ -41,7 +41,7 @@ public function setNameAttribute($value)
$this
->
attributes
[
'name'
]
=
$value
;
$pinyin
=
new
Pinyin
();
$abbr
=
$pinyin
->
abbr
(
$
this
->
nam
e
)
->
join
(
''
);
// 获取拼音首字母
$abbr
=
$pinyin
->
abbr
(
$
valu
e
)
->
join
(
''
);
// 获取拼音首字母
$this
->
attributes
[
'code'
]
=
strtoupper
(
$abbr
);
}
...
...
resources/views/admin/loginstore.blade.php
View file @
6ea285f5
...
...
@@ -64,7 +64,7 @@
<div
class=
"login-box"
>
<div
class=
"login-logo mb-2"
style=
"font-size:1.8rem;font-weight: normal;"
>
<img
class=
"avatar img-circle login-img"
src=
"{{ admin_asset('@admin/images/logo.jpg') }}"
>
{{ config('admin.name') }}
{{ config('admin.name') }}
-药店端
<p
style=
"font-size:0.5rem"
></p>
</div>
<div
class=
"card"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment