作者 开飞机的舒克

优化定时任务

... ... @@ -294,10 +294,11 @@ class Study extends Backend
public function down()
{
$id = input('id');
$res = \app\admin\model\Study::where('id', $id)->update(['down' => 1]);
if ($res !== false) {
$this->success('');
}
// $res = \app\admin\model\Study::where('id', $id)->update(['down' => 1]);
// if ($res) {
// $this->success('');
// }
}
... ...
... ... @@ -23,7 +23,7 @@ class Crontab extends Api
public function index()
{
//查询未生成的条形码
$id = db('study')->where('barcode', '')->limit(10)->column('id');
$id = db('study')->where('generate', 0)->limit(10)->column('id');
foreach ($id as $k => $v){
$res = str_pad($v, 8, "0", STR_PAD_LEFT);
$barpath = Resource::StudyBar($res);
... ... @@ -31,7 +31,8 @@ class Crontab extends Api
->where('id',$v)
->update([
'barcode' => $barpath,
'unique' => $res
'unique' => $res,
'generate'=>1
]);
}
}
... ...