init commit

This commit is contained in:
2026-03-17 09:56:00 +08:00
commit e2c8ae752d
6827 changed files with 1211784 additions and 0 deletions

View 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] : '';
}
}

View File

@@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | 麦沃德科技赋能开发者,助力中小企业发展
// +----------------------------------------------------------------------
// | Copyright (c) 20172024 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' => __('不对外开放')];
}
}

View File

@@ -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);
}
}

View 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);
}
}

View 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);
}
}