Browse Source

初始化

huwhois 4 years ago
parent
commit
efdc1f6b38
60 changed files with 4259 additions and 51 deletions
  1. 0 0
      .gitignore
  2. 0 36
      README.en.md
  3. 1 15
      README.md
  4. 25 0
      application/admin/controller/Base.php
  5. 500 0
      application/admin/controller/Index.php
  6. 71 0
      application/admin/controller/Login.php
  7. 116 0
      application/admin/controller/User.php
  8. 59 0
      application/admin/model/Attenders.php
  9. 196 0
      application/admin/model/MySqlite.php
  10. 68 0
      application/admin/model/SignBak.php
  11. 56 0
      application/admin/model/User.php
  12. 564 0
      application/admin/view/index/index.html
  13. 205 0
      application/admin/view/index/info.html
  14. 136 0
      application/admin/view/index/printReceipt.html
  15. 89 0
      application/admin/view/index/receipt.html
  16. 85 0
      application/admin/view/login/index.html
  17. 47 0
      application/admin/view/login/jump.html
  18. 122 0
      application/index/controller/Index.php
  19. 414 0
      application/index/view/index/index.html
  20. 1 0
      daswork/.gitignore
  21. 14 0
      daswork/config.bak.php
  22. 30 0
      daswork/main/App.php
  23. 20 0
      daswork/main/Connect.php
  24. 26 0
      daswork/main/Controller.php
  25. 123 0
      daswork/main/Loader.php
  26. 159 0
      daswork/main/Model.php
  27. 51 0
      daswork/main/View.php
  28. 55 0
      daswork/main/common/function.php
  29. 66 0
      daswork/main/lib/Route.php
  30. 14 0
      daswork/service.php
  31. 25 0
      daswork/start.php
  32. 3 0
      db/.gitignore
  33. BIN
      public/favicon.ico
  34. 118 0
      public/html/index2.html
  35. 7 0
      public/html/index3.html
  36. 25 0
      public/index.php
  37. 2 0
      public/info.php
  38. 161 0
      public/socketservice.php
  39. 229 0
      public/static/css/admin-base.css
  40. 54 0
      public/static/css/admin-index.css
  41. 29 0
      public/static/css/admin-info.css
  42. 70 0
      public/static/css/base.css
  43. 5 0
      public/static/css/bootstrap-select.min.css
  44. 4 0
      public/static/css/bootstrap.min.css
  45. 34 0
      public/static/css/bootstrapValidator.css
  46. 37 0
      public/static/css/index.css
  47. BIN
      public/static/img/a6xul-o8xd3-001.ico
  48. BIN
      public/static/img/a7ihm-zdunv-001.ico
  49. BIN
      public/static/img/ae5ni-6w62l-001.ico
  50. BIN
      public/static/img/logo.jpg
  51. 7 0
      public/static/js/bootstrap-select.min.js
  52. 5 0
      public/static/js/bootstrap.min.js
  53. 9 0
      public/static/js/bootstrapValidator.min.js
  54. 52 0
      public/static/js/init.js
  55. 1 0
      public/static/js/jquery.min.js
  56. 59 0
      public/static/js/myfun.js
  57. 0 0
      public/static/js/qrcode.min.js
  58. 5 0
      start.bat
  59. 3 0
      start.sh
  60. 2 0
      vendor/.gitignore

+ 0 - 0
.gitignore


+ 0 - 36
README.en.md

@@ -1,36 +0,0 @@
-# mas-meeting
-
-#### Description
-简易的会议报名签到系统, 包含前台报名表单, 后台名单管理等
-
-#### Software Architecture
-Software architecture description
-
-#### Installation
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Instructions
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
-
-#### Contribution
-
-1.  Fork the repository
-2.  Create Feat_xxx branch
-3.  Commit your code
-4.  Create Pull Request
-
-
-#### Gitee Feature
-
-1.  You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
-2.  Gitee blog [blog.gitee.com](https://blog.gitee.com)
-3.  Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
-4.  The most valuable open source project [GVP](https://gitee.com/gvp)
-5.  The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
-6.  The most popular members  [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

+ 1 - 15
README.md

@@ -5,27 +5,13 @@
 
 #### 软件架构
 软件架构说明
-
-
-#### 安装教程
-
-1.  xxxx
-2.  xxxx
-3.  xxxx
+使用自制建议版mvc框架: https://gitee.com/huwhois001/hu-mvc
 
 #### 使用说明
 
-1.  xxxx
-2.  xxxx
-3.  xxxx
 
 #### 参与贡献
 
-1.  Fork 本仓库
-2.  新建 Feat_xxx 分支
-3.  提交代码
-4.  新建 Pull Request
-
 
 #### 特技
 

+ 25 - 0
application/admin/controller/Base.php

@@ -0,0 +1,25 @@
+<?php
+/**
+ * @author huwhois<huwhois@163.com>
+ */
+namespace app\admin\controller;
+
+use daswork\Controller;
+use app\admin\model\User;
+
+class Base extends Controller
+{
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new User();
+        session_start();
+        if (!isset($_SESSION["admin"]) || $_SESSION["admin"] !== true) {
+            //  验证失败,将 $_SESSION["admin"] 置为 false
+            $_SESSION["admin"] = false;
+            die("alert('您未登录, 请登录');<script>location.href='http://meeting.ecorr.org/admin/login/index';</script>");
+        }
+        $this->assign('username', $_SESSION['username']);
+        $this->assign('userid', $_SESSION['userid']);
+    }
+}

+ 500 - 0
application/admin/controller/Index.php

@@ -0,0 +1,500 @@
+<?php
+/**
+ * @author huwhois<huwhois@163.com>
+ */
+namespace app\admin\controller;
+
+use daswork\Controller;
+use app\admin\model\SignBak;
+use app\admin\model\Attenders;
+
+class Index extends Base
+{
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new Attenders();
+    }
+
+    public function index()
+    {
+        $key = isset($_GET['key']) ? escapeString($_GET['key']) : '';
+        $where = '';
+        if ($key) {
+            $where = "WHERE truename LIKE '$key%' OR phone LIKE '$key%' or organization LIKE '$key%'";
+            $this->assign('key', $key);
+        }
+        
+        $page = isset($_GET['page']) ? escapeString($_GET['page']) : 1;
+        $data = $this->model->pageList($where, $page, 15);
+
+        $this->assign('data', $data);
+        $this->fetch();
+    }
+
+    public function info()
+    {
+        $id = $_GET['id'];
+        if (isset($_SERVER['HTTP_X_REQUESTED_WITH'])  && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
+            if (!$id) {
+                echo json_encode(['code' => 1, 'msg'=>'id不能为空']);
+            }
+            $data = $this->model->getOneById($id);
+
+            echo json_encode(['code'=>0, 'data'=>$data]);
+        } else {
+            if (!$id) {
+                echo "<script>alert('id 不能为空');history.back();</script>";
+            }
+            $data = $this->model->getOneById($id);
+            $this->assign('data', $this->replaceDate($data));
+            $this->fetch();
+        }
+    }
+    
+    // 替换报名表数据输出字符
+    public function replaceDate($arr = []) {
+        // 替换性别
+        if (isset($arr['sex'])) {
+            $arr['sex'] = ($arr['sex'] == 2) ? "女" : "男";
+        }
+        // 替换开票信息
+        if (isset($arr['tax_type'])) {
+            $arr['tax_type'] = ($arr['tax_type'] == 2) ? "专票" : "普票";
+        }
+        // 替换会议注册类型(注册费)
+        if (isset($arr['fee_type'])) {
+            $arr['fee_type'] = ($arr['fee_type'] == 2) ? "学生(1200/人)" : "普通(2000/人)";
+        }
+        //是否做报告
+        if (isset($arr['is_report'])) {
+            $arr['is_report'] = ($arr['is_report'] == 1) ? "是" : "否";
+        }
+        // 酒店
+        if (isset($arr['room_type'])) {
+            $arr['room_type'] = ($arr['room_type'] == 1) ? "标准间" : "商务房";
+        }
+        if (isset($arr['is_share'])) {
+            $arr['is_share'] = ($arr['is_share'] == 1) ? "是" : "否";
+        }
+        // 支付形式
+        if (isset($arr['pay_type'])) {
+            $arr['pay_type'] = ($arr['pay_type'] == 1) ? "汇款" : "现场缴费";
+        }
+        // 报名时间
+        if (isset($arr['create_time'])) {
+            date_default_timezone_set("PRC");
+            $arr['create_time'] = date("Y-m-d H:i:s", $arr['create_time']);
+        }
+
+        return $arr;
+    }
+
+    public function test()
+    {
+        $res = $this->model->getByTruenameAndPhone('测试', '13366667777');
+        var_dump($res);
+        exit;
+    }
+
+    public function save()
+    {
+        $params = escapeString($_POST);
+        // echo json_encode($params);
+        // exit;
+
+        if (empty($params['truename']) || empty($params['phone'])) {
+            die(json_encode(['code'=>1, 'msg'=>'姓名 or 电话不能为空']));
+        }
+
+        $res = $this->model->getByTruenameAndPhone($params['truename'], $params['phone']);
+        if ($res) {
+            die(json_encode(['code'=>1, 'msg'=>'已经报名成功,请勿重复提交']));
+        }
+        // var_dump($res);
+        // exit;
+        $data = [
+            "meeting_id" => 3,
+            'truename' => $params['truename'],
+            'organization' => $params['organization'],
+            'position' => $params['position'],
+            'sex' => $params['sex'],
+            'phone' => $params['phone'],
+            'email' => $params['email'],
+            'fee_type' => intval($params['feeType']),
+            'is_report' => intval($params['isReport']),
+            'report_title' => $params['reportTitle'],
+            'hotel_type' => 1,
+            'room_type' => intval($params['roomType']),
+            'is_share' => intval($params['isShare']),
+            'pay_type' => intval($params['payType']),
+            'is_pay' => intval($params['isPay']),
+            'money' =>floatval($params['money']),
+            'tax_type' => intval($params['taxType']),
+            'tax_title' => $params['taxTitle'],
+            'tax_number' => $params['taxNumber'],
+            'bank_account' => $params['bankAccount'],
+            'company_address' => $params['companyAddress'],
+            'company_phone' => $params['companyPhone'],
+            'mailing_address' => $params['mailingAddress'],
+            'postcode' => $params['postcode'],
+            'remark' => $params['remark'],
+            'member_type'=> 10,
+            'status' => 0,
+            'token' => md5($params['truename'] . $params['phone']),
+            'create_time' => time()
+        ];
+
+        $id = $params['id'];
+        if ($id) {
+            $data['id'] = $id;
+            $res = $this->model->updateById($data);
+        } else {
+            $res = $this->model->save($data);
+        }
+
+        if (!$res) {
+            echo json_encode(['code' => 2, 'msg'=>$this->model->lastErrorMsg()]);
+        } else {
+            echo json_encode(['code' => 0]);
+        }
+    }
+
+    public function delete()
+    {
+        $id = escapeString($_POST['id']);
+        if (!$id) {
+            echo json_encode(['code' => 1, 'msg'=>'id不能为空']);
+        }
+        $res = $this->model->deleteById($id);
+        if (!$res) {
+            echo json_encode(['code' => 2, 'msg'=>$this->model->lastErrorMsg()]);
+        } else {
+            echo json_encode(['code' => 0]);
+        }
+    }
+
+    public function export()
+    {
+        require_once (VENDOR . DS .'phpoffice/PHPExcel.php');
+        // Create new PHPExcel object
+        $objPHPExcel = new \PHPExcel();
+
+        // Set document properties
+        $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+            ->setLastModifiedBy("Maarten Balliauw")
+            ->setTitle("Office 2007 XLSX Test Document")
+            ->setSubject("Office 2007 XLSX Test Document")
+            ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+            ->setKeywords("office 2007 openxml php")
+            ->setCategory("Test result file");
+
+        // 设置D,E,F,G,I列宽
+        $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(12);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(13);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(20); 
+        $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(13); 
+        $objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(18);
+
+        // 设置E,G,J,L,M,O,R列为文本格式
+        $objPHPExcel->getActiveSheet()->getStyle('E')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+        $objPHPExcel->getActiveSheet()->getStyle('G')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+        $objPHPExcel->getActiveSheet()->getStyle('J')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+        $objPHPExcel->getActiveSheet()->getStyle('L')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+        $objPHPExcel->getActiveSheet()->getStyle('M')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+        $objPHPExcel->getActiveSheet()->getStyle('O')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+        $objPHPExcel->getActiveSheet()->getStyle('R')->getNumberFormat()
+            ->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_TEXT);
+
+        // 添加表头
+        $objPHPExcel->setActiveSheetIndex(0)
+            ->setCellValue('A1', 'ID')
+            ->setCellValue('B1', '姓名')
+            ->setCellValue('C1', '所属机构')
+            ->setCellValue('D1', '职位')
+            ->setCellValue('E1', '性别')
+            ->setCellValue('F1', '电话')
+            ->setCellValue('G1', '邮箱')
+            ->setCellValue('H1', '注册费(类型)')
+            ->setCellValue('I1', '是否做报告')
+            ->setCellValue('J1', '报告题目')
+            ->setCellValue('K1', '酒店')
+            ->setCellValue('L1', '房型')
+            ->setCellValue('M1', '是否接受合住')
+            ->setCellValue('N1', '付款方式')
+            ->setCellValue('O1', '是否付款')
+            ->setCellValue('P1', '金额')
+            ->setCellValue('Q1', '开票类型')
+            ->setCellValue('R1', '发票抬头')
+            ->setCellValue('S1', '纳税人识别号')
+            ->setCellValue('T1', '开户行及账号')
+            ->setCellValue('U1', '单位电话')
+            ->setCellValue('V1', '单位地址')
+            ->setCellValue('W1', '邮寄地址')
+            ->setCellValue('X1', '邮编')
+            ->setCellValue('Y1', '备注')
+            ->setCellValue('Z1', '报名时间');
+        
+        $data = $this->model->dataList();
+
+        if ($data) {
+            $count = 1;
+            foreach ($data as $value) {
+                $count += 1;
+                //替换性别等字符
+                $value = $this->replaceDate($value);
+                // 字符型数字前加空格" ", 以字符型插入excel
+                $objPHPExcel->setActiveSheetIndex(0)
+                    ->setCellValue('A'.$count, $value['id'])
+                    ->setCellValue('B'.$count, $value['truename'])
+                    ->setCellValue('C'.$count, $value['organization'])
+                    ->setCellValue('D'.$count, $value['position'])
+                    ->setCellValue('E'.$count, $value['sex'])
+                    ->setCellValue('F'.$count, $value['phone'])
+                    ->setCellValue('G'.$count, $value['email'])
+                    ->setCellValue('H'.$count, $value['fee_type'])
+                    ->setCellValue('I'.$count, $value['is_report'])
+                    ->setCellValue('J'.$count, $value['report_title'])
+                    ->setCellValue('K'.$count, $value['hotel_type'])
+                    ->setCellValue('L'.$count, $value['room_type'])
+                    ->setCellValue('M'.$count, $value['is_share'])
+                    ->setCellValue('N'.$count, $value['pay_type'])
+                    ->setCellValue('O'.$count, $value['is_pay'])
+                    ->setCellValue('P'.$count, $value['money'])
+                    ->setCellValue('Q'.$count, $value['tax_type'])
+                    ->setCellValue('R'.$count, $value['tax_title'])
+                    ->setCellValue('S'.$count, $value['tax_number'])
+                    ->setCellValue('T'.$count, $value['bank_account'])
+                    ->setCellValue('U'.$count, $value['company_address'])
+                    ->setCellValue('V'.$count, $value['company_phone'])
+                    ->setCellValue('W'.$count, $value['mailing_address'])
+                    ->setCellValue('X'.$count, $value['postcode'])
+                    ->setCellValue('Y'.$count, $value['remark'])
+                    ->setCellValue('Z'.$count, $value['create_time']);
+            }
+        }
+
+        // 命名标签页
+        $objPHPExcel->getActiveSheet()->setTitle('2020耐蚀钢会网络报名表');
+
+        // Set active sheet index to the first sheet, so Excel opens this as the first sheet
+        $objPHPExcel->setActiveSheetIndex(0);
+
+        // Redirect output to a client’s web browser (Excel2007)
+        $filename = date('YmdHis') . ".xlsx";
+        header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+        header('Content-Disposition: attachment;filename=' . $filename);
+        header('Cache-Control: max-age=0');
+        // If you're serving to IE 9, then the following may be needed
+        header('Cache-Control: max-age=1');
+
+        // If you're serving to IE over SSL, then the following may be needed
+        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
+        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
+        header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
+        header('Pragma: public'); // HTTP/1.0
+
+        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+        $objWriter->save('php://output');
+        exit;
+    }
+
+    public function doPrint()
+    {
+        $id = $_POST['id'];
+        if (!$id) {
+            echo json_encode(['code' => 1, 'msg'=>'id不能为空']);
+        }
+        $time = time();
+        $sql = "UPDATE `sign_bak` SET badge=1, status=1, printNum=printNum+1, printTime=$time WHERE member_id=$id";
+
+        $res = $this->model->query($sql);
+        if ($res===false) {
+            echo json_encode(['code' => 2, 'msg'=>$this->model->lastErrorMsg()]);
+        }
+
+        $data = $this->model->getOneById($id);
+        $data['img'] = $this->getQrcode($data['token']);
+        header("Content-type: text/html; charset=utf-8");
+        // var_dump($data);
+        echo json_encode(['code'=>0, 'data'=>$data]);
+    }
+
+    public function getQrcode($token)
+    {
+        include_once(VENDOR . 'phpqrcode' . DS . 'phpqrcode.php');
+        $codeUrl = 'http://meeting.ecorr.org/qrcode/webmeeting.html?token=' . $token;
+        ob_start();//开启缓冲区
+        \QRcode::png($codeUrl, false, 'L', 6, 1);//生成二维码
+        $img = ob_get_contents();//获取缓冲区内容
+        ob_end_clean();//清除缓冲区内容
+        $imgInfo = 'data:image/png;base64,' . chunk_split(base64_encode($img));//转base64
+        ob_flush();
+        return $imgInfo;
+    }
+
+    public function printReceipt()
+    {
+        $ids = escapeString($_GET['ids']);
+        $idarr = explode(',', $ids);
+        $id = '(';
+        foreach ($idarr as $value) {
+            $id .= intval($value) . ',';
+        }
+        $id = rtrim($id, ',');
+        $id .=")";
+        $res = $this->model->dataList("where id IN $id");
+        // var_dump($res);
+        // exit;
+        $name = [];
+        $money = 0;
+        $organization = '';
+        foreach ($res as $val) {
+            $name[] = $val['truename'];
+            if ($val['fee_type']==1) {
+                $money += 2000;
+            } else {
+                $money += 1200;
+            }
+            $organization = $val['organization'];
+        }
+        $pname = implode(',', $name);
+
+        $this->assign('time', date('Y-m-d'));
+        $this->assign('pname', $pname);
+        $this->assign('money', $money);
+        $this->assign('organization', $organization);
+        $this->assign('dxmoney', $this->convertAmountToCn($money));
+        $this->fetch();
+    }
+    
+    /**
+    * 将数值金额转换为中文大写金额
+    * @param $amount float 金额(支持到分)
+    * @param $type   int   补整类型,0:到角补整;1:到元补整
+    * @return mixed 中文大写金额
+    */
+    public function convertAmountToCn($amount, $type = 1) {
+        // 判断输出的金额是否为数字或数字字符串
+        if(!is_numeric($amount)){
+            return "要转换的金额只能为数字!";
+        }
+        
+        // 金额为0,则直接输出"零元整"
+        if($amount == 0) {
+            return "人民币零元整";
+        }
+        
+        // 金额不能为负数
+        if($amount < 0) {
+            return "要转换的金额不能为负数!";
+        }
+        
+        // 金额不能超过万亿,即12位
+        if(strlen($amount) > 12) {
+            return "要转换的金额不能为万亿及更高金额!";
+        }
+        
+        // 预定义中文转换的数组
+        $digital = array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖');
+        // 预定义单位转换的数组
+        $position = array('仟', '佰', '拾', '亿', '仟', '佰', '拾', '万', '仟', '佰', '拾', '元');
+        
+        // 将金额的数值字符串拆分成数组
+        $amountArr = explode('.', $amount);
+        
+        // 将整数位的数值字符串拆分成数组
+        $integerArr = str_split($amountArr[0], 1);
+        
+        // 将整数部分替换成大写汉字
+        //    $result = '人民币';
+        $result = '';
+        $integerArrLength = count($integerArr);     // 整数位数组的长度
+        $positionLength = count($position);         // 单位数组的长度
+        $zeroCount = 0;                             // 连续为0数量
+        for($i = 0; $i < $integerArrLength; $i++) {
+            // 如果数值不为0,则正常转换
+            if($integerArr[$i] != 0){
+                // 如果前面数字为0需要增加一个零
+                if($zeroCount >= 1){
+                    $result .= $digital[0];
+                }
+                $result .= $digital[$integerArr[$i]] . $position[$positionLength - $integerArrLength + $i];
+                $zeroCount = 0;
+            }else{
+                $zeroCount += 1;
+                // 如果数值为0, 且单位是亿,万,元这三个的时候,则直接显示单位
+                if(($positionLength - $integerArrLength + $i + 1)%4 == 0){
+                    $result = $result . $position[$positionLength - $integerArrLength + $i];
+                }
+            }
+        }
+        
+        // 如果小数位也要转换
+        if($type == 0) {
+            // 将小数位的数值字符串拆分成数组
+            $decimalArr = str_split($amountArr[1], 1);
+            // 将角替换成大写汉字. 如果为0,则不替换
+            if($decimalArr[0] != 0){
+                $result = $result . $digital[$decimalArr[0]] . '角';
+            }
+            // 将分替换成大写汉字. 如果为0,则不替换
+            if($decimalArr[1] != 0){
+                $result = $result . $digital[$decimalArr[1]] . '分';
+            }
+        }else{
+            $result = $result . '整';
+        }
+        return $result;
+    }
+
+    public function receipt()
+    {
+        $params = $_GET;
+        // var_dump($params);
+        $this->assign('data', $params);
+        $this->fetch();
+    }
+
+    public function getab($y = 1000)
+    {
+        $res = [];
+        $sum = 0;
+        $s = 0;
+        // echo mt_rand(1, 10);
+        // var_dump($y);
+        while(1){
+            $ab = [];
+            $ab['a'] = mt_rand(10, 20);
+            $ab['b'] = mt_rand(10, 20);
+            $sum += $ab['a'] * $ab['b'];
+            if ($sum > $y) {
+                break;
+            }
+            $s = $sum;
+            $res[] = $ab;
+        }
+        $sy = $y - $s;
+        var_dump($s);
+        var_dump($sy);
+        while(1){
+            $ab = [];
+            $ab['a'] = mt_rand(1, 200);
+            $ab['b'] = mt_rand(1, 200);
+
+            if ($ab['a'] * $ab['b'] == $sy) {
+                $res[] = $ab;
+                break;
+            }
+        }
+
+        return $res;
+    }
+
+}

+ 71 - 0
application/admin/controller/Login.php

@@ -0,0 +1,71 @@
+<?php
+/**
+ * @author huwhois<huwhois@163.com>
+ */
+namespace app\admin\controller;
+
+use daswork\Controller;
+use app\admin\model\User;
+
+class Login extends Controller
+{
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new User();
+        session_start();
+    }
+
+    public function index()
+    {
+        if ($_SERVER['REQUEST_METHOD']=='POST') {
+            $param = escapeString($_POST);
+            // var_dump($param);
+            // exit;
+            $username = trim($param['username']);
+            $password = trim($param['passwd']);
+
+            if (!$username || !$password) {
+                echo "<script>alert('用户名/密码/不能为空');location.href='http://meeting.ecorr.org/admin/login/index';</script>";
+                return false;
+            }
+
+            $info = $this->model->getOneByUsername($username);
+ 
+            if (!$info || md5($password) != $info['password']) {
+                $this->assign('code', 0);
+                $this->assign('msg', '用户名/密码不正确');
+                $this->assign('url', '/admin/login/index');
+                $this->assign('wait', 2);
+                $this->fetch('jump.html');
+                // die("<script>alert('用户名/密码不正确');location.href='http://meeting.ecorr.org/admin/login/index';</script>");
+                return false;
+            }
+            // 记录登录时间
+            $info['last_time'] = time();
+            $this->model->updateById($info);
+            $_SESSION['admin'] = true;
+            $_SESSION['username'] = $username;
+            $_SESSION['userid'] = $info['id'];
+            
+            $this->assign('code', 1);
+            $this->assign('msg', '登录成功');
+            $this->assign('url', '/admin/index/index');
+            $this->assign('wait', 3);
+            $this->fetch('jump.html');
+        } else {
+            if (isset($_SESSION["admin"]) && $_SESSION["admin"] === true) {
+                echo "alert('您已登录');<script>location.href='http://meeting.ecorr.org/admin/index/index';</script>";
+                // return false;
+            } else {
+                $this->fetch();
+            }
+        }
+    }
+
+    public function logout()
+    {
+        session_destroy();
+        return $this->fetch('index.html');
+    }
+}

+ 116 - 0
application/admin/controller/User.php

@@ -0,0 +1,116 @@
+<?php
+/**
+ * @author huwhois<huwhois@163.com>
+ */
+namespace app\admin\controller;
+
+use daswork\Controller;
+use app\admin\model\User as UserModel;
+
+class User extends Base
+{   
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new UserModel();
+    }
+
+    public function index()
+    {
+        $data = $this->model->dataList();
+        $this->assign('data', $data);
+        $this->fetch();
+    }
+
+    public function info()
+    {
+        $id = $_GET['id'];
+        if (!$id) {
+            echo json_encode(['code' => 1, 'msg'=>'id不能为空']);
+            return false;
+        }
+        $data = $this->model->getOneById($id);
+        echo json_encode(['code'=>0, 'data'=>$data]);
+        return false;
+    }
+
+    public function save()
+    {
+        $params = escapeString($_POST);
+        $data = [
+            'truename' => $params['truename'],
+            'organization' => $params['organization'],
+            'phone' => $params['phone'],
+            'fee_type' => intval($params['feeType']), 
+            'is_pay' => intval($params['isPay']),
+            'money' =>intval($params['money']),
+            'remark' => $params['remark'],
+            'member_type'=> intval($params['memberType']),
+            'receipt_number'=> intval($params['receipt_number'])
+        ];
+        
+        $id = $params['id'];
+        if ($id) {
+            $data['id'] = $id;
+            $res = $this->model->updateById($data);
+        } else {
+            $res = $this->model->save($data);
+        }
+
+        if (!$res) {
+            echo json_encode(['code' => 2, 'msg'=>$this->model->lastErrorMsg()]);
+            return false;
+        } else {
+            echo json_encode(['code' => 0]);
+            return false;
+        }
+    }
+
+    public function delete()
+    {
+        $id = escapeString($_POST['id']);
+        if (!$id) {
+            echo json_encode(['code' => 1, 'msg'=>'id不能为空']);
+            return false;
+        }
+        if (is_array($id)) {
+            if (in_array(1, $id)) {
+                echo json_encode(['code' => 1, 'msg'=>'超级管理员不可删除']);
+                return false;
+            }
+        } elseif ($id == 1) {
+            echo json_encode(['code' => 1, 'msg'=>'超级管理员不可删除']);
+            return false;
+        }
+        
+        $res = $this->model->deleteById($id);
+        if (!$res) {
+            echo json_encode(['code' => 2, 'msg'=>$this->model->lastErrorMsg()]);
+            return false;
+        } else {
+            echo json_encode(['code' => 0]);
+            return false;
+        }
+    }
+
+    public function repassword()
+    {
+        $params = escapeString($_POST);
+
+        $id = $_SESSION['userid'];
+        $user = $this->model->getOneById($id);
+        if ($user['password'] != md5($params['oldpassword'])) {
+            echo json_encode(['code' => 2, 'msg'=>'原密码不正确']);
+            return false;
+        }
+
+        $user['password'] = md5($params['newpassword']);
+
+        $res = $this->model->updateById($user);
+
+        echo json_encode(['code' => 0, 'msg'=>'修改成功, 请重新登录']);
+        return false;
+    }
+}

+ 59 - 0
application/admin/model/Attenders.php

@@ -0,0 +1,59 @@
+<?php
+/**
+ * 签到表模型
+ */
+namespace app\admin\model;
+
+use daswork\Model;
+
+class Attenders extends Model
+{
+    public function __construct($tablename = '')
+    {
+        parent::__construct();
+        // if ($tablename) {
+        //     $this->tablename = $tablename;
+        // } else {
+        //     $this->tablename = uncamelize(basename(__CLASS__));
+        // }
+        $this->tablename = 'attenders';
+    }
+
+    public function dataList($where = '')
+    {
+        $sql = "select id,truename,organization,position,sex,phone,email,fee_type,is_report,report_title,hotel_type,room_type,is_share,pay_type,is_pay,money,tax_type,tax_title,tax_number,bank_account,company_address,company_phone,mailing_address,postcode,remark,create_time from $this->tablename $where;";
+        // echo $sql;
+        // exit;
+        return $this->select($sql);
+    }
+
+    public function getByTruenameAndPhone($name = '', $phone = '')
+    {
+        $query = "select * from attenders where truename='$name' and phone='$phone'";
+        $result = $this->query($query)->fetch_assoc();
+        return $result;
+    }
+
+    /**
+     * deleteByIds
+     */
+    public function deleteById($id)
+    {
+        if (is_array($id)) {
+            $sql = "DELETE FROM `$this->tablename` WHERE `id` IN(";
+            for ($i=0; $i < count($id); $i++) {
+                $sql .= $id[$i] . ',';
+            }
+            $sql = rtrim($sql, ',');
+            $sql .= ");";
+        } else {
+            $sql = "DELETE FROM `$this->tablename` WHERE `id`=$id;";
+        }
+        return $this->query($sql);
+    }
+
+    public function exportToExcel()
+    {
+
+    }
+}

+ 196 - 0
application/admin/model/MySqlite.php

