StoreServiceLog.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\admin\model\wechat;
  3. use app\models\user\User;
  4. use crmeb\traits\ModelTrait;
  5. use crmeb\basic\BaseModel;
  6. /**
  7. * 客服管理 model
  8. * Class StoreProduct
  9. * @package app\admin\model\store
  10. */
  11. class StoreServiceLog extends BaseModel
  12. {
  13. /**
  14. * 数据表主键
  15. * @var string
  16. */
  17. protected $pk = 'id';
  18. /**
  19. * 模型名称
  20. * @var string
  21. */
  22. protected $name = 'store_service_log';
  23. use ModelTrait;
  24. /**
  25. * @param $where
  26. * @return array
  27. */
  28. public static function getChatList($where, $mer_id){
  29. $model = new self;
  30. $model = $model->where('mer_id', $mer_id);
  31. $model = $model->whereIn('uid', [$where['uid'], $where['to_uid']]);
  32. $model = $model->whereIn('to_uid', [$where['uid'], $where['to_uid']]);
  33. $model->order("add_time desc");
  34. return self::page($model,function($item) use ($mer_id){
  35. $user = StoreService::field("nickname,avatar")->where('mer_id',$mer_id)->where(array("uid"=>$item["uid"]))->find();
  36. if(!$user)$user = User::field("nickname,avatar")->where(array("uid"=>$item["uid"]))->find();
  37. $item["nickname"] = $user["nickname"];
  38. $item["avatar"] = $user["avatar"];
  39. }, $where);
  40. }
  41. }