添加测试的代码生成以及采购编码的页面的代码生成
This commit is contained in:
59
app/common/model/PdmPurchasecode.php
Normal file
59
app/common/model/PdmPurchasecode.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
use think\Model;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
/**
|
||||
* pdm_purchasecode
|
||||
* <!--partmanage-->
|
||||
* 采购编码
|
||||
* Class PdmPurchasecode
|
||||
* @package app\common\model
|
||||
*/
|
||||
class PdmPurchasecode extends Model
|
||||
{
|
||||
|
||||
use SoftDelete;
|
||||
|
||||
// 定义时间戳字段名
|
||||
protected $createTime = 'create_time';
|
||||
protected $updateTime = 'update_time';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
/**
|
||||
* 定义 sa_user 关联模型
|
||||
* @localKey user_id
|
||||
* @bind nickname,name
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(\app\common\model\system\User::Class,'id','user_id')->bind(['nickname','name']);
|
||||
}
|
||||
|
||||
public function setAttributeAttr($value)
|
||||
{
|
||||
if (!empty($value) && is_array($value)) {
|
||||
$arr = [];
|
||||
foreach ($value['key'] as $key => $elem) {
|
||||
$arr[$elem] = $value['value'][$key];
|
||||
}
|
||||
|
||||
$value = json_encode($arr,JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
return $value ?: json_encode([]);
|
||||
}
|
||||
|
||||
public function getAttributeAttr($value)
|
||||
{
|
||||
if (!empty($value) && is_string($value)) {
|
||||
$value = json_decode($value, true);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
}
|
||||
36
app/common/validate/PdmPurchasecode.php
Normal file
36
app/common/validate/PdmPurchasecode.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\validate;
|
||||
|
||||
use think\Validate;
|
||||
/**
|
||||
* <!--partmanage-->
|
||||
* PdmPurchasecode 验证器
|
||||
* Class PdmPurchasecode
|
||||
* @package app\common\validate
|
||||
*/
|
||||
class PdmPurchasecode extends Validate
|
||||
{
|
||||
/**
|
||||
* 验证规则
|
||||
*/
|
||||
protected $rule = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
*/
|
||||
protected $message = [
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 验证场景
|
||||
*/
|
||||
protected $scene = [
|
||||
'add' => [],
|
||||
'edit' => [],
|
||||
];
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user