ChangeLog.php 866 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class ChangeLog extends Model
  5. {
  6. //记录商品、咨询单的修改记录
  7. static function logAdd($type,$code,$before_info,$after_info,$token){
  8. if (is_array($token)) {
  9. $createrid = $token['id'];
  10. $creater = $token['nickname'];
  11. } else {
  12. $user = GetUserInfo($token);
  13. $createrid = isset($user['data']['id']) ? $user['data']['id'] : 0;
  14. $creater = isset($user['data']['nickname']) ? $user['data']['nickname'] : '';
  15. }
  16. $data=[
  17. "createrid"=>$createrid,
  18. "creater"=>$creater,
  19. "before_info"=>$before_info,
  20. "after_info"=>$after_info,
  21. "code"=>$code,
  22. "type"=>$type,
  23. "addtime"=>date("Y-m-d H:i:s"),
  24. ];
  25. self::insert($data);
  26. }
  27. }