123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\model;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class NoteLog extends Model
- {
- public static function log($tem,$post,$type){
- $token=$post['token'];
- unset($post['token']);
- $in=$tem['bugNo'];
- unset($tem['bugNo']);
- $post['model_id'] = isset($post['model_id']) ? array_pop($post['model_id']):"";
- $item = array_diff_assoc($tem,$post);
- $user = VerifyTokens($token);
- $uid = isset($user['data']['id']) ? $user['data']['id'] :0;
- $name = isset($user['data']['nickname']) ? $user['data']['nickname'] :'';
- if(!empty($item)){
- $data=[];
- foreach ($item as $key=>$value){
- if(isset($post[$key])==false){
- continue;
- }
- $datai=[];
- $datai['action_uid']=$uid;
- $datai['action_name']=$name;
- $datai['type']=$type;
- // $datai['action_type']=$action_type;
- $datai['handle_name']=$key;
- $datai['action_item']=$value;
- $datai['action_after']=isset($post[$key]) ? $post[$key]:"";
- $datai['bugNo']=$in;
- $datai['addtime']=date("Y-m-d H:i:s");
- $data[]=$datai;
- }
- self::insertAll($data);
- }
- }
- }
|