From 211f199067e613e0ee728b9d175da9c91756e586 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Fri, 18 Sep 2020 17:27:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E4=B8=93=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/ServicePersonnel.php | 15 ++++++++++++++- .../v3/Implementations/ServiceEvaluateService.php | 3 ++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/Model/v3/ServicePersonnel.php b/app/Model/v3/ServicePersonnel.php index ad1aeaf..807f273 100644 --- a/app/Model/v3/ServicePersonnel.php +++ b/app/Model/v3/ServicePersonnel.php @@ -3,12 +3,20 @@ declare (strict_types=1); namespace App\Model\v3; +use App\Constants\v3\OssThumbnail; use App\Model\Model; +use App\Service\v3\Interfaces\AttachmentServiceInterface; use Hyperf\Database\Model\SoftDeletes; - +use Hyperf\Di\Annotation\Inject; class ServicePersonnel extends Model { use SoftDeletes; + + /** + * @Inject + * @var AttachmentServiceInterface + */ + protected $attachmentService; /** * The table associated with the model. * @@ -21,6 +29,7 @@ class ServicePersonnel extends Model * @var array */ protected $fillable = []; + /** * The attributes that should be cast to native types. * @@ -29,4 +38,8 @@ class ServicePersonnel extends Model // protected $casts = [ // 'set_reward' => 'array' // ]; + public function getHeadUrlAttribute($value) + { + return $this->attachmentService->switchImgToAliOss($value, OssThumbnail::THUMBNAIL_600_Q90); + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/ServiceEvaluateService.php b/app/Service/v3/Implementations/ServiceEvaluateService.php index d7c7724..ec0c41f 100644 --- a/app/Service/v3/Implementations/ServiceEvaluateService.php +++ b/app/Service/v3/Implementations/ServiceEvaluateService.php @@ -3,6 +3,7 @@ namespace App\Service\v3\Implementations; use App\Model\v3\ServiceEvaluate; +use App\Model\v3\ServicePersonnel; use App\Model\v3\User; use App\Service\v3\Interfaces\ServiceEvaluateServiceInterface; use Hyperf\DbConnection\Db; @@ -47,7 +48,7 @@ class ServiceEvaluateService implements ServiceEvaluateServiceInterface public function getPersonnelInfo($service_personnel_id) { - $res = Db::table('lanzu_service_personnel') + $res = ServicePersonnel::query() ->where([ ['id','=',$service_personnel_id], ['status','=',1]