作者 开飞机的舒克

后台功能优化

... ... @@ -3,6 +3,8 @@
namespace app\admin\controller;
use app\common\controller\Backend;
use app\common\controller\Resource;
use think\Db;
/**
* 学生管理
... ... @@ -180,9 +182,9 @@ class Study extends Backend
$result = $this->model->allowField(true)->save($params);
$id = $this->model->id;
$unique = time();
$brpath = Resource::StudyBar($unique);
//$brpath = Resource::StudyBar($unique);
$time = date('YmdHi',time());
$this->model->save(['barcode'=>$brpath,'sno'=>$time,'unique'=>$time],['id'=>$id]);
$this->model->save(['sno'=>$time,'unique'=>time()],['id'=>$id]);
Db::commit();
} catch (ValidateException|PDOException|Exception $e) {
Db::rollback();
... ...
... ... @@ -10,7 +10,6 @@
<a href="javascript:;" class="btn btn-success btn-add {:$auth->check('study/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
<a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('你的权限规则')?'':'hide'}" title="导入" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> 导入</a>
<a href="javascript:;" class="btn btn-success btn-export {:$auth->check('study/export')?'':'hide'}" title="{:__('Export')}" id="btn-export-file"><i class="fa fa-download"></i> {:__('Export')}</a>
<a href="javascript:;" class="btn btn-success btn-download {:$auth->check('study/download')?'':'hide'}" title="{:__('Download')}" id="btn-download-file"><i class="fa fa-download"></i> {:__('Download')}</a>
<div class="dropdown btn-group {:$auth->check('study/multi')?'':'hide'}">
<ul class="dropdown-menu text-left" role="menu">
... ...
... ... @@ -3,7 +3,7 @@
namespace app\api\controller;
use app\common\controller\Api;
use app\common\controller\Resource;
use tinymeng\code\Generate;
/**
* 示例接口
... ... @@ -68,8 +68,7 @@ class Demo extends Api
*/
public function test3()
{
$ids = Resource::StudyBar(1);
return $ids;
$generate = Generate::bar();
}
}
... ...
... ... @@ -7,10 +7,10 @@ use tinymeng\code\Generate;
class Resource
{
public static function StudyBar($unique){
$generate = Generate::qr();
$generate = Generate::bar();
/** 直接输出图片 */
$file_path = $generate->create($unique,true);
$file_path = substr($file_path,strripos($file_path,"public")+6);
return $file_path;
//$generate->create($unique);
//$file_path = substr($file_path,strripos($file_path,"public")+6);
//return $file_path;
}
}
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@ use \tinymeng\tools\Strings;
* @method static \tinymeng\code\Gateways\Qr qr(array $config=[]) 二维码
* @package tinymeng\mailer
*/
define('saveFilePath',dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'barimages'.DIRECTORY_SEPARATOR.date('Ymd').DIRECTORY_SEPARATOR);
//define('saveFilePath',dirname(dirname(dirname(dirname(__DIR__)))).DIRECTORY_SEPARATOR.'public'.DIRECTORY_SEPARATOR.'uploads'.DIRECTORY_SEPARATOR.'barimages'.DIRECTORY_SEPARATOR.date('Ymd').DIRECTORY_SEPARATOR);
class Generate
{
... ...