@@ -0,0 +1,196 @@
+<?php
+namespace app\admin\model;
+
+class MySqlite
+{
+    private $mydb;
+    protected $tablename;
+
+    public function __construct()
+    {
+        $mydb = new \SQLite3(DB . DS . 'mysqlitedb.db');
+        if (!$mydb) {
+            throw new \Exception("$mydb->lastErrorMsg()", 1);
+        } else {
+            // echo "Opened database successfully\n";
+            $this->mydb = $mydb;
+        }
+    }
+
+    /**
+     * 执行sql
+     * @param string $sql
+     * @return mixd $res
+     */
+    public function exec($sql)
+    {
+        @$res = $this->mydb->exec($sql);
+        return $res;
+    }
+
+    public function query($sql)
+    {
+        $result = $this->mydb->query($sql);
+        return $result;
+    }
+    
+    public function lastInsertRowID()
+    {
+        $result = $this->mydb->lastInsertRowID();
+        return $result;
+    }
+
+    public function lastErrorMsg()
+    {
+        return $this->mydb->lastErrorMsg();
+    }
+
+    /**
+     * 查询数组列表
+     */
+    public function select($sql)
+    {
+        $result = $this->mydb->query($sql);
+        $data = array();
+        // var_dump($result);exit;
+        while ($arr = $result->fetchArray(SQLITE3_ASSOC)) {
+            $data[] = $arr;
+        }
+        return $data;
+    }
+
+    /**
+     * 查询一条
+     */
+    public function getOneById($id, $tablename = '')
+    {
+        $tablename = $tablename ? $tablename : $this->tablename;
+        $sql = "SELECT * FROM `$tablename` WHERE `id`=$id;";
+        $result = $this->mydb->query($sql);
+        // var_dump($result);
+        $data = $result->fetchArray(SQLITE3_ASSOC);
+        // var_dump($data);
+        return $data;
+    }
+
+    /**
+     * 分页结果
+     */
+    public function pageList($where, $page = 1, $limit = 10)
+    {
+        $res = $this->query("select count(*) as total from $this->tablename $where;"); 
+        $data = $res->fetchArray(SQLITE3_ASSOC);
+        
+        $offset = ($page - 1) * $limit;
+        $sql = "select * from $this->tablename $where limit $offset, $limit;";
+        $list = $this->select($sql);
+        $data['list'] = $list;
+        $data['page'] = $page;
+        $data['limit'] = $limit;
+        
+        return $data;
+    }
+
+    /**
+     * 单列合计
+     */
+    public function sumColumn($column, $tablename)
+    {
+        $tablename = $tablename ? $tablename : $this->tablename;
+        $sql = "SELECT sum(`$column`) as sumData FROM `$tablename`;";
+        $result = $this->mydb->query($sql);
+        // $data = $result->fetchArray();
+        // var_dump($data['sumData']);exit;
+        if ($data = $result->fetchArray(SQLITE3_ASSOC)) {
+            return $data['sumData'];
+        }
+        return 0;
+    }
+
+    /**
+     * 列表结果集
+     */
+    public function dataList($where = '')
+    {
+        $sql = "select * from $this->tablename $where;";
+        return $this->select($sql);
+    }
+
+    public function listByName($name = '', $order = '', $desc = false)
+    {
+        $where = "";
+        if ($name) {
+            $where = " where name like '%$name%'";
+        }
+
+        if ($order) {
+            $where .= " order by $order";
+            if ($desc) {
+                $where .= " desc";
+            } else {
+                $where .= " asc";
+            }
+        }
+        $sql = "select * from $this->tablename $where;";
+        $res = $this->select($sql);
+
+        return $res;
+    }
+
+    /**
+     * save
+     */
+    public function save($data)
+    {
+        $columns = "";
+        $values = "";
+        foreach ($data as $key => $value) {
+            $columns .=  "`" . $key . "`,";
+            $values .=  "'" . $value . "',";
+        }
+        $columns = rtrim($columns, ',');
+        $values = rtrim($values, ',');
+        $sql = "INSERT INTO `$this->tablename`(" . $columns . ") VALUES(". $values . ")";
+        echo $sql . "<br />";
+        return $this->exec($sql);
+    }
+    
+    /**
+     * updateById
+     */
+    public function updateById($data)
+    {
+        $id = $data['id'];
+        unset($data['id']);
+        $columns = "";
+        foreach ($data as $key => $value) {
+            $columns .= "`" . $key . "`='" . $value ."',";
+        }
+        $columns = rtrim($columns, ',');
+        $sql = "UPDATE `$this->tablename` SET $columns WHERE `id`=$id";
+        return $this->exec($sql);
+    }
+
+    /**
+     * deleteByIds
+     */
+    public function deleteById($id)
+    {
+        $sql = "DELETE FROM `$this->tablename` WHERE `id` IN(";
+        if (is_array($id)) {
+            for ($i=0; $i < count($id); $i++) {
+                $sql .= $id[$i] . ',';
+            }
+            $sql = rtrim($sql, ',');
+            $sql .= ");";
+        } else {
+            $sql = "DELETE FROM `$this->tablename` WHERE `id`=$id;";
+        }
+        return $this->exec($sql);
+    }
+
+    public function __destruct()
+    {
+        $this->mydb->close();
+    }
+}

+ 68 - 0
application/admin/model/SignBak.php

@@ -0,0 +1,68 @@
+<?php
+/**
+ * 签到表模型
+ */
+namespace app\admin\model;
+
+use app\admin\model\MySqlite;
+
+class SignBak extends MySqlite
+{
+    public function __construct($tablename = '')
+    {
+        parent::__construct();
+        if ($tablename) {
+            $this->tablename = $tablename;
+        } else {
+            $this->tablename = uncamelize(basename(__CLASS__));
+        }
+    }
+
+    public function dataList($where = '')
+    {
+        $sql = "select member_id,truename,phone,organization,memberType,feeType,isPay,money,receiptNumber,status,badge,token from $this->tablename $where;";
+        // echo $sql;
+        // exit;
+        return $this->select($sql);
+    }
+
+    public function getOneById($id, $tablename = '')
+    {
+        $sql = "SELECT * FROM `$this->tablename` WHERE `member_id`=$id;";
+        $result = $this->query($sql);
+        $data = $result->fetchArray(SQLITE3_ASSOC);
+
+        return $data;
+    }
+
+    public function updateById($data)
+    {
+        $id = $data['id'];
+        unset($data['id']);
+        $columns = "";
+        foreach ($data as $key => $value) {
+            $columns .= "`" . $key . "`='" . $value ."',";
+        }
+        $columns = rtrim($columns, ',');
+        $sql = "UPDATE `$this->tablename` SET $columns WHERE `member_id`=$id";
+        return $this->exec($sql);
+    }
+
+    /**
+     * deleteByIds
+     */
+    public function deleteById($id)
+    {
+        if (is_array($id)) {
+            $sql = "DELETE FROM `$this->tablename` WHERE `member_id` IN(";
+            for ($i=0; $i < count($id); $i++) {
+                $sql .= $id[$i] . ',';
+            }
+            $sql = rtrim($sql, ',');
+            $sql .= ");";
+        } else {
+            $sql = "DELETE FROM `$this->tablename` WHERE `member_id`=$id;";
+        }
+        return $this->exec($sql);
+    }
+}

+ 56 - 0
application/admin/model/User.php

@@ -0,0 +1,56 @@
+<?php
+/**
+ * 签到表模型
+ */
+namespace app\admin\model;
+
+use daswork\Model;
+
+class User extends Model
+{
+    public function __construct($tablename = '')
+    {
+        parent::__construct();
+        // if ($tablename) {
+        //     $this->tablename = $tablename;
+        // } else {
+        //     $this->tablename = uncamelize(basename(__CLASS__));
+        // }
+        $this->tablename = 'user';
+    }
+
+    public function dataList($where = '')
+    {
+        $sql = "select id,truename,phone,organization,member_type,fee_type,is_pay,money,receipt_number,status from $this->tablename $where;";
+        // echo $sql;
+        // exit;
+        return $this->select($sql);
+    }
+
+    public function getOneByUsername($username, $tablename = '')
+    {
+        $sql = "SELECT * FROM `$this->tablename` WHERE `username`='$username';";
+        $result = $this->query($sql);
+        $data = $result->fetch_assoc();
+
+        return $data;
+    }
+
+    /**
+     * deleteByIds
+     */
+    public function deleteById($id)
+    {
+        if (is_array($id)) {
+            $sql = "DELETE FROM `$this->tablename` WHERE `member_id` IN(";
+            for ($i=0; $i < count($id); $i++) {
+                $sql .= $id[$i] . ',';
+            }
+            $sql = rtrim($sql, ',');
+            $sql .= ");";
+        } else {
+            $sql = "DELETE FROM `$this->tablename` WHERE `member_id`=$id;";
+        }
+        return $this->exec($sql);
+    }
+}

+ 564 - 0
application/admin/view/index/index.html

@@ -0,0 +1,564 @@
+<!DOCTYPE html>
+<html lang="zh-cn">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
+    <script src="/static/js/jquery.min.js"></script>
+    <script src="/static/js/bootstrap.min.js"></script>
+    <script src="/static/js/myfun.js"></script>
+    <title>耐蚀钢报名表</title>
+    <style>
+        .container {
+            width: 1300px;
+            margin: 40px auto;
+        }
+
+        .table {
+            margin-top: 30px;
+        }
+
+        .table,
+        th {
+            text-align: center;
+        }
+
+        .input-group {
+            width: 500px;
+        }
+
+        .page_navigation {
+            float: right;
+        }
+
+        /* #qrcode img {
+            margin: 0 auto;
+        } */
+        .c-red {
+            color: red;
+        }
+    </style>
+
+</head>
+
+<body>
+    <div class="container">
+        <div style="position: relative;">
+            <div class="input-group" >
+                <input type="text" class="form-control" placeholder="Search for 姓名 or 单位 or 电话" id="key" name="key"
+                    value="<?php echo isset($key)? $key : '';?>" style="width: 300px; height: auto;">
+                <span class="input-group-btn">
+                    <button class="btn btn-default" type="button" onclick="search()">查询</button>
+                    <button class="btn btn-default" type="button" onclick="celerSearch()">清除</button>
+                    <button class="btn btn-primary " data-toggle="modal" data-target="#myModal"
+                        style="background-color: pink;color: white;margin-left: 10px;">新增</button>
+                        <!-- <button class="btn btn-primary" onclick="printReceipt()" style="margin-left: 10px;">打印收据</button> -->
+                    <a class="btn btn-primary" href="/admin/index/export" style="background-color: rgb(26, 127, 241);color: white;margin-left: 10px;">导出</a>
+                </span>
+            </div>
+            <span class="input-group-btn" style="position: absolute;top:0;right: 180px;">
+                <button class="btn btn-primary" type="button" data-toggle="modal" data-target="#reModal">修改密码</button>
+                <button class="btn btn-default" type="button" onclick="logout()"><?php echo $username;?> 退出</button>
+            </span>
+        </div>
+        <table class="table table-hover table-bordered">
+            <tr class="active">
+                <th>选择</th>
+                <th>id</th>
+                <th style="width: 100px;">姓名</th>
+                <th>所在机构</th>
+                <th>电话</th>
+                <th>费用类型</th>
+                <th>是否签到</th>
+                <th>是否缴费</th>
+                <th>金额</th>
+                <th>操作</th>
+            </tr>
+            <?php
+                $feeType = [1=>'普通', 2=>'学生'];
+                $memberType = [10=>'正常', 90=>'免注册'];
+                foreach ($data['list'] as $val) {
+            ?>
+            <tr class="data-row">
+                <td><input type="checkbox" name="checkbox[]" value="<?php echo $val['id']?>"></td>
+                <td><?php echo $val['id']?></td>
+                <td><?php echo $val['truename']?></td>
+                <td><?php echo $val['organization']?></td>
+                <td><?php echo $val['phone']?></td>
+                <td><?php echo $feeType[$val['fee_type']]?></td>
+                <td><?php echo $val['status'] ? '是' : '否'; ?></td>
+                <td><?php echo $val['is_pay'] ? '是' : '否'; ?></td>
+                <td><?php echo $val['money']?></td>
+                <td class="td-manager">
+                    <!-- <a href="javascript:;" onclick="doPrint(<?php echo $val['id'];?>)">打印</a> -->
+                    <a href="/admin/index/info/id/<?php echo $val['id'];?>">详细信息</a>
+                    <a href="javascript:;" onclick="update(<?php echo $val['id'];?>)">修改</a>
+                    <a href="javascript:;" onclick="del(<?php echo $val['id'];?>, this)">删除</a>
+                </td>
+            </tr>
+            <?php
+                }
+            ?>
+        </table>
+        <div>
+            <nav aria-label="Page navigation" class="page_navigation">
+                <ul class="pagination">
+                    <?php
+                        $total = $data['total'];
+                        $page = $data['page'];
+                        $limit = $data['limit'];
+                        $pages = intval($total/$limit) + 1;
+                    ?>
+                    <li>
+                        <a href="?page=<?php echo ($page-1)==0 ? 1 : $page-1; ?><?php echo isset($key) ? '&key='.$key : '';?>" aria-label="Previous">
+                            <span aria-hidden="true">&laquo;</span>
+                        </a>
+                    </li>
+                    <?php
+                        $li = (($pages - $page) >= 5 ? 4 : $pages - $page) + 1; 
+                        for ($i=0;$i<$li;$i++) {
+                    ?>
+                            <li><a href="?page=<?php echo $i + $page; ?><?php echo isset($key) ? '&key='.$key : '';?>"><?php echo $i + $page; ?></a></li>
+                    <?php        
+                        }
+                    ?>
+                    <li>
+                        <a href="?page=<?php echo ($page+1)>=$pages ? $pages : $page+1; ?><?php echo isset($key) ? '&key='.$key : '';?>" aria-label="Next">
+                            <span aria-hidden="true">&raquo;</span>
+                        </a>
+                    </li>
+                </ul>
+            </nav>
+        </div>
+    </div>
+    
+    <!-- 弹窗 -->
+    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
+        <div class="modal-dialog">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="myModalLabel">新建</h4>
+                </div>
+                <div class="modal-body">
+                    <form id="form-add">
+                        <input type="hidden" name="id" id="id" value="0">
+                        <div class="form-group">
+                            <span class="c-red">* </span><label for="truename">姓 名</label>
+                            <input type="text" class="form-control" id="truename" name="truename" placeholder="姓 名">
+                        </div>
+                        <div class="form-group">
+                            <label for="organization">所在机构</label>
+                            <input type="text" class="form-control" id="organization" name="organization"
+                                placeholder="所在机构">
+                        </div>
+                        <div class="form-group">
+                            <label for="position">职 务</label>
+                            <input type="text" class="form-control" id="position" name="position" placeholder="职 务">
+                        </div>
+                        <div class="form-group">
+                            <label for="sex">性 别</label>
+                            <input type="radio" name="sex" value="1" id="sex1" checked>男
+                            <input type="radio" name="sex" value="2" id="sex2">女
+                        </div>
+                        <div class="form-group">
+                            <span class="c-red">* </span><label for="phone">电 话</label>
+                            <input type="text" class="form-control" id="phone" name="phone" placeholder="电 话">
+                        </div>
+                        <div class="form-group">
+                            <label for="email">邮 箱</label>
+                            <input type="text" class="form-control" id="email" name="email" placeholder="邮 箱">
+                        </div>
+                        <div class="form-group">
+                            <label for="feeType">费用类型</label>
+                            <input type="radio" name="feeType" id="feeType1" value="1" checked>普通
+                            <input type="radio" name="feeType" id="feeType2" value="2">学生
+                        </div>
+                        <div class="form-group">
+                            <label for="isPay">是否有报告</label>
+                            <input type="radio" name="isReport" id="isReport1" value="1">是
+                            <input type="radio" name="isReport" id="isReport2" value="0" checked>否
+                        </div>
+                        <div class="form-group">
+                            <label for="report_title">报告题目</label>
+                            <input type="text" class="form-control" id="reportTitle" name="reportTitle" placeholder="报告题目">
+                        </div>
+                        <div class="form-group">
+                            <label for="feeType">房 型</label>
+                            <input type="radio" name="roomType" id="roomType1" value="1" checked>标准间
+                            <input type="radio" name="roomType" id="roomType2" value="2">商务间
+                        </div>
+                        <div class="form-group">
+                            <label for="isPay">是否合住</label>
+                            <input type="radio" name="isShare" id="isShare1" value="1">是
+                            <input type="radio" name="isShare" id="isShare2" value="0" checked>否
+                        </div>
+                        <div class="form-group">
+                            <label for="isPay">付款方式</label>
+                            <input type="radio" name="payType" id="payType1" value="0" checked>汇款
+                            <input type="radio" name="payType" id="payType2" value="1">现场缴费
+                        </div>
+                        <div class="form-group">
+                            <label for="isPay">是否缴费</label>
+                            <input type="radio" name="isPay" id="isPay1" value="1">是
+                            <input type="radio" name="isPay" id="isPay2" value="0" checked>否
+                        </div>
+                        <div class="form-group">
+                            <label for="money">金 额</label>
+                            <input type="number" class="form-control" id="money" name="money" placeholder="金额">
+                        </div>
+                        <!-- 开票信息 -->
+                        <div class="form-group">
+                            <label>开票类型</label>
+                            <div>
+                                <label class="radio-inline">
+                                    <input type="radio" value="1" name="taxType" id="taxType1" checked  onclick=text(value)>普票
+                                </label>
+                                <label class="radio-inline">
+                                    <input type="radio" value="2" name="taxType" id="taxType2" onclick=text(value)>专票
+                                </label>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label>发票抬头</label>
+                            <input type="text" class="form-control" name="taxTitle" placeholder="发票抬头"/>
+                        </div>
+                        <div class="form-group">
+                            <label>纳税人识别号</label>
+                                <input type="text" class="form-control" name="taxNumber" placeholder="纳税人识别号"/>
+                        </div>
+                        <div id='isShow' style="display: none;">
+                            <div class="form-group">
+                                <label>开户行及账号</label>
+                                    <input type="text" class="form-control" name="bankAccount" placeholder="开户行及账号"/>
+                            </div>
+                            <div class="form-group">
+                                <label>地 址</label>
+                                <div>
+                                    <input type="text" class="form-control" name="companyAddress" placeholder="地 址"/>
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <label>开户电话</label>
+                                    <input type="text" class="form-control" name="companyPhone" placeholder="开户电话"/>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label>邮寄地址</label>
+                            <input type="text" class="form-control" name="mailingAddress" placeholder="邮寄地址"/>
+                        </div>
+                        <div class="form-group">
+                            <label >邮 编</label>
+                            <input type="text" class="form-control" name="postcode" placeholder="邮 编"/>
+                        </div>
+                        <!-- 开票信息 end -->
+                        <div class="form-group">
+                            <label for="remark">备注</label>
+                            <textarea id="remark" name="remark" class ="form-control"></textarea>
+                        </div>
+                    </form>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+                    <button type="button" class="btn btn-primary" onclick="save()">提交</button>
+                </div>
+            </div><!-- /.modal-content -->
+        </div>
+    </div><!-- /.modal -->
+    <div class="modal fade" id="reModal" tabindex="-1" role="dialog" aria-labelledby="reModalLabel" aria-hidden="true">
+        <div class="modal-dialog">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="reModalLabel">修改密码</h4>
+                </div>
+                <div class="modal-body">
+                    <form id="form-repassword">
+                        <div class="form-group">
+                            <label>原密码</label>
+                            <input type="password" class="form-control" name="oldpassword" placeholder="原密码"/>
+                        </div>
+                        <div class="form-group">
+                            <label >新密码</label>
+                            <input type="password" class="form-control" name="newpassword" placeholder="新密码"/>
+                        </div>
+                        <div class="form-group">
+                            <label >确认密码</label>
+                            <input type="password" class="form-control" name="repassword" placeholder="确认密码"/>
+                        </div>
+                    </form>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
+                    <button type="button" class="btn btn-primary" onclick="rePasswd()">提交</button>
+                </div>
+            </div><!-- /.modal-content -->
+        </div>
+    </div><!-- /.modal -->
+
+</body>
+<script>
+    // 退出登陆
+    function logout() {
+        var r=confirm("纳尼,要退出?")
+        if (r==true) {
+            window.location.href = "/admin/login/logout";
+        }
+    }
+
+    function rePasswd() {
+        var oldpassword = $('input[name="oldpassword"]').val();
+        var newpassword = $('input[name="newpassword"]').val();
+        var repassword = $('input[name="repassword"]').val();
+        if (isEmpty(oldpassword) || isEmpty(newpassword) || isEmpty(repassword)) {
+            alert('原密码新密码不能为空');
+            return false;
+        }
+
+        if (newpassword!=repassword) {
+            alert('新密码不一致');
+            return false;
+        }
+        $.ajax({
+            url: "/admin/user/repassword",
+            type: "POST",
+            data: {'oldpassword': oldpassword, 'newpassword': newpassword},
+            dataType: 'json',
+            success: function (res) {
+                console.log(res);
+                alert(res.msg);
+                if (res.code == 0) {
+                    window.location.href = "/admin/login/logout";
+                }
+            }
+        })
+    }
+
+    function search() {
+        var key = $("#key").val();
+        window.location.href = "?key=" + key;
+    }
+
+    function celerSearch() {
+        window.location.href = "/";
+    }
+
+    // 开票类型
+    function text(val) {
+        if (val == 2) {
+            document.querySelector('#isShow').style.display = 'block'
+        } else {
+            document.querySelector('#isShow').style.display = 'none'
+        }
+    }
+
+    function update(id) {
+        $("#id").val(id);
+        $.ajax({
+            url: "/admin/index/info/id/" + id,
+            type: "GET",
+            data: {},
+            dataType: 'json',
+            success: function (res) {
+                console.log(res);
+                if (res.code == 0) {
+                    var data = res.data;
+                    $("#id").val(data.id);
+                    $("#truename").val(data.truename);
+                    $("#organization").val(data.organization);
+                    $("#position").val(data.position);
+                    $('input[name="sex"]').prop('checked', false);
+                    if (data.sex==2) {
+                        $("#sex2").prop('checked', true);
+                    } else {
+                        $("#sex1").prop('checked', true);
+                    }
+                    $("#phone").val(data.phone);
+                    $("#email").val(data.email);
+                    $('input[name="feeType"]').prop('checked', false);
+                    if (data.fee_type==1) {
+                        $("#feeType1").prop('checked', true);
+                    } else {
+                        $("#feeType2").prop('checked', true);
+                    }
+                    $('input[name="isReport"]').prop('checked', false);
+                    if (data.is_report==1) {
+                        $("#isReport1").prop('checked', true);
+                    } else {
+                        $("#isReport").prop('checked', true);
+                    }
+                    $("#reportTitle").val(data.report_title);
+                    $('input[name="roomType"]').prop('checked', false);
+                    if (data.room_type==1) {
+                        $("#roomType1").prop('checked', true);
+                    } else {
+                        $("#roomType2").prop('checked', true);
+                    }
+                    $('input[name="isShare"]').prop('checked', false);
+                    if (data.is_share==1) {
+                        $("#isShare").prop('checked', true);
+                    } else {
+                        $("#isShare2").prop('checked', true);
+                    }
+                    $('input[name="payType"]').prop('checked', false);
+                    if (data.pay_type==1) {
+                        $("#payType1").prop('checked', true);
+                    } else {
+                        $("#payType2").prop('checked', true);
+                    }
+                    // $("#isPay").val(data.isPay);
+                    $('input[name="isPay"]').prop('checked', false);
+                    if (data.is_pay==1) {
+                        $("#isPay1").prop('checked', true);
+                    } else {
+                        $("#isPay2").prop('checked', true);
+                    }
+                    $("#money").val(data.money);
+                    $('input[name="taxType"]').prop('checked', false);
+                    if (data.pay_type==2) {
+                        $("#taxType2").prop('checked', true);
+                        document.querySelector('#isShow').style.display = 'block';
+                    } else {
+                        $("#taxType1").prop('checked', true);
+                        document.querySelector('#isShow').style.display = 'none';
+                    }
+                    $('input[name="taxTitle"]').val(data.tax_title);
+                    $('input[name="taxNumber"]').val(data.tax_number);
+                    $('input[name="bankAccount"]').val(data.bank_account);
+                    $('input[name="companyAddress"]').val(data.company_address);
+                    $('input[name="companyPhone"]').val(data.company_Phone);
+                    $('input[name="mailingAddress"]').val(data.mailing_address);
+                    $('input[name="postcode"]').val(data.postcode);
+                    $("#remark").val(data.remark);
+                    $('#myModal').modal("show");
+                } else {
+                    alert(res.msg);
+                }
+                return false;
+            }
+        });
+    }
+
+    function save() {
+        var truename = $("#truename").val();
+        var phone = $("#phone").val();
+        // console.log(truename);
+        // console.log(phone);
+        if (isEmpty(truename) || isEmpty(phone)) {
+            alert('姓名 or 电话不能为空');
+            return false;
+        }
+        
+        var data = $('#form-add').serializeArray();
+        $.ajax({
+            url: "/admin/index/save",
+            type: "POST",
+            data: data,
+            dataType: 'json',
+            success: function (res) {
+                // console.log(res);
+                $("#id").val(0);
+                if (res.code == 0) {
+                    alert('保存成功');
+                    window.location.reload();
+                } else {
+                    alert(res.msg);
+                }
+
+                return false;
+            }
+        });
+    }
+
+    function del(id, that) {
+        $.ajax({
+            url: "/admin/index/delete",
+            type: "POST",
+            data: {
+                'id': id
+            },
+            dataType: 'json',
+            success: function (res) {
+                // console.log(res);
+                if (res.code == 0) {
+                    alert('删除成功');
+                    $(that).parents('tr').remove();
+                    // window.location.reload();
+                } else {
+                    alert(res.msg);
+                }
+
+                return false;
+            }
+        });
+    }
+
+    function doPrint(id) {
+        $.ajax({
+            url: "/admin/index/do_print",
+            type: "POST",
+            data: {'id': id},
+            dataType: 'json',
+            success: function (res) {
+                if (res.code == 0) {
+                    // qrcode.clear();
+                    var data = res.data;
+                    let str = '<div style="margin: 10px auto; text-align: center;">';
+                    str += '<img src="' + data.img + '">';
+                    str += '<p style="font-size: 14px;margin-top: 10px;"><font style="vertical-align: inherit;">' + data.id + '  ' + data.truename + '</font></p>';
+                    str += '<p style="font-size: 14px;"><font style="vertical-align: inherit;">'+data.organization+'</font></p>';
+                    str += '</div>';
+                    window.document.body.innerHTML = str;
+                    // console.log(str);
+                    setTimeout(function(){ window.print(); }, 500);
+                } else {
+                    alert(res.msg);
+                }
+                return false;
+            }
+        });
+    }
+    //定义打印前事件 
+    var beforePrint = function () {
+        console.log("打印前");
+    };
+    //定义打印后事件 
+    var afterPrint = function () {
+        console.log("打印后");
+        window.location.reload();
+    }
+ 
+    // //监听window状态
+    // if (window.matchMedia) {
+    //     var mediaQueryList = window.matchMedia('print');
+    //     //为印添加事件
+    //     mediaQueryList.addListener(function (mql) {
+    //         console.log(mql);
+    //         if (mql.matches) {
+    //             beforePrint();
+    //         } else {
+    //             afterPrint();
+    //         }
+    //     });
+    // }
+ 
+    //打印前事件
+    window.onbeforeprint = beforePrint;
+    //打印后事件
+    window.onafterprint = afterPrint;
+
+    function printReceipt() {
+        var checkbox = $('.data-row input[name="checkbox[]"]');
+        var ids = new Array();
+        checkbox.each(function (x) {
+            if (this.checked)
+                ids.push(this.value);
+        })
+        console.log(ids);
+        window.open('/admin/index/print_receipt?ids='+ids);
+        return false;
+    }   
+</script>
+
+</html>

+ 205 - 0
application/admin/view/index/info.html

@@ -0,0 +1,205 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <link rel="stylesheet" href="/static/css/admin-info.css" type="text/css">
+    <title>耐蚀钢报名表</title>
+    <style>
+    tbody tr td {
+        width: 100px;
+    }        
+    </style>
+</head>
+
+<body>
+    <table>
+        <tr>
+            <td class="text-l" width="30%">位置:
+                <a href="/admin/index/index">耐蚀钢报名表</a>
+            </td>
+            <td class="text-r" width="70%">
+                <div class="emenubutton">
+                    <input type="button" value="返回" onclick="javascript:history.back(-1);";>
+                </div>
+            </td>
+        </tr>
+    </table>
+    <table class="tableborder table_content">
+        <thead>
+            <tr class="header_tr">
+                <th class="text-l" colspan="6">
+                    报名详细信息
+                    | id: <?php echo $data['id']; ?>
+                    | 网上报名时间: <?php echo $data['create_time']; ?>
+                </th>
+            </tr>
+        </thead>
+        <tbody>
+            <tr class="header_tr_xq">
+                <td class="text-l" colspan="6">
+                    个人信息
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    姓名
+                </td>
+                <td>
+                    <?php echo $data['truename']; ?>
+                </td>
+                <td>
+                    性别
+                </td>
+                <td style="width: 200px;">
+                    <?php echo $data['sex']; ?>
+                </td>
+                <td>
+                    单位名称
+                </td>
+                <td style="width: 400px;">
+                    <?php echo $data['organization']; ?>
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    电话
+                </td>
+                <td>
+                    <?php echo $data['phone']; ?>
+                </td>
+                <td>
+                    邮箱
+                </td>
+                <td>
+                    <?php echo $data['email']; ?>
+                </td>
+                <td>
+                    职位
+                </td>
+                <td>
+                    <?php echo $data['position']; ?>
+                </td>
+            </tr>
+            <tr class="header_tr_xq">
+                <td class="text-l" colspan="6">
+                    开票信息
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    开票类型
+                </td>
+                <td>
+                    <?php echo $data['tax_type']; ?>
+                </td>
+                <td>
+                    发票抬头
+                </td>
+                <td>
+                    <?php echo $data['tax_title']; ?>
+                </td>
+                <td>
+                    单位地址
+                </td>
+                <td>
+                    <?php echo $data['company_address']; ?>
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    单位电话
+                </td>
+                <td>
+                    <?php echo $data['company_phone']; ?>
+                </td>
+                <td>
+                    纳税人识别号
+                </td>
+                <td>
+                    <?php echo $data['tax_number']; ?>
+                </td>
+                <td>
+                    开户行及账号
+                </td>
+                <td>
+                    <?php echo $data['bank_account']; ?>
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    邮 编
+                </td>
+                <td>
+                    <?php echo $data['postcode']; ?>
+                </td>
+                <td>
+                    邮寄地址
+                </td>
+                <td colspan="3">
+                    <?php echo $data['mailing_address']; ?>
+                </td>
+            </tr>
+            <tr class="header_tr_xq">
+                <td class="text-l" colspan="6">
+                    参会信息
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    注册费<sup style="color: crimson;">1</sup>
+                </td>
+                <td>
+                    <?php echo $data['fee_type']; ?>
+                </td>
+                <td>
+                    是否做报告
+                </td>
+                <td>
+                    <?php echo $data['is_report']; ?>
+                </td>
+                <td>
+                    报告题目
+                </td>
+                <td class="text-l">
+                    <?php echo $data['report_title']; ?>
+                </td>
+            </tr>
+            <tr class="header_tr_xq">
+                <td class="text-l" colspan="6">
+                    住宿(安徽省马鞍山市梦都雨山湖酒店)
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td>
+                    房型
+                </td>
+                <td colspan="2">
+                    <?php echo $data['room_type']; ?>
+                </td>
+                <td>
+                    是否接受合住
+                </td>
+                <td colspan="2">
+                    <?php echo $data['is_share']; ?>
+                </td>
+            </tr>
+            <tr style="height: 60px;">
+                <td>
+                    备注
+                </td>
+                <td class="text-l" colspan="5">
+                    <?php echo $data['remark']; ?>
+                </td>
+            </tr>
+            <tr class="list_tr">
+                <td class="text-l" colspan="6">
+                    <span style="color: red;">*</span> 付款方式 : <?php echo $data['pay_type']; ?>
+                </td>
+            </tr>
+        </tbody>
+    </table>
+
+</body>
+
+</html>

+ 136 - 0
application/admin/view/index/printReceipt.html

@@ -0,0 +1,136 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        html,
+        body {
+            padding: 0;
+            margin: 0;
+        }
+
+        .box {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            width: 700px;
+            height: 400px;
+            /* border: 1px solid #888; */
+        }
+
+        .header h1 {
+            text-align: center;
+            font-size: 30px;
+            font-weight: 700;
+            line-height: 10px;
+            color: rgba(36, 33, 33, 0.822);
+        }
+
+        .nav {
+            padding: 0px 16px;
+        }
+
+        .content {
+            height: 260px;
+            padding: 20px 10px;
+            box-sizing: border-box;
+        }
+
+        .content div {
+            line-height: 60px;
+            color: rgba(36, 33, 33, 0.822);
+        }
+
+        .border1 {
+            line-height: 18px;
+            display: inline-block;
+            width: 300px;
+            border-bottom: 1px solid rgba(36, 33, 33, 0.822);
+        }
+
+        hr {
+            margin: 1px;
+
+        }
+
+        .footer {
+            padding: 0px 16px;
+            line-height: 34px;
+        }
+    </style>
+</head>
+
+<body>
+    <div class="box1">
+        <div class="box">
+            <div class="header">
+                <h1>收 款 收 据
+                </h1>
+                <div style="width:154px;margin:0 auto">
+                    <hr>
+                    <hr>
+                </div>
+
+            </div>
+            <div class="nav">
+                <span>开票日期: <b class="time" style="font-weight: 200;" id="time"><?php echo $time;?></b></span>
+                <span style="float: right;margin-right: 30px;">编码:
+                    <b style="color: red;">20041008</b>
+                </span>
+            </div>
+
+            <div class="content">
+                <div style="padding: 24px 40px;border: 1px solid ; color: rgba(36, 33, 33, 0.822)">
+                    <div>交款人 <span class="border1"  id="truename"><?php echo $pname;?>(<?php echo $organization;?>)</span></div>
+                    <div>人民币(大写) <span class="border1"  id="rmb-dx"><?php echo $dxmoney;?></span>
+                        <span>¥</span>
+                        <span
+                            style="display:inline-block;width:120px;border-bottom: 1px solid rgba(36, 33, 33, 0.822);line-height: 18px;"  id="rmb-xx"><?php echo $money;?></span>
+                    </div>
+                    <div>收款事由 <span class="border1" id="time"> 会费</span></div>
+                </div>
+            </div>
+            <div class="footer">
+                <span>单位盖章: </span>
+                <span style="float: right;margin-right: 30px;">开票人: 
+                    <select name="kpr" id="kpr">
+                        <option value="应" selected>应</option>
+                        <option value="齐">齐</option>
+                    </select>
+                </span>
+            </div>
+            <div class="button-footer">
+                <button type="button" class="btn btn-primary" style="float: right;" onclick="doPrint()">确定</button>
+            </div>
+        </div>
+    </div>
+</body>
+<script src="/static/js/jquery.min.js"></script>
+<script>
+    // 获取当前时间
+    // (function name(params) {
+    //     let time = new Date()
+    //     let y = time.getFullYear()
+    //     let m = time.getMonth()
+    //     let d = time.getDate()
+    //     let notTime = y + '/' + m + '/' + d
+    //     document.querySelector('.time').innerText = notTime
+    // })()
+
+    function doPrint() {
+        var  time = $("#time").text();
+        var  truename = $("#truename").text();
+        var  rmbDx = $("#rmb-dx").text();
+        var  rmbXx = $("#rmb-xx").text();
+        var  kpr = $("#kpr").val();
+       
+        window.location.href = '/admin/index/receipt?time='+time+'&truename='+truename+'&rmbDx='+rmbDx+'&rmbXx='+rmbXx+'&kpr='+kpr;
+        // window.open('/index/index/receipt?time='+time+'&truename='+truename+'&rmbDx='+rmbDx+'&rmbXx='+rmbXx+'&kpr='+kpr);
+    }
+</script>
+
+</html>

+ 89 - 0
application/admin/view/index/receipt.html

@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        html,
+        body {
+            padding: 0;
+            margin: 0;
+        }
+
+        .box {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            width: 700px;
+            height: 368px;
+            /* border: 1px solid #888; */
+        }
+        .nav {
+            position: absolute;
+            /* padding: 0px 16px; */
+            left: 170px;
+            top: 80px;
+        }
+        .jkr {
+            position: absolute;
+            left:180px;
+            top: 130px;
+        }
+        .rmb-dx {
+            position: absolute;
+            left:230px;
+            top: 180px;
+        }
+        .rmb-xx {
+            position: absolute;
+            left:520px;
+            top: 180px;
+        }
+        .sy {
+            position: absolute;
+            left: 180px;
+            top: 246px;
+        }
+        .kpr {
+            position: absolute;
+            left: 630px;
+            top: 310px;
+        }
+        span {
+            font-family: '宋体';
+        }
+    </style>
+</head>
+
+<body>
+    <div class="box">
+        <div class="nav">
+            <span class="time"><?php echo $data['time'];?></span>
+        </div>
+        <div class="jkr">
+            <span class="truename"><?php echo $data['truename'];?></span>
+        </div>
+        <div class="rmb-dx">
+            <span class="dx"><?php echo $data['rmbDx'];?></span>
+        </div>
+        <div class="rmb-xx">
+            <span class="xx"><?php echo $data['rmbXx'];?></span>
+        </div>
+        <div class="sy">
+            <span class="hyh">海洋会会费</span>
+        </div>
+        <div class="kpr">
+            <span><?php echo $data['kpr'];?></span>
+        </div>
+    </div>
+</body>
+<script>
+    // console.log('tt');
+    window.print();
+    
+</script>
+
+</html>

+ 85 - 0
application/admin/view/login/index.html

@@ -0,0 +1,85 @@
+<!DOCTYPE html>
+<html lang="zh-cn">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        body {
+
+            background-color: rgb(192, 216, 240)
+        }
+
+        .box {
+            width: 100%;
+        }
+
+        .login {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            width: 400px;
+            height: 300px;
+            border: 1px solid #ccc;
+            text-align: center;
+            border-radius: 8px 8px 8px 8px;
+            background-color: #fff;
+            box-shadow: 0px 1px 9px #eee;
+        }
+
+        .login-header {
+            color: #888;
+            font-size: 28px;
+            line-height: 70px;
+        }
+
+        .login-footer {
+            display: flex;
+            justify-content: flex-end;
+            margin-top: 30px;
+        }
+
+        .login-footer button {
+            margin-right: 20px;
+        }
+
+        input {
+            width: 300px;
+            height: 20px;
+        }
+
+        form div:nth-child(1) {
+            margin-top: 30px;
+        }
+
+        form div:nth-child(2) {
+            margin-top: 30px;
+        }
+    </style>
+</head>
+
+<body>
+    <div class="box">
+        <div class="login">
+            <div class="login-header">登 录</div>
+            <div class="login-content">
+                <form action="/admin/login/index" method="POST">
+                    <div>
+                        <input type="text" name="username" placeholder="登录账号">
+                    </div>
+                    <div>
+                        <input type="password" name="passwd" placeholder="登录密码">
+                    </div>
+                    <div class="login-footer">
+                        <button type="submit">提交</button>
+                        <button type="reset">取消</button>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</body>
+
+</html>

+ 47 - 0
application/admin/view/login/jump.html

@@ -0,0 +1,47 @@
+<!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" />
+    <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">
+        <?php
+            if ($code==1) {
+                echo "<h1>:)</h1>";
+                echo "<p class='success'>$msg</p>";
+            } else {
+                echo "<h1>:(</h1>";
+                echo "<p class='error'>$msg</p>";
+            }
+        ?>
+        <p class="detail"></p>
+        <p class="jump">
+            页面自动 <a id="href" href="<?php echo($url);?>">跳转</a> 等待时间: <b id="wait"><?php echo($wait);?></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>

+ 122 - 0
application/index/controller/Index.php

@@ -0,0 +1,122 @@
+<?php
+namespace app\index\controller;
+
+use \daswork\Controller;
+use app\admin\model\Attenders;
+
+Class Index extends Controller
+{
+    public function index()
+    {
+        $this->fetch();
+    }
+
+    public function save()
+    {
+        if ($_SERVER['REQUEST_METHOD']=='POST') {
+            $param = escapeString($_POST);
+            // echo json_encode($param);
+            // exit;
+            //查询是否已经注册过
+            $model = new Attenders();
+            $name = handleInput($param['name']) ? $param['name'] : '';
+            $phone = handleInput($param['phone']) ? $param['phone'] : '';
+            $query = "select count(*) as total from attenders where truename='$name' and phone=$phone";
+            $result = $model->query($query)->fetch_assoc();
+            // echo json_encode($result['total']>0);
+            // exit;
+            /*
+            tax_type 开票类型
+            company_name 公司名称
+            tax_number 纳税人识别号
+            company_address 公司地址
+            company_phone 公司电话
+            bank_account 开户行及账号
+            mailing_address 邮寄地址
+            postcode 邮编
+            name 名字
+            sex 性别
+            position 职务
+            phone 电话
+            email 邮箱
+            fee_id 注册费类型
+            school 学校
+            professional 专业
+            paper_type '论文类型:0, 不发表; 1, << 中国腐蚀与防护学报 >> 2000元/篇; 2, << 混凝土与水泥制品 >> 3200元/篇',
+            is_report 是否作报告
+            report_title 报告标题
+            hotel_type 酒店类型
+            room_type 房间类型
+            pay_type 支付方式 1, 现场缴费 2汇款
+            create_time '填表时间'
+            */
+            if($result['total']>0){
+                echo "<script>alert('您已经报名成功,请勿重复提交!');location.href='http://meeting.ecorr.org';</script>";
+            }else{
+                $tax_type = handleInput($param['tax_type']) ? $param['tax_type'] : 1;
+                $company_name = handleInput($param['company_name']) ? $param['company_name'] : '';
+                $tax_number = handleInput($param['tax_number']) ? $param['tax_number'] : '';
+                $company_address = handleInput($param['company_address']) ? $param['company_address'] : '';
+                $company_phone = handleInput($param['company_phone']) ? $param['company_phone'] : '';
+                $bank_account = handleInput($param['bank_account']) ? $param['bank_account'] : '';
+                $mailing_address = handleInput($param['mailing_address']) ? $param['mailing_address'] : '';
+                $postcode = handleInput($param['postcode']) ? $param['postcode'] : '';
+
+                $name = handleInput($param['name']) ? $param['name'] : '';
+                $sex = handleInput($param['sex']) ? $param['sex'] : 0;
+                $position = handleInput($param['position']) ? $param['position'] : '';
+                $phone = handleInput($param['phone']) ? $param['phone'] : '';
+                $email = handleInput($param['email']) ? $param['email'] : '';
+
+                $fee_id = handleInput($param['fee_id']) ? $param['fee_id'] : 1;
+                $is_report = handleInput($param['is_report']) ?$param['is_report'] : 0;
+                $report_title = handleInput($param['report_title']) ? $param['report_title'] : '无报告';
+                
+                // $hotel_type = handleInput(isset($param['hotel_type'])?$param['hotel_type']:1);
+                $hotel_type = 1;
+                $room_type = handleInput($param['room_type']) ?$param['room_type'] : 1;
+                $is_share = handleInput($param['is_share']) ? $param['is_share'] : 0;
+                $pay_type = handleInput($param['pay_type']) ? $param['pay_type'] : 1;
+                $note = handleInput($param['note']) ? $param['note'] : '';
+                $create_time = time();
+
+                $data = [
+                    "meeting_id" => 3,
+                    "truename" => $name,
+                    "sex" => $sex,
+                    "organization" => $company_name,
+                    "position" => $position,
+                    "phone" => $phone,
+                    "email" => $email,
+                    "remark" => $note,
+                    "fee_type" => $fee_id,
+                    "is_report" => $is_report,
+                    "report_title" => $report_title,
+                    "hotel_type" => $hotel_type,
+                    "room_type" => $room_type,
+                    "is_share" => $is_share,
+                    "pay_type" => $pay_type,
+                    "tax_type" => $tax_type,
+                    "tax_title" => $company_name,
+                    "tax_number" => $tax_number,
+                    "company_address" => $company_address,
+                    "company_phone" => $company_phone,
+                    "bank_account" => $bank_account,
+                    "mailing_address" => $mailing_address,
+                    "postcode" => $postcode,
+                    "create_time" => $create_time
+                ];
+                $res = $model->save($data);
+                // var_dump($res);
+                // exit;
+                if($res){
+                    echo "<script>alert('报名成功');location.href='http://meeting.ecorr.org';</script>"; 
+                }else{
+                    echo "<script>alert('失败!请重新填写');history.back();</script>";
+                }
+            }
+        } else {
+            echo "<script>alert('非法操作!');location.href='http://meeting.ecorr.org';</script>";
+        }
+    }
+}

+ 414 - 0
application/index/view/index/index.html

@@ -0,0 +1,414 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="UTF-8" />
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
+    <meta name="keywords" content="CSS3" />
+    <title>在线报名系统</title>
+    <link rel="stylesheet" href="/static/css/bootstrap.min.css">
+    <link rel="stylesheet" href="/static/css/base.css">
+    <link rel="stylesheet" href="/static/css/index.css">
+    <link rel="stylesheet" href="/static/css/bootstrapValidator.css">
+    <script src="/static/js/jquery.min.js"></script>
+    <script src="/static/js/bootstrap.min.js"></script>
+    <script src="/static/js/bootstrapValidator.min.js"></script>
+</head>
+<div class="center-con">
+    <div class="row">
+        <section>
+            <div class="page-header">
+                <h2 style="color: #f7b16b;  font-weight: 700;font-size: 20px;">2020年高性能耐蚀钢发展与防腐新技术交流会</h2>
+                <h2 style="color: #f7b16b; font-weight: 700;font-size: 20px;">主办单位: 耐蚀钢产业技术创新战略联盟</h2>
+            </div>
+            <div class="col-lg-8 col-lg-offset-2">
+                <form id="defaultForm" method="post" action="/index/index/save" class="form-horizontal">
+                    <div class="rel">
+                        <h3 style="font-weight: 700; font-size: 18px;" class="yellow">参会回执表</h3>
+                    </div>
+                    <fieldset style='padding-left:20px;padding-right: 15px;'>
+                        <div class="margin-bottom-20" style="text-align: center"><span class="blue fz-16"
+                                style="font-weight:700;font-size: 16px;">2020年12月11-13日<br />(11日全天签到,12日、13日全天会议)<br />
+                                地点: 安徽省马鞍山市梦都雨山湖酒店</span></div>
+
+                        <h5 class="fz-20 padding-10 yellow">开票信息</h5>
+                        <!-- 开票类型 -->
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"> <span class="require-star">*</span>开票类型</label>
+                            <div class="col-lg-5">
+                                <label class="radio-inline">
+                                    <input type="radio" value="1" name="tax_type" id="tax_type1" checked  onclick=text(value)>普票
+                                </label>
+                                <label class="radio-inline">
+                                    <input type="radio" value="2" name="tax_type" id="tax_type1" onclick=text(value)>专票
+                                </label>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>单位名称</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="company_name" />
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>纳税人识别号</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="tax_number" />
+                            </div>
+                        </div>
+                        <div id='isShow' style="display: none;">
+                            <div class="form-group">
+                                <label class="col-lg-4 control-label"><span class="require-star">*</span>开户行及账号</label>
+                                <div class="col-lg-5">
+                                    <input type="text" class="form-control" name="bank_account" />
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <label class="col-lg-4 control-label"><span class="require-star">*</span>地 址</label>
+                                <div class="col-lg-5">
+                                    <input type="text" class="form-control" name="company_address" />
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <label class="col-lg-4 control-label"><span class="require-star">*</span>开户电话</label>
+                                <div class="col-lg-5">
+                                    <input type="text" class="form-control" name="company_phone" />
+                                </div>
+                            </div>
+
+                        </div>
+                        <!-- 邮寄地址 -->
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>邮寄地址</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="mailing_address" />
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>邮 编</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="postcode" />
+                            </div>
+                        </div>
+                        <!-- 个人信息 -->
+                        <h5 class="fz-20 padding-10 yellow">个人信息</h5>
+
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>姓 名</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="name" />
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"> <span class="require-star">*</span>性别</label>
+                            <div class="col-lg-5">
+                                <label class="radio-inline">
+                                    <input checked type="radio" value="1" name="sex">男
+                                </label>
+                                <label class="radio-inline">
+                                    <input type="radio" value="2" name="sex">女
+                                </label>
+                            </div>
+                        </div>
+
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>职 位</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="position" />
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>手 机</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="phone" />
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>邮 箱</label>
+                            <div class="col-lg-5">
+                                <input type="text" class="form-control" name="email" />
+                            </div>
+                        </div>
+
+                        <h5 class="fz-20  padding-10 yellow">会议注册类型和费用(联盟成员免收)</h5>
+
+                        <!-- 学生 -->
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"> <span class="require-star">*</span>注册费</label>
+                            <div class="col-lg-5">
+                                <label class="radio-inline">
+                                    <input checked type="radio" value="1" name="fee_id" checked
+                                        onclick="isStudent(1);">正式代表 2000元/人
+                                </label>
+                                <label class="radio-inline">
+                                    <input type="radio" value="2" name="fee_id" onclick="isStudent(2);">学 生
+                                    1200元/人
+                                </label>
+                            </div>
+                        </div>
+
+                        <h5 class="fz-20  padding-10 yellow">报 告 </h5>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label">是否做报告</label>
+                            <div class="col-lg-5">
+                                <label class="radio-inline">
+                                    <input checked type="radio" value="1" name="is_report" onclick=reportl(value)>是
+                                </label>
+                                <label class="radio-inline">
+                                    <input type="radio" value="2" name="is_report" onclick=reportl(value)>否
+                                </label>
+                            </div>
+                        </div>
+                        <div id='reportShow'>
+                            <div class="form-group reportTit">
+                                <label class="col-lg-4 control-label"><span class="require-star">*</span>报告题目</label>
+                                <div class="col-lg-5">
+                                    <input type="text" class="form-control" name="report_title" />
+                                </div>
+                            </div>
+                        </div>
+                        <h5 class="fz-20  padding-10 yellow">住 宿 </h5>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label">酒 店</label>
+                            <div class="col-lg-5 " style="text-align: left; padding-left:0px">
+                                <label class="radio-inline">
+                                    <!-- <input  type="radio" value="1" name="hotel_type" onclick=hotel(value)> -->
+                                    安徽省马鞍山市梦都雨山湖酒店
+                                </label>
+                            </div>
+                        </div>
+                        <div id="show">
+                            <div class="form-group">
+                                <label class="col-lg-4 control-label">房 型</label>
+                                <div class="col-lg-5 " style="text-align: left">
+                                    <label class="radio-inline" style="margin-left: 0px;">
+                                        <input type="radio" value="1" name="room_type" checked>标准房248元/间/天
+                                    </label>
+                                    <label class="radio-inline" style="margin-left: 0px;">
+                                        <input type="radio" value="2" name="room_type">商务房288元/间/天
+                                    </label>
+                                </div>
+                            </div>
+                            <div class="form-group">
+                                <label class="col-lg-4 control-label">是否接受合住</label>
+                                <div class="col-lg-5 " style="text-align: left">
+                                    <label class="radio-inline" style="margin-left: 0px;">
+                                        <input type="radio" value="1" name="is_share">是
+                                    </label>
+                                    <label class="radio-inline" style="margin-left: 0px;">
+                                        <input checked type="radio" value="0" name="is_share">否
+                                    </label>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="form-group reportTit">
+                            <label class="col-lg-4 control-label">备注</label>
+                            <div class="col-lg-5">
+                                <textarea name="note" class="form-control" cols="30" rows="10"
+                                    style=" resize: none; height: 100px"></textarea>
+                            </div>
+                        </div>
+                        <!-- 付款相关信息 -->
+                        <h5 class="fz-20  padding-10 yellow">
+                            付 款 信 息<strong class="require-star"> </strong></h5>
+                        <div class="form-group">
+                            <label class="col-lg-7 control-label require-star"
+                                style="font-size: 16px;color:#e64b44"><span
+                                    class="require-star">*</span>汇款请注明:会费 + 姓名(以提前电汇为主)</label>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"><span class="require-star">*</span>支付形式</label>
+                            <div class="col-lg-5">
+                                <label class="radio-inline">
+                                    <input type="radio" value="1" name="pay_type" checked>汇 款
+                                </label>
+                                <label class="radio-inline">
+                                    <input type="radio" value="2" name="pay_type">现场缴费
+                                </label>
+                            </div>
+                        </div>
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label" style="margin-top: -8px;"><span
+                                    class="require-star">*</span>汇款</label>
+                            <div class="col-lg-5">
+                                <p>
+                                    开 户 行:中国农业银行股份有限公司北京海淀东区支行营业部</p>
+                                <p>
+                                    户 名:北京丰盈环蚀技术有限公司</p>
+                                <p>
+                                    账 号:11250501040029807</p>
+                            </div>
+                        </div>
+                        <div class="form-group" style="text-align: center;">
+                            <button type="submit" class="btn  form-btn"
+                                style="background-color: #e2a669;font-size: 18px;font-weight: 700;">提交</button>
+                            <button type="reset" class="btn  form-btn"
+                                style="background-color:#e2a669;font-size: 18px;font-weight: 700;">重置</button>
+                        </div>
+                        <h5 class="fz-20  padding-10 yellow" style="margin-top: 30px;">会务组联系方式</h5>
+
+                        <div class="form-group">
+                            <label class="col-lg-4 control-label"></label>
+                            <div class="col-lg-5">
+                                王 &nbsp;&nbsp; 元&nbsp;&nbsp;&nbsp;: 13693251529<br />
+                                齐颖欣 &nbsp;&nbsp;: 15311083856<br />
+                                石 &nbsp;&nbsp; 践 &nbsp;&nbsp;: 18655593989<br />
+                                回执邮箱:68235282@qq.com
+                            </div>
+                        </div>
+                    </fieldset>
+                </form>
+            </div>
+        </section>
+    </div>
+</div>
+
+</body>
+<!-- <script type="text/javascript" src="demo/js/dcalendar.picker.js"></script> -->
+
+<script>
+    // 开票类型
+    function text(val) {
+        if (val == 2) {
+            document.querySelector('#isShow').style.display = 'block'
+        } else {
+            document.querySelector('#isShow').style.display = 'none'
+        }
+    }
+    //学生
+    function demo(val) {
+        if (val == 2) {
+            document.querySelector('#isHide').style.display = 'none'
+        } else {
+            document.querySelector('#isHide').style.display = 'block'
+        }
+    }
+
+    function isStudent(val) {
+        if (val == 2) {
+            document.querySelector('#feeShow').style.display = 'block';
+            $("#fee-1").prop('checked', false);
+            $("#fee-2").prop('checked', true);
+        } else {
+            document.querySelector('#feeShow').style.display = 'none';
+            $("#fee-1").prop('checked', true);
+            $("#fee-2").prop('checked', false);
+        }
+    }
+    // 报告
+    function reportl(val) {
+        if (val == 2) {
+            document.querySelector('#reportShow').style.display = 'none';
+        } else {
+            document.querySelector('#reportShow').style.display = 'block';
+        }
+    }
+    // hotl
+    function hotel(val) {
+        if (val == 2) {
+            document.querySelector('#show').style.display = 'none'
+        } else {
+            document.querySelector('#show').style.display = 'block'
+        }
+    }
+    
+    //表单验证
+    $(function () {
+        $('#defaultForm').bootstrapValidator({
+            message: 'This value is not valid',
+            feedbackIcons: {
+                valid: 'glyphicon glyphicon-ok',
+                invalid: 'glyphicon glyphicon-remove',
+                validating: 'glyphicon glyphicon-refresh'
+            },
+            fields: {
+                company_name: {
+                    validators: {
+                        notEmpty: {
+                            message: '单位名称不能为空'
+                        }
+                    }
+                },
+                tax_number: {
+                    validators: {
+                        notEmpty: {
+                            message: '识别号不能为空'
+                        }
+                    }
+                },
+                bank_account: {
+                    validators: {
+                        notEmpty: {
+                            message: '开户行账号不能为空'
+                        }
+                    }
+                },
+                company_address: {
+                    validators: {
+                        notEmpty: {
+                            message: '地址不能为空'
+                        }
+                    }
+                },
+                company_phone: {
+                    validators: {
+                        notEmpty: {
+                            message: '电话不能为空'
+                        },
+                        regexp: {
+                            regexp: /^((0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$/,
+                            message: '电话号码格式有误,请重新输入'
+                        }
+                    }
+                },
+                mailing_address: {
+                    validators: {
+                        notEmpty: {
+                            message: '地址不能为空'
+                        },
+
+                    }
+                },
+                name: {
+                    validators: {
+                        notEmpty: {
+                            message: '姓名不能为空'
+                        },
+                    }
+                },
+                position: {
+                    validators: {
+                        notEmpty: {
+                            message: '职位不能为空'
+                        },
+                    }
+                },
+                phone: {
+                    validators: {
+                        notEmpty: {
+                            message: '电话不能为空'
+                        },
+                        regexp: {
+                            regexp: /^1[3|4|5|7|8][0-9]\d{8}$/,
+                            message: '电话号码格式有误,请重新输入'
+                        }
+                    }
+                },
+                email: {
+                    validators: {
+                        notEmpty: {
+                            message: '邮箱地址不能为空'
+                        },
+                        emailAddress: {
+                            message: '邮箱地址格式有误,请重新确认'
+                        }
+                    }
+                }
+            }
+        });
+    });
+</script>
+
+</html>

+ 1 - 0
daswork/.gitignore

@@ -0,0 +1 @@
+config.php

+ 14 - 0
daswork/config.bak.php

@@ -0,0 +1,14 @@
+<?php
+return array(
+    'db'  =>[
+        'host'=>'locaohost',
+        'username'=>'root',
+        'pwd'=>'',
+        'dbname'=>'test'
+    ],
+    'route' =>[
+        'm'=>'index',
+        'c'=>'Index',
+        'a'=>'index'
+    ],
+);

+ 30 - 0
daswork/main/App.php

@@ -0,0 +1,30 @@
+<?php
+namespace daswork;
+
+use \daswork\lib\Route;
+use \daswork\lib\Config;
+
+class App
+{
+    public static $classMap = array();#用于判断类是否存在,节约性能
+ 
+    /**
+     * 运行控制器和方法
+     * @throws \Exception
+     */
+    public static function run()
+    {
+        self::init();
+        $route = new Route();
+        $ctrlClass = '\\app\\' . $route->model  . '\\' . "controller" . '\\'. $route->ctrl;
+        $action = $route->action;
+        
+        $ctrl = new $ctrlClass();
+        $ctrl->$action();
+    }
+
+    public static function init()
+    {
+        Config::load();
+    }
+}

+ 20 - 0
daswork/main/Connect.php

@@ -0,0 +1,20 @@
+<?php
+namespace daswork;
+
+use mysqli;
+
+class Connect
+{
+    protected $connect;
+
+    public function __construct()
+    {
+        $mydb = new mysqli('127.0.0.1', 'root', '123456', 'test');
+        if ($mydb->connect_error) {
+            throw new \Exception('Connect Error (' . $mydb->connect_errno . ') '. $mydb->connect_error);
+        } else {
+            // echo "Opened database successfully\n";
+            $this->connect = $mydb;
+        }
+    }
+}

+ 26 - 0
daswork/main/Controller.php

@@ -0,0 +1,26 @@
+<?php
+namespace daswork;
+
+use daswork\View;
+
+class Controller
+{
+
+    
+    protected $view;
+
+    public function __construct()
+    {
+        $this->view = new View();
+    }
+    
+    public function fetch($file = "")
+    {
+        return $this->view->fetch($file);
+    }
+
+    public function assign($name, $value)
+    {
+        return $this->view->assign($name, $value);
+    }
+}

+ 123 - 0
daswork/main/Loader.php

@@ -0,0 +1,123 @@
+<?php
+namespace daswork;
+
+class Loader
+{
+    // protected static $instance = [];
+    // 类名映射
+    protected static $map = [];
+    // 命名空间别名
+    protected static $namespaceAilas = [];
+    // // 自动加载的文件
+    // private static $autoloadFiles = [];
+    // 命名空间与路径映射
+    private static $namespaces = [];
+    // 保存已加载的类
+    private static $classMaps = [];
+
+    // // 自动加载
+    // public static function autoload($class)
+    // {
+    //     // 检测命名空间别名
+    //     if (!empty(self::$namespaces)) {
+    //         $namespace = dirname($class);
+    //         if (isset(self::$namespaces[$namespace])) {
+    //             $original = self::$namespaces[$namespace] . '\\' . basename($class);
+    //             if (class_exists($original)) {
+    //                 return class_alias($original, $class, false);
+    //             }
+    //         }
+    //     }
+
+    //     if ($file = self::findFile($class)) {
+
+    //         // Win环境严格区分大小写
+    //         if (IS_WIN && pathinfo($file, PATHINFO_FILENAME) != pathinfo(realpath($file), PATHINFO_FILENAME)) {
+    //             return false;
+    //         }
+
+    //         __include_file($file);
+    //         return true;
+    //     }
+    // }
+
+    private static function autoload($class)
+    {
+        if (in_array($class, self::$classMaps)) {
+            return true;
+        }
+
+        if ($file = self::findFile($class)) {
+            // Win环境严格区分大小写
+            if (IS_WIN && pathinfo($file, PATHINFO_FILENAME) != pathinfo(realpath($file), PATHINFO_FILENAME)) {
+                return false;
+            }
+            __include_file($file);
+            self::$classMaps[] = $class;
+            return true;
+        }
+    }
+    
+    public static function findFile($class)
+    {
+        if (IS_WIN) {
+            $namespace = \dirname($class);
+            // 有命名空间映射的
+            if (isset(self::$namespaces[$namespace])) {
+                $file = self::$namespaces[$namespace] . basename($class) . EXT;
+                // var_dump($file);
+                return $file;
+            }
+            // var_dump(substr($class,strpos($class, '\\') + 1));
+            $model = substr($class, 0, strpos($class, '\\'));
+            
+            if ($model=='app') {
+                $file = APP_PATH . DS. str_replace('\\', DS, substr($class, strpos($class, '\\') + 1)) . EXT;
+    
+                return $file;
+            }
+        } else {
+            $class = str_replace('\\', '/', $class);
+            $namespace = str_replace('/','\\',dirname($class));
+
+            // 有命名空间映射的
+            if (isset(self::$namespaces[$namespace])) {
+                $file = self::$namespaces[$namespace] . basename($class) . EXT;
+
+                return $file;
+            }
+            $model = substr($class, 0, strpos($class, '/'));
+            if ($model=='app') {
+                $file = APP_PATH . str_replace($model, '', $class) . EXT;
+                // var_dump($class);
+                return $file;
+            }
+        }
+    }
+
+    // 注册系统自动加载
+    public static function register($autoload = '')
+    {
+        spl_autoload_register($autoload ?: 'daswork\\Loader::autoload', true, true);
+        self::$namespaces = [
+            'daswork' => CORE_PATH,
+            'daswork\lib' => CORE_PATH . 'lib' . DS
+        ];
+    }
+}
+
+/**
+ * 作用范围隔离
+ *
+ * @param $file
+ * @return mixed
+ */
+function __include_file($file)
+{
+    return include $file;
+}
+
+function __require_file($file)
+{
+    return require $file;
+}

+ 159 - 0
daswork/main/Model.php

@@ -0,0 +1,159 @@
+<?php
+namespace daswork;
+
+// use daswork\Connect;
+use mysqli;
+use daswork\lib\Config;
+
+class Model
+{
+    private $mydb;
+    protected $tablename;
+
+    public function __construct()
+    {
+        // $content = new Connect();  后期这得改成多次model 用一个连接
+        $db = Config::get('db');
+        $mydb = new mysqli($db['host'], $db['username'], $db['pwd'], $db['dbname']);
+        if ($mydb->connect_error) {
+            throw new \Exception('Connect Error (' . $mydb->connect_errno . ') '. $mydb->connect_error);
+        } else {
+            // echo "Opened database successfully\n";
+            $this->connect = $mydb;
+        }
+    }
+
+    /**
+     * 执行sql
+     * @param string $sql
+     * @return mixd $res
+     */
+    public function query($sql)
+    {
+        $res = $this->mydb->query($sql);
+        return $res;
+    }
+    
+    public function lastInsertRowID()
+    {
+        $res = $this->mydb->insert_id;
+        return $res;
+    }
+
+    public function lastErrorMsg()
+    {
+        return "Errorcode: %d\n" . $this->mydb->errno . $this->mydb->error;
+    }
+
+    /**
+     * 查询数组列表
+     */
+    public function select($sql)
+    {
+        $result = $this->mydb->query($sql);
+        $data = array();
+
+        while ($arr = $result->fetch_assoc()) {
+            $data[] = $arr;
+        }
+        return $data;
+    }
+
+    /**
+     * 查询一条
+     */
+    public function getOneById($id, $tablename = '')
+    {
+        $tablename = $tablename ? $tablename : $this->tablename;
+        $sql = "SELECT * FROM `$tablename` WHERE `id`=$id;";
+        $result = $this->mydb->query($sql);
+
+        $data = $result->fetch_assoc();
+        // var_dump($data);
+        return $data;
+    }
+
+    /**
+     * 列表结果集
+     */
+    public function dataList($where = '')
+    {
+        $sql = "select * from $this->tablename $where;";
+        return $this->select($sql);
+    }
+
+    /**
+     * 分页结果集
+     */
+    public function pageList($where, $page = 1, $limit = 10)
+    {
+        $res = $this->query("select count(*) as total from $this->tablename $where;"); 
+        $data = $res->fetch_assoc();
+        
+        $offset = ($page - 1) * $limit;
+        $sql = "select * from $this->tablename $where limit $offset, $limit;";
+        $list = $this->select($sql);
+        $data['list'] = $list;
+        $data['page'] = $page;
+        $data['limit'] = $limit;
+        
+        return $data;
+    }
+
+    /**
+     * save
+     */
+    public function save($data)
+    {
+        $columns = "";
+        $values = "";
+        foreach ($data as $key => $value) {
+            $columns .=  "`" . $key . "`,";
+            $values .=  "'" . $value . "',";
+        }
+        $columns = rtrim($columns, ',');
+        $values = rtrim($values, ',');
+        $sql = "INSERT INTO `$this->tablename`(" . $columns . ") VALUES(". $values . ");";
+        // echo $sql;
+        return $this->query($sql);
+    }
+    
+    /**
+     * updateById
+     */
+    public function updateById($data)
+    {
+        $id = $data['id'];
+        unset($data['id']);
+        $columns = "";
+        foreach ($data as $key => $value) {
+            $columns .= "`" . $key . "`='" . $value ."',";
+        }
+        $columns = rtrim($columns, ',');
+        $sql = "UPDATE `$this->tablename` SET $columns WHERE `id`=$id";
+        return $this->query($sql);
+    }
+
+    /**
+     * deleteByIds
+     */
+    public function deleteById($id)
+    {
+        $sql = "DELETE FROM `$this->tablename` WHERE `id` IN(";
+        if (is_array($id)) {
+            for ($i=0; $i < count($id); $i++) {
+                $sql .= $id[$i] . ',';
+            }
+            $sql = rtrim($sql, ',');
+            $sql .= ");";
+        } else {
+            $sql = "DELETE FROM `$this->tablename` WHERE `id`=$id;";
+        }
+        return $this->query($sql);
+    }
+
+    public function __destruct()
+    {
+        $this->mydb->close();
+    }
+}

+ 51 - 0
daswork/main/View.php

@@ -0,0 +1,51 @@
+<?php
+namespace daswork;
+
+class View
+{
+    public $assign;#用于判断类是否存在,节约性能
+ 
+    /**
+     * 变量名替换
+     * @param $name
+     * @param $value
+     */
+    public function assign($name, $value)
+    {
+        $this->assign[$name] = $value;
+    }
+ 
+    /**
+     * 显示视图
+     * @param $file
+     */
+    // public function display($file)
+    // {
+    //     $file = APP.'/views/'.$file;
+    //     if (is_file($file)){
+    //         extract($this->assign);#从数组中将变量导入到当前的符号表
+    //         include $file;
+    //     }
+    // }
+
+    public function fetch($file = "")
+    {
+        if (!empty($this->assign)) {
+            extract($this->assign);
+        }
+        if ($file) {
+            $namearary = explode(".", $file);
+            $typename = end($namearary);
+            if (!in_array($typename, ['html','tpl','htm','php'])) {
+                $file=$file . '.' . TPL;
+            }
+            
+            $filename = APP_PATH."/".$GLOBALS['model']."/view/" . strtolower($GLOBALS['ctrl']) . "/".$file;
+            // echo '<br/>'.$filename;
+            return require($filename);
+        } else {
+            // var_dump(APP_PATH . DS . $GLOBALS['model'] . DS . 'view' . DS .  strtolower($GLOBALS['ctrl']) . $GLOBALS['action']. TPL);
+            return require(APP_PATH . DS . $GLOBALS['model'] . DS . 'view' . DS . strtolower($GLOBALS['ctrl']) . DS . $GLOBALS['action']. TPL);
+        }
+    }
+}

+ 55 - 0
daswork/main/common/function.php

@@ -0,0 +1,55 @@
+<?php
+/**
+ * 下划线转驼峰
+ * 思路:
+ * step1.原字符串转小写,原字符串中的分隔符用空格替换,在字符串开头加上分隔符
+ * step2.将字符串中每个单词的首字母转换为大写,再去空格,去字符串首部附加的分隔符.
+ */
+function camelize($uncamelized_words, $separator = '_')
+{
+    $uncamelized_words = $separator. str_replace($separator, " ", strtolower($uncamelized_words));
+    return ltrim(str_replace(" ", "", ucwords($uncamelized_words)), $separator);
+}
+
+/**
+ * 驼峰命名转下划线命名
+ * 思路:
+ * 小写和大写紧挨一起的地方,加上分隔符,然后全部转小写
+ */
+function uncamelize($camelCaps, $separator = '_')
+{
+    return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $camelCaps));
+}
+
+/**
+ * 防sql注入字符串转义
+ * @param $content 要转义内容
+ * @return array|string
+ */
+function escapeString($content)
+{
+    $pattern = "/(select[\s])|(insert[\s])|(update[\s])|(delete[\s])|(from[\s])|(where[\s])|(drop[\s])/i";
+    if (is_array($content)) {
+        foreach ($content as $key => $value) {
+            $content[$key] = addslashes(trim($value));
+            if (preg_match($pattern, $content[$key])) {
+                echo $content[$key];
+                $content[$key] = '';
+            }
+        }
+    } else {
+        $content = addslashes(trim($content));
+        if (preg_match($pattern, $content)) {
+            $content = '';
+        }
+    }
+    return $content;
+}
+
+function handleInput($data)
+{
+  $data = trim($data);
+  $data = stripslashes($data);
+  $data = htmlspecialchars($data);
+  return $data;
+}

