Deal.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace app\bug\model;
  3. class Deal extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'int',//
  8. 'bugNo' =>'varchar',//编号
  9. 'deal_name' =>'varchar',//处理人
  10. 'deal_id' =>'int',//处理人id
  11. 'action_name' =>'varchar',//操作人
  12. 'action_id' =>'int',//操作人id
  13. 'level' =>'int',//优先级
  14. 'type' =>'varchar',//问题类型
  15. 'status' =>'int',//处理状态
  16. 'is_del' =>'int',//是否删除
  17. 'addtime' =>'datetime',//
  18. 'updatetime' =>'datetime',//
  19. ];
  20. protected $updateTime='updatetime';
  21. protected $createTime='addtime';
  22. public static function onAfterWrite($model){
  23. $dealLog = new noteLog();
  24. $origin = $model->getOrigin();
  25. $add=$model->getChangedData();
  26. if(empty($add)){
  27. $dealLog->save([
  28. 'bugNo' =>$model->bugNo,//编号
  29. 'type' =>2,//操作类型
  30. 'action_uid' =>$model->action_id,//操作人id
  31. 'action_name' =>$model->action_name,//操作人名称
  32. 'handle_name' =>"deal_name",//操作字段
  33. 'action_item' =>"",//操作前值
  34. 'action_after' =>$origin['deal_name'],
  35. ]);
  36. }else{
  37. if(isset($add['deal_name'])){
  38. $dealLog->save(
  39. [
  40. 'bugNo' =>$model->bugNo,//编号
  41. 'type' =>2,//操作类型
  42. 'action_uid' =>$model->action_id,//操作人id
  43. 'action_name' =>$model->action_name,//操作人名称
  44. 'handle_name' =>'deal_name',//操作字段
  45. 'action_item' =>$origin['deal_name'],//操作前值
  46. 'action_after' =>$add['deal_name'],
  47. ]);
  48. }
  49. }
  50. }
  51. }