commit
847a541b35
@ -0,0 +1,6 @@
|
||||
.idea
|
||||
composer.lock
|
||||
*.log
|
||||
thinkphp
|
||||
.env
|
||||
a.txt
|
@ -0,0 +1,42 @@
|
||||
sudo: false
|
||||
|
||||
language: php
|
||||
|
||||
branches:
|
||||
only:
|
||||
- stable
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.composer/cache
|
||||
|
||||
before_install:
|
||||
- composer self-update
|
||||
|
||||
install:
|
||||
- composer install --no-dev --no-interaction --ignore-platform-reqs
|
||||
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Core.zip .
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-image:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-migration:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-captcha:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-mongo:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-worker:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-helper:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-queue:^1.0"
|
||||
- composer require --update-no-dev --no-interaction "topthink/think-angular:^1.0"
|
||||
- composer require --dev --update-no-dev --no-interaction "topthink/think-testing:^1.0"
|
||||
- zip -r --exclude='*.git*' --exclude='*.zip' --exclude='*.travis.yml' ThinkPHP_Full.zip .
|
||||
|
||||
script:
|
||||
- php think unit
|
||||
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key:
|
||||
secure: TSF6bnl2JYN72UQOORAJYL+CqIryP2gHVKt6grfveQ7d9rleAEoxlq6PWxbvTI4jZ5nrPpUcBUpWIJHNgVcs+bzLFtyh5THaLqm39uCgBbrW7M8rI26L8sBh/6nsdtGgdeQrO/cLu31QoTzbwuz1WfAVoCdCkOSZeXyT/CclH99qV6RYyQYqaD2wpRjrhA5O4fSsEkiPVuk0GaOogFlrQHx+C+lHnf6pa1KxEoN1A0UxxVfGX6K4y5g4WQDO5zT4bLeubkWOXK0G51XSvACDOZVIyLdjApaOFTwamPcD3S1tfvuxRWWvsCD5ljFvb2kSmx5BIBNwN80MzuBmrGIC27XLGOxyMerwKxB6DskNUO9PflKHDPI61DRq0FTy1fv70SFMSiAtUv9aJRT41NQh9iJJ0vC8dl+xcxrWIjU1GG6+l/ZcRqVx9V1VuGQsLKndGhja7SQ+X1slHl76fRq223sMOql7MFCd0vvvxVQ2V39CcFKao/LB1aPH3VhODDEyxwx6aXoTznvC/QPepgWsHOWQzKj9ftsgDbsNiyFlXL4cu8DWUty6rQy8zT2b4O8b1xjcwSUCsy+auEjBamzQkMJFNlZAIUrukL/NbUhQU37TAbwsFyz7X0E/u/VMle/nBCNAzgkMwAUjiHM6FqrKKBRWFbPrSIixjfjkCnrMEPw=
|
||||
file:
|
||||
- ThinkPHP_Core.zip
|
||||
- ThinkPHP_Full.zip
|
||||
skip_cleanup: true
|
||||
on:
|
||||
tags: true
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
deny from all
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
namespace app\admin\command;
|
||||
|
||||
use app\admin\model\SqlFiles;
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
class Backup extends Command
|
||||
{
|
||||
|
||||
|
||||
|
||||
//定义任务名和描述
|
||||
protected function configure(){
|
||||
|
||||
$this->setName('BackUp')->setDescription("php think backup 备份mysql数据库");
|
||||
|
||||
}
|
||||
|
||||
//调用该类时,会自动运行execute方法
|
||||
public function execute(Input $input, Output $output){
|
||||
set_time_limit(0);
|
||||
ini_set('memory_limit','5000M');
|
||||
$allData = count(SqlFiles::where(1)->select());
|
||||
if ($allData == 10){
|
||||
$getFirst = SqlFiles::where(1)->find();
|
||||
SqlFiles::where(['id'=>$getFirst['id']])->delete();
|
||||
$delFile = dirname(dirname(dirname(__DIR__)))."/backup/sql/".$getFirst['name'].".sql";
|
||||
unlink($delFile);
|
||||
}
|
||||
$data = SqlFiles::where(1)->order("id","desc")->find();
|
||||
$num = $data['id']+1;
|
||||
// backup($path = '备份路径', $tableArray = [需要备份的表集合], $bool = '是否同时备份数据 默认false',['is_compress' => '是否写入内容文件进行压缩','is_download' => '是否进行下载'])
|
||||
|
||||
// 配置项-----必传值
|
||||
$config = [
|
||||
// 服务器地址
|
||||
'host' => "127.0.0.1",
|
||||
// 数据库名
|
||||
'database' => "hospital_web",
|
||||
// 用户名
|
||||
'user' => "root",
|
||||
// 密码
|
||||
'password' =>"123456",
|
||||
// 端口
|
||||
'port' => "3306",
|
||||
// 字符编码
|
||||
'charset' => "utf8"
|
||||
];
|
||||
// 备份
|
||||
$dir = "./backup/sql";//备份路径
|
||||
$createData = [
|
||||
'name'=>'hospital_web'.$num,
|
||||
'create_time'=>time()
|
||||
];
|
||||
$res = SqlFiles::create($createData);
|
||||
if (!$res){
|
||||
echo "save failed";die;
|
||||
}
|
||||
$data = \cocolait\sql\Backup::instance($config)->backUp($dir,[],true,['is_compress' => 0],$num);
|
||||
var_dump($data);
|
||||
|
||||
// 还原
|
||||
// $data = \cocolait\sql\Backup::instance($config)->recover('test1.sql',$dir);
|
||||
// print_r($data);die;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace app\admin\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Log;
|
||||
class RollBack extends Command
|
||||
{
|
||||
|
||||
|
||||
|
||||
//定义任务名和描述
|
||||
protected function configure(){
|
||||
|
||||
$this->setName('RollBack')->setDescription("php think backup 还原mysql数据库");
|
||||
|
||||
}
|
||||
|
||||
//调用该类时,会自动运行execute方法
|
||||
protected function execute(Input $input, Output $output,$num = 1){
|
||||
|
||||
$config = [
|
||||
// 服务器地址
|
||||
'host' => "127.0.0.1",
|
||||
// 数据库名
|
||||
'database' => "hospital_web",
|
||||
// 用户名
|
||||
'user' => "root",
|
||||
// 密码
|
||||
'password' =>"123456",
|
||||
// 端口
|
||||
'port' => "3306",
|
||||
// 字符编码
|
||||
'charset' => "utf-8"
|
||||
];
|
||||
|
||||
$dir = "./backup/sql";//备份路径
|
||||
// 还原
|
||||
$data = \cocolait\sql\Backup::instance($config)->recover('hospital_web15.sql',$dir);
|
||||
print_r($data);die;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 10/3/2019
|
||||
* Time: 2:32 PM
|
||||
*/
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\Controller;
|
||||
use think\Env;
|
||||
use think\Session;
|
||||
|
||||
class BaseController extends Controller
|
||||
{
|
||||
public function _initialize()
|
||||
{
|
||||
//跳过前台因出现PHP语句的报错
|
||||
if (!Env::get("debug.reportingNotice")) {
|
||||
error_reporting(E_ALL & ~E_NOTICE);
|
||||
}
|
||||
|
||||
//当前台没有传数据过来时,刷新页面
|
||||
$id = Session::get('id');
|
||||
if (!$id) {
|
||||
return $this->redirect('Login/index');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\admin\model\Drugs;
|
||||
use app\admin\model\Role;
|
||||
use app\admin\model\User_Role;
|
||||
use app\lib\exception\HtmlException;
|
||||
use app\lib\validate\DrugsManagerCheck;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
|
||||
class DrugsManager extends BaseController
|
||||
{
|
||||
//渲染分页+搜索
|
||||
public function index(){
|
||||
// $map = [];
|
||||
if (Request::instance()->isPost()) {
|
||||
$input = Request::instance()->param();
|
||||
}
|
||||
else {
|
||||
$input = Request::instance()->get();
|
||||
}
|
||||
// if (!empty($input['name'])){
|
||||
// $map['register_id'] = $input['registerId'];
|
||||
// }
|
||||
$drugs = Drugs::where(['name'=>['like',"%{$input['name']}%"]])
|
||||
->paginate(10,false,[
|
||||
"query" => [
|
||||
'name' => $input['name'],
|
||||
]
|
||||
]);
|
||||
foreach ($drugs as $val){
|
||||
if(empty($val['use_amount'])){
|
||||
$val['use_amount'] = 0;
|
||||
}
|
||||
if($val['description'] == NULL){
|
||||
$val['description'] = "暂时为空";
|
||||
}
|
||||
}
|
||||
$total = $drugs->total();
|
||||
$page = $drugs->render();
|
||||
$this->assign('page',$page);
|
||||
$this->assign('total',$total);
|
||||
$this->assign('name',$input['name']);
|
||||
$this->assign('drugs',$drugs);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//添加药品
|
||||
public function addDrugs(){
|
||||
$roleId = Session::get('roleId');
|
||||
if($roleId != 1){
|
||||
throw new HtmlException('您没有权限进行该操作!');
|
||||
}
|
||||
if(Request::instance()->isPost()) {
|
||||
$input = Request::instance()->param();
|
||||
// p($input);die();
|
||||
$data = new Drugs([
|
||||
'name' => $input['name'],
|
||||
'price'=> $input['price'],
|
||||
'quantity' => $input['quantity'],
|
||||
'description' => $input['description'],
|
||||
]);
|
||||
$data->save();
|
||||
if ($data === false)
|
||||
return $this->error('添加失败');
|
||||
return $this->success('添加成功');
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//查看药品详细信息
|
||||
public function check(){
|
||||
$input = Request::instance()->param();
|
||||
// p($input);die();
|
||||
$drugs = Drugs::where($input)->find();
|
||||
if(empty($drugs['use_amount'])){
|
||||
$drugs['use_amount'] = 0;
|
||||
}
|
||||
$this->assign('drugs',$drugs);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//修改药品信息
|
||||
public function write(){
|
||||
$roleId = Session::get('roleId');
|
||||
if($roleId != 1){
|
||||
throw new HtmlException('您没有权限进行该操作!');
|
||||
}
|
||||
$id = Request::instance()->param();
|
||||
$drugs = Drugs::where($id)->find();
|
||||
if(empty($drugs['use_amount'])){
|
||||
$drugs['use_amount'] = 0;
|
||||
}
|
||||
if(Request::instance()->isPost()){
|
||||
$data = [];
|
||||
$input = Request::instance()->param();
|
||||
$drugsInfo = Drugs::where(['id'=>$input['id']])->find();
|
||||
$quantity = $drugsInfo['quantity'];
|
||||
if(!empty($input['quantity'])) {
|
||||
if ($input['quantity'] == 2) {
|
||||
if ($input['use_amount'] > $drugsInfo['quantity']) {
|
||||
throw new HtmlException("减少的数量大于库存量!");
|
||||
}
|
||||
$quantity = $drugsInfo['quantity'] - $input['use_amount'];
|
||||
} else {
|
||||
$quantity = $drugsInfo['quantity'] + $input['use_amount'];
|
||||
}
|
||||
}
|
||||
$data =([
|
||||
'name' => $input['name'],
|
||||
'price' => $input['price'],
|
||||
'description' => $input['description'],
|
||||
'quantity' => $quantity
|
||||
]);
|
||||
$drugsInfo->save($data);
|
||||
if ($drugsInfo === false)
|
||||
return $this->error('修改失败');
|
||||
return $this->success('修改成功');
|
||||
}
|
||||
$this->assign('drugs',$drugs);
|
||||
return $this->fetch();
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 10/3/2019
|
||||
* Time: 4:42 PM
|
||||
*/
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use app\admin\model\User as UserModel;
|
||||
use app\admin\model\User_Role;
|
||||
use app\admin\model\ViewHistory as ViewHistoryModel;
|
||||
use app\admin\model\WebStatus;
|
||||
use think\Controller;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
use app\admin\model\Advertisement as AdvertisementModel;
|
||||
use app\admin\model\Role_Permission as Role_PermissionModel;
|
||||
use app\lib\exception\HtmlException;
|
||||
use app\service\InfoForViewHistory;
|
||||
|
||||
class Index extends BaseController
|
||||
{
|
||||
public function index(){
|
||||
Session::get('id');
|
||||
$user = UserModel::where('id', '=', Session::get('id'))->find();
|
||||
$getRole =User_Role::where(['user_id'=>$user['id']])->find();
|
||||
$this->assign('role_id', $getRole['role_id']);
|
||||
$this->assign('user', $user['name']);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function welcome(){
|
||||
//用户名
|
||||
$user = UserModel::where('id', '=', Session::get('id'))->find();
|
||||
//工作人员数
|
||||
$users = UserModel::where(1)->select();
|
||||
$count = count($users);
|
||||
//今日挂号数
|
||||
$todayStart = strtotime(date("Y-m-d",time()));
|
||||
$todayNow = time();
|
||||
$todayView = \app\admin\model\Register::where('date','between',[$todayStart,$todayNow])->select();
|
||||
$todayCount = count($todayView);
|
||||
//本月挂号数
|
||||
$monthStart = strtotime(date("Y-m",time()));
|
||||
$monthEnd = time();
|
||||
$monthView = \app\admin\model\Register::where('date','between',[$monthStart,$monthEnd])->select();
|
||||
$monthCount = count($monthView);
|
||||
//公告
|
||||
$advertise = AdvertisementModel::where(1)->select();
|
||||
$this->assign('user', $user['name']);
|
||||
$this->assign('dayCount', $todayCount);
|
||||
$this->assign('MonthCount', $monthCount);
|
||||
$this->assign('count', $count);
|
||||
$this->assign('advertise', $advertise);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//增加公告
|
||||
public function addAdvertisement(){
|
||||
$roleId = Session::get('roleId');
|
||||
if ($roleId!=1){
|
||||
throw new HtmlException('您没有权限进行该操作!');
|
||||
}
|
||||
if (Request::instance()->isPost()){
|
||||
$input = Request::instance()->post();
|
||||
$data = [
|
||||
'content' => $input['addAdvertisement'],
|
||||
];
|
||||
$result = AdvertisementModel::create($data);
|
||||
if (!$result){
|
||||
throw new HtmlException('添加失败!');
|
||||
}else {
|
||||
$this->success('添加成功!');
|
||||
}
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function delAdvertisement(){
|
||||
$roleId = Session::get('roleId');
|
||||
if ($roleId!=1){
|
||||
throw new HtmlException('您没有权限进行该操作!');
|
||||
}
|
||||
$contents = AdvertisementModel::where(1)->select();
|
||||
$this->assign('contents',$contents);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function delAdvertisementHandle(){
|
||||
$input = Request::instance()->param();
|
||||
$result = AdvertisementModel::where('id','=',$input['id'])->delete();
|
||||
if (!$result){
|
||||
throw new HtmlException('删除失败!');
|
||||
}else {
|
||||
$this->success('删除成功!');
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/9/29 0029
|
||||
* Time: 下午 5:15
|
||||
*/
|
||||
namespace app\admin\controller;
|
||||
use app\lib\exception\JsonException;
|
||||
use app\lib\exception\Success;
|
||||
use think\Controller;
|
||||
use app\lib\validate\LoginCheck;
|
||||
use app\lib\enum\ExceptionType;
|
||||
use think\Request;
|
||||
use think\Session;
|
||||
use app\admin\model\User;
|
||||
use app\admin\model\User_Role;
|
||||
use think\captcha\Captcha;
|
||||
|
||||
class Login extends Controller
|
||||
{
|
||||
public function index(){
|
||||
if (Session::get("id")){
|
||||
return $this->redirect("Index/index");
|
||||
}
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//生成验证码
|
||||
public function verify()
|
||||
{
|
||||
$config = [
|
||||
'useCurve' => false,
|
||||
// 关闭验证码杂点
|
||||
'useNoise' => false,
|
||||
];
|
||||
$captcha = new Captcha($config);
|
||||
return $captcha->entry();
|
||||
}
|
||||
|
||||
public function login(){
|
||||
$input = Request::instance()->param();
|
||||
$data = (new LoginCheck(ExceptionType::JSON))->goCheck();
|
||||
$name = $data['username'];
|
||||
$password = md5($data['password']);
|
||||
$user = User::loginCheck($name,$password);
|
||||
$time = time();
|
||||
$id = $user['id'];
|
||||
$getRole_id = User_Role::where('user_id','=',$id)->find();
|
||||
User::where('name', '=',$name)
|
||||
->update(['last_login_time' => $time]);
|
||||
Session::set('time',time());
|
||||
Session::set('id',$id); //比较Session与Cookie
|
||||
Session::set('password',$password);
|
||||
Session::set('name',$name);
|
||||
Session::set('roleId',$getRole_id['role_id']);
|
||||
throw new Success("登录成功!");
|
||||
// return $this->success('登陆成功!','Index/index');
|
||||
}
|
||||
|
||||
public function logOut(){
|
||||
Session::clear();
|
||||
throw new Success("注销成功!");
|
||||
}
|
||||
|
||||
public function test(){
|
||||
echo \think\Config::get("view_replace_str.__ADMIN__");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\lib\exception\HtmlException;
|
||||
use app\viewModel\PatientMedicalView;
|
||||
use think\Request;
|
||||
|
||||
class PatientInfo extends BaseController
|
||||
{
|
||||
public function index(){
|
||||
$map = [];
|
||||
if (Request::instance()->isPost()) {
|
||||
$input = Request::instance()->param();
|
||||
}
|
||||
else {
|
||||
$input = Request::instance()->get();
|
||||
}
|
||||
if (!empty($input['code'])){
|
||||
$map['code'] = $input['code'];
|
||||
}
|
||||
$patients = \app\admin\model\PatientInfo::viewQuery(PatientMedicalView::CLASS,"patientRegister")
|
||||
->where($map)
|
||||
->paginate(10,false,[
|
||||
"query" => [
|
||||
'code' => $map['code'],
|
||||
]
|
||||
]);
|
||||
foreach ($patients as $patient){
|
||||
if($patient['description'] == NULL){
|
||||
$patient['description'] = "暂无记录" ;
|
||||
}
|
||||
}
|
||||
$total = $patients->total();
|
||||
$page = $patients->render();
|
||||
$this->assign('page',$page);
|
||||
$this->assign('total',$total);
|
||||
$this->assign('code',$input['code']);
|
||||
$this->assign('patients',$patients);
|
||||
return $this->fetch();
|
||||
}
|
||||
//查看患者详情
|
||||
public function check(){
|
||||
$input = Request::instance()->param();
|
||||
// p($input);die();
|
||||
$patient = \app\admin\model\PatientInfo::where($input)->find();
|
||||
if($patient['description'] == NULL){
|
||||
$patient['description'] = "暂无记录" ;
|
||||
}
|
||||
$this->assign('patient',$patient);
|
||||
return $this->fetch();
|
||||
}
|
||||
//填写诊断结果
|
||||
public function write(){
|
||||
$id = Request::instance()->param();
|
||||
$patient = \app\admin\model\PatientInfo::where($id)->find();
|
||||
// p($patient);die();
|
||||
if(Request::instance()->isPost()) {
|
||||
$input = Request::instance()->param();
|
||||
// p($input);die();
|
||||
if (empty($input['description'])) {
|
||||
throw new HtmlException("请填写诊断结果!");
|
||||
}
|
||||
$patientInfo = \app\admin\model\PatientInfo::where(['id'=>$input['id']])->find();
|
||||
// if (empty($patientInfo['description'])) {
|
||||
$data = ['description' => $input['description']];
|
||||
$patientInfo->save($data);
|
||||
if ($patient['description'] === false)
|
||||
return $this->error('添加失败');
|
||||
return $this->success('添加成功');
|
||||
// p($patientInfo);die();
|
||||
// }
|
||||
|
||||
}
|
||||
$this->assign('patient',$patient);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\admin\model\Drugs;
|
||||
use app\admin\model\User;
|
||||
use app\admin\model\User_Role;
|
||||
use app\lib\enum\ExceptionType;
|
||||
use app\lib\exception\JsonException;
|
||||
use app\lib\exception\Success;
|
||||
use app\lib\validate\IdMustBePositiveInt;
|
||||
use app\viewModel\PatientMedicalView;
|
||||
use think\Request;
|
||||
|
||||
class Payment extends BaseController
|
||||
{
|
||||
public function index(){
|
||||
$map = [];
|
||||
//有搜索时
|
||||
if (Request::instance()->isPost()) {
|
||||
$code = Request::instance()->param('code');
|
||||
// p($union);die();
|
||||
if (!empty($code)) {
|
||||
$patient = \app\admin\model\PatientInfo::where(['code'=>$code])->column('id');
|
||||
$patientName = \app\admin\model\PatientInfo::where(['code'=>$code])->column('name');
|
||||
// $test = \app\admin\model\PatientInfo::where(['code'=>$code])->select();
|
||||
// p($test[0]['code']);die();
|
||||
//???
|
||||
$patient['id'] = ['in',$patient];
|
||||
// p($patient);die();
|
||||
$medicals = \app\admin\model\PatientMedical::viewQuery(PatientMedicalView::CLASS, "patientDrugsList")
|
||||
->where(['patient_id' => $patient['id']])
|
||||
->paginate(10, false, [
|
||||
"query" => [
|
||||
'code' => $code,
|
||||
]
|
||||
]);
|
||||
$medicalsCheck = \app\admin\model\PatientMedical::where(['patient_id' => $patient['id']])->select();
|
||||
// p($medicals[0]['id']);die();
|
||||
if($medicalsCheck[0]) $check = 1;
|
||||
else $check = 2;
|
||||
$totalPrice = 0;
|
||||
$totalStatus = 0;
|
||||
$totalType = 0;
|
||||
foreach($medicals as $key=>$medical){
|
||||
$totalPrice = $medical['price'] + $totalPrice;
|
||||
$totalStatus = $medical['status'] + $totalStatus;
|
||||
$totalType = $medical['type'] + $totalType;
|
||||
if($medical['status']==0) $medical['status'] = "未缴费";
|
||||
else $medical['status']="已缴费";
|
||||
if($medical['type']==0) $medical['type'] = "未取药";
|
||||
else $medical['type']="已取药";
|
||||
// p($medical['status']);
|
||||
}
|
||||
// p($totalStatus);die();
|
||||
if($totalStatus == count($medicals)){
|
||||
$totalStatus = "已缴费";
|
||||
}
|
||||
elseif($totalStatus == 0){
|
||||
$totalStatus = "未缴费";
|
||||
}
|
||||
else{
|
||||
$totalStatus = "有未缴费的药品";
|
||||
}
|
||||
if($totalType == count($medicals)){
|
||||
$totalType = "已取药";
|
||||
}
|
||||
elseif($totalType == 0){
|
||||
$totalType = "未取药";
|
||||
}
|
||||
else{
|
||||
$totalType = "有未取的药品";
|
||||
}
|
||||
$total = $medicals->total();
|
||||
$page = $medicals->render();
|
||||
$this->assign('page', $page);
|
||||
$this->assign('total', $total);
|
||||
$this->assign('code', $code);
|
||||
$this->assign('medicals', $medicals);
|
||||
$this->assign('totalPrice', $totalPrice);
|
||||
$this->assign('totalStatus', $totalStatus);
|
||||
$this->assign('totalType', $totalType);
|
||||
$this->assign('check', $check);
|
||||
$this->assign('patientName', $patientName[0]);
|
||||
// $this->assign('id', $patient[0]);
|
||||
}
|
||||
}
|
||||
//无搜索时
|
||||
$patientInfo = \app\admin\model\PatientInfo::viewQuery(PatientMedicalView::CLASS, "patientDate")
|
||||
->where(1)
|
||||
->paginate(10, false);
|
||||
$total = $patientInfo->total();
|
||||
$page = $patientInfo->render();
|
||||
$this->assign('page', $page);
|
||||
$this->assign('total', $total);
|
||||
$this->assign('patientInfo', $patientInfo);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
public function check(){
|
||||
$code = Request::instance()->param('code');
|
||||
$patient = \app\admin\model\PatientInfo::where(['code'=>$code])->column('id');
|
||||
$patientName = \app\admin\model\PatientInfo::where(['code'=>$code])->column('name');
|
||||
// $test = \app\admin\model\PatientInfo::where(['code'=>$code])->select();
|
||||
// p($test[0]['code']);die();
|
||||
//???
|
||||
$patient['id'] = ['in',$patient];
|
||||
// p($patient);die();
|
||||
$medicals = \app\admin\model\PatientMedical::viewQuery(PatientMedicalView::CLASS, "patientDrugsList")
|
||||
->where(['patient_id' => $patient['id']])
|
||||
->paginate(10, false, [
|
||||
"query" => [
|
||||
'code' => $code,
|
||||
]
|
||||
]);
|
||||
$medicalsCheck = \app\admin\model\PatientMedical::where(['patient_id' => $patient['id']])->select();
|
||||
// p($medicals[0]['id']);die();
|
||||
if($medicalsCheck[0]) $check = 1;
|
||||
else $check = 2;
|
||||
$totalPrice = 0;
|
||||
$totalStatus = 0;
|
||||
$totalType = 0;
|
||||
foreach($medicals as $key=>$medical){
|
||||
$totalPrice = $medical['price'] + $totalPrice;
|
||||
$totalStatus = $medical['status'] + $totalStatus;
|
||||
$totalType = $medical['type'] + $totalType;
|
||||
if($medical['status']==0) $medical['status'] = "未缴费";
|
||||
else $medical['status']="已缴费";
|
||||
if($medical['type']==0) $medical['type'] = "未取药";
|
||||
else $medical['type']="已取药";
|
||||
// p($medical['status']);
|
||||
}
|
||||
// p($totalStatus);die();
|
||||
if($totalStatus == count($medicals)){
|
||||
$totalStatus = "已缴费";
|
||||
}
|
||||
elseif($totalStatus == 0){
|
||||
$totalStatus = "未缴费";
|
||||
}
|
||||
else{
|
||||
$totalStatus = "有未缴费的药品";
|
||||
}
|
||||
if($totalType == count($medicals)){
|
||||
$totalType = "已取药";
|
||||
}
|
||||
elseif($totalType == 0){
|
||||
$totalType = "未取药";
|
||||
}
|
||||
else{
|
||||
$totalType = "有未取的药品";
|
||||
}
|
||||
$total = $medicals->total();
|
||||
$page = $medicals->render();
|
||||
$this->assign('page', $page);
|
||||
$this->assign('total', $total);
|
||||
$this->assign('code', $code);
|
||||
$this->assign('medicals', $medicals);
|
||||
$this->assign('totalPrice', $totalPrice);
|
||||
$this->assign('totalStatus', $totalStatus);
|
||||
$this->assign('totalType', $totalType);
|
||||
$this->assign('check', $check);
|
||||
$this->assign('patientName', $patientName[0]);
|
||||
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
//单个缴费 id:患者药单的id
|
||||
public function costAlong($id){
|
||||
$patientMedical = \app\admin\model\PatientMedical::where(['id'=>$id])->find();
|
||||
// p($patientMedical);die();
|
||||
if ($patientMedical['status'] == 1){
|
||||
throw new JsonException('1','费用已缴');
|
||||
}
|
||||
else{
|
||||
$data = [
|
||||
'status' => 1,
|
||||
];
|
||||
$patientMedical->save($data);
|
||||
throw new Success('缴费成功!');
|
||||
}
|
||||
}
|
||||
|
||||
//单个领取 id:患者药单id
|
||||
public function getMedical($id){
|
||||
$patientMedical = \app\admin\model\PatientMedical::where(['id'=>$id])->find();
|
||||
$drugs = Drugs::where(['id'=>$patientMedical['drugs_id']])->find();
|
||||
if ($patientMedical['type'] == 1){
|
||||
throw new JsonException('1','药品已领取');
|
||||
}
|
||||
else{
|
||||
$use = [
|
||||
'use_amount' => $drugs['use_amount'] + $patientMedical['quantity'],
|
||||
'quantity' => $drugs['quantity'] - $patientMedical['quantity'],
|
||||
];
|
||||
$data = [
|
||||
'type' => 1,
|
||||
];
|
||||
$drugs->save($use);
|
||||
$patientMedical->save($data);
|
||||
throw new Success('领取成功!');
|
||||
}
|
||||
}
|
||||
|
||||
//总缴费 union:流水号
|
||||
public function total(){
|
||||
//参数传过来的时候有问题??以下均不可以
|
||||
// public function total($code){
|
||||
//$code = $_POST['code']
|
||||
$code = Request::instance()->param('code');
|
||||
// p($code);die();
|
||||
// 1590834044M1
|
||||
$patient = \app\admin\model\PatientInfo::where(['code'=>$code])->find();
|
||||
$patientMedicals =\app\admin\model\PatientMedical::where(['patient_id'=>$patient['id']])->select();
|
||||
// p($patient);die();
|
||||
$check = 0;
|
||||
foreach($patientMedicals as $medical){
|
||||
if($medical['status']==0){
|
||||
$data = ['status' => 1];
|
||||
$medical->save($data);
|
||||
}
|
||||
$check++;
|
||||
}
|
||||
if($check == count($patientMedicals)){
|
||||
throw new Success('缴费成功!');
|
||||
}
|
||||
else throw new JsonException('1','缴费失败!');
|
||||
}
|
||||
|
||||
// //总领取 code:流水号
|
||||
public function getTotal(){
|
||||
$code = Request::instance()->param('code');
|
||||
$patient = \app\admin\model\PatientInfo::where(['code'=>$code])->find();
|
||||
$patientMedicals =\app\admin\model\PatientMedical::where(['patient_id'=>$patient['id']])->select();
|
||||
// p($patientMedicals);die();
|
||||
$check1 = 0;
|
||||
$check2 = 0;
|
||||
foreach($patientMedicals as $patientMedical){
|
||||
$drugs = Drugs::where(['id'=>$patientMedical['drugs_id']])->find();
|
||||
if($drugs){
|
||||
if($patientMedical['type']==0){
|
||||
$data = [
|
||||
'type' => 1,
|
||||
];
|
||||
$medical = [
|
||||
'use_amount' => $drugs['use_amount'] + $patientMedical['quantity'],
|
||||
'quantity' => $drugs['quantity'] - $patientMedical['quantity'],
|
||||
];
|
||||
$patientMedical->save($data);
|
||||
$drugs->save($medical);
|
||||
$check2++;
|
||||
// p($medical);
|
||||
}
|
||||
else $check1++;
|
||||
}
|
||||
}
|
||||
// die();
|
||||
$check = $check1 +$check2;
|
||||
if($check == count($patientMedicals)){
|
||||
throw new Success('领取成功!');
|
||||
}
|
||||
else throw new JsonException('1','领取失败!');
|
||||
}
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
|
||||
use app\admin\model\Department;
|
||||
use app\admin\model\PatientInfo;
|
||||
use app\admin\model\Role;
|
||||
use app\admin\model\User;
|
||||
use app\admin\model\User_Role;
|
||||
use app\lib\enum\ExceptionType;
|
||||
use app\lib\validate\RegisterCheck;
|
||||
use app\viewModel\PatientMedicalView;
|
||||
use think\Request;
|
||||
|
||||
class Register extends BaseController
|
||||
{
|
||||
public function index(){
|
||||
$map = [];
|
||||
if (Request::instance()->isPost()) {
|
||||
$input = Request::instance()->param();
|
||||
}
|
||||
else {
|
||||
$input = Request::instance()->get();
|
||||
}
|
||||
if (!empty($input['code'])){
|
||||
$map['code'] = $input['code'];
|
||||
}
|
||||
$patients = \app\admin\model\PatientInfo::viewQuery(PatientMedicalView::CLASS,"patientRegister")
|
||||
->where($map)
|
||||
->paginate(10,false,[
|
||||
"query" => [
|
||||
'code' => $map['code'],
|
||||
]
|
||||
]);
|
||||
$total = $patients->total();
|
||||
$page = $patients->render();
|
||||
$this->assign('page',$page);
|
||||
$this->assign('total',$total);
|
||||
$this->assign('code',$input['code']);
|
||||
$this->assign('patients',$patients);
|
||||
return $this->fetch();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function add(){
|
||||
$department = Department::where(1)->select();
|
||||
//在role表中找到护士对应的角色id
|
||||
$role = Role::where(['role'=>'护士'])->column('id');
|
||||
//处理数组
|
||||
$roleId['id'] = [in,$role];
|
||||
//在user_role表中找到所有护士角色的user_id
|
||||
$nurseID = User_Role::where(['role_id'=>$roleId['id']])->column('user_id');
|
||||
//处理数组
|
||||
$map['id'] = ['in',$nurseID];
|
||||
// p($map['id']);die();
|
||||
//在user表中找到护士的姓名
|
||||
$nurse = User::where(['id'=>$map['id']])->select();
|
||||
$this->assign('department',$department);
|
||||
$this->assign('nurse',$nurse);
|
||||
return $this->fetch();
|
||||
}
|
||||
//下拉框一二级联动
|
||||
public function indexHandle(){
|
||||
$map = [];
|
||||
$map['department'] = $_POST['id'];
|
||||
//得到医生的角色id
|
||||
$doctor = Role::where(['role'=>'医生'])->column('id');
|
||||
//处理数组
|
||||
$doctor['id'] = ['in',$doctor];
|
||||
//得到医生角色的用户id
|
||||
$userId = User_Role::where(['role_id'=>$doctor['id']])->column('user_id');
|
||||
//处理数组
|
||||
if (empty($userId[1])){
|
||||
$map['id'] = $userId[0];
|
||||
}else {
|
||||
$map['id'] = ['in',$userId];
|
||||
}
|
||||
$Member = User::where($map)->select();
|
||||
$Member = json_encode($Member,JSON_UNESCAPED_UNICODE);
|
||||
return $Member;
|
||||
}
|
||||
|
||||
//提交
|
||||
public function submit(){
|
||||
if (Request::instance()->isPost()) {
|
||||
$input = Request::instance()->param();
|
||||
$data = (new RegisterCheck(ExceptionType::HTML))->goCheck();
|
||||
$register_id = 1;
|
||||
if ($temp = \app\admin\model\Register::where(1)->column('register_id')){
|
||||
rsort($temp);
|
||||
$register_id = max($temp) + 1;
|
||||
}
|
||||
$register = new \app\admin\model\Register([
|
||||
'register_id' => $register_id,
|
||||
'doctor_id' => $data['doctor'],
|
||||
'nurse_id' => $data['nurse'],
|
||||
"date" => time(),
|
||||
]);
|
||||
// p($register);die();
|
||||
$register->save();
|
||||
if ($register === false)
|
||||
return $this->error('添加失败');
|
||||
else{
|
||||
$patientInfo = new PatientInfo([
|
||||
'register_id' => $register_id,
|
||||
'name' => $data['name'],
|
||||
'sex' => $data['sex'],
|
||||
"department" => $data['department'],
|
||||
'code' => time()."M".$register_id,
|
||||
]);
|
||||
$patientInfo->save();
|
||||
if ($patientInfo === false)
|
||||
return $this->error('添加失败');
|
||||
return $this->success('添加成功');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/6/6 0006
|
||||
* Time: 下午 5:38
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseAdvertisement;
|
||||
|
||||
class Advertisement extends BaseAdvertisement
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseDepartment;
|
||||
|
||||
class Department extends BaseDepartment
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseDrugs;
|
||||
|
||||
class Drugs extends BaseDrugs
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseMember;
|
||||
|
||||
class Member extends BaseMember
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BasePatientInfo;
|
||||
|
||||
class PatientInfo extends BasePatientInfo
|
||||
{
|
||||
public function getSexAttr($var){
|
||||
switch($var){
|
||||
case '1':
|
||||
return "男";
|
||||
break;
|
||||
case '2':
|
||||
return "女";
|
||||
break;
|
||||
}
|
||||
}
|
||||
// //获取任职时间
|
||||
// public function getDateAttr($val,$data)
|
||||
// {
|
||||
// if (empty($data['date']))
|
||||
// return '暂无记录';
|
||||
// return date("Y-m-d",$data['entry_time']);
|
||||
// }
|
||||
|
||||
// public function getDepartmentAttr($var){
|
||||
// switch($var){
|
||||
// case '1':
|
||||
// return "内科";
|
||||
// break;
|
||||
// case '2':
|
||||
// return "儿科";
|
||||
// break;
|
||||
// case '3':
|
||||
// return "神经科";
|
||||
// break;
|
||||
// case '4':
|
||||
// return "口腔科";
|
||||
// break;
|
||||
// case '5':
|
||||
// return "眼科";
|
||||
// break;
|
||||
// case '6':
|
||||
// return "耳鼻喉科";
|
||||
// break;
|
||||
// case '7':
|
||||
// return "妇科";
|
||||
// break;
|
||||
// case '8':
|
||||
// return "中医科";
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BasePatientMedical;
|
||||
|
||||
class PatientMedical extends BasePatientMedical
|
||||
{
|
||||
// public function getStatusAttr($var){
|
||||
// switch($var){
|
||||
// case '0':
|
||||
// return "未缴费";
|
||||
// break;
|
||||
// case '1':
|
||||
// return "已缴费";
|
||||
// break;
|
||||
// default:
|
||||
// return "未知";
|
||||
// }
|
||||
// }
|
||||
// public function getTypeAttr($var){
|
||||
// switch($var){
|
||||
// case '0':
|
||||
// return "未取药";
|
||||
// break;
|
||||
// case '1':
|
||||
// return "已取药";
|
||||
// break;
|
||||
// default:
|
||||
// return "未知";
|
||||
// }
|
||||
// }
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseRegister;
|
||||
|
||||
class Register extends BaseRegister
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/4/18 0018
|
||||
* Time: 下午 10:33
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseRole;
|
||||
|
||||
class Role extends BaseRole
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/4/18 0018
|
||||
* Time: 上午 1:03
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
use app\lib\exception\JsonException;
|
||||
use app\model\BaseUser;
|
||||
|
||||
class User extends BaseUser
|
||||
{
|
||||
public static function loginCheck($name,$password){
|
||||
|
||||
// $sessionVerify = Session::get('verify');
|
||||
// if($verify != $sessionVerify){
|
||||
// throw new HtmlException("验证码输入错误,请重试!");
|
||||
// }
|
||||
|
||||
$user = self::where(['name'=>$name,'password'=>$password])->find();
|
||||
if(!$user){
|
||||
throw new JsonException(1,"用户名或密码输入错误,请重试!");
|
||||
}
|
||||
|
||||
// if($user->status == \app\lib\enum\User::DELETED){
|
||||
// throw new JsonException(1,"该用户已经被删除!");
|
||||
// }
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
//获取性别
|
||||
public function getSexAttr($var){
|
||||
switch($var){
|
||||
case '1':
|
||||
return "男";
|
||||
break;
|
||||
case '2':
|
||||
return "女";
|
||||
break;
|
||||
default:
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
|
||||
//获取科室
|
||||
public function getDepartmentAttr($var){
|
||||
switch($var){
|
||||
case '1':
|
||||
return "内科";
|
||||
break;
|
||||
case '2':
|
||||
return "儿科";
|
||||
break;
|
||||
case '3':
|
||||
return "神经科";
|
||||
break;
|
||||
case '4':
|
||||
return "口腔科";
|
||||
break;
|
||||
case '5':
|
||||
return "眼科";
|
||||
break;
|
||||
case '6':
|
||||
return "耳鼻喉科";
|
||||
break;
|
||||
case '7':
|
||||
return "妇科";
|
||||
break;
|
||||
case '8':
|
||||
return "中医科";
|
||||
break;
|
||||
default:
|
||||
return "无";
|
||||
}
|
||||
}
|
||||
|
||||
//获取职位
|
||||
public function getPositionAttr($var){
|
||||
switch($var){
|
||||
case '1':
|
||||
return "管理员";
|
||||
break;
|
||||
case '2':
|
||||
return "医生";
|
||||
break;
|
||||
case '3':
|
||||
return "护士";
|
||||
break;
|
||||
default:
|
||||
return "无职位";
|
||||
}
|
||||
}
|
||||
|
||||
//获取任职时间
|
||||
public function getEntryTimeAttr($val,$data)
|
||||
{
|
||||
if (empty($data['entry_time']))
|
||||
return '暂无记录';
|
||||
return date("Y-m-d",$data['entry_time']);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/5/19 0019
|
||||
* Time: 上午 1:04
|
||||
*/
|
||||
|
||||
namespace app\admin\model;
|
||||
|
||||
|
||||
use app\model\BaseUser_Role;
|
||||
|
||||
class User_Role extends BaseUser_Role
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,307 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>医院就诊管理系统后台</title>
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/font.css">
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/xadmin.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/fonts/iconfont.eot" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/fonts/iconfont.svg" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/fonts/iconfont.ttf" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/fonts/iconfont.woff" charset="utf-8"></script>
|
||||
<script src="__ADMIN__/x-admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/js/xadmin.js"></script>
|
||||
<style>
|
||||
.third-menu li{
|
||||
margin-left:20px;
|
||||
}
|
||||
body.index{background: linear-gradient(to left,rgba(57, 61, 73, 1), rgba(0, 0, 0, 0.5)) !important;}
|
||||
.container{background: linear-gradient(to left,rgba(57, 61, 73, 1), rgba(0, 0, 0, 0.5)) !important;}
|
||||
.container .layui-nav-bar{background:rgba(153, 153, 153, 1) !important;}
|
||||
.container .logo a{background:rgba(150, 144, 144, 0.5) !important;}
|
||||
.container .logo a{color:rgba(213, 211, 211, 1) !important;}
|
||||
.left-nav{background:rgba(153, 153, 153, 1) !important;}
|
||||
.left-nav a{color:rgba(57, 61, 73, 1) !important;}
|
||||
.left-nav a:hover,.left-nav a.active{background: linear-gradient(to left,rgba(221, 220, 220, 1), rgba(0, 0, 0, 0.5)) !important;}
|
||||
.left-nav a:hover,.left-nav a.active{color:rgba(153, 153, 153, 1) !important;}
|
||||
.left-nav a:hover,.left-nav a.active{border-color:rgba(153, 153, 153, 1) !important;}
|
||||
body{background:rgba(0,0,0,0) !important;}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
||||
<style type="text/css">
|
||||
*{
|
||||
margin:0;
|
||||
padding:0;
|
||||
list-style:none;
|
||||
text-decoration:none;
|
||||
}
|
||||
body{
|
||||
font-family:sans-serif;
|
||||
}
|
||||
.sidebar{
|
||||
position:fixed;
|
||||
left:-250px;
|
||||
width:250px;
|
||||
height:100%;
|
||||
background:#9CC;
|
||||
}
|
||||
.sidebar header{
|
||||
font-size:20px;
|
||||
color:#FFF;
|
||||
text-align:center;
|
||||
line-height:45px;
|
||||
background:#066;
|
||||
user-select:none;
|
||||
}
|
||||
.sidebar ul a{
|
||||
display:block;
|
||||
height:100%;
|
||||
width:100%;
|
||||
line-height:65px;
|
||||
font-size:20px;
|
||||
color:#FFF;
|
||||
padding-left:60px;
|
||||
box-sizing:border-box;
|
||||
border-top:1px solid rgba(255,255,255,1);
|
||||
border-bottom:1px solid black;
|
||||
|
||||
}
|
||||
.sidebar ul li:hover a{
|
||||
padding-left:70px;
|
||||
}
|
||||
|
||||
.sidebar ul a i{
|
||||
margin-right:16px;
|
||||
}
|
||||
#check{
|
||||
display:none;
|
||||
}
|
||||
label #btn,label #cancel{
|
||||
position:absolute;
|
||||
cursor:pointer;
|
||||
background:#9CC;
|
||||
border-radius:3px;
|
||||
}
|
||||
label #btn{
|
||||
left:0px;
|
||||
top:0px;
|
||||
font-size:30px;
|
||||
color:#FFF;
|
||||
padding:6px 12px;
|
||||
|
||||
}
|
||||
label #cancel{
|
||||
z-index:1111;
|
||||
left:-195px;
|
||||
top:10px;
|
||||
font-size:20px;
|
||||
color:#FFF;
|
||||
padding:4px 9px;
|
||||
}
|
||||
#check:checked ~.sidebar{
|
||||
left:0;
|
||||
}
|
||||
#check:checked ~label #btn{
|
||||
left:250px;
|
||||
opacity:0;
|
||||
pointer-events:none;
|
||||
}
|
||||
#check:checked ~label #cancel{
|
||||
left:195px;
|
||||
|
||||
}
|
||||
#check:checked ~section{
|
||||
margin-left:250px;
|
||||
}
|
||||
.navbar{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
background:#066;
|
||||
box-shadow: 0 -2px 2px #000;
|
||||
left: 1px;
|
||||
top: 0px;
|
||||
height: 45px;
|
||||
}
|
||||
.navbar ul li{
|
||||
list-style:none;
|
||||
float:right;
|
||||
color:#FFF;
|
||||
font-size:20px;
|
||||
text-align:center;
|
||||
padding:10px 5px;
|
||||
}
|
||||
.navbar ul li a:hover{
|
||||
color:#0FF;
|
||||
}
|
||||
section{
|
||||
background:url(../../../../public/static/admin/bg2.jpg) no-repeat;
|
||||
background-position:center;
|
||||
background-size:cover;
|
||||
height:100vh;
|
||||
}
|
||||
</style>
|
||||
|
||||
<body>
|
||||
<!-- 顶部开始 -->
|
||||
<div class="navbar">
|
||||
<ul>
|
||||
<li><a title="退出" onclick="log_out(this)" href="javascript:;" style="margin-right: 5vh">退出系统</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" id="check" />
|
||||
<label for="check">
|
||||
<i class="fas fa-bars iconfont" title="展开左侧栏" id="btn"></i>
|
||||
<i class="fas fa-times iconfont" title="关闭左侧栏" id="cancel"></i>
|
||||
</label>
|
||||
<!-- </div>-->
|
||||
<!-- 顶部结束 -->
|
||||
<!-- 中部开始 -->
|
||||
<!-- 左侧菜单开始 -->
|
||||
|
||||
<!-- {if condition="$role_id==1 "}-->
|
||||
<!-- <div class="sidebar">-->
|
||||
<!-- <header>管理员页面</header>-->
|
||||
<!-- <ul>-->
|
||||
|
||||
|
||||
<div class="sidebar">
|
||||
|
||||
{if condition="$role_id==3 "}
|
||||
<header>护士页面</header>
|
||||
<ul>
|
||||
<li>
|
||||
<a data-src="{:url('Register/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>挂号登记</cite>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-src="{:url('Payment/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>统计缴费</cite>
|
||||
</a>
|
||||
</li >
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
|
||||
{if condition="$role_id==2 "}
|
||||
<header>医生页面</header>
|
||||
<ul>
|
||||
<li>
|
||||
<a data-src="{:url('PatientInfo/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>患者信息</cite>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-src="{:url('PatientMedical/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>患者药单</cite>
|
||||
</a>
|
||||
</li >
|
||||
<li>
|
||||
<a data-src="{:url('DrugsManager/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>药库信息</cite>
|
||||
</a>
|
||||
</li >
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
|
||||
|
||||
{if condition="$role_id==1 "}
|
||||
<header>管理员页面</header>
|
||||
<ul>
|
||||
<li>
|
||||
<a data-src="{:url('PatientInfo/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>患者信息</cite>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-src="{:url('MemberManager/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>职工信息</cite>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a data-src="{:url('DrugsManager/index')}">
|
||||
<i class="iconfont"></i>
|
||||
<cite>药库信息</cite>
|
||||
</a>
|
||||
</li >
|
||||
</ul>
|
||||
{/if}
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <div class="x-slide_left"></div> -->
|
||||
<!-- 左侧菜单结束 -->
|
||||
<!-- 右侧主体开始 -->
|
||||
<section>
|
||||
<div style="width: 100%;background:#066;box-shadow: 0 -2px 2px #000;left: 1px;height: 45px;"></div>
|
||||
<iframe src='{:url("welcome")}' frameborder="0" scrolling="yes" style="width:100%;height:90vh"></iframe>
|
||||
</section>
|
||||
<!-- 右侧主体结束 -->
|
||||
<!-- 中部结束 -->
|
||||
<!-- 底部开始 -->
|
||||
<div class="footer" style="background-color:#066 ">
|
||||
<div class="copyright">-</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
$(function(){
|
||||
$(".sidebar li a").on("click",function(){
|
||||
var address =$(this).attr("data-src");
|
||||
$("iframe").attr("src",address);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
function log_out(obj){
|
||||
const url = "{:url('Login/logOut')}";
|
||||
layer.confirm('确定要退出吗?',function(index){
|
||||
//发异步删除数据
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:"Post",
|
||||
dataType:"json",//前端指定后端响应的格式
|
||||
success:function(data){
|
||||
const {status,message} = data;
|
||||
if(!status){
|
||||
layer.msg(message,{icon: 6, time: 2000});
|
||||
window.location.href = "{:url('Login/index')}";
|
||||
} else {
|
||||
layer.msg(message,{icon: 5, time: 2000});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
//layer.msg('已删除!',{icon:1,time:1000});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,107 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>欢迎</title>
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/font.css">
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/xadmin.css">
|
||||
<meta name="renderer" content="webkit">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/font.css">
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/xadmin.css">
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/js/xadmin.js"></script>
|
||||
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
|
||||
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
|
||||
<script>
|
||||
const addAdvertisement = "{:url('addAdvertisement','','')}";
|
||||
const delAdvertisement = "{:url('delAdvertisement','','')}";
|
||||
</script>
|
||||
</head>
|
||||
<style>
|
||||
body.index{background: linear-gradient(to left,rgba(57, 61, 73, 1), rgba(0, 0, 0, 0.5)) !important;}.container{background: linear-gradient(to left,rgba(57, 61, 73, 1), rgba(0, 0, 0, 0.5)) !important;}.container .layui-nav-bar{background:rgba(153, 153, 153, 1) !important;}.container .logo a{background:rgba(150, 144, 144, 0.5) !important;}.container .logo a{color:rgba(213, 211, 211, 1) !important;}.left-nav{background:rgba(153, 153, 153, 1) !important;}.left-nav a{color:rgba(57, 61, 73, 1) !important;}.left-nav a:hover,.left-nav a.active{background: linear-gradient(to left,rgba(221, 220, 220, 1), rgba(0, 0, 0, 0.5)) !important;}.left-nav a:hover,.left-nav a.active{color:rgba(153, 153, 153, 1) !important;}.left-nav a:hover,.left-nav a.active{border-color:rgba(153, 153, 153, 1) !important;}body{background:rgba(0,0,0,0) !important;}
|
||||
</style>
|
||||
<body class="layui-anim layui-anim-up" >
|
||||
<div class="x-body layui-anim layui-anim-up">
|
||||
<blockquote class="layui-elem-quote">欢迎用户:
|
||||
<span class="x-red">{$user}</span>!当前时间:{:date("Y-m-d H:i:s")}</blockquote>
|
||||
<fieldset class="layui-elem-field">
|
||||
<legend>数据统计</legend>
|
||||
<div class="layui-field-box">
|
||||
<div class="layui-col-md12">
|
||||
<div class="layui-card">
|
||||
<div class="layui-card-body">
|
||||
<div class="layui-carousel x-admin-carousel x-admin-backlog" lay-anim="" lay-indicator="inside" lay-arrow="none" style="width: 100%; height: 90px;">
|
||||
<div carousel-item="">
|
||||
<ul class="layui-row layui-col-space10 layui-this">
|
||||
<li class="layui-col-xs2">
|
||||
<a href="javascript:;" class="x-admin-backlog-body">
|
||||
<h3>工作人员数目</h3>
|
||||
<p>
|
||||
<cite>{$count}</cite></p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-col-xs2">
|
||||
<a href="javascript:;" class="x-admin-backlog-body">
|
||||
<h3>今日挂号数</h3>
|
||||
<p>
|
||||
<cite>{$dayCount}</cite></p>
|
||||
</a>
|
||||
</li>
|
||||
<li class="layui-col-xs2">
|
||||
<a href="javascript:;" class="x-admin-backlog-body">
|
||||
<h3>本月挂号数</h3>
|
||||
<p>
|
||||
<cite>{$MonthCount}</cite></p>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset class="layui-elem-field">
|
||||
<legend>公告通知</legend>
|
||||
<div class="layui-field-box">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<tbody>
|
||||
{foreach name='$advertise' item='v'}
|
||||
<tr>
|
||||
<td style="background-color: #99CCCC;color: #ffffff">
|
||||
<h2>{$v.content}</h2>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</fieldset>
|
||||
<a title="新增公告" onclick="x_admin_show('新增公告',addAdvertisement,600,300,true)">
|
||||
<i class="layui-btn">新增公告</i>
|
||||
</a>
|
||||
<a title="删除公告" onclick="x_admin_show('删除公告',delAdvertisement,600,300,true)"
|
||||
href="javascript:;">
|
||||
<i class="layui-btn">删除公告</i>
|
||||
</a>
|
||||
</div>
|
||||
<script>
|
||||
var _hmt = _hmt || [];
|
||||
(function() {
|
||||
var hm = document.createElement("script");
|
||||
hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
|
||||
var s = document.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(hm, s);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,163 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="apple-touch-icon" sizes="76x76" href="__ASSETS__/img/apple-icon.png">
|
||||
<link rel="icon" type="image/png" href="__ASSETS__/img/favicon.png">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
||||
<title>医院就诊管理系统后台</title>
|
||||
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no' name='viewport' />
|
||||
<!-- Fonts and icons -->
|
||||
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700,200" rel="stylesheet" />
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css" />
|
||||
<!-- CSS Files -->
|
||||
<link href="__ASSETS__/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="__ASSETS__/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
|
||||
<!-- CSS Just for demo purpose, don't include it in your project -->
|
||||
<link href="__ASSETS__/css/demo.css" rel="stylesheet" />
|
||||
<meta name="renderer" content="webkit|ie-comp|ie-stand">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
|
||||
<meta http-equiv="Cache-Control" content="no-siteapp" />
|
||||
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||
<link rel="stylesheet" href="__ADMIN__/x-admin/css/font.css">
|
||||
<!--<link rel="stylesheet" href="__ADMIN__/x-admin/css/xadmin.css">-->
|
||||
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
|
||||
<script src="__ADMIN__/x-admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||
<script src="__ADMIN__/x-admin/lib/layui/layui.js" charset="utf-8"></script>
|
||||
<script src="__ASSETS__/fonts/nucleo-outline.eot" charset="utf-8"></script>
|
||||
<script src="__ASSETS__/fonts/nucleo-outline.woff2" charset="utf-8"></script>
|
||||
<script src="__ASSETS__/fonts/nucleo-outline.woff" charset="utf-8"></script>
|
||||
<script src="__ASSETS__/fonts/nucleo-outline.ttf" charset="utf-8"></script>
|
||||
<script type="text/javascript" src="__ADMIN__/x-admin/js/xadmin.js"></script>
|
||||
<link rel="canonical" href="" />
|
||||
<!-- Social tags -->
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="login-page sidebar-collapse">
|
||||
<!-- Navbar -->
|
||||
<nav class="navbar navbar-expand-lg bg-primary fixed-top navbar-transparent " color-on-scroll="400">
|
||||
<div class="container">
|
||||
<div class="dropdown button-dropdown">
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
<a class="dropdown-header">Dropdown header</a>
|
||||
<a class="dropdown-item" href="#">Action</a>
|
||||
<a class="dropdown-item" href="#">Another action</a>
|
||||
<a class="dropdown-item" href="#">Something else here</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#">Separated link</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#">One more separated link</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="navbar-translate">
|
||||
</div>
|
||||
<div class="collapse navbar-collapse justify-content-end" data-nav-image="__ASSETS__/img/blurred-image-1.jpg">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
<!-- End Navbar -->
|
||||
<div class="page-header" filter-color="blue">
|
||||
<div class="page-header-image" style="background-image:url(__ASSETS__/img/denglu.png)"></div>
|
||||
<div class="container">
|
||||
<div class="col-md-4 content-center">
|
||||
<div class="card card-login card-plain">
|
||||
<div class="header header-primary text-center">
|
||||
<div class="logo-container">
|
||||
<img src="__ASSETS__/img/now-logo.png" alt="">
|
||||
</div>
|
||||
</div>
|
||||
<form method="post" class="layui-form">
|
||||
<div class="content">
|
||||
<div class="input-group form-group-no-border input-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="now-ui-icons users_circle-08"></i>
|
||||
</span>
|
||||
<input lay-verify="required" name="username" type="text" class="form-control" placeholder="用户名">
|
||||
</div>
|
||||
<div class="input-group form-group-no-border input-lg">
|
||||
<span class="input-group-addon">
|
||||
<i class="now-ui-icons text_caps-small"></i>
|
||||
</span>
|
||||
<input lay-verify="required" name="password" type="password" placeholder="密码" class="form-control" />
|
||||
</div>
|
||||
<div >
|
||||
<input name="captcha" lay-verify="required" placeholder="验证码" type="text" class="layui-input" style="width:35% !important;display: inline-block;margin-right: 10px;">
|
||||
<img id="captcha" src="{:url('verify','','')}" alt="验证码" style="display:inline-block;width:60%;cursor: pointer;" onclick="this.src='{:url(\'verify\')}?id='+Math.random()" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer text-center">
|
||||
<input lay-submit="" lay-filter="login" type="submit" value="登录" class="form-control" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<!-- Core JS Files -->
|
||||
<script src="__ASSETS__/js/core/jquery.3.2.1.min.js" type="text/javascript"></script>
|
||||
<script src="__ASSETS__/js/core/popper.min.js" type="text/javascript"></script>
|
||||
<script src="__ASSETS__/js/core/bootstrap.min.js" type="text/javascript"></script>
|
||||
<!-- Plugin for Switches, full documentation here: http://www.jque.re/plugins/version3/bootstrap.switch/ -->
|
||||
<script src="__ASSETS__/js/plugins/bootstrap-switch.js"></script>
|
||||
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
|
||||
<script src="__ASSETS__/js/plugins/nouislider.min.js" type="text/javascript"></script>
|
||||
<!-- Plugin for the DatePicker, full documentation here: https://github.com/uxsolutions/bootstrap-datepicker -->
|
||||
<script src="__ASSETS__/js/plugins/bootstrap-datepicker.js" type="text/javascript"></script>
|
||||
<!-- Share Library etc -->
|
||||
<script src="__ASSETS__/js/plugins/jquery.sharrre.js" type="text/javascript"></script>
|
||||
<!-- Control Center for Now Ui Kit: parallax effects, scripts for the example pages etc -->
|
||||
<script src="__ASSETS__/js/now-ui-kit.js?v=1.1.0" type="text/javascript"></script>
|
||||
<script>
|
||||
|
||||
$(function() {
|
||||
layui.use('form', function(){
|
||||
var form = layui.form;
|
||||
console.log(form);
|
||||
// layer.msg('玩命卖萌中', function(){
|
||||
// //关闭后的操作
|
||||
// });
|
||||
//监听提交
|
||||
form.on('submit(login)', function(data){
|
||||
console.log(data)
|
||||
// alert(888)
|
||||
const {field:postData} = data;
|
||||
const url = "{:url('login','','')}";
|
||||
$.ajax({
|
||||
url,
|
||||
data:postData,
|
||||
type:"Post",
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
console.log("data")
|
||||
const {status,message} = data;
|
||||
if(!status){
|
||||
console.log('okkkkkk')
|
||||
layer.msg(message,{icon: 6, time: 2000});
|
||||
window.location.href = "{:url('Index/index')}";
|
||||
} else {
|
||||
console.log('question')
|
||||
layer.msg(message,{icon: 5, time: 2000});
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
console.log('noooooo')
|
||||
console.log(data);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
</html>
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: yunwuxin <448901948@qq.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return ['app\admin\command\BackUp',
|
||||
'app\admin\command\RollBack',
|
||||
'app\admin\command\Test,'
|
||||
];
|
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 数据库类型
|
||||
'type' => 'mysql',
|
||||
// 服务器地址
|
||||
'hostname' => \think\Env::get('mysql.host'),
|
||||
// 数据库名
|
||||
'database' => \think\Env::get('mysql.database'),
|
||||
// 用户名
|
||||
'username' => \think\Env::get('mysql.username'),
|
||||
// 密码
|
||||
'password' => \think\Env::get('mysql.password'),
|
||||
// 端口
|
||||
'hostport' => '',
|
||||
// 连接dsn
|
||||
'dsn' => '',
|
||||
// 数据库连接参数
|
||||
'params' => [],
|
||||
// 数据库编码默认采用utf8
|
||||
'charset' => 'utf8',
|
||||
// 数据库表前缀
|
||||
'prefix' => '',
|
||||
// 数据库调试模式
|
||||
'debug' => true,
|
||||
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||
'deploy' => 0,
|
||||
// 数据库读写是否分离 主从式有效
|
||||
'rw_separate' => false,
|
||||
// 读写分离后 主服务器数量
|
||||
'master_num' => 1,
|
||||
// 指定从服务器序号
|
||||
'slave_no' => '',
|
||||
// 自动读取主库数据
|
||||
'read_master' => false,
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 数据集返回类型
|
||||
'resultset_type' => 'collection',
|
||||
// 自动写入时间戳字段
|
||||
'auto_timestamp' => false,
|
||||
// 时间字段取出后的默认时间格式
|
||||
'datetime_format' => false,
|
||||
// 是否需要进行SQL性能分析
|
||||
'sql_explain' => false,
|
||||
];
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\event;
|
||||
abstract class BaseSubject implements Subject
|
||||
{
|
||||
protected $observers = [];
|
||||
|
||||
/**
|
||||
* @param Observer $observer
|
||||
* @return $this
|
||||
* 绑定一个观察者
|
||||
*/
|
||||
public function addObserver(Observer $observer)
|
||||
{
|
||||
$this->observers[spl_object_hash($observer)] = $observer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Observer $observer
|
||||
* @return $this
|
||||
* 解绑一个观察者
|
||||
*/
|
||||
public function removeObserver(Observer $observer)
|
||||
{
|
||||
unset($this->observers[spl_object_hash($observer)]);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function exec()
|
||||
{
|
||||
foreach ($this->observers as $observer){
|
||||
$observer->notify($this);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace app\event;
|
||||
interface Observer
|
||||
{
|
||||
public function notify(Subject $subject);
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace app\event;
|
||||
interface Subject
|
||||
{
|
||||
public function exec();
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/7/18 0018
|
||||
* Time: 上午 2:30
|
||||
*/
|
||||
|
||||
namespace app\extend;
|
||||
|
||||
|
||||
class IdCardCheck
|
||||
{
|
||||
public function IdCheck($value)
|
||||
{
|
||||
if (strlen($value) != 18) {
|
||||
return false;
|
||||
}
|
||||
$idcard_base = substr($value, 0, 17);
|
||||
if ($this->idcard_verify_number($idcard_base) != strtoupper(substr($value, 17, 1))) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private function idcard_verify_number($value)
|
||||
{
|
||||
if (strlen($value) != 17) {
|
||||
return false;
|
||||
}
|
||||
//加权因子
|
||||
$factor = array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
|
||||
//校验码对应值
|
||||
$verify_number_list = array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
|
||||
$checksum = 0;
|
||||
for ($i = 0; $i < strlen($value); $i++) {
|
||||
$checksum += substr($value, $i, 1) * $factor[$i];
|
||||
}
|
||||
$mod = $checksum % 11;
|
||||
$verify_number = $verify_number_list[$mod];
|
||||
return $verify_number;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 11/7/2019
|
||||
* Time: 12:45 AM
|
||||
*/
|
||||
|
||||
namespace app\extend;
|
||||
|
||||
|
||||
class Map
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 11/7/2019
|
||||
* Time: 12:47 AM
|
||||
*/
|
||||
|
||||
class map
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/11/13
|
||||
* Time: 20:48
|
||||
*/
|
||||
|
||||
namespace app\lib\enum;
|
||||
|
||||
|
||||
class ExceptionType
|
||||
{
|
||||
const HTML = 1;
|
||||
const JSON = 2;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2/21/2020
|
||||
* Time: 7:34 PM
|
||||
*/
|
||||
|
||||
namespace app\lib\enum;
|
||||
|
||||
|
||||
class SecondColumn
|
||||
{
|
||||
const SINGAL = 1; //单页
|
||||
const ISLIST = 2;//列表
|
||||
|
||||
public static $TYPEMASK = [
|
||||
self::SINGAL => "单页",
|
||||
self::ISLIST => "列表",
|
||||
];
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2/21/2020
|
||||
* Time: 11:46 PM
|
||||
*/
|
||||
|
||||
namespace app\lib\enum;
|
||||
|
||||
|
||||
class Temp
|
||||
{
|
||||
const SINGAL = 1; //单页
|
||||
const ISLIST = 2;//列表
|
||||
const DOWNLOAD = 3;//列表
|
||||
|
||||
public static $TYPEMASK = [
|
||||
self::SINGAL => "单页",
|
||||
self::ISLIST => "列表",
|
||||
self::DOWNLOAD => "下载页面",
|
||||
];
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2/21/2020
|
||||
* Time: 7:37 PM
|
||||
*/
|
||||
|
||||
namespace app\lib\enum;
|
||||
|
||||
|
||||
class ThirdColumn
|
||||
{
|
||||
const SINGAL = 1; //单页
|
||||
const ISLIST = 2;//列表
|
||||
const DOWNLOAD = 3;//列表
|
||||
|
||||
public static $TYPEMASK = [
|
||||
self::SINGAL => "单页",
|
||||
self::ISLIST => "列表",
|
||||
self::DOWNLOAD => "下载列表",
|
||||
];
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: admin
|
||||
* Date: 2019/1/14
|
||||
* Time: 16:16
|
||||
*/
|
||||
|
||||
namespace app\lib\enum;
|
||||
|
||||
|
||||
class User
|
||||
{
|
||||
const NORMAL = 1;
|
||||
const DELETED = 0;
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/8/6
|
||||
* Time: 19:01
|
||||
*/
|
||||
|
||||
namespace app\lib\exception;
|
||||
|
||||
|
||||
use think\Db;
|
||||
use think\exception\Handle;
|
||||
use think\Log;
|
||||
use think\Request;
|
||||
|
||||
class ExceptionHandle extends Handle
|
||||
{
|
||||
public function render(\Exception $e)
|
||||
{
|
||||
if ($e instanceof HtmlException) {
|
||||
echo $this->responseToHtmlError($e->getMessage());
|
||||
die;
|
||||
} else if ($e instanceof JsonException) {
|
||||
$url = Request::instance()->url();
|
||||
$result = [
|
||||
'status' => $e->status,
|
||||
'message' => $e->message,
|
||||
'data' => $e->data,
|
||||
'request_url' => $url,
|
||||
];
|
||||
return json($result);
|
||||
} else if($e instanceof SysException){
|
||||
//TODO 使用error_log 在数据库记录错误信息
|
||||
$data = [
|
||||
'time'=>time(),
|
||||
//'ip'=>get_client_ip(),
|
||||
'ip'=>Request::instance()->ip(),
|
||||
'url'=>$_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : "for-cli",
|
||||
'message'=>$e->message,
|
||||
'num'=>$e->errCode,
|
||||
"data"=>$e->data,
|
||||
];
|
||||
Db::name("log")->add($data);
|
||||
return json(['status'=>-1,"message"=>"系统错误,请重试!"]);
|
||||
} else {
|
||||
return parent::render($e);
|
||||
}
|
||||
}
|
||||
|
||||
public function responseToHtmlError($message,$url = "")
|
||||
{
|
||||
$html =
|
||||
<<<START
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
|
||||
<title>跳转提示</title>
|
||||
<style type="text/css">
|
||||
*{ padding: 0; margin: 0; }
|
||||
body{ background: #fff; font-family: "Microsoft Yahei","Helvetica Neue",Helvetica,Arial,sans-serif; color: #333; font-size: 16px; }
|
||||
.system-message{ padding: 24px 48px; }
|
||||
.system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }
|
||||
.system-message .jump{ padding-top: 10px; }
|
||||
.system-message .jump a{ color: #333; }
|
||||
.system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px; }
|
||||
.system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display: none; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="system-message">
|
||||
<h1>:(</h1>
|
||||
<p class="error">{$message}</p>
|
||||
<p class="detail"></p>
|
||||
<p class="jump">
|
||||
页面自动 <a id="href" href="javascript:history.back(-1);">跳转</a> 等待时间: <b id="wait">3</b>
|
||||
</p>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
(function(){
|
||||
var wait = document.getElementById('wait'),
|
||||
href = document.getElementById('href').href;
|
||||
var interval = setInterval(function(){
|
||||
var time = --wait.innerHTML;
|
||||
if(time <= 0) {
|
||||
location.href = href;
|
||||
clearInterval(interval);
|
||||
};
|
||||
}, 1000);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
START;
|
||||
return $html;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/8/6
|
||||
* Time: 19:04
|
||||
*/
|
||||
|
||||
namespace app\lib\exception;
|
||||
|
||||
|
||||
use think\Exception;
|
||||
|
||||
class HtmlException extends Exception
|
||||
{
|
||||
public $message = "操作失败,请重试!";
|
||||
public function __construct($message = "")
|
||||
{
|
||||
parent::__construct();
|
||||
if(is_string($message) && $message){
|
||||
$this->message = $message;
|
||||
}
|
||||
}
|
||||
|
||||
public function setMessage($message){
|
||||
$this->message = $message;
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/8/6
|
||||
* Time: 19:05
|
||||
*/
|
||||
|
||||
namespace app\lib\exception;
|
||||
|
||||
|
||||
use think\Exception;
|
||||
use Throwable;
|
||||
|
||||
class JsonException extends Exception
|
||||
{
|
||||
public $status = 1;
|
||||
public $message = "操作失败,请重试!";
|
||||
public $data = [];
|
||||
|
||||
public function __construct($status = 1,$message="",$data = null)
|
||||
{
|
||||
if(is_numeric($status)){
|
||||
$this->status = $status;
|
||||
}
|
||||
|
||||
if($message){
|
||||
$this->message = $message;
|
||||
}
|
||||
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function setStatus($status){
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
//向data返回message
|
||||
public function setMessage($message){
|
||||
$this->message = $message;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setJsonData($data){
|
||||
$this->data = $data;
|
||||
return $this;
|
||||
}
|
||||
//向data返回status
|
||||
public function getStatus(){
|
||||
return $this->status;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/11/15
|
||||
* Time: 0:23
|
||||
*/
|
||||
|
||||
namespace app\lib\exception;
|
||||
|
||||
|
||||
class Success extends JsonException
|
||||
{
|
||||
public function __construct($message = "操作成功!", $data = null)
|
||||
{
|
||||
parent::__construct(0,$message, $data);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: admin
|
||||
* Date: 2019/1/18
|
||||
* Time: 14:43
|
||||
*/
|
||||
|
||||
namespace app\lib\exception;
|
||||
|
||||
|
||||
use app\lib\enum\ErrorLevel;
|
||||
use think\Exception;
|
||||
|
||||
class SysException extends Exception
|
||||
{
|
||||
public $errCode = 0;
|
||||
public $message = "";
|
||||
public $data = "";
|
||||
|
||||
public function __construct($errCode,$message,$data)
|
||||
{
|
||||
$this->errCode = $errCode;
|
||||
$this->message = $message;
|
||||
$this->data = $data;
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: admin
|
||||
* Date: 2019/2/13
|
||||
* Time: 14:42
|
||||
*/
|
||||
|
||||
namespace app\lib\facade;
|
||||
use think\Exception;
|
||||
|
||||
class BaseView extends Facade
|
||||
{
|
||||
public static function getViewFields($class,$method){
|
||||
if(!method_exists(new $class(),$method)){
|
||||
throw new Exception("method {$method} do not exist in class Base");
|
||||
}
|
||||
return call_user_func_array([new $class(),$method],[]);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/12/24
|
||||
* Time: 18:33
|
||||
*/
|
||||
|
||||
namespace app\lib\facade;
|
||||
|
||||
|
||||
class Facade
|
||||
{
|
||||
public static function getInstance($className,$option){
|
||||
return new $className($option);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待子类重写,用于获取代理对象
|
||||
*/
|
||||
public static function getFacadeAccessor(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* 获取构造函数参数
|
||||
*/
|
||||
public static function getConstructParam(){
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
public static function __callStatic($functionName,$arguments)
|
||||
{
|
||||
$instance = static::getInstance(static::getFacadeAccessor(),static::getConstructParam());//获取代理对象
|
||||
return call_user_func_array([$instance,$functionName],$arguments);//调用代理对象内的$name方法,并传入$arguments作为参数
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: admin
|
||||
* Date: 2019/2/22
|
||||
* Time: 15:48
|
||||
*/
|
||||
|
||||
namespace app\lib\facade;
|
||||
|
||||
|
||||
class MsgService extends Facade
|
||||
{
|
||||
public static function getFacadeAccessor()
|
||||
{
|
||||
return \app\service\MsgService::CLASS;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/12/24
|
||||
* Time: 18:40
|
||||
*/
|
||||
|
||||
namespace app\lib\facade;
|
||||
use app\service\Qiniu as QiniuService;
|
||||
|
||||
class Qiniu extends Facade
|
||||
{
|
||||
public static function getFacadeAccessor()
|
||||
{
|
||||
return QiniuService::class;
|
||||
}
|
||||
|
||||
public static function getConstructParam()
|
||||
{
|
||||
// TODO: Implement getConstructParam() method.
|
||||
return [];
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: admin
|
||||
* Date: 2019/2/16
|
||||
* Time: 22:29
|
||||
*/
|
||||
|
||||
namespace app\lib\facade;
|
||||
use redis\RedisModel;
|
||||
|
||||
|
||||
class Redis extends Facade
|
||||
{
|
||||
public static function getFacadeAccessor()
|
||||
{
|
||||
return RedisModel::CLASS;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/11/14
|
||||
* Time: 19:46
|
||||
*/
|
||||
|
||||
namespace app\lib\factory;
|
||||
|
||||
|
||||
use app\lib\enum\ExceptionType;
|
||||
use app\lib\exception\HtmlException;
|
||||
use app\lib\exception\JsonException;
|
||||
|
||||
class ExceptionFactory
|
||||
{
|
||||
public static function get($type,$errorMsg=""){
|
||||
if($type == ExceptionType::HTML){
|
||||
return new HtmlException($errorMsg);
|
||||
} else if($type == ExceptionType::JSON){
|
||||
return new JsonException(1,$errorMsg);
|
||||
} else {
|
||||
throw new \Exception("exceptionType must be HTML or JSON");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,254 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/8/6
|
||||
* Time: 20:10
|
||||
*/
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use app\lib\enum\AgentEnum;
|
||||
use app\lib\enum\ExceptionType;
|
||||
use app\lib\factory\ExceptionFactory;
|
||||
use app\lib\model\BaseAgent;
|
||||
use think\Request;
|
||||
use think\Validate;
|
||||
|
||||
class BaseValidate extends Validate
|
||||
{
|
||||
/**
|
||||
* @param array $param
|
||||
* @return array|bool
|
||||
* 自定义规则检查方法
|
||||
*/
|
||||
|
||||
private $exceptionType = null;
|
||||
private $wrapper = null;
|
||||
|
||||
public function setWrapper(BaseValidate $wrapper){
|
||||
$this->wrapper = $wrapper;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function __construct($type = ExceptionType::HTML)
|
||||
{
|
||||
$this->exceptionType = ExceptionFactory::get($type);
|
||||
}
|
||||
|
||||
public function setExcetptionType($type=""){
|
||||
$this->exceptionType = ExceptionFactory::get($type);
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function goCheck($autoFiller = true,$param = []){
|
||||
|
||||
$decorate = [];
|
||||
if(!is_null($this->wrapper)){
|
||||
$decorate = $this->wrapper->goCheck();
|
||||
}
|
||||
|
||||
if(!$this->requestMethodCheckHook()){
|
||||
throw $this->exceptionType->setMessage("页面不存在!");
|
||||
}
|
||||
|
||||
$input = Request::instance()->param();
|
||||
|
||||
$param = array_merge($input,$param);
|
||||
//验证前转各参数去空
|
||||
$param = array_map(function($item){
|
||||
if(is_string($item)){
|
||||
$item = trim($item);
|
||||
}
|
||||
return $item;
|
||||
},$param);
|
||||
|
||||
$result = $this->check($param);
|
||||
if(!$result){
|
||||
throw $this->exceptionType->setMessage($this->getError());
|
||||
}
|
||||
|
||||
if($autoFiller){
|
||||
$param = array_merge($this->fillterParamAccoringToRule($param));
|
||||
}
|
||||
|
||||
return array_merge($decorate,$param);
|
||||
}
|
||||
|
||||
//根据验证规则过滤参数,保证入库的都是我们想要的字段
|
||||
public function fillterParamAccoringToRule($param){
|
||||
$legalParam = [];
|
||||
foreach ($this->rule as $key => $val){
|
||||
if(array_key_exists($key,$param)){
|
||||
if(is_string($param[$key])){
|
||||
$legalParam[$key] = trim($param[$key]);
|
||||
}else if(is_array($param[$key])){
|
||||
$legalParam[$key] = $param[$key];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $legalParam;
|
||||
}
|
||||
|
||||
//必须为正整数
|
||||
protected function isPositiveInteger($value){
|
||||
if(!is_numeric($value) || !is_int($value + 0) || ($value + 0) < 0){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//必须为整数
|
||||
protected function isInteger($value){
|
||||
if(!is_numeric($value) || !is_int($value + 0)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//输入不得全为空
|
||||
protected function isNotEmpty($value){
|
||||
$value = trim($value);
|
||||
if(!$value){
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//过滤手机号码
|
||||
protected function isMobile($value){
|
||||
if(strlen($value) == "11") {
|
||||
$n = preg_match_all("/13[123569]{1}d{8}|15[1235689]d{8}|188d{8}/",$value,$array);
|
||||
if($array){
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//过滤时间输入
|
||||
protected function isDate($value){
|
||||
return strtotime( date('Y-m-d', strtotime($value)) ) === strtotime($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 汉字类型长度验证
|
||||
*/
|
||||
protected function mbMax($field,$value){
|
||||
$len = mb_strlen($field);
|
||||
if($len <= $value ){
|
||||
return true;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 请求方式验证钩子
|
||||
*/
|
||||
protected function requestMethodCheckHook(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否为非空数组
|
||||
*/
|
||||
protected function isArray($value){
|
||||
if(is_array($value) && !empty($value)){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return bool
|
||||
* 验证是否为字符串
|
||||
*/
|
||||
public function isString($value){
|
||||
return is_string($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @param $value
|
||||
* @return bool
|
||||
* 验证ids集合中的每个元素是否都为整形
|
||||
*/
|
||||
public function idsCollections($field,$value){
|
||||
|
||||
if(is_array($field) && !empty($field)){
|
||||
$idsArr = $field;
|
||||
} else if(is_string($field)){
|
||||
$value || $value = ",";
|
||||
$idsArr = explode($value,$field);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
foreach ($idsArr as $id){
|
||||
if(!$this->isPositiveInteger($id)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @param $_
|
||||
* @param $data
|
||||
* @return bool
|
||||
* 验证是否为开始时间
|
||||
*/
|
||||
public function isStartTime($value,$_,$data){
|
||||
// if(date("Y-m-d",strtotime($value)) != $value){
|
||||
// return false;
|
||||
// }
|
||||
if(strtotime($value) > strtotime($data['end_time'])) {
|
||||
return false;
|
||||
}
|
||||
if (empty($value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
protected function array_check($arr,$level){
|
||||
$level = "scaleRule{$level}";
|
||||
$error_msg = "{$level}_message";
|
||||
$validate = new self();
|
||||
$validate->rule = $this->$level;
|
||||
$validate->message = $this->$error_msg;
|
||||
$validate->exceptionType = $this->exceptionType;
|
||||
foreach ($arr as $v){
|
||||
$validate->goCheck(true,$v);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return bool
|
||||
* 验证参数值是否为金额
|
||||
*/
|
||||
protected function isMoney($value){
|
||||
|
||||
if(!is_numeric($value)){
|
||||
return false;
|
||||
}
|
||||
|
||||
if($value < 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
use app\lib\enum\ExceptionType;
|
||||
use think\Request;
|
||||
|
||||
class Check extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'phone'=>'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'phone.require'=>'数值必须输入'
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/8/6
|
||||
* Time: 20:15
|
||||
*/
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
class IdMustBePositiveInt extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'id'=>'require|isPositiveInteger|min:1',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'id'=>'id必须填写且为正整数',
|
||||
];
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Admin
|
||||
* Date: 2018/8/15
|
||||
* Time: 20:19
|
||||
*/
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use app\lib\enum\ExceptionType;
|
||||
use think\Request;
|
||||
|
||||
class LoginCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'username'=>'require',
|
||||
'password'=>'require',
|
||||
'captcha'=>'require|captcha'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'username.require'=>'用户名必须输入',
|
||||
'password.require'=>'密码必须输入',
|
||||
'captcha.require'=>'验证码必须输入',
|
||||
'captcha.captcha'=>'验证码输入错误',
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
class ModifyMemberCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'nameType'=>'require',
|
||||
'mobileType'=>'require',
|
||||
'sexType'=>'require',
|
||||
'positionType'=>'require',
|
||||
'departmentType'=>'require',
|
||||
'passwordType'=>'require',
|
||||
'timeType'=>'require',
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'nameType.require'=>'请选择姓名是否修改',
|
||||
'mobileType.require'=>'请选择手机号是否修改',
|
||||
'sexType.require'=>'请选择性别是否修改',
|
||||
'positionType.captcha'=>'请选择职位是否修改',
|
||||
'departmentType.require'=>'请选择科室是否修改',
|
||||
'passwordType.require'=>'请选择密码是否修改',
|
||||
'timeType.require'=>'请选择入职时间是否修改',
|
||||
];
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
|
||||
class RegisterCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'name'=>'require',
|
||||
'sex'=>'require',
|
||||
'department'=>'require',
|
||||
'doctor'=>'require',
|
||||
'nurse'=>'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require'=>'姓名必须输入',
|
||||
'sex.require'=>'性别必须选择',
|
||||
'department.require'=>'科室必须选择',
|
||||
'doctor.captcha'=>'预约医生必须选择',
|
||||
'nurse.require'=>'填写护士必须选择',
|
||||
];
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2020/2/5
|
||||
* Time: 18:24
|
||||
*/
|
||||
|
||||
namespace app\lib\validate;
|
||||
use think\Request;
|
||||
|
||||
|
||||
class SecondColumnContentCeck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
|
||||
// 'title'=>'require',
|
||||
'second_id'=>'require',
|
||||
'content'=>'require',
|
||||
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
// 'title.require'=>'标题不能为空',
|
||||
'content.require'=>'内容不能为空',
|
||||
'second_id.require'=>'请选择所属二级栏目',
|
||||
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
|
||||
class SecondColumnContentCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'second_id'=>'require',
|
||||
'title'=>'require',
|
||||
'content'=>'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'second_id.require'=>'请选择一个所属栏目',
|
||||
'title.require'=>'添加文章标题不能为空',
|
||||
'content.require'=>'添加内容不能为空'
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
|
||||
class SecondColumnInfoCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
|
||||
'second_id'=>'require',
|
||||
'title'=>'require',
|
||||
'content'=>'require',
|
||||
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'second_id.require'=>'请选择一个所属栏目',
|
||||
'title.require'=>'添加栏目名称不能为空',
|
||||
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/1/17 0017
|
||||
* Time: 下午 8:58
|
||||
*/
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
|
||||
class SurfInfoQueryFilter extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
"start"=>"isset_value|isDate",
|
||||
"end"=>"isset_value|isDate",
|
||||
"username" => "isset_value",
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
"start.isDate" => "起始日期不合法",
|
||||
"end.isDate" => "结束日期不合法",
|
||||
"start.isset_value" => "请填写开始时间",
|
||||
"end.isset_value" => "请填写结束时间",
|
||||
];
|
||||
|
||||
//存在storeId 即验证
|
||||
public function isset_value($value,$_,$data){
|
||||
if(Request::instance()->isPost() && (array_key_exists("storeId",$data) && !$value)){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
|
||||
class ThirdColumnCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
|
||||
'name'=>'require',
|
||||
'second_id'=>'require',
|
||||
'type'=>'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require'=>'添加栏目名称不能为空',
|
||||
'second_id.require'=>'请选择一个所属栏目',
|
||||
'type.require'=>'请选择一个类型'
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
class ThirdColumnContentCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'third_id'=>'require',
|
||||
'title'=>'require',
|
||||
'content'=>'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'third_id.require'=>'请选择一个所属栏目',
|
||||
'title.require'=>'添加文章标题不能为空',
|
||||
'content.require'=>'添加内容不能为空'
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace app\lib\validate;
|
||||
|
||||
|
||||
use think\Request;
|
||||
|
||||
class WebInfoCheck extends BaseValidate
|
||||
{
|
||||
protected $rule = [
|
||||
'name'=>'require',
|
||||
'website'=>'require',
|
||||
'keyword'=>'require'
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'name.require'=>'网站名称必须输入',
|
||||
'website.require'=>'网站地址必须输入',
|
||||
'keyword.require'=>'关键字必须输入',
|
||||
];
|
||||
|
||||
public function requestMethodCheckHook()
|
||||
{
|
||||
if(!Request::instance()->isPost()){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Administrator
|
||||
* Date: 2019/6/6 0006
|
||||
* Time: 下午 5:36
|
||||
*/
|
||||
|
||||
namespace app\model;
|
||||
|
||||
|
||||
class BaseAdvertisement extends BaseModel
|
||||
{
|
||||
protected $name = "advertisement";
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue