添加公司验证参数
This commit is contained in:
parent
01df667b41
commit
50ab82edd0
@ -18,6 +18,7 @@ use app\common\repositories\enter\EnterCompanyRepository;
|
|||||||
use think\App;
|
use think\App;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\common\model\user\User;
|
use app\common\model\user\User;
|
||||||
|
use app\validate\api\EnterCompanyValidate;
|
||||||
|
|
||||||
use function GuzzleHttp\json_decode;
|
use function GuzzleHttp\json_decode;
|
||||||
|
|
||||||
@ -33,14 +34,15 @@ class EnterCompany extends BaseController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param EnterCompanyRepository $repository
|
* @param EnterCompanyValidate $validate
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @author xaboy
|
* @author xaboy
|
||||||
* @day 2020/5/28
|
* @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']);
|
$data = $this->request->params(['company', ['company_image', []],['master_idcar_positive', []],['master_idcar_negative', []], 'master', 'supervisor','director']);
|
||||||
|
$validate->check($data);
|
||||||
$data['create_time'] = time();
|
$data['create_time'] = time();
|
||||||
$data['shop_user_id'] = $this->request->uid();
|
$data['shop_user_id'] = $this->request->uid();
|
||||||
$res = Db::connect('dev')->name('market_company')->insert($data);
|
$res = Db::connect('dev')->name('market_company')->insert($data);
|
||||||
|
30
app/validate/api/EnterCompanyValidate.php
Normal file
30
app/validate/api/EnterCompanyValidate.php
Normal 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',
|
||||||
|
];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user