From 8c8eb991fb73ef6c1716fadf10d96f502a2c250d Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Fri, 19 Jan 2024 14:34:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=90=8E=E6=88=96=E8=80=85=E5=BA=97=E5=91=98?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=85=B3=E9=97=AD=E5=90=8E=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E7=AE=A1=E7=90=86=E5=85=A5=E5=8F=A3=E4=BE=9D=E7=84=B6?= =?UTF-8?q?=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/user/User.php | 35 ++++++++++++++++--- .../merchant/store/service/StoreService.php | 1 + 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/app/common/model/user/User.php b/app/common/model/user/User.php index c984b04..35a38ab 100644 --- a/app/common/model/user/User.php +++ b/app/common/model/user/User.php @@ -189,18 +189,43 @@ class User extends BaseModel public function service() { - return $this->hasOne(StoreService::class, 'uid', 'uid') - ->where('mer_id', '<>', 0) - ->where('is_del', 0) - ->where('is_open', 1) + return $this->hasOne(StoreService::class,'uid','uid') + ->where('mer_id','<>',0) + ->where('is_del',0) + ->where('is_open',1) ->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods,is_open') ->order('is_verify DESC,customer DESC'); } + // 用户是否存在商户平台 有效店员信息 + public function getServiceAttr($value){ + $info = (new StoreService()) + ->field('service_id,uid,nickname,avatar,customer,StoreService.mer_id,is_verify,is_goods,is_open') + ->hasWhere('merchant',function($query){ + $query->where('is_del', 0) + ->where('mer_state', 1) + ->where('status', 1); + }) + ->where('uid',$this->uid) + ->where('StoreService.mer_id','<>',0) + ->where('StoreService.is_del',0) + ->where('is_open',1) + ->order('StoreService.is_verify DESC,StoreService.customer DESC') + // ->fetchSql() + ->find(); + + return !empty($info) ? $info->toArray() : null; + } + + + public function topService() { return $this->hasOne(StoreService::class, 'uid', 'uid') - ->where('mer_id', 0)->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods')->where('is_del', 0) + ->field('service_id,uid,nickname,avatar,customer,mer_id,is_verify,is_goods') + ->where('mer_id', 0) + ->where('is_del', 0) + ->where('is_open',1) ->order('is_verify DESC,customer DESC'); } diff --git a/app/controller/merchant/store/service/StoreService.php b/app/controller/merchant/store/service/StoreService.php index ce05119..651795e 100644 --- a/app/controller/merchant/store/service/StoreService.php +++ b/app/controller/merchant/store/service/StoreService.php @@ -114,6 +114,7 @@ class StoreService extends BaseController 'is_verify', 'is_goods', 'is_user', + 'staff_manage', 'notify', 'avatar', 'phone',