init commit
This commit is contained in:
57
application/admin/model/wdsxh/institution/Institution.php
Normal file
57
application/admin/model/wdsxh/institution/Institution.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\institution;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Institution extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_institution';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
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 ['0' => __('Status 0'), '1' => __('Status 1')];
|
||||
}
|
||||
|
||||
|
||||
public function getStatusTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
|
||||
$list = $this->getStatusList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 麦沃德科技赋能开发者,助力中小企业发展
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2017~2024 www.wdadmin.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Wdadmin系统产品软件并不是自由软件,不加密,并不代表开源,未经许可不可自由转售和商用
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: MY WORLD Team <bd@maiwd.cn> www.wdadmin.cn
|
||||
// +----------------------------------------------------------------------
|
||||
/**
|
||||
* Class InstitutionConfig
|
||||
* Desc 机构配置Model
|
||||
* Create on 2025/3/6 10:50
|
||||
* Create by wangyafang
|
||||
*/
|
||||
|
||||
namespace app\admin\model\wdsxh\institution;
|
||||
|
||||
|
||||
use think\Model;
|
||||
|
||||
class InstitutionConfig extends Model
|
||||
{
|
||||
// 表名
|
||||
protected $name = 'wdsxh_institution_config';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
|
||||
public function getIsStatusList()
|
||||
{
|
||||
return ['1' => __('对外开放'), '2' => __('不对外开放')];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\institution;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class InstitutionMemberApply extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_institution_member_apply';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = false;
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'state_text',
|
||||
'handle_time_text'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function getStateList()
|
||||
{
|
||||
return ['1' => __('State 1'), '2' => __('State 2'), '3' => __('State 3')];
|
||||
}
|
||||
|
||||
|
||||
public function getStateTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['state']) ? $data['state'] : '');
|
||||
$list = $this->getStateList();
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
|
||||
|
||||
public function getHandleTimeTextAttr($value, $data)
|
||||
{
|
||||
$value = $value ? $value : (isset($data['handle_time']) ? $data['handle_time'] : '');
|
||||
return is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
|
||||
}
|
||||
|
||||
protected function setHandleTimeAttr($value)
|
||||
{
|
||||
return $value === '' ? null : ($value && !is_numeric($value) ? strtotime($value) : $value);
|
||||
}
|
||||
|
||||
|
||||
public function institution()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\wdsxh\institution\Institution', 'institution_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function level()
|
||||
{
|
||||
return $this->belongsTo('Level', 'level_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function usermember()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\wdsxh\Member', 'member_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
44
application/admin/model/wdsxh/institution/Level.php
Normal file
44
application/admin/model/wdsxh/institution/Level.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\institution;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Level extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_institution_level';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function institution()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\wdsxh\institution\Institution', 'institution_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
69
application/admin/model/wdsxh/institution/Member.php
Normal file
69
application/admin/model/wdsxh/institution/Member.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\wdsxh\institution;
|
||||
|
||||
use think\Model;
|
||||
|
||||
|
||||
class Member extends Model
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 表名
|
||||
protected $name = 'wdsxh_institution_member';
|
||||
|
||||
// 自动写入时间戳字段
|
||||
protected $autoWriteTimestamp = 'integer';
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'createtime';
|
||||
protected $updateTime = 'updatetime';
|
||||
protected $deleteTime = false;
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
|
||||
];
|
||||
|
||||
protected static function init()
|
||||
{
|
||||
self::beforeInsert(function ($row) {
|
||||
if (empty($row['institution_id']) && isset($row['level_id']) && !empty($row['level_id'])) {
|
||||
$row->institution_id = (new \app\api\model\wdsxh\institution\Level())->where('id',$row['level_id'])->value('institution_id');
|
||||
}
|
||||
$row->wechat_id = (new \app\admin\model\wdsxh\Member)->where('id',$row->member_id)->value('wechat_id');
|
||||
});
|
||||
|
||||
self::beforeUpdate(function ($row) {
|
||||
$row->wechat_id = (new \app\admin\model\wdsxh\Member)->where('id',$row->member_id)->value('wechat_id');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function institution()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\wdsxh\institution\Institution', 'institution_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
|
||||
public function level()
|
||||
{
|
||||
return $this->belongsTo('Level', 'level_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
|
||||
public function usermember()
|
||||
{
|
||||
return $this->belongsTo('app\admin\model\wdsxh\Member', 'member_id', 'id', [], 'LEFT')->setEagerlyType(0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user