init commit
This commit is contained in:
77
application/admin/model/wdsxh/corporate/Card.php
Normal file
77
application/admin/model/wdsxh/corporate/Card.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\corporate;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Card extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_corporate_card';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'is_default_text',
|
||||
'is_hide_avatar_text',
|
||||
'is_wechat_number_public_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getIsDefaultList()
|
||||
{
|
||||
return ['1' => __('Is_default 1'), '2' => __('Is_default 2')];
|
||||
}
|
||||
|
||||
public function getIsHideAvatarList()
|
||||
{
|
||||
return ['1' => __('Is_hide_avatar 1'), '2' => __('Is_hide_avatar 2')];
|
||||
}
|
||||
|
||||
public function getIsWechatNumberPublicList()
|
||||
{
|
||||
return ['1' => __('Is_wechat_number_public 1'), '2' => __('Is_wechat_number_public 2')];
|
||||
}
|
||||
|
||||
|
||||
public function getIsDefaultTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['is_default']) ? $data['is_default'] : '');
|
||||
$list = $this->getIsDefaultList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getIsHideAvatarTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['is_hide_avatar']) ? $data['is_hide_avatar'] : '');
|
||||
$list = $this->getIsHideAvatarList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getIsWechatNumberPublicTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['is_wechat_number_public']) ? $data['is_wechat_number_public'] : '');
|
||||
$list = $this->getIsWechatNumberPublicList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
62
application/admin/model/wdsxh/corporate/CardBackground.php
Normal file
62
application/admin/model/wdsxh/corporate/CardBackground.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\corporate;
|
||||
|
||||
use think\Model;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class CardBackground extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_corporate_card_background';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::afterInsert(function ($row) {
|
||||
$pk = $row->getPk();
|
||||
$row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public function getStatusList()
|
||||
{
|
||||
return ['normal' => __('Status normal'), 'hidden' => __('Status hidden')];
|
||||
}
|
||||
|
||||
public function getFontColorList()
|
||||
{
|
||||
return ['#FFFFFF' => __('White'),'#5A5B6E' => __('Black')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user