345 lines
8.2 KiB
PHP
Executable File
345 lines
8.2 KiB
PHP
Executable File
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | likeshop100%开源免费商用商城系统
|
||
// +----------------------------------------------------------------------
|
||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||
// | 开源版本可自由商用,可去除界面版权logo
|
||
// | 商业版本务必购买商业授权,以免引起法律纠纷
|
||
// | 禁止对系统程序代码以任何目的,任何形式的再发布
|
||
// | gitee下载:https://gitee.com/likeshop_gitee
|
||
// | github下载:https://github.com/likeshop-github
|
||
// | 访问官网:https://www.likeshop.cn
|
||
// | 访问社区:https://home.likeshop.cn
|
||
// | 访问手册:http://doc.likeshop.cn
|
||
// | 微信公众号:likeshop技术社区
|
||
// | likeshop团队 版权所有 拥有最终解释权
|
||
// +----------------------------------------------------------------------
|
||
// | author: likeshopTeam
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\common\model\shop;
|
||
|
||
use app\common\enum\shop\ShopEnum;
|
||
use app\common\model\BaseModel;
|
||
use app\common\model\goods\Goods;
|
||
use app\common\model\Region;
|
||
use app\common\service\FileService;
|
||
|
||
/**
|
||
* 店铺模型类
|
||
* Class Shop
|
||
* @package app\common\model\shop
|
||
*/
|
||
class ShopUpdate extends BaseModel
|
||
{
|
||
|
||
public function goods()
|
||
{
|
||
return $this->hasMany(Goods::class,'shop_id','shop_id');
|
||
}
|
||
|
||
|
||
/**
|
||
* @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::setFileUrl($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
|
||
* @return array|string[]
|
||
* @author cjhao
|
||
* @date 2024/10/5 21:02
|
||
*/
|
||
public function getShopImageAttr($value)
|
||
{
|
||
$shopImageLists = [];
|
||
if($value) {
|
||
$shopImageLists = explode(',',$value);
|
||
foreach ($shopImageLists as $key => $shopImage) {
|
||
$shopImageLists[$key] = FileService::getFileUrl($shopImage);
|
||
}
|
||
}
|
||
return $shopImageLists;
|
||
}
|
||
|
||
/**
|
||
* @notes 公共图片处理
|
||
* @param $value
|
||
* @return string
|
||
* @author cjhao
|
||
* @date 2024/10/5 21:05
|
||
*/
|
||
public function setShopImageAttr($value)
|
||
{
|
||
$shopImageLists = [];
|
||
if($value){
|
||
foreach ($value as $shopImage){
|
||
$shopImageLists[] = FileService::setFileUrl($shopImage);
|
||
}
|
||
}
|
||
return implode(',',$shopImageLists);
|
||
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取分类ids
|
||
* @param $value
|
||
* @return string
|
||
* @author cjhao
|
||
* @date 2024/10/6 13:05
|
||
*/
|
||
public function getCategoryIdsAttr($value)
|
||
{
|
||
$categoryIds = '';
|
||
if($value){
|
||
$categoryIds = explode(',',$value);
|
||
}
|
||
return $categoryIds;
|
||
}
|
||
|
||
/**
|
||
* @notes 设置分类ids
|
||
* @param $value
|
||
* @return array|string[]
|
||
* @author cjhao
|
||
* @date 2024/10/6 13:06
|
||
*/
|
||
public function setCategoryIdsAttr($value){
|
||
$categoryIds = [];
|
||
if($value){
|
||
$categoryIds = implode(',',$value);
|
||
}
|
||
return $categoryIds;
|
||
}
|
||
|
||
|
||
/**
|
||
* @notes 获取商品ids
|
||
* @param $value
|
||
* @return string
|
||
* @author cjhao
|
||
* @date 2024/10/6 13:05
|
||
*/
|
||
public function getGoodsIdsAttr($value)
|
||
{
|
||
$goodsIds = '';
|
||
if($value){
|
||
$goodsIds = explode(',',$value);
|
||
}
|
||
return $goodsIds;
|
||
}
|
||
|
||
/**
|
||
* @notes 设置商品ids
|
||
* @param $value
|
||
* @return array|string[]
|
||
* @author cjhao
|
||
* @date 2024/10/6 13:06
|
||
*/
|
||
public function setGoodsIdsAttr($value){
|
||
$goodsIds = [];
|
||
if($value){
|
||
$goodsIds = implode(',',$value);
|
||
}
|
||
return $goodsIds;
|
||
}
|
||
|
||
|
||
/**
|
||
* @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'];
|
||
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 获取地区
|
||
* @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');
|
||
}
|
||
} |