1234567891011121314151617181920212223242526272829 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\model;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class ReportCode extends Model
- {
- public function setField($filed,$vale){
- $arr= explode(",",$this->$filed);
- if(!in_array($vale,$arr)) $this->$filed == '' ? $this->$filed =$vale : $this->$filed .=",".$vale;
- }
- public function rmField($filed,$vale){
- $arr= explode(",",$this->$filed);
- if(in_array($vale,$arr)){
- $key = array_search($vale,$arr);
- unset($arr[$key]);
- }
- $this->$filed=implode(",",$arr);
- }
- public function __destruct(){
- $this->save();
- }
- }
|