添加公司验证参数

This commit is contained in:
彭桃 2023-01-10 10:16:43 +08:00
parent 01df667b41
commit 50ab82edd0
2 changed files with 34 additions and 2 deletions

View File

@ -18,6 +18,7 @@ use app\common\repositories\enter\EnterCompanyRepository;
use think\App;
use think\facade\Db;
use app\common\model\user\User;
use app\validate\api\EnterCompanyValidate;
use function GuzzleHttp\json_decode;
@ -33,14 +34,15 @@ class EnterCompany extends BaseController
/**
*
* @param EnterCompanyRepository $repository
* @param EnterCompanyValidate $validate
* @return mixed
* @author xaboy
* @day 2020/5/28
*/
public function add()
public function add(EnterCompanyValidate $validate)
{
$data = $this->request->params(['company', ['company_image', []],['master_idcar_positive', []],['master_idcar_negative', []], 'master', 'supervisor','director']);
$validate->check($data);
$data['create_time'] = time();
$data['shop_user_id'] = $this->request->uid();
$res = Db::connect('dev')->name('market_company')->insert($data);

View File

@ -0,0 +1,30 @@
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\api;
use think\Validate;
class EnterCompanyValidate extends Validate
{
protected $failException = true;
protected $rule = [
'company|公司名称' => 'require',
'company_image|公司证件' => 'require',
'master|法人' => 'require',
'master_idcar_positive|身份证正面' => 'require',
'master_idcar_negative|身份证反面' => 'require',
];
}