会员级别添加关联权益及图片
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// | 麦沃德科技赋能开发者,助力商协会发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdsxh.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
@@ -17,13 +17,13 @@ use think\Model;
|
||||
class Level extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_member_level';
|
||||
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
@@ -32,11 +32,15 @@ class Level extends Model
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
protected $type = [
|
||||
'benefits_id' => 'json',
|
||||
];
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
@@ -46,7 +50,7 @@ class Level extends Model
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
|
||||
|
||||
@@ -53,4 +53,13 @@ class MemberBenefits extends Model
|
||||
$list = $this->getDisabledList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
public function getSimpleByStatus($disabled = 0)
|
||||
{
|
||||
return Self::field(['id', 'title'])->where(function($query) use ($disabled) {
|
||||
if (null !== $disabled) {
|
||||
$query->where('disabled', '=', $disabled);
|
||||
}
|
||||
})->order('sort', 'asc')->select();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user