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
adc189b2
authored
Nov 29, 2024
by
lujunyi
Browse files
Options
Browse Files
Download
Plain Diff
合并代码解决冲突
parents
5fab8c61
bd585d9f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
5 deletions
+36
-5
app/Admin/Controllers/PharmacyDrugController.php
+1
-1
app/Api/Controllers/DrugController.php
+1
-1
app/Api/Controllers/UserController.php
+7
-2
app/Http/Kernel.php
+1
-0
app/Http/Middleware/CheckRoleChangeMiddleware.php
+25
-0
routes/api.php
+1
-1
No files found.
app/Admin/Controllers/PharmacyDrugController.php
View file @
adc189b2
...
@@ -66,7 +66,7 @@ protected function grid()
...
@@ -66,7 +66,7 @@ protected function grid()
// 行按钮控制
// 行按钮控制
$grid
->
disableCreateButton
();
// 禁用创建按钮
$grid
->
disableCreateButton
();
// 禁用创建按钮
$grid
->
disableDeleteButton
();
// 禁用删除按钮
//
$grid->disableDeleteButton(); // 禁用删除按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
$grid
->
disableViewButton
();
// 禁用详情按钮
// 工具栏按钮控制
// 工具栏按钮控制
...
...
app/Api/Controllers/DrugController.php
View file @
adc189b2
...
@@ -118,7 +118,7 @@ public function drugLimit(Request $request)
...
@@ -118,7 +118,7 @@ public function drugLimit(Request $request)
$sevenDaysAgo
=
Carbon
::
now
()
->
subDays
(
7
);
$sevenDaysAgo
=
Carbon
::
now
()
->
subDays
(
7
);
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
$prescriptions
=
PrescriptionModel
::
where
(
'patient_id'
,
$patient_id
)
->
where
(
'is_voided'
,
PrescriptionModel
::
IS_VOIDED_FALSE
)
// 未作废的处方
->
where
(
'is_voided'
,
PrescriptionModel
::
IS_VOIDED_FALSE
)
// 未作废的处方
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
//
->
where
(
'status'
,
PrescriptionModel
::
PRESCRIPTION_STATUS_SUCCESS
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'pharmacy_id'
,
$pharmacy_id
)
->
where
(
'created_at'
,
'>='
,
$sevenDaysAgo
)
->
where
(
'created_at'
,
'>='
,
$sevenDaysAgo
)
->
get
();
->
get
();
...
...
app/Api/Controllers/UserController.php
View file @
adc189b2
...
@@ -146,6 +146,9 @@ public function bindRole(Request $request)
...
@@ -146,6 +146,9 @@ public function bindRole(Request $request)
if
(
$verificationCode
!=
$code
)
{
if
(
$verificationCode
!=
$code
)
{
return
$this
->
failed
(
'验证码错误,请重新获取!'
);
return
$this
->
failed
(
'验证码错误,请重新获取!'
);
}
}
// 验证通过清除验证码
cache
()
->
forget
(
"sms_verification_code_
{
$mobile
}
"
);
// 验证手机号是否存在
// 验证手机号是否存在
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
if
(
$login_type
==
User
::
LOGIN_TYPE_PHARMACY
)
{
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
$pharmacy
=
PharmacyModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
...
@@ -160,8 +163,10 @@ public function bindRole(Request $request)
...
@@ -160,8 +163,10 @@ public function bindRole(Request $request)
}
}
// 把所有user_id:$authInfo->id的置为0
// 把所有user_id:$authInfo->id的置为0
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
update
([
'user_id'
=>
0
]);
PharmacyModel
::
where
(
'user_id'
,
$authInfo
->
id
)
->
update
([
'user_id'
=>
0
]);
$pharmacy
->
user_id
=
$authInfo
->
id
;
// 重新绑定
$pharmacy
->
save
();
PharmacyModel
::
where
(
'id'
,
$pharmacy
->
id
)
->
update
([
'user_id'
=>
$authInfo
->
id
]);
// $pharmacy->user_id = $authInfo->id;
// $pharmacy->save();
}
elseif
(
$login_type
==
User
::
LOGIN_TYPE_DOCTOR
)
{
}
elseif
(
$login_type
==
User
::
LOGIN_TYPE_DOCTOR
)
{
$doctor
=
DoctorModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
$doctor
=
DoctorModel
::
query
()
->
where
(
'mobile'
,
$mobile
)
->
first
();
...
...
app/Http/Kernel.php
View file @
adc189b2
...
@@ -66,5 +66,6 @@ class Kernel extends HttpKernel
...
@@ -66,5 +66,6 @@ class Kernel extends HttpKernel
'throttle'
=>
\Illuminate\Routing\Middleware\ThrottleRequests
::
class
,
'throttle'
=>
\Illuminate\Routing\Middleware\ThrottleRequests
::
class
,
'verified'
=>
\Illuminate\Auth\Middleware\EnsureEmailIsVerified
::
class
,
'verified'
=>
\Illuminate\Auth\Middleware\EnsureEmailIsVerified
::
class
,
'watermark'
=>
\App\Http\Middleware\WatermarkMiddleware
::
class
,
'watermark'
=>
\App\Http\Middleware\WatermarkMiddleware
::
class
,
'checkrole'
=>
\App\Http\Middleware\CheckRoleChangeMiddleware
::
class
,
];
];
}
}
app/Http/Middleware/CheckRoleChangeMiddleware.php
0 → 100644
View file @
adc189b2
<?php
namespace
App\Http\Middleware
;
use
Closure
;
class
CheckRoleChangeMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @return mixed
*/
public
function
handle
(
$request
,
Closure
$next
)
{
$lastLoginType
=
auth
(
'api'
)
->
user
()
->
last_login_type
;
$requestLastLoginType
=
$request
->
headers
->
get
(
'last_login_type'
,
0
);
if
(
$lastLoginType
!=
$requestLastLoginType
)
{
return
response
()
->
json
([
'status'
=>
false
,
'code'
=>
600
,
'message'
=>
'您的角色切换错误~'
,
'data'
=>
[]]);
}
return
$next
(
$request
);
}
}
routes/api.php
View file @
adc189b2
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
// 需要验证是否登录的路由组
// 需要验证是否登录的路由组
Route
::
middleware
([
'jwt.auth'
])
->
group
(
function
()
{
Route
::
middleware
([
'jwt.auth'
,
'checkrole'
])
->
group
(
function
()
{
// 获取用户信息
// 获取用户信息
Route
::
get
(
'/users'
,
'App\Api\Controllers\UserController@userInfo'
);
Route
::
get
(
'/users'
,
'App\Api\Controllers\UserController@userInfo'
);
// 退出
// 退出
...
...
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