作者 开飞机的舒克

后台功能修改

@@ -180,8 +180,10 @@ class Study extends Backend @@ -180,8 +180,10 @@ class Study extends Backend
180 } 180 }
181 $result = $this->model->allowField(true)->save($params); 181 $result = $this->model->allowField(true)->save($params);
182 $id = $this->model->id; 182 $id = $this->model->id;
183 - $brpath = Resource::StudyBar($id);  
184 - $this->model->save(['barcode'=>$brpath],['id'=>$id]); 183 + $unique = time();
  184 + $brpath = Resource::StudyBar($unique);
  185 + $time = date('YmdHi',time());
  186 + $this->model->save(['barcode'=>$brpath],['sno'=>$time],['id'=>$id]);
185 Db::commit(); 187 Db::commit();
186 } catch (ValidateException|PDOException|Exception $e) { 188 } catch (ValidateException|PDOException|Exception $e) {
187 Db::rollback(); 189 Db::rollback();
@@ -6,10 +6,10 @@ use tinymeng\code\Generate; @@ -6,10 +6,10 @@ use tinymeng\code\Generate;
6 6
7 class Resource 7 class Resource
8 { 8 {
9 - public static function StudyBar($id){ 9 + public static function StudyBar($unique){
10 $generate = Generate::qr(); 10 $generate = Generate::qr();
11 /** 直接输出图片 */ 11 /** 直接输出图片 */
12 - $file_path = $generate->create($id,true); 12 + $file_path = $generate->create($unique,true);
13 $file_path = substr($file_path,strripos($file_path,"public")+6); 13 $file_path = substr($file_path,strripos($file_path,"public")+6);
14 return $file_path; 14 return $file_path;
15 } 15 }