OrderMsg.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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']."修改为".$order_status[$msg['action_process']];
  17. $mguid =ProcessOrder::Where(["order_type"=>$msg['order_type'],'order_code'=>$msg['order_code']])->column('action_uid,action_name');
  18. if(!empty($mguid)){
  19. $data=[];
  20. foreach ($mguid as $value){
  21. if($value["action_uid"]==$msg['action_uid']){
  22. continue;
  23. }
  24. $temp=[];
  25. $temp['content']=$content;
  26. $temp['orderCode']=$msg['order_code'];
  27. $temp['order_type']=$msg['order_type'];
  28. $temp['order_status']=$msg['order_status'];
  29. $temp['order_id']=$msg['order_id'];
  30. $temp['uid']=$value['action_uid'];//所有人,缺申请人和操作人
  31. $temp['uname']=$value['action_name'];
  32. $temp['is_read']=0;
  33. $temp['addtime']=date("Y-m-d H:i:s");
  34. $temp['updatetime']=date("Y-m-d H:i:s");
  35. $data[]=$temp;
  36. }
  37. self::insertAll($data);
  38. }
  39. }
  40. }