2
This commit is contained in:
parent
373e1a6f6c
commit
e87174ae9f
32
app/common/dao/store/parameter/ParameterDao.php
Normal file
32
app/common/dao/store/parameter/ParameterDao.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\common\dao\store\parameter;
|
||||||
|
|
||||||
|
use app\common\dao\BaseDao;
|
||||||
|
use app\common\model\store\parameter\Parameter;
|
||||||
|
|
||||||
|
class ParameterDao extends BaseDao
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function getModel(): string
|
||||||
|
{
|
||||||
|
return Parameter::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function search(array $where)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
26
app/common/dao/store/parameter/ParameterTemplateDao.php
Normal file
26
app/common/dao/store/parameter/ParameterTemplateDao.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\common\dao\store\parameter;
|
||||||
|
|
||||||
|
use app\common\dao\BaseDao;
|
||||||
|
use app\common\model\store\parameter\ParameterTemplate;
|
||||||
|
|
||||||
|
class ParameterTemplateDao extends BaseDao
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function getModel(): string
|
||||||
|
{
|
||||||
|
return ParameterTemplate::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
32
app/common/dao/store/parameter/ParameterValueDao.php
Normal file
32
app/common/dao/store/parameter/ParameterValueDao.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\common\dao\store\parameter;
|
||||||
|
|
||||||
|
use app\common\dao\BaseDao;
|
||||||
|
use app\common\model\store\parameter\ParameterValue;
|
||||||
|
|
||||||
|
class ParameterValueDao extends BaseDao
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function getModel(): string
|
||||||
|
{
|
||||||
|
return ParameterValue::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clear($id,$field)
|
||||||
|
{
|
||||||
|
$this->getModel()::getDb()->where($field, $id)->delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
36
app/common/model/parameter/Parameter.php
Normal file
36
app/common/model/parameter/Parameter.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\common\model\store\parameter;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
class Parameter extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public static function tablePk(): string
|
||||||
|
{
|
||||||
|
return 'parameter_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function tableName(): string
|
||||||
|
{
|
||||||
|
return 'parameter';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchTemplateIdAttr($query, $value)
|
||||||
|
{
|
||||||
|
$query->where('template_id',$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
85
app/common/model/parameter/ParameterTemplate.php
Normal file
85
app/common/model/parameter/ParameterTemplate.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\common\model\store\parameter;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use app\common\model\system\merchant\Merchant;
|
||||||
|
use app\common\model\system\Relevance;
|
||||||
|
use app\common\repositories\system\RelevanceRepository;
|
||||||
|
|
||||||
|
class ParameterTemplate extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public static function tablePk(): string
|
||||||
|
{
|
||||||
|
return 'template_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function tableName(): string
|
||||||
|
{
|
||||||
|
return 'parameter_template';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function merchant()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Merchant::class,'mer_id','mer_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parameter()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Parameter::class,'template_id','template_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function cateId()
|
||||||
|
{
|
||||||
|
return $this->hasMany(Relevance::class,'left_id','template_id')->where('type', RelevanceRepository::PRODUCT_PARAMES_CATE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchCateIdAttr($query, $value)
|
||||||
|
{
|
||||||
|
$id = Relevance::where('right_id',$value)->where('type', RelevanceRepository::PRODUCT_PARAMES_CATE)->column('left_id');
|
||||||
|
$query->where('template_id','in',$id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchTemplateNameAttr($query, $value)
|
||||||
|
{
|
||||||
|
$query->whereLike('template_name',"%{$value}%");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchTemplateIdsAttr($query, $value)
|
||||||
|
{
|
||||||
|
$query->whereIn('template_id',$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchMerIdAttr($query, $value)
|
||||||
|
{
|
||||||
|
$query->where('mer_id',$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchMerNameAttr($query, $value)
|
||||||
|
{
|
||||||
|
$value = Merchant::whereLike('mer_name',"%{$value}%")->coupon('mer_id');
|
||||||
|
$query->whereIn('mer_id',$value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchIsMerAttr($query, $value)
|
||||||
|
{
|
||||||
|
if ($value == 1) {
|
||||||
|
$query->where('mer_id','>',0);
|
||||||
|
} else {
|
||||||
|
$query->where('mer_id',0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
35
app/common/model/parameter/ParameterValue.php
Normal file
35
app/common/model/parameter/ParameterValue.php
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: CRMEB Team <admin@crmeb.com>
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace app\common\model\store\parameter;
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
class ParameterValue extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public static function tablePk(): string
|
||||||
|
{
|
||||||
|
return 'parameter_attr_id';
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function tableName(): string
|
||||||
|
{
|
||||||
|
return 'parameter_value';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parameter()
|
||||||
|
{
|
||||||
|
return $this->hasOne(Parameter::class,'parameter_id','parameter_id');
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user