作者 开飞机的舒克

后台修改

@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace app\admin\controller; 3 namespace app\admin\controller;
4 4
5 use app\common\controller\Backend; 5 use app\common\controller\Backend;
  6 +use app\common\controller\Resource;
6 7
7 /** 8 /**
8 * 学生管理 9 * 学生管理
@@ -69,6 +70,21 @@ class Study extends Backend @@ -69,6 +70,21 @@ class Study extends Backend
69 return $this->view->fetch(); 70 return $this->view->fetch();
70 } 71 }
71 72
  73 + /**
  74 + * 生成现场二维码
  75 + */
  76 + public function barcode($ids)
  77 + {
  78 + $barcode = $this->model->where('id', $ids)->value('barcode');
  79 + if (!empty($barcode)) {
  80 + $this->error('已生成二维码,无需重复生成');
  81 + }
  82 + $brpath = Resource::StudyBar($ids);
  83 + $this->model->save(['qrcode' => $brpath], ['id' => $ids]);
  84 + $this->success('操作成功');
  85 + }
  86 +
  87 +
72 //导出数据 88 //导出数据
73 public function export() 89 public function export()
74 { 90 {
  1 +<?php
  2 +
  3 +namespace app\common\controller;
  4 +
  5 +use tinymeng\code\Generate;
  6 +
  7 +class Resource
  8 +{
  9 + /**
  10 + *
  11 + */
  12 + public static function StudyBar($id){
  13 + $generate = Generate::bar();
  14 + /** 二维码存入本地并输出存储路径 */
  15 + $file_path = $generate->create($id,true);
  16 + $file_path = substr($file_path,strripos($file_path,"public")+6);
  17 + return $file_path;
  18 + }
  19 +}
@@ -31,8 +31,8 @@ @@ -31,8 +31,8 @@
31 "ext-pdo": "*", 31 "ext-pdo": "*",
32 "ext-bcmath": "*", 32 "ext-bcmath": "*",
33 "txthinking/mailer": "^2.0", 33 "txthinking/mailer": "^2.0",
34 - "chenbool/barcode": "^1.0",  
35 - "phpoffice/phpexcel": "^1.8" 34 + "phpoffice/phpexcel": "^1.8",
  35 + "tinymeng/code": "^2.0"
36 }, 36 },
37 "config": { 37 "config": {
38 "preferred-install": "dist", 38 "preferred-install": "dist",
@@ -99,7 +99,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin @@ -99,7 +99,25 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
99 {field: 'barcode', title: __('Barcode'), operate:false}, 99 {field: 'barcode', title: __('Barcode'), operate:false},
100 // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, 100 // {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
101 // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, 101 // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
102 - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} 102 + {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate,
  103 + buttons: [
  104 + {
  105 + name: 'qrcode',
  106 + title: __('生成条形码'),
  107 + classname: 'btn btn-xs btn-primary btn-ajax',
  108 + icon: 'fa fa-qrcode',
  109 + url: 'study/barcode',
  110 + confirm: '确认生成新的条形码吗',
  111 + success: function (data, ret) {
  112 + return data;
  113 + },
  114 + error: function (data, ret) {
  115 + Toastr.error(ret.msg);
  116 + return false;
  117 + }
  118 + }
  119 + ],
  120 + formatter: Table.api.formatter.operate}
103 ] 121 ]
104 ] 122 ]
105 }); 123 });
@@ -6,11 +6,12 @@ $vendorDir = dirname(__DIR__); @@ -6,11 +6,12 @@ $vendorDir = dirname(__DIR__);
6 $baseDir = dirname($vendorDir); 6 $baseDir = dirname($vendorDir);
7 7
8 return array( 8 return array(
  9 + 'tinymeng\\tools\\' => array($vendorDir . '/tinymeng/tools/src'),
  10 + 'tinymeng\\code\\' => array($vendorDir . '/tinymeng/code/src'),
9 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'), 11 'think\\helper\\' => array($vendorDir . '/topthink/think-helper/src'),
10 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'), 12 'think\\composer\\' => array($vendorDir . '/topthink/think-installer/src'),
11 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'), 13 'think\\captcha\\' => array($vendorDir . '/topthink/think-captcha/src'),
12 'think\\' => array($vendorDir . '/karsonzhang/fastadmin-addons/src', $baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'), 14 'think\\' => array($vendorDir . '/karsonzhang/fastadmin-addons/src', $baseDir . '/thinkphp/library/think', $vendorDir . '/topthink/think-queue/src'),
13 - 'chenbool\\' => array($vendorDir . '/chenbool/barcode/src'),  
14 'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'), 15 'ZipStream\\' => array($vendorDir . '/maennchen/zipstream-php/src'),
15 'Tx\\' => array($vendorDir . '/txthinking/mailer/src'), 16 'Tx\\' => array($vendorDir . '/txthinking/mailer/src'),
16 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'), 17 'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
@@ -26,15 +26,13 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65 @@ -26,15 +26,13 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
26 public static $prefixLengthsPsr4 = array ( 26 public static $prefixLengthsPsr4 = array (
27 't' => 27 't' =>
28 array ( 28 array (
  29 + 'tinymeng\\tools\\' => 15,
  30 + 'tinymeng\\code\\' => 14,
29 'think\\helper\\' => 13, 31 'think\\helper\\' => 13,
30 'think\\composer\\' => 15, 32 'think\\composer\\' => 15,
31 'think\\captcha\\' => 14, 33 'think\\captcha\\' => 14,
32 'think\\' => 6, 34 'think\\' => 6,
33 ), 35 ),
34 - 'c' =>  
35 - array (  
36 - 'chenbool\\' => 9,  
37 - ),  
38 'Z' => 36 'Z' =>
39 array ( 37 array (
40 'ZipStream\\' => 10, 38 'ZipStream\\' => 10,
@@ -99,6 +97,14 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65 @@ -99,6 +97,14 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
99 ); 97 );
100 98
101 public static $prefixDirsPsr4 = array ( 99 public static $prefixDirsPsr4 = array (
  100 + 'tinymeng\\tools\\' =>
  101 + array (
  102 + 0 => __DIR__ . '/..' . '/tinymeng/tools/src',
  103 + ),
  104 + 'tinymeng\\code\\' =>
  105 + array (
  106 + 0 => __DIR__ . '/..' . '/tinymeng/code/src',
  107 + ),
102 'think\\helper\\' => 108 'think\\helper\\' =>
103 array ( 109 array (
104 0 => __DIR__ . '/..' . '/topthink/think-helper/src', 110 0 => __DIR__ . '/..' . '/topthink/think-helper/src',
@@ -117,10 +123,6 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65 @@ -117,10 +123,6 @@ class ComposerStaticInit73f9e72fede2c36621e52f7b610bbb65
117 1 => __DIR__ . '/../..' . '/thinkphp/library/think', 123 1 => __DIR__ . '/../..' . '/thinkphp/library/think',
118 2 => __DIR__ . '/..' . '/topthink/think-queue/src', 124 2 => __DIR__ . '/..' . '/topthink/think-queue/src',
119 ), 125 ),
120 - 'chenbool\\' =>  
121 - array (  
122 - 0 => __DIR__ . '/..' . '/chenbool/barcode/src',  
123 - ),  
124 'ZipStream\\' => 126 'ZipStream\\' =>
125 array ( 127 array (
126 0 => __DIR__ . '/..' . '/maennchen/zipstream-php/src', 128 0 => __DIR__ . '/..' . '/maennchen/zipstream-php/src',
1 { 1 {
2 "packages": [ 2 "packages": [
3 { 3 {
4 - "name": "chenbool/barcode",  
5 - "version": "1.0.0",  
6 - "version_normalized": "1.0.0.0",  
7 - "source": {  
8 - "type": "git",  
9 - "url": "https://github.com/chenbool/barcode.git",  
10 - "reference": "4c1b8264527e8e53bfb059696d60c4e31fd63e24"  
11 - },  
12 - "dist": {  
13 - "type": "zip",  
14 - "url": "https://api.github.com/repos/chenbool/barcode/zipball/4c1b8264527e8e53bfb059696d60c4e31fd63e24",  
15 - "reference": "4c1b8264527e8e53bfb059696d60c4e31fd63e24",  
16 - "shasum": ""  
17 - },  
18 - "require": {  
19 - "php": ">=5.3.0"  
20 - },  
21 - "time": "2019-07-31T09:34:38+00:00",  
22 - "type": "library",  
23 - "installation-source": "dist",  
24 - "autoload": {  
25 - "psr-4": {  
26 - "chenbool\\": "src"  
27 - }  
28 - },  
29 - "notification-url": "https://packagist.org/downloads/",  
30 - "license": [  
31 - "MIT"  
32 - ],  
33 - "authors": [  
34 - {  
35 - "name": "chenbool",  
36 - "email": "30024167@qq.com",  
37 - "homepage": "https://github.com/chenbool"  
38 - }  
39 - ],  
40 - "description": "一个简单的条形码生成插件",  
41 - "homepage": "https://github.com/chenbool",  
42 - "keywords": [  
43 - "qrcode",  
44 - "二维码"  
45 - ],  
46 - "support": {  
47 - "issues": "https://github.com/chenbool/barcode/issues",  
48 - "source": "https://github.com/chenbool/barcode/tree/1.0.0"  
49 - },  
50 - "install-path": "../chenbool/barcode"  
51 - },  
52 - {  
53 "name": "easywechat-composer/easywechat-composer", 4 "name": "easywechat-composer/easywechat-composer",
54 "version": "1.4.1", 5 "version": "1.4.1",
55 "version_normalized": "1.4.1.0", 6 "version_normalized": "1.4.1.0",
@@ -3014,6 +2965,107 @@ @@ -3014,6 +2965,107 @@
3014 "install-path": "../symfony/var-exporter" 2965 "install-path": "../symfony/var-exporter"
3015 }, 2966 },
3016 { 2967 {
  2968 + "name": "tinymeng/code",
  2969 + "version": "v2.0.1",
  2970 + "version_normalized": "2.0.1.0",
  2971 + "source": {
  2972 + "type": "git",
  2973 + "url": "https://github.com/majiameng/phpQrCode.git",
  2974 + "reference": "a5a6ba189f18a8e1f826dfa4994e26da5714d8ad"
  2975 + },
  2976 + "dist": {
  2977 + "type": "zip",
  2978 + "url": "https://api.github.com/repos/majiameng/phpQrCode/zipball/a5a6ba189f18a8e1f826dfa4994e26da5714d8ad",
  2979 + "reference": "a5a6ba189f18a8e1f826dfa4994e26da5714d8ad",
  2980 + "shasum": ""
  2981 + },
  2982 + "require": {
  2983 + "php": ">=5.4.0",
  2984 + "tinymeng/tools": "^1.0.7"
  2985 + },
  2986 + "time": "2020-03-28T10:11:51+00:00",
  2987 + "type": "library",
  2988 + "installation-source": "dist",
  2989 + "autoload": {
  2990 + "psr-4": {
  2991 + "tinymeng\\code\\": "src"
  2992 + }
  2993 + },
  2994 + "notification-url": "https://packagist.org/downloads/",
  2995 + "license": [
  2996 + "MIT"
  2997 + ],
  2998 + "authors": [
  2999 + {
  3000 + "name": "TinyMeng",
  3001 + "email": "666@majiameng.com",
  3002 + "homepage": "https://majiameng.com"
  3003 + }
  3004 + ],
  3005 + "description": "php生成条形码或者二维码QRcode",
  3006 + "keywords": [
  3007 + "code",
  3008 + "qrcode",
  3009 + "tinymeng"
  3010 + ],
  3011 + "support": {
  3012 + "issues": "https://github.com/majiameng/phpQrCode/issues",
  3013 + "source": "https://github.com/majiameng/phpQrCode/tree/v2.0.1"
  3014 + },
  3015 + "install-path": "../tinymeng/code"
  3016 + },
  3017 + {
  3018 + "name": "tinymeng/tools",
  3019 + "version": "v1.2.4",
  3020 + "version_normalized": "1.2.4.0",
  3021 + "source": {
  3022 + "type": "git",
  3023 + "url": "https://github.com/majiameng/tools.git",
  3024 + "reference": "a16c4b550e9fbede32159779a4507cd97133208b"
  3025 + },
  3026 + "dist": {
  3027 + "type": "zip",
  3028 + "url": "https://api.github.com/repos/majiameng/tools/zipball/a16c4b550e9fbede32159779a4507cd97133208b",
  3029 + "reference": "a16c4b550e9fbede32159779a4507cd97133208b",
  3030 + "shasum": ""
  3031 + },
  3032 + "require": {
  3033 + "php": ">=7.0.0"
  3034 + },
  3035 + "time": "2023-02-10T04:56:10+00:00",
  3036 + "type": "library",
  3037 + "installation-source": "dist",
  3038 + "autoload": {
  3039 + "files": [],
  3040 + "psr-4": {
  3041 + "tinymeng\\tools\\": "src"
  3042 + }
  3043 + },
  3044 + "notification-url": "https://packagist.org/downloads/",
  3045 + "license": [
  3046 + "MIT"
  3047 + ],
  3048 + "authors": [
  3049 + {
  3050 + "name": "JiaMeng Ma",
  3051 + "email": "666@majiameng.com",
  3052 + "homepage": "http://majiameng.com"
  3053 + }
  3054 + ],
  3055 + "description": "Integrate third-party logins",
  3056 + "keywords": [
  3057 + "php",
  3058 + "php-tools",
  3059 + "tinymeng",
  3060 + "tools"
  3061 + ],
  3062 + "support": {
  3063 + "issues": "https://github.com/majiameng/tools/issues",
  3064 + "source": "https://github.com/majiameng/tools/tree/v1.2.4"
  3065 + },
  3066 + "install-path": "../tinymeng/tools"
  3067 + },
  3068 + {
3017 "name": "topthink/framework", 3069 "name": "topthink/framework",
3018 "version": "dev-master", 3070 "version": "dev-master",
3019 "version_normalized": "dev-master", 3071 "version_normalized": "dev-master",
@@ -3,22 +3,13 @@ @@ -3,22 +3,13 @@
3 'name' => 'karsonzhang/fastadmin', 3 'name' => 'karsonzhang/fastadmin',
4 'pretty_version' => 'dev-master', 4 'pretty_version' => 'dev-master',
5 'version' => 'dev-master', 5 'version' => 'dev-master',
6 - 'reference' => '9a8361a29c430477d49b4eccbb24941b30610f16', 6 + 'reference' => '0f0ef558f4db0a4fde56b14198cdf8e8431c82ba',
7 'type' => 'project', 7 'type' => 'project',
8 'install_path' => __DIR__ . '/../../', 8 'install_path' => __DIR__ . '/../../',
9 'aliases' => array(), 9 'aliases' => array(),
10 'dev' => true, 10 'dev' => true,
11 ), 11 ),
12 'versions' => array( 12 'versions' => array(
13 - 'chenbool/barcode' => array(  
14 - 'pretty_version' => '1.0.0',  
15 - 'version' => '1.0.0.0',  
16 - 'reference' => '4c1b8264527e8e53bfb059696d60c4e31fd63e24',  
17 - 'type' => 'library',  
18 - 'install_path' => __DIR__ . '/../chenbool/barcode',  
19 - 'aliases' => array(),  
20 - 'dev_requirement' => false,  
21 - ),  
22 'easywechat-composer/easywechat-composer' => array( 13 'easywechat-composer/easywechat-composer' => array(
23 'pretty_version' => '1.4.1', 14 'pretty_version' => '1.4.1',
24 'version' => '1.4.1.0', 15 'version' => '1.4.1.0',
@@ -67,7 +58,7 @@ @@ -67,7 +58,7 @@
67 'karsonzhang/fastadmin' => array( 58 'karsonzhang/fastadmin' => array(
68 'pretty_version' => 'dev-master', 59 'pretty_version' => 'dev-master',
69 'version' => 'dev-master', 60 'version' => 'dev-master',
70 - 'reference' => '9a8361a29c430477d49b4eccbb24941b30610f16', 61 + 'reference' => '0f0ef558f4db0a4fde56b14198cdf8e8431c82ba',
71 'type' => 'project', 62 'type' => 'project',
72 'install_path' => __DIR__ . '/../../', 63 'install_path' => __DIR__ . '/../../',
73 'aliases' => array(), 64 'aliases' => array(),
@@ -451,6 +442,24 @@ @@ -451,6 +442,24 @@
451 'aliases' => array(), 442 'aliases' => array(),
452 'dev_requirement' => false, 443 'dev_requirement' => false,
453 ), 444 ),
  445 + 'tinymeng/code' => array(
  446 + 'pretty_version' => 'v2.0.1',
  447 + 'version' => '2.0.1.0',
  448 + 'reference' => 'a5a6ba189f18a8e1f826dfa4994e26da5714d8ad',
  449 + 'type' => 'library',
  450 + 'install_path' => __DIR__ . '/../tinymeng/code',
  451 + 'aliases' => array(),
  452 + 'dev_requirement' => false,
  453 + ),
  454 + 'tinymeng/tools' => array(
  455 + 'pretty_version' => 'v1.2.4',
  456 + 'version' => '1.2.4.0',
  457 + 'reference' => 'a16c4b550e9fbede32159779a4507cd97133208b',
  458 + 'type' => 'library',
  459 + 'install_path' => __DIR__ . '/../tinymeng/tools',
  460 + 'aliases' => array(),
  461 + 'dev_requirement' => false,
  462 + ),
454 'topthink/framework' => array( 463 'topthink/framework' => array(
455 'pretty_version' => 'dev-master', 464 'pretty_version' => 'dev-master',
456 'version' => 'dev-master', 465 'version' => 'dev-master',