StoreServiceLog.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\model\wechat;
  12. use app\admin\model\wechat\StoreService as ServiceModel;
  13. use app\wap\model\user\User;
  14. use traits\ModelTrait;
  15. use basic\ModelBasic;
  16. /**
  17. * 客服管理 model
  18. * Class StoreProduct
  19. * @package app\admin\model\store
  20. */
  21. class StoreServiceLog extends ModelBasic
  22. {
  23. use ModelTrait;
  24. /**
  25. * @return array
  26. */
  27. public static function getChatList($uid,$to_uid,$mer_id){
  28. $model = new self;
  29. $where = "mer_id = ".$mer_id." AND ((uid = ".$uid." AND to_uid = ".$to_uid.") OR (uid = ".$to_uid." AND to_uid = ".$uid."))";
  30. $model->where($where);
  31. $model->order("add_time desc");
  32. return self::page($model,function($item,$key) use ($mer_id){
  33. $user = StoreService::field("nickname,avatar")->where('mer_id',$mer_id)->where(array("uid"=>$item["uid"]))->find();
  34. if(!$user)$user = User::field("nickname,avatar")->where(array("uid"=>$item["uid"]))->find();
  35. $item["nickname"] = $user["nickname"];
  36. $item["avatar"] = $user["avatar"];
  37. });
  38. }
  39. }