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
0a6fd4e2
authored
Nov 29, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
药店密码登录
parent
2c421dbe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
6 deletions
+24
-6
app/Admin/Controllers/PrescriptionPrintController.php
+1
-1
app/Api/Controllers/PatientController.php
+1
-2
app/Api/Controllers/UserController.php
+22
-3
No files found.
app/Admin/Controllers/PrescriptionPrintController.php
View file @
0a6fd4e2
...
@@ -54,7 +54,7 @@ public function search()
...
@@ -54,7 +54,7 @@ public function search()
try
{
try
{
$pharmacy_id
=
Admin
::
user
()
->
pharmacy_id
;
$pharmacy_id
=
Admin
::
user
()
->
pharmacy_id
;
// 获取处方信息
// 获取处方信息
$prescription
=
PrescriptionModel
::
where
(
'id'
,
$prescriptionNo
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
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
)
{
if
(
!
$prescription
)
{
return
response
()
->
json
([
'status'
=>
false
,
'message'
=>
'未找到该处方或还未审方成功~'
]);
return
response
()
->
json
([
'status'
=>
false
,
'message'
=>
'未找到该处方或还未审方成功~'
]);
}
}
...
...
app/Api/Controllers/PatientController.php
View file @
0a6fd4e2
...
@@ -17,7 +17,6 @@ public function test()
...
@@ -17,7 +17,6 @@ public function test()
{
{
return
$this
->
success
([
'a'
=>
1
,
'b'
=>
2
,
'c'
=>
3
]);
return
$this
->
success
([
'a'
=>
1
,
'b'
=>
2
,
'c'
=>
3
]);
}
}
// 获取问诊人列表
// 获取问诊人列表
public
function
patientList
(
Request
$request
)
public
function
patientList
(
Request
$request
)
...
@@ -34,7 +33,7 @@ public function patientList(Request $request)
...
@@ -34,7 +33,7 @@ public function patientList(Request $request)
if
(
$search_input
)
{
if
(
$search_input
)
{
$query
->
where
(
function
(
$q
)
use
(
$search_input
)
{
$query
->
where
(
function
(
$q
)
use
(
$search_input
)
{
$q
->
where
(
'id_card'
,
'like'
,
"%
{
$search_input
}
%"
)
$q
->
where
(
'id_card'
,
'like'
,
"%
{
$search_input
}
%"
)
->
orWhere
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
);
->
orWhere
(
'name'
,
'like'
,
"%
{
$search_input
}
%"
);
});
});
// $query->where('id_card', 'like', "%{$search_input}%");
// $query->where('id_card', 'like', "%{$search_input}%");
// $query->orWhere('name', 'like', "%{$search_input}%");
// $query->orWhere('name', 'like', "%{$search_input}%");
...
...
app/Api/Controllers/UserController.php
View file @
0a6fd4e2
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Api\Controllers
;
namespace
App\Api\Controllers
;
use
App\Http\Controllers\BaseApiController
;
use
App\Http\Controllers\BaseApiController
;
use
App\Models\AdminUsers
;
use
App\Models\DoctorModel
;
use
App\Models\DoctorModel
;
use
App\Models\PharmacyModel
;
use
App\Models\PharmacyModel
;
use
App\Models\User
;
use
App\Models\User
;
...
@@ -138,14 +139,23 @@ public function bindRole(Request $request)
...
@@ -138,14 +139,23 @@ public function bindRole(Request $request)
$mobile
=
$request
->
input
(
'mobile'
);
$mobile
=
$request
->
input
(
'mobile'
);
$login_type
=
$request
->
input
(
'login_type'
);
$login_type
=
$request
->
input
(
'login_type'
);
$code
=
$request
->
input
(
'code'
);
$code
=
$request
->
input
(
'code'
);
if
(
!
$mobile
||
!
$login_type
||
!
$code
)
{
$password
=
$request
->
input
(
'password'
);
// 只有药店登录会传passowrd
return
$this
->
failed
(
'参数错误'
);
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
}
"
);
$verificationCode
=
cache
()
->
get
(
"sms_verification_code_
{
$mobile
}
"
);
if
(
$verificationCode
!=
$code
)
{
// 有密码说明是药店密码登录
if
(
!
$password
&&
(
$verificationCode
!=
$code
))
{
return
$this
->
failed
(
'验证码错误,请重新发送!'
);
return
$this
->
failed
(
'验证码错误,请重新发送!'
);
}
}
// 验证通过清除验证码
// 验证通过清除验证码
cache
()
->
forget
(
"sms_verification_code_
{
$mobile
}
"
);
cache
()
->
forget
(
"sms_verification_code_
{
$mobile
}
"
);
...
@@ -155,6 +165,15 @@ public function bindRole(Request $request)
...
@@ -155,6 +165,15 @@ public function bindRole(Request $request)
if
(
!
$pharmacy
)
{
if
(
!
$pharmacy
)
{
return
$this
->
failed
(
'手机号不存在'
);
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
)
{
if
(
$pharmacy
->
user_id
>
0
)
{
$user
=
User
::
query
()
->
find
(
$pharmacy
->
user_id
);
$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