hasMany(Coach::class,'shop_id'); } public function categoryIds() { return $this->hasMany(ShopCategoryIndex::class,'shop_id'); } public function goods() { return $this->hasMany(ShopGoodsIndex::class,'shop_id'); } public function goodsIds() { return $this->hasMany(ShopGoodsIndex::class,'shop_id'); } public function shopImage() { return $this->hasMany(ShopImage::class,'shop_id'); } public function getTakeOrderAttr($value,$data) { return [ 'everyday' => 2, 'total_order' => 1 ]; } /** * @notes 获取工作状态 * @param $value * @param $data * @return string|string[] * @author cjhao * @date 2024/10/3 15:43 */ public function getWorkStatusDescAttr($value,$data) { return ShopEnum::getWorkStatus($data['work_status']); } /** * @notes 获取工作状态 * @param $value * @param $data * @return string|string[] * @author cjhao * @date 2024/10/3 15:43 */ public function getServerStatusDescAttr($value,$data) { return ShopEnum::getServerStatus($data['server_status']); } /** * @notes 公共处理图片,补全路径 * @param $value * @return string * @author 张无忌 * @date 2021/9/10 11:02 */ public function getIdCardFrontAttr($value) { return trim($value) ? FileService::getFileUrl($value) : ''; } /** * @notes 公共图片处理,去除图片域名 * @param $value * @return mixed|string * @author 张无忌 * @date 2021/9/10 11:04 */ public function setIdCardFrontAttr($value) { return trim($value) ? FileService::setFileUrl($value) : ''; } /** * @notes 公共处理图片,补全路径 * @param $value * @return string * @author 张无忌 * @date 2021/9/10 11:02 */ public function getIdCardBackAttr($value) { return trim($value) ? FileService::getFileUrl($value) : ''; } /** * @notes 公共图片处理,去除图片域名 * @param $value * @return mixed|string * @author 张无忌 * @date 2021/9/10 11:04 */ public function setIdCardBackAttr($value) { return trim($value) ? FileService::setFileUrl($value) : ''; } /** * @notes 公共处理图片,补全路径 * @param $value * @return string * @author 张无忌 * @date 2021/9/10 11:02 */ public function getPortraitShootingAttr($value) { return trim($value) ? FileService::getFileUrl($value) : ''; } /** * @notes 公共图片处理,去除图片域名 * @param $value * @return mixed|string * @author 张无忌 * @date 2021/9/10 11:04 */ public function setPortraitShootingAttr($value) { return trim($value) ? FileService::setFileUrl($value) : ''; } /** * @notes 公共处理图片,补全路径 * @param $value * @return string * @author 张无忌 * @date 2021/9/10 11:02 */ public function getLogoAttr($value) { return trim($value) ? FileService::getFileUrl($value) : ''; } /** * @notes 公共图片处理,去除图片域名 * @param $value * @return mixed|string * @author 张无忌 * @date 2021/9/10 11:04 */ public function setLogoAttr($value) { return trim($value) ? FileService::setFileUrl($value) : ''; } /** * @notes 公共处理图片,补全路径 * @param $value * @return string * @author 张无忌 * @date 2021/9/10 11:02 */ public function getBusinessLicenseAttr($value) { return trim($value) ? FileService::getFileUrl($value) : ''; } /** * @notes 公共图片处理,去除图片域名 * @param $value * @return mixed|string * @author 张无忌 * @date 2021/9/10 11:04 */ public function setBusinessLicenseAttr($value) { return trim($value) ? FileService::setFileUrl($value) : ''; } /** * @notes 获取店铺地址 * @param $value * @param $data * @return string * @author cjhao * @date 2024/10/7 00:34 */ public function getRegionDescAttr($value,$data) { $cityIds = []; $cityLists = ''; $data['province_id'] && $cityIds[] = $data['province_id']; $data['city_id'] && $cityIds[] = $data['city_id']; $data['region_id'] && $cityIds[] = $data['region_id']; if($cityIds){ $cityLists = Region::where(['id'=>$cityIds])->column('name'); $cityLists = implode('',$cityLists); } return $cityLists; } /** * @notes 审核状态 * @param $value * @return string|string[] * @author cjhao * @date 2024/10/7 00:25 */ public function getAuditStatusDescAttr($value,$data) { return ShopEnum::getAuditStatusDesc($data['audit_status']); } /** * @notes 将距离转成km格式显示 * @param $value * @param $data * @return string * @author cjhao * @date 2024/9/3 22:56 */ public function getDistanceDescAttr($value,$data){ return !empty($data['distance']) ? round($data['distance'],2).'km' : ''; } /** * @notes 获取营业时间 * @param $value * @param $data * @return string * @author cjhao * @date 2024/11/20 20:44 */ public function getBusinessTimeDescAttr($value,$data) { $businessTimeLists = [ '周一' => $data['monday'], '周二' => $data['tuesday'], '周三' => $data['wednesday'], '周四' => $data['thursday'], '周五' => $data['friday'], '周六' => $data['saturday'], '周日' => $data['sunday'] ]; $businessTime = displayBusinessHours($businessTimeLists); if(empty($businessTime)){ return ''; } return $businessTime . ' '.$data['business_start_time'].'-'.$data['business_end_time']; } /** * @notes 获取地区 * @param $value * @param $data * @return string * @author cjhao * @date 2024/8/26 12:52 */ public function getRegionNameAttr($value,$data) { return Region::where(['id'=>$data['region_id']])->value('name'); } /** * @notes 省份id * @param $value * @param $data * @return mixed * @author cjhao * @date 2024/11/26 14:47 */ public function getProvinceNameAttr($value,$data) { return Region::where(['id'=>$data['province_id']])->value('name'); } /** * @notes 省份id * @param $value * @param $data * @return mixed * @author cjhao * @date 2024/11/26 14:47 */ public function getCityNameAttr($value,$data) { return Region::where(['id'=>$data['city_id']])->value('name'); } }