Commit adc189b2 by lujunyi

合并代码解决冲突

parents 5fab8c61 bd585d9f
......@@ -66,7 +66,7 @@ protected function grid()
// 行按钮控制
$grid->disableCreateButton(); // 禁用创建按钮
$grid->disableDeleteButton(); // 禁用删除按钮
// $grid->disableDeleteButton(); // 禁用删除按钮
$grid->disableViewButton(); // 禁用详情按钮
// 工具栏按钮控制
......
......@@ -118,7 +118,7 @@ public function drugLimit(Request $request)
$sevenDaysAgo = Carbon::now()->subDays(7);
$prescriptions = PrescriptionModel::where('patient_id', $patient_id)
->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('created_at', '>=', $sevenDaysAgo)
->get();
......
......@@ -146,6 +146,9 @@ public function bindRole(Request $request)
if ($verificationCode != $code) {
return $this->failed('验证码错误,请重新获取!');
}
// 验证通过清除验证码
cache()->forget("sms_verification_code_{$mobile}");
// 验证手机号是否存在
if ($login_type == User::LOGIN_TYPE_PHARMACY) {
$pharmacy = PharmacyModel::query()->where('mobile', $mobile)->first();
......@@ -160,8 +163,10 @@ public function bindRole(Request $request)
}
// 把所有user_id:$authInfo->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) {
$doctor = DoctorModel::query()->where('mobile', $mobile)->first();
......
......@@ -66,5 +66,6 @@ class Kernel extends HttpKernel
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'watermark' => \App\Http\Middleware\WatermarkMiddleware::class,
'checkrole' => \App\Http\Middleware\CheckRoleChangeMiddleware::class,
];
}
<?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);
}
}
......@@ -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');
// 退出
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment