chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
215
app/model/activity/promotions/StorePromotionsAuxiliary.php
Normal file
215
app/model/activity/promotions/StorePromotionsAuxiliary.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\model\activity\promotions;
|
||||
|
||||
|
||||
use app\model\activity\coupon\StoreCouponIssue;
|
||||
use app\model\product\brand\StoreBrand;use app\model\product\label\StoreProductLabel;use app\model\product\product\StoreProduct;
|
||||
use app\model\product\sku\StoreProductAttrValue;
|
||||
use crmeb\basic\BaseModel;
|
||||
use crmeb\traits\ModelTrait;use think\Model;
|
||||
|
||||
/**
|
||||
* 优惠活动辅助表
|
||||
*/
|
||||
class StorePromotionsAuxiliary extends BaseModel
|
||||
{
|
||||
use ModelTrait;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $key = 'id';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'store_promotions_auxiliary';
|
||||
|
||||
/**
|
||||
* 商品规格
|
||||
* @param $value
|
||||
* @return array|mixed
|
||||
*/
|
||||
protected function getUniqueAttr($value, $data)
|
||||
{
|
||||
if ($value) {
|
||||
return is_string($value) && (!isset($data['type']) || $data['type'] != 3) ? explode(',', $value) : $value;
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联优惠券
|
||||
* @return \think\model\relation\HasOne
|
||||
*/
|
||||
public function coupon()
|
||||
{
|
||||
return $this->hasOne(StoreCouponIssue::class, 'id', 'coupon_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联商品
|
||||
* @return \think\model\relation\HasOne
|
||||
*/
|
||||
public function productInfo()
|
||||
{
|
||||
return $this->hasOne(StoreProduct::class, 'id', 'product_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送sku一对一
|
||||
* @return \think\model\relation\hasOne
|
||||
*/
|
||||
public function giveAttrValue()
|
||||
{
|
||||
return $this->hasOne(StoreProductAttrValue::class, 'unique', 'unique')->where('type', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* sku一对多
|
||||
* @return \think\model\relation\HasMany
|
||||
*/
|
||||
public function attrValue()
|
||||
{
|
||||
return $this->hasMany(StoreProductAttrValue::class, 'product_id', 'product_id')->where('type', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联商品品牌
|
||||
* @return \think\model\relation\HasOne
|
||||
*/
|
||||
public function brandInfo()
|
||||
{
|
||||
return $this->hasOne(StoreBrand::class, 'id', 'brand_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联商品标签
|
||||
* @return \think\model\relation\HasOne
|
||||
*/
|
||||
public function productLabelInfo()
|
||||
{
|
||||
return $this->hasOne(StoreProductLabel::class, 'id', 'store_label_id');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* type搜索器
|
||||
* @param Model $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchTypeAttr($query, $value)
|
||||
{
|
||||
if ($value) $query->where('type', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* product_partake_type搜索器
|
||||
* @param Model $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchProductPartakeTypeAttr($query, $value)
|
||||
{
|
||||
if ($value !== '') {
|
||||
if (is_array($value)) {
|
||||
if ($value) $query->whereIn('product_partake_type', $value);
|
||||
} else {
|
||||
if ($value) $query->where('product_partake_type', $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* promotions_id搜索器
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchPromotionsIdAttr($query, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if ($value) $query->whereIn('promotions_id', $value);
|
||||
} else {
|
||||
if ($value !== '') $query->where('promotions_id', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* coupon_id搜索器
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchCouponIdAttr($query, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if ($value) $query->whereIn('coupon_id', $value);
|
||||
} else {
|
||||
if ($value !== '') $query->where('coupon_id', $value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* product_id搜索器
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchProductIdAttr($query, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if ($value) $query->whereIn('product_id', $value);
|
||||
} else {
|
||||
if ($value !== '') $query->where('product_id', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* is_all搜索器
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchIsAllAttr($query, $value)
|
||||
{
|
||||
if ($value !== '') {
|
||||
$query->where('is_all', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* brand_id
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchBrandIdAttr($query, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if ($value) $query->whereIn('brand_id', $value);
|
||||
} else {
|
||||
if ($value !== '') $query->where('brand_id', $value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* store_label_id
|
||||
* @param $query
|
||||
* @param $value
|
||||
*/
|
||||
public function searchStoreLabelIdAttr($query, $value)
|
||||
{
|
||||
if (is_array($value)) {
|
||||
if ($value) $query->whereIn('store_label_id', $value);
|
||||
} else {
|
||||
if ($value !== '') $query->where('store_label_id', $value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user