OrderMsg.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\model;
  4. use think\facade\Config;
  5. use think\Model;
  6. /**
  7. * @mixin \think\Model
  8. */
  9. class OrderMsg extends Model
  10. {
  11. //每个用户的消息
  12. public static function addmsg($msg){
  13. $conf=Config::get("order");
  14. $order_type = $conf['order_type'];
  15. $order_status = $conf['order_status'][$msg['order_type']];
  16. $content = $order_type[$msg['order_type']].':'.$msg['order_code']."状态由".$msg['action_name']."修改为"
  17. .$order_status[$msg['action_process']];
  18. $mguid =ProcessOrder::Where(["order_type"=>$msg['order_type'],'order_code'=>$msg['order_code']])->column('action_uid,action_name');
  19. if(!empty($mguid)){
  20. $data=[];
  21. foreach ($mguid as $value){
  22. if($value["action_uid"]==$msg['action_uid']){
  23. continue;
  24. }
  25. $temp=[];
  26. $temp['content']=$content;
  27. $temp['orderCode']=$msg['order_code'];
  28. $temp['order_type']=$msg['order_type'];
  29. $temp['order_status']=$msg['order_status'];
  30. $temp['order_id']=$msg['order_id'];
  31. $temp['uid']=$value['action_uid'];//所有人,缺申请人和操作人
  32. $temp['uname']=$value['action_name'];
  33. $temp['is_read']=0;
  34. $temp['addtime']=date("Y-m-d H:i:s");
  35. $temp['updatetime']=date("Y-m-d H:i:s");
  36. $data[]=$temp;
  37. }
  38. self::insertAll($data);
  39. }
  40. }
  41. }