+ 66 - 0
daswork/main/lib/Route.php

@@ -0,0 +1,66 @@
+<?php
+namespace daswork\lib;
+
+use daswork\lib\Config;
+
+class Route
+{
+    public $model; # 模块
+    public $ctrl; # 控制器
+    public $action; #方法
+    public function __construct()
+    {
+        //xx.com/index.php/index/index
+        //xx.com/index/index
+        /**
+         * 1.隐藏index.php文件,引入.htaccess文件,与入口文件同级
+         * 2.获取URL 参数部分,即get传值
+         * 3.返回对应模块,控制器和方法 REQUEST_URI
+         */
+        $route = Config::get('route');
+
+        if (isset($_SERVER['PATH_INFO'])&& $_SERVER['PATH_INFO'] != '/') {
+            $path = $_SERVER['PATH_INFO'];
+            $pathArr = explode('/', trim($path, '/'));//数组
+            // echo json_encode($pathArr);
+            // exit;
+            if (isset($pathArr[0]) && !empty($pathArr[0])) {
+                $this->model = $pathArr[0];
+                unset($pathArr[0]);
+            } else {
+                $this->model = $route['m'];
+            }
+            if (isset($pathArr[1])) {
+                $this->ctrl = ucfirst(camelize($pathArr[1]));
+                unset($pathArr[1]);
+            } else {
+                $this->ctrl = $route['c'];
+            }
+            if (isset($pathArr[2])) {
+                $this->action = camelize($pathArr[2]);
+                unset($pathArr[2]);
+            } else {
+                $this->action = $route['a'];
+            }
+
+            //url 多余部分转换成GET eg:index/index/index/id/1 实现get传值
+            // var_dump($pathArr);
+            $count = count($pathArr) + 3;
+            $i = 3;
+            while ($i < $count) {
+                if (isset($pathArr[$i+1])) {
+                    $_GET[$pathArr[$i]] = $pathArr[$i+1];
+                }
+                $i = $i + 2;
+            };
+        } else {
+            $this->model = $route['m'];
+            $this->ctrl = $route['c'];
+            $this->action = $route['a'];
+        }
+
+        $GLOBALS['model'] = $this->model;
+        $GLOBALS['ctrl'] = $this->ctrl;
+        $GLOBALS['action'] = $this->action;
+    }
+}

+ 14 - 0
daswork/service.php

@@ -0,0 +1,14 @@
+<?php
+$uri = urldecode(
+    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
+);
+
+// 这个文件允许我们从内置 PHP web 服务器中模拟 Apache 的 "mod_rewrite" 功能.
+// 这提供了一种测试 Laravel 应用程序的便捷方法,
+// 而无需在此安装"真正的" web 服务器软件。
+
+if ($uri !== '/' && file_exists(__DIR__.'/../public'.$uri)) {
+    return false;
+}
+
+require_once __DIR__.'/../public/index.php';

+ 25 - 0
daswork/start.php

@@ -0,0 +1,25 @@
+<?php
+namespace daswork;
+
+//定义系统常量
+define('EXT', '.php');
+define('TPL', '.html'); //模板默认后缀名
+define("DS", DIRECTORY_SEPARATOR);
+define("DAS_PATH", __DIR__);
+define("CORE_PATH", DAS_PATH . DS . "main" . DS);
+define("LIB_PATH", CORE_PATH . "lib" . DS);
+define("VENDOR", DAS_PATH . DS. "../vendor" . DS);
+
+// 环境常量
+define('IS_CLI', PHP_SAPI == 'cli' ? true : false);
+define('IS_WIN', strpos(PHP_OS, 'WIN') !== false);
+
+// 载入Loader类
+require CORE_PATH . 'Loader.php';
+// 注册自动加载
+\daswork\Loader::register();
+// 加载公共函数库
+require CORE_PATH . "common" . DS . "function.php";
+
+// 执行应用
+App::run();

+ 3 - 0
db/.gitignore

@@ -0,0 +1,3 @@
+*.xls
+*.xlsx
+mysqlitedb.db

BIN
public/favicon.ico


+ 118 - 0
public/html/index2.html

@@ -0,0 +1,118 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        html,
+        body {
+            padding: 0;
+            margin: 0;
+        }
+
+        .box {
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            transform: translate(-50%, -50%);
+            width: 700px;
+            height: 400px;
+            /* border: 1px solid #888; */
+        }
+
+        .header h1 {
+            text-align: center;
+            font-size: 30px;
+            font-weight: 700;
+            line-height: 10px;
+            color: rgba(36, 33, 33, 0.822);
+        }
+
+        .nav {
+            padding: 0px 16px;
+        }
+
+        .content {
+            height: 260px;
+            padding: 20px 10px;
+            box-sizing: border-box;
+        }
+
+        .content div {
+            line-height: 60px;
+            color: rgba(36, 33, 33, 0.822);
+        }
+
+        .border1 {
+            line-height: 18px;
+            display: inline-block;
+            width: 300px;
+            border-bottom: 1px solid rgba(36, 33, 33, 0.822);
+        }
+
+        hr {
+            margin: 1px;
+
+        }
+
+        .footer {
+            padding: 0px 16px;
+            line-height: 34px;
+        }
+    </style>
+</head>
+
+<body>
+    <div class="box1">
+        <div class="box">
+            <div class="header">
+                <h1>收 款 收 据
+                </h1>
+                <div style="width:154px;margin:0 auto">
+                    <hr>
+                    <hr>
+                </div>
+
+            </div>
+            <div class="nav">
+                <span>开票日期: <b class="time" style="font-weight: 200;">123</b></span>
+                <span style="float: right;margin-right: 30px;">编码:
+                    <b style="color: red;">20041008</b>
+                </span>
+            </div>
+
+            <div class="content">
+                <div style="padding: 24px 40px;border: 1px solid ; color: rgba(36, 33, 33, 0.822)">
+                    <div>交款人 <span class="border1">小明</span></div>
+                    <div>人民币(大写) <span class="border1"></span>
+                        <span>¥</span>
+                        <span
+                            style="display:inline-block;width:120px;border-bottom: 1px solid rgba(36, 33, 33, 0.822);line-height: 18px;"></span>
+                    </div>
+                    <div>收款事由 <span class="border1">海洋会</span></div>
+                </div>
+
+
+            </div>
+            <div class="footer">
+                <span>单位盖章: </span>
+                <span style="float: right;margin-right: 30px;">开票人: </span>
+            </div>
+        </div>
+    </div>
+</body>
+<script>
+    // 获取当前时间
+    (function name(params) {
+        let time = new Date()
+        let y = time.getFullYear()
+        let m = time.getMonth()
+        let d = time.getDate()
+        let notTime = y + '/' + m + '/' + d
+        document.querySelector('.time').innerText = notTime
+    })()
+</script>
+
+</html>

+ 7 - 0
public/html/index3.html

@@ -0,0 +1,7 @@
+<pre class='xdebug-var-dump' dir='ltr'>
+    <small>/web/www/hu-mvc/daswork/main/Response.php:65:</small><small>string</small> <font color='#cc0000'>'\daswork\response\Json'</font> <i>(length=22)</i>
+    </pre><pre class='xdebug-var-dump' dir='ltr'>
+    <small>/web/www/hu-mvc/daswork/main/Response.php:292:</small>
+    <b>array</b> <i>(size=1)</i>
+      0 <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'aaaatest--dasdsd'</font> <i>(length=16)</i>
+    </pre>

+ 25 - 0
public/index.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | Daswork simple php formwork
+// +----------------------------------------------------------------------
+// | Copyright (c) none
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Time:  2017-10-31 14:36
+// +----------------------------------------------------------------------
+// | Author: huwhois <huwhois@163.com>
+// +----------------------------------------------------------------------
+if (version_compare(PHP_VERSION, '5.3.0', '<')) {
+    die('require PHP > 5.3.0 !');
+}
+    
+
+// error_reporting(E_ALL || ~E_NOTICE);
+error_reporting(E_ALL);
+ini_set('max_execution_time', 0);
+// error_reporting(0);
+
+define("APP_PATH", __DIR__ . '/../application');
+define("DB", __DIR__ . '/../db');
+require(__DIR__.'/../daswork/start.php');

+ 2 - 0
public/info.php

@@ -0,0 +1,2 @@
+<?php
+phpinfo();

+ 161 - 0
public/socketservice.php

@@ -0,0 +1,161 @@
+<?php
+
+/**
+ * Created by xwx
+ * Date: 2017/10/18
+ * Time: 14:33
+ */
+
+class SocketService
+{
+    private $address = '0.0.0.0';
+    private $port = 8083;
+    private $_sockets;
+    public function __construct($address = '', $port = '')
+    {
+        if (!empty($address)) {
+            $this->address = $address;
+        }
+        if (!empty($port)) {
+            $this->port = $port;
+        }
+    }
+
+    public function service()
+    {
+        //获取tcp协议号码。
+        $tcp = getprotobyname("tcp");
+        $sock = socket_create(AF_INET, SOCK_STREAM, $tcp);
+        socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1);
+        if ($sock < 0) {
+            throw new Exception("failed to create socket: " . socket_strerror($sock) . "\n");
+        }
+        socket_bind($sock, $this->address, $this->port);
+        socket_listen($sock, $this->port);
+        echo "listen on $this->address $this->port ... \n";
+        $this->_sockets = $sock;
+    }
+
+    public function run()
+    {
+        $this->service();
+        $clients[] = $this->_sockets;
+        while (true) {
+            $changes = $clients;
+            $write = NULL;
+            $except = NULL;
+            socket_select($changes, $write, $except, NULL);
+            foreach ($changes as $key => $_sock) {
+                if ($this->_sockets == $_sock) { //判断是不是新接入的socket
+                    if (($newClient = socket_accept($_sock)) === false) {
+                        die('failed to accept socket: ' . socket_strerror($_sock) . "\n");
+                    }
+                    $line = trim(socket_read($newClient, 1024));
+                    $this->handshaking($newClient, $line);
+                    //获取client ip
+                    socket_getpeername($newClient, $ip);
+                    $clients[$ip] = $newClient;
+                    echo "Client ip:{$ip}  \n";
+                    echo "Client msg:{$line} \n";
+                } else {
+                    socket_recv($_sock, $buffer, 2048, 0);
+                    $msg = $this->message($buffer);
+                    //在这里业务代码
+                    echo "{$key} clinet msg:", $msg, "\n";
+                    fwrite(STDOUT, 'Please input a argument:');
+                    $response = trim(fgets(STDIN));
+                    $this->send($_sock, $response);
+                    echo "{$key} response to Client:" . $response, "\n";
+                }
+            }
+        }
+    }
+
+    /**
+     * 握手处理
+     * @param $newClient socket
+     * @return int 接收到的信息
+     */
+    public function handshaking($newClient, $line)
+    {
+
+        $headers = array();
+        $lines = preg_split("/\r\n/", $line);
+        foreach ($lines as $line) {
+            $line = chop($line);
+            if (preg_match('/\A(\S+): (.*)\z/', $line, $matches)) {
+                $headers[$matches[1]] = $matches[2];
+            }
+        }
+        $secKey = $headers['Sec-WebSocket-Key'];
+        $secAccept = base64_encode(pack('H*', sha1($secKey . '258EAFA5-E914-47DA-95CA-C5AB0DC85B11')));
+        $upgrade = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n" .
+            "Upgrade: websocket\r\n" .
+            "Connection: Upgrade\r\n" .
+            "WebSocket-Origin: $this->address\r\n" .
+            "WebSocket-Location: ws://$this->address:$this->port/websocket/websocket\r\n" .
+            "Sec-WebSocket-Accept:$secAccept\r\n\r\n";
+        return socket_write($newClient, $upgrade, strlen($upgrade));
+    }
+
+    /**
+     * 解析接收数据
+     * @param $buffer
+     * @return null|string
+     */
+    public function message($buffer)
+    {
+        $len = $masks = $data = $decoded = null;
+        $len = ord($buffer[1]) & 127;
+        if ($len === 126) {
+            $masks = substr($buffer, 4, 4);
+            $data = substr($buffer, 8);
+        } else if ($len === 127) {
+            $masks = substr($buffer, 10, 4);
+            $data = substr($buffer, 14);
+        } else {
+            $masks = substr($buffer, 2, 4);
+            $data = substr($buffer, 6);
+        }
+        for ($index = 0; $index < strlen($data); $index++) {
+            $decoded .= $data[$index] ^ $masks[$index % 4];
+        }
+        return $decoded;
+    }
+
+    /**
+     * 发送数据
+     * @param $newClinet 新接入的socket
+     * @param $msg  要发送的数据
+     * @return int|string
+     */
+    public function send($newClinet, $msg)
+    {
+        $msg = $this->frame($msg);
+        socket_write($newClinet, $msg, strlen($msg));
+    }
+
+    public function frame($s)
+    {
+        $a = str_split($s, 125);
+        if (count($a) == 1) {
+            return "\x81" . chr(strlen($a[0])) . $a[0];
+        }
+        $ns = "";
+        foreach ($a as $o) {
+            $ns .= "\x81" . chr(strlen($o)) . $o;
+        }
+        return $ns;
+    }
+
+    /**
+     * 关闭socket
+     */
+    public function close()
+    {
+        return socket_close($this->_sockets);
+    }
+}
+
+$sock = new SocketService('0.0.0.0', '9003');
+$sock->run();

