正在显示
2 个修改的文件
包含
34 行增加
和
0 行删除
application/api/controller/Crontab.php
0 → 100644
1 | +<?php | ||
2 | + | ||
3 | +namespace app\api\controller; | ||
4 | + | ||
5 | +use app\api\model\Study; | ||
6 | +use app\common\controller\Api; | ||
7 | +use app\common\controller\Resource; | ||
8 | + | ||
9 | +class Crontab extends Api | ||
10 | +{ | ||
11 | + // 无需登录的接口,*表示全部 | ||
12 | + protected $noNeedLogin = ['*']; | ||
13 | + // 无需鉴权的接口,*表示全部 | ||
14 | + protected $noNeedRight = ['*']; | ||
15 | + | ||
16 | + /** | ||
17 | + * @ApiTitle (定时任务) | ||
18 | + */ | ||
19 | + public function index() | ||
20 | + { | ||
21 | + //查询未生成的条形码 | ||
22 | + $id = db('study')->where('barcode', '')->limit(10)->column('id'); | ||
23 | + foreach ($id as $k => $v){ | ||
24 | + $res = str_pad($v, 8, "0", STR_PAD_LEFT); | ||
25 | + $barpath = Resource::StudyBar($res); | ||
26 | + db('study') | ||
27 | + ->where('id',$v) | ||
28 | + ->update([ | ||
29 | + 'barcode' => $barpath, | ||
30 | + 'unique' => $res | ||
31 | + ]); | ||
32 | + } | ||
33 | + } | ||
34 | +} |
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论