|
|
@@ -17,6 +17,7 @@ namespace app\common\model\agricultural_machinery;
|
|
|
use app\common\model\agricultural_machinery\ServiceCategory;
|
|
|
use app\common\model\BaseModel;
|
|
|
use app\common\model\asset\AssetArea;
|
|
|
+use app\common\service\FileService;
|
|
|
use think\model\concern\SoftDelete;
|
|
|
|
|
|
/**
|
|
|
@@ -105,4 +106,80 @@ class UserService extends BaseModel
|
|
|
|
|
|
return['area_str'=>$area_str,'area_arr'=>$area_list];
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 设置图片域名
|
|
|
+ * @param $value
|
|
|
+ * @param $data
|
|
|
+ * @return array|string|string[]|null
|
|
|
+ * @author 段誉
|
|
|
+ * @date 2022/9/28 10:17
|
|
|
+ */
|
|
|
+ public function getContentAttr($value, $data)
|
|
|
+ {
|
|
|
+ return get_file_domain($value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 清除图片域名
|
|
|
+ * @param $value
|
|
|
+ * @param $data
|
|
|
+ * @return array|string|string[]
|
|
|
+ * @author 段誉
|
|
|
+ * @date 2022/9/28 10:17
|
|
|
+ */
|
|
|
+ public function setContentAttr($value, $data)
|
|
|
+ {
|
|
|
+ return clear_file_domain($value);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @notes 清除图片域名
|
|
|
+ * @param $value
|
|
|
+ * @param $data
|
|
|
+ * @return array|string|string[]
|
|
|
+ * @author 段誉
|
|
|
+ * @date 2022/9/28 10:17
|
|
|
+ */
|
|
|
+ public function setImagesAttr($value)
|
|
|
+ {
|
|
|
+ $imagesArr = explode(',',$value);
|
|
|
+ $imagesStr = '';
|
|
|
+ foreach($imagesArr as $k=>$v){
|
|
|
+ if($k==0){
|
|
|
+ $imagesStr = clear_file_domain($v);
|
|
|
+ }else{
|
|
|
+ $imagesStr .=','. clear_file_domain($v);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return $imagesStr;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @notes 加图片域名
|
|
|
+ * @param $value
|
|
|
+ * @param $data
|
|
|
+ * @return array|string|string[]
|
|
|
+ * @author 段誉
|
|
|
+ * @date 2022/9/28 10:17
|
|
|
+ */
|
|
|
+ public function getImagesAttr($value,$data)
|
|
|
+ {
|
|
|
+
|
|
|
+ $imagesArr = explode(',',$data['images']);
|
|
|
+
|
|
|
+ $imagesStr = '';
|
|
|
+
|
|
|
+ foreach($imagesArr as $k=>$v){
|
|
|
+
|
|
|
+ if($k==0){
|
|
|
+ $imagesStr = FileService::getFileUrl(trim($v, '/')); //get_file_domain($v);
|
|
|
+ }else{
|
|
|
+ $imagesStr .=','. FileService::getFileUrl(trim($v, '/')); //get_file_domain($v);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return $imagesStr;
|
|
|
+ }
|
|
|
}
|