本地生活商品添加验证规则

This commit is contained in:
wangxiaowei 2024-08-22 09:26:52 +08:00
parent 53801a1c5a
commit 703fb99846
2 changed files with 8 additions and 9 deletions

@ -3,10 +3,8 @@
namespace app\api\controller;
use app\common\basics\Api;
use app\common\model\Config;
use app\common\model\user\User;
use app\common\server\JsonServer;
use app\common\server\UrlServer;
use app\common\server\WeChatServer;
use app\api\logic\LocalStoreLogic;
use EasyWeChat\Factory;
@ -270,6 +268,6 @@ class LocalStore extends Api
public function addGoods()
{
$form = $this->request->post();
(new LocalStoreGoodsValidate())->goCheck('add', $form);
(new LocalStoreGoodsValidate())->goCheck($form);
}
}

@ -1,7 +1,12 @@
<?php
namespace app\api\validate;
use think\Validate;
use app\common\basics\Validate;
use app\common\enum\OrderEnum;
use app\common\model\after_sale\AfterSale;
use app\common\server\ConfigServer;
use think\facade\Db;
class LocalStoreGoodsValidate extends Validate
{
@ -19,11 +24,7 @@ class LocalStoreGoodsValidate extends Validate
'url.require' => '商品图片不能为空',
];
protected $scene = [
'add' => ['lstore_id', 'title', 'price', 'url'],
];
public function checkPrice($value)
public function checkPrice($value, $data, $rule)
{
dump($value);die;
// $pattern = '/^\d+(\.\d{1,2})?$/';