123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class ChangeLog extends Model
- {
- //记录商品、咨询单的修改记录
- static function logAdd($type,$code,$before_info,$after_info,$token,$post){
- if (is_array($token)) {
- $createrid = $token['id'];
- $creater = $token['nickname'];
- } else {
- $user = GetUserInfo($token);
- $createrid = isset($user['data']['id']) ? $user['data']['id'] : 0;
- $creater = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
- }
- unset($post['token']);
- // $item= array_diff($before_info,$after_info);
- // $json = json_encode($after_info,JSON_UNESCAPED_UNICODE);
- // $jsp = json_encode($before_info,JSON_UNESCAPED_UNICODE);
- $data=[
- "createrid"=>$createrid,
- "creater"=>$creater,
- "before_info"=>$before_info,
- "after_info"=>$after_info,
- "code"=>$code,
- "type"=>$type,
- // "action_data"=>json_encode($post),
- "addtime"=>date("Y-m-d H:i:s"),
- // "updatetime"=>date("Y-m-d H:i:s")
- ];
- // var_dump($data);
- self::insert($data);
- }
- }
|