其余文件

This commit is contained in:
2026-04-14 17:46:22 +08:00
parent 294b68fe37
commit 3691f4db22
1343 changed files with 189847 additions and 0 deletions

View File

@ -0,0 +1,68 @@
<?php
// +----------------------------------------------------------------------
// | likeshop100%开源免费商用商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | 商业版本务必购买商业授权,以免引起法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshopTeam
// +----------------------------------------------------------------------
namespace app\admin\validate\kefu;
use app\common\basics\Validate;
use app\common\model\kefu\KefuLang;
/**
*
* Class KefuLangValidate
* @package app\admin\validate\kefu
*/
class KefuLangValidate extends Validate
{
protected $rule = [
'id' => 'require|checkLang',
'title' => 'require|unique:'.KefuLang::class.',title',
'content' => 'require|unique:'.KefuLang::class.',content',
'sort' => 'gt:0',
];
protected $message = [
'title.require' => '请输入标题',
'title.unique' => '标题已存在',
'content.require' => '请输入内容',
'content.unique' => '内容已存在',
'sort.gt' => '排序不能小于零',
];
public function sceneAdd()
{
$this->remove('id', true);
}
public function sceneDel()
{
$this->only(['id']);
}
public function checkLang($value,$rule,$data){
$lang = KefuLang::where(['id'=>$value])->find();
if($lang){
return true;
}
return '话术不存在';
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace app\admin\validate\kefu;
use app\common\basics\Validate;
use app\common\model\kefu\Kefu;
/**
* 客服验证逻辑
* Class KefuValidate
* @package app\admin\validate\content
*/
class KefuValidate extends Validate
{
protected $rule = [
'id' => 'require|number',
'admin_id' => 'require|number|checkIsKefu',
'avatar' => 'require',
'nickname' => 'require',
'disable' => 'require|in:0,1',
'sort' => 'gt:0'
];
protected $message = [
'id.require' => 'id不可为空',
'id.number' => 'id必须为数字',
'admin_id.require' => '请选择管理员',
'admin_id.number' => '管理员选择异常',
'avatar.require' => '请选择头像',
'nickname.require' => '请填写客服昵称',
'disable.require' => '请选择状态',
'disable.in' => '状态错误',
'sort.gt' => '排序需大于0',
];
public function sceneAdd()
{
$this->remove('id', true);
}
public function sceneEdit()
{
$this->remove('admin_id',true);
}
public function sceneDel()
{
$this->only(['id'])->append('id', 'checkIsDel');
}
/**
* @notes 选中管理员是否已为客服
* @param $value
* @param $rule
* @param array $data
* @return bool|string
* @author 段誉
* @date 2021/11/26 18:56
*/
protected function checkIsKefu($value, $rule, $data = [])
{
$check = Kefu::where([
'admin_id' => $value,
'shop_id' => 0,
'del' => 0
])->findOrEmpty();
if (!$check->isEmpty()) {
return "该管理员已是客服";
}
return true;
}
/**
* @notes 客服是否存在
* @param $value
* @param $rule
* @param array $data
* @return bool|string
* @author 段誉
* @date 2021/11/26 18:57
*/
protected function checkIsDel($value, $rule, $data = [])
{
$check = Kefu::where(['id' => $value, 'del' => 0])->findOrEmpty();
if ($check->isEmpty()) {
return "该客服数据错误";
}
return true;
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace app\admin\validate\kefu;
use app\common\basics\Validate;
use app\common\logic\ChatLogic;
class LoginValidate extends Validate
{
protected $rule = [
'id' => 'require|number|checkConfig',
];
protected $message = [
'id.require' => 'id不可为空',
'id.number' => 'id必须为数字',
];
protected function checkConfig($value, $rule, $data = [])
{
if (false === ChatLogic::checkConfig()) {
return ChatLogic::getError() ?: '请联系管理员设置后台配置';
}
return true;
}
}