This commit is contained in:
2024-10-29 14:04:59 +08:00
commit 48bf3e6f33
2839 changed files with 762707 additions and 0 deletions

40
app/mobile/validate/Pinglun.php Executable file
View File

@@ -0,0 +1,40 @@
<?php
namespace app\mobile\validate;
use think\Validate;
class Pinglun extends Validate
{
protected $rule = [
['pid', 'require', 'pid不能为空'],
['cid', 'require', 'cid不能为空'],
['typeid', 'require', 'typeid不能为空'],
['content', 'require|check_value:content', '内容不能为空'],
];
protected $scene = [
'add' => ['pid', 'cid', 'typeid', 'content'],
];
protected function check_value($value, $rule)
{
switch ($rule) {
case 'content':
$length = utf8_strlen($value);
if ($length < 6 || $length > 100) {
return '评论必须在6-100个字之间';
}
return true;
break;
case '':
return true;
break;
default:
# code...
break;
}
}
}