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
81abb609
authored
Nov 30, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Plain Diff
合并密码登录
parents
83230fd9
0a6fd4e2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
9 deletions
+34
-9
app/Admin/Controllers/PrescriptionLogController.php
+1
-0
app/Admin/Controllers/PrescriptionPrintController.php
+2
-1
app/Api/Controllers/PatientController.php
+8
-4
app/Api/Controllers/UserController.php
+23
-4
No files found.
app/Admin/Controllers/PrescriptionLogController.php
View file @
81abb609
...
...
@@ -33,6 +33,7 @@ protected function grid()
$filter
->
expand
();
// 默认展开搜索框
$filter
->
like
(
'pharmacy_name'
)
->
width
(
3
);
$filter
->
between
(
'created_at'
,
'创建时间'
)
->
date
()
->
width
(
3
);
});
// 行按钮控制
...
...
app/Admin/Controllers/PrescriptionPrintController.php
View file @
81abb609
...
...
@@ -52,8 +52,9 @@ public function search()
}
try
{
$pharmacy_id
=
Admin
::
user
()
->
pharmacy_id
;
// 获取处方信息
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$prescriptionNo
)
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
first
();
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$prescriptionNo
)
->
where
(
'
pharmacy_id'
,
$pharmacy_id
)
->
where
(
'
status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
first
();
if
(
!
$prescription
)
{
return
response
()
->
json
([
'status'
=>
false
,
'message'
=>
'未找到该处方或还未审方成功~'
]);
}
...
...
app/Api/Controllers/PatientController.php
View file @
81abb609
...
...
@@ -24,15 +24,19 @@ public function patientList(Request $request)
$authInfo
=
auth
(
'api'
)
->
user
();
$query
=
PatientModel
::
query
();
if
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_USER
)
{
// 用户
$query
=
$query
->
where
(
'user_id'
,
$authInfo
->
id
);
$query
->
where
(
'user_id'
,
$authInfo
->
id
);
}
elseif
(
$authInfo
->
last_login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
// 药店
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'user_id'
,
$authInfo
->
id
)
->
first
();
$query
=
$query
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
);
$query
->
where
(
'pharmacy_id'
,
$pharmacy
->
id
);
}
$search_input
=
$request
->
input
(
'search_input'
);
if
(
$search_input
)
{
$query
->
where
(
'id_card'
,
'like'
,
"%
{
$search_input
}
%"
)
->
orWhere
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
);
$query
->
where
(
function
(
$q
)
use
(
$search_input
)
{
$q
->
where
(
'id_card'
,
'like'
,
"%
{
$search_input
}
%"
)
->
orWhere
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
);
});
// $query->where('id_card', 'like', "%{$search_input}%");
// $query->orWhere('name', 'like', "%{$search_input}%");
// ->orWhere('mobile', 'like', "%{$search_input}%");
}
// 分页
...
...
app/Api/Controllers/UserController.php
View file @
81abb609
...
...
@@ -3,6 +3,7 @@
namespace
App\Api\Controllers
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\AdminUsers
;
use
App\Models\DoctorModel
;
use
App\Models\PharmacyModel
;
use
App\Models\User
;
...
...
@@ -138,14 +139,23 @@ public function bindRole(Request $request)
$mobile
=
$request
->
input
(
'mobile'
);
$login_type
=
$request
->
input
(
'login_type'
);
$code
=
$request
->
input
(
'code'
);
if
(
!
$mobile
||
!
$login_type
||
!
$code
)
{
return
$this
->
failed
(
'参数错误'
);
$password
=
$request
->
input
(
'password'
);
// 只有药店登录会传passowrd
if
(
!
$mobile
)
{
return
$this
->
failed
(
'请填写手机号'
);
}
if
(
!
$login_type
)
{
return
$this
->
failed
(
'登录类型错误'
);
}
if
((
$login_type
!=
User
::
LOGIN_TYPE_PHARMACY
)
&&
!
$code
)
{
return
$this
->
failed
(
'请填写短信验证码'
);
}
$verificationCode
=
cache
()
->
get
(
"sms_verification_code_
{
$mobile
}
"
);
if
(
$verificationCode
!=
$code
)
{
return
$this
->
failed
(
'验证码错误,请重新获取!'
);
// 有密码说明是药店密码登录
if
(
!
$password
&&
(
$verificationCode
!=
$code
))
{
return
$this
->
failed
(
'验证码错误,请重新发送!'
);
}
// 验证通过清除验证码
cache
()
->
forget
(
"sms_verification_code_
{
$mobile
}
"
);
...
...
@@ -155,6 +165,15 @@ public function bindRole(Request $request)
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'手机号不存在'
);
}
// 密码验证
if
(
$password
)
{
$adminUserInfo
=
AdminUsers
::
where
(
'pharmacy_id'
,
$pharmacy
->
id
)
->
first
();
$databasePassword
=
$adminUserInfo
->
password
;
$flag
=
app
(
'hash'
)
->
driver
(
'bcrypt'
)
->
check
(
$password
,
$databasePassword
);
if
(
!
$flag
)
{
return
$this
->
failed
(
'手机号或者密码错误!'
);
}
}
// 先把普通用户状态清除
if
(
$pharmacy
->
user_id
>
0
)
{
$user
=
User
::
query
()
->
find
(
$pharmacy
->
user_id
);
...
...
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