+ 229 - 0
public/static/css/admin-base.css

@@ -0,0 +1,229 @@
+@charset "utf-8";
+/* CSS Document */
+@charset "utf-8";
+
+/*!
+ * @名称:base.css
+ * @功能:1、重设浏览器默认样式
+ *       2、设置通用原子类
+ */
+/* 防止用户自定义背景颜色对网页的影响,添加让用户可以自定义字体 */
+html {
+  background: white;
+  color: black;
+}
+
+/* 内外边距通常让各个浏览器样式的表现位置不同 */
+body,
+div,
+dl,
+dt,
+dd,
+ul,
+ol,
+li,
+h1,
+h2,
+h3,
+h4,
+h5,
+h6,
+pre,
+code,
+form,
+fieldset,
+legend,
+input,
+textarea,
+p,
+blockquote,
+th,
+td,
+hr,
+button,
+article,
+aside,
+details,
+figcaption,
+figure,
+footer,
+header,
+hgroup,
+menu,
+nav,
+section {
+  margin: 0;
+  padding: 0;
+}
+
+/* 要注意表单元素并不继承父级 font 的问题 */
+body,
+button,
+input,
+select,
+textarea {
+  font: 12px \5b8b\4f53, arial, sans-serif;
+}
+
+input,
+select,
+textarea {
+  font-size: 100%;
+}
+
+/* 去掉 table cell 的边距并让其边重合 */
+table {
+  border-collapse: collapse;
+  border-spacing: 0;
+}
+
+/* ie bug:th 不继承 text-align */
+th {
+  text-align: inherit;
+}
+
+/* 去除默认边框 */
+fieldset,
+img {
+  border: none;
+}
+
+/* ie6 7 8(q) bug 显示为行内表现 */
+iframe {
+  display: block;
+}
+
+/* 去掉 firefox 下此元素的边框 */
+abbr,
+acronym {
+  border: none;
+  font-variant: normal;
+}
+
+/* 一致的 del 样式 */
+del {
+  text-decoration: line-through;
+}
+
+address,
+caption,
+cite,
+code,
+dfn,
+em,
+th,
+var {
+  font-style: normal;
+  font-weight: 500;
+}
+
+/* 去掉列表前的标识,li 会继承 */
+ol,
+ul {
+  list-style: none;
+}
+
+/* 对齐是排版最重要的因素,别让什么都居中 */
+caption,
+th {
+  text-align: left;
+}
+
+/* 来自yahoo,让标题都自定义,适应多个系统应用 */
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+  font-size: 100%;
+  font-weight: 500;
+}
+
+q:before,
+q:after {
+  content: '';
+}
+
+/* 统一上标和下标 */
+sub,
+sup {
+  font-size: 75%;
+  line-height: 0;
+  position: relative;
+  vertical-align: baseline;
+}
+
+sup {
+  top: -0.5em;
+}
+
+sub {
+  bottom: -0.25em;
+}
+
+/* 让链接在 hover 状态下显示下划线 */
+a:hover {
+  text-decoration: underline;
+}
+
+/* 默认不显示下划线,保持页面简洁 */
+ins,
+a {
+  text-decoration: none;
+}
+
+/* 去除 ie6 & ie7 焦点点状线 */
+a:focus,
+*:focus {
+  outline: none;
+}
+
+/* 清除浮动 */
+.clearfix:before,
+.clearfix:after {
+  content: "";
+  display: table;
+}
+
+.clearfix:after {
+  clear: both;
+  overflow: hidden;
+}
+
+.clearfix {
+  zoom: 1;
+  /* for ie6 & ie7 */
+}
+
+.clear {
+  clear: both;
+  display: block;
+  font-size: 0;
+  height: 0;
+  line-height: 0;
+  overflow: hidden;
+}
+
+/* 设置显示和隐藏,通常用来与 js 配合 */
+.hide {
+  display: none;
+}
+
+.block {
+  display: block;
+}
+
+/* 设置浮动,减少浮动带来的 bug */
+.fl,
+.fr {
+  display: inline;
+}
+
+.fl {
+  float: left;
+}
+
+.fr {
+  float: right;
+}

+ 54 - 0
public/static/css/admin-index.css

@@ -0,0 +1,54 @@
+.wrap {
+  width: 1300px;
+  /* margin: 0 auto; */
+  margin-left: 20px;
+}
+.header {
+  line-height: 60px;
+  box-sizing: border-box;
+}
+.header span {
+  margin-right: 40px;
+  color: black;
+  font-size: 20px;
+}
+.aside {
+  width: 150px;
+  margin-top: 50px;
+  float: left;
+}
+.aside div{
+  margin-top:30px;
+}
+.time {
+  line-height: 50px;
+}
+.content {
+  width: 1060px;
+  /* height: 300px; */
+  margin-top: 30px;
+  float: left;
+}
+.content a {
+  display: inline-block;
+  width: 100%;
+  line-height: 60px;
+}
+.footer {
+  height: 300px;
+}
+.footer .col-md {
+  text-align: center ;
+}
+.text_center {
+  text-align: center;
+}
+.content_nav {
+  height: 100%;
+}
+.table > tbody > tr > th {
+  line-height: 30px;
+}
+.modal-content {
+  width: 800px;
+}

+ 29 - 0
public/static/css/admin-info.css

@@ -0,0 +1,29 @@
+/* style.css */
+body {font-size: 9pt;}
+a {text-decoration: none; color: #002280;}
+a:hover {text-decoration: underline;}
+.text-l {text-align: left;}
+.text-c {text-align: center;}
+.text-r {text-align: right;}
+.bold {font-weight: bold}
+/* table 样式 */
+table {font: 9pt Tahoma, Verdana; color: #000000; width: 1020px; border: 0px; text-align: center;margin: 0 auto;}
+.tableborder {background: #C9F1FF; border: 1px solid #4FB4DE;border-collapse: collapse;}
+.table_content {background: #FFF; font-size: 12pt;}
+.table_content .header_tr {height: 25px; background-color: #4FB4DE; color: #FFFFFF; font-weight: bold;}
+.table_content td {border: 1px solid #C9F1FF;}
+.table_content tr.list_tr{height: 42px;}
+.table_content tr.list_tr:hover{background: #C3EFFF;}
+.table_content .header_tr_xq {height: 25px; background-color: #C3EFFF; font-weight: bold;}
+/* .tableborder td {
+     border: 1px solid #4FB4DE;
+} */
+input,select,textarea {font: 9pt Tahoma, Verdana;font-weight: normal;}
+/*菜单按扭样式*/
+.emenubutton input{font-weight: bold; font-size: 1.2em; color: #ffffff; font-family: Verdana, Tahoma; background: #86C31F; text-align: center;vertical-align: middle;}
+/*分页样式*/
+.epages {margin: 3px 0; font: 12px;}
+.epages * {vertical-align: middle;}
+.epages a {padding: 1px 4px 1px; border: 1px solid #A6CBE7; margin: 0 1px 0 0; text-align: center; text-decoration: none; font: normal 12px/14px verdana;}
+.epages a:hover {border: #659B28 1px solid;background: #f3f8ef;text-decoration: none;color: #004c7d}
+.epages input {margin-bottom: 0px; border: 1px solid #659B28; height: 15px; font: bold 12px/15px Verdana; padding-bottom: 1px; padding-left: 1px; margin-right: 1px; color: #659B28;}

+ 70 - 0
public/static/css/base.css

@@ -0,0 +1,70 @@
+.center-con {
+  padding: 0 20px 10px;
+  margin: auto;
+}
+
+.page-header,
+fieldset {
+  text-align: left;
+}
+
+h2 {
+  text-align: center
+}
+
+.form-btn {
+  padding: 8px 40px;
+  margin: auto;
+  margin-top: 20px;
+  margin-right: 10px;
+  display: inline-block;
+}
+
+.require-star {
+  color: red;
+  margin-right: 8px;
+}
+
+
+.fz-16 {
+  font-size: 16px;
+}
+
+.blue {
+  color: #fff;
+}
+
+.margin-bottom-20 {
+  margin-bottom: 20px;
+}
+
+.center {
+  text-align: center
+}
+
+.fz-20 {
+  font-size: 18px;
+  font-weight: 700;
+}
+
+.padding-10 {
+  padding: 10px 0px;
+}
+
+.col-lg-5 {
+  text-align: left
+}
+
+input::-webkit-search-cancel-button {
+  display: none;
+}
+
+body,
+html {
+  /* background: url('../img/20200527135329.jpg') no-repeat; */
+  /* background-image: linear-gradient(to bottom, #6699CC, #99CCFF); */
+  background-color: #135394;
+  background-size: 100% 100%;
+  background-position: top right;
+  color: #eee;
+}

File diff suppressed because it is too large
+ 5 - 0
public/static/css/bootstrap-select.min.css


File diff suppressed because it is too large
+ 4 - 0
public/static/css/bootstrap.min.css


+ 34 - 0
public/static/css/bootstrapValidator.css

@@ -0,0 +1,34 @@
+/*!
+ * BootstrapValidator (http://bootstrapvalidator.com)
+ * The best jQuery plugin to validate form fields. Designed to use with Bootstrap 3
+ *
+ * @version     v0.5.2, built on 2014-09-25 4:01:07 PM
+ * @author      https://twitter.com/nghuuphuoc
+ * @copyright   (c) 2013 - 2014 Nguyen Huu Phuoc
+ * @license     MIT
+ */
+
+.bv-form .help-block {
+    margin-bottom: 0
+}
+
+.bv-form .tooltip-inner {
+    text-align: left
+}
+
+.nav-tabs li.bv-tab-success>a {
+    color: #3c763d
+}
+
+.nav-tabs li.bv-tab-error>a {
+    color: #a94442
+}
+
+.bv-form .bv-icon-no-label {
+    top: 0
+}
+
+.bv-form .bv-icon-input-group {
+    top: 0;
+    z-index: 100
+}

+ 37 - 0
public/static/css/index.css

@@ -0,0 +1,37 @@
+.rel {
+  position: relative;
+}
+
+.rel h3 {
+  position: absolute;
+  top: 50%;
+  left: 50%;
+  padding: 20px;
+  transform: translate(-50%, -44%);
+  /* background-color: #fff; */
+  z-index: 200;
+  zoom: 1;
+}
+
+fieldset {
+  padding-top: 50px;
+  position: relative;
+  border: 2px solid #DAA569;
+  border-radius: 10px;
+  /* background-color: #fff; */
+
+}
+
+fieldset .line {
+  width: 500px;
+  text-align: left;
+  background-color: #ccc;
+}
+
+fieldset label {
+  text-align: left;
+}
+
+.yellow {
+  color: #f7b16b;
+}

BIN
public/static/img/a6xul-o8xd3-001.ico


BIN
public/static/img/a7ihm-zdunv-001.ico


BIN
public/static/img/ae5ni-6w62l-001.ico


BIN
public/static/img/logo.jpg


File diff suppressed because it is too large
+ 7 - 0
public/static/js/bootstrap-select.min.js


File diff suppressed because it is too large
+ 5 - 0
public/static/js/bootstrap.min.js


File diff suppressed because it is too large
+ 9 - 0
public/static/js/bootstrapValidator.min.js


+ 52 - 0
public/static/js/init.js

@@ -0,0 +1,52 @@
+//显示
+function init() {
+    if (!window.localStorage) {
+        console.log('浏览器不支持localStorage, 请更换浏览器');
+        $('#loading').modal('show');
+        $("#resultLoading").html("初始化失败, 请更换浏览器(如Edge, Chrome)");
+    } else {
+        // console.log(window.sessionStorage.getItem("loading"));
+        if (window.sessionStorage.getItem("loading") == null || window.localStorage.getItem("salesData") == null) {
+            $('#loading').modal('show');
+            storageSalesData();
+        }
+    }
+}
+
+/**
+ * 获取销售数据表里的数据并存入浏览器不支持localStorage
+ */
+function storageSalesData(refresh = false) {
+    console.log(refresh);
+    $.ajax({
+        url: "/index/index/sales_data",
+        // async: false, //改为同步方式
+        type: "post",
+        data: {},
+        dataType: 'json',
+        success: function (res) {
+            if (res.code == 0) {
+                window.sessionStorage.setItem('loading',  1);
+                window.localStorage.setItem('salesData',  JSON.stringify(res.data));
+                console.log(refresh);
+                if (refresh) {
+                    alert('数据刷新成功');
+                } else {
+                    setTimeout(function(){ $('#loading').modal('hide'); }, 1000);
+                }
+            }  else {
+                console.log('销售数据获取失败');
+                $("#resultLoading").html("初始化失败, 请稍后重试");
+            }
+        },
+        error: function (res) {
+            console.log('数据请求失败');
+            $("#resultLoading").html("初始化失败, 请稍后重试");
+        }
+    });
+}
+
+// 隐藏
+// function close() {
+    // setTimeout(function(){ $('#loading').modal('hide'); }, 1000);
+// }

File diff suppressed because it is too large
+ 1 - 0
public/static/js/jquery.min.js


+ 59 - 0
public/static/js/myfun.js

@@ -0,0 +1,59 @@
+function isEmpty(str) {
+    if(typeof str== null || str== "" || str== "undefined") {
+        return true;
+    } else {
+        return false;
+    }
+}
+
+/**
+ * 遍历数组查找指定值
+ * @param {*} arr 查找数组
+ * @param {*} str 查找值
+ */
+
+function searchString(arr, str) {
+    var res = new Array()
+    if (Array.isArray(arr)) {
+        if (str) {
+            arr.forEach(e => {
+                if (e.search(str) != -1) {
+                    res.push(e);
+                }
+            });
+        } else {
+            res = arr;
+        }
+    }
+    return res;
+}
+
+// var arr = ["张三", "李四", "王麻子", "麻张子"]
+// var str = "张"
+
+// console.log(searchString(arr, str));
+
+/**
+ * 去掉字符串两端指定字符串
+ */
+function bstrim(str, opt) {
+    var pos = str.indexOf(opt);
+    str = str.substr(pos+1);
+    pos = str.lastIndexOf(opt);
+    str = str.substr(0,pos);
+    return str;
+}
+
+function ltrim(str,char){
+    var pos = str.indexOf(char);
+    var sonstr = str.substr(pos+1);
+    return sonstr;
+}
+    
+function rtrim(str,char){
+    var pos = str.lastIndexOf(char);
+    
+    var sonstr = str.substr(0,pos);
+    
+    return sonstr;
+}

File diff suppressed because it is too large
+ 0 - 0
public/static/js/qrcode.min.js


+ 5 - 0
start.bat

@@ -0,0 +1,5 @@
+@echo off
+rem �ṩWindows php �����ı�servic���������� (��ͨ�����ߴ��Ϊexe�ļ�)
+
+cd ./public
+php -S 0.0.0.0:9002 ../daswork/service.php

+ 3 - 0
start.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+cd ./public
+php -S localhost:8000 ../daswork/service.php

+ 2 - 0
vendor/.gitignore

@@ -0,0 +1,2 @@
+/phpoffice
+/phpqrcode

Some files were not shown because too many files changed in this diff