小组集中采购更新
This commit is contained in:
commit
0cb775b161
40
app/common/dao/enter/EnterCompanyDao.php
Normal file
40
app/common/dao/enter/EnterCompanyDao.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?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\common\dao\enter;
|
||||||
|
|
||||||
|
use think\Collection;
|
||||||
|
use think\db\BaseQuery;
|
||||||
|
use think\db\exception\DataNotFoundException;
|
||||||
|
use think\db\exception\DbException;
|
||||||
|
use think\db\exception\ModelNotFoundException;
|
||||||
|
use think\facade\Db;
|
||||||
|
use app\common\dao\BaseDao;
|
||||||
|
use app\common\model\enter\EnterCompany;
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
use think\Model;
|
||||||
|
|
||||||
|
class EnterCompanyDao extends BaseDao
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return BaseModel
|
||||||
|
* @author xaboy
|
||||||
|
* @day 2020-03-30
|
||||||
|
*/
|
||||||
|
protected function getModel(): string
|
||||||
|
{
|
||||||
|
return EnterCompany::class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
43
app/common/model/enter/EnterCompany.php
Normal file
43
app/common/model/enter/EnterCompany.php
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<?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\common\model\enter;
|
||||||
|
|
||||||
|
|
||||||
|
use app\common\model\BaseModel;
|
||||||
|
|
||||||
|
class EnterCompany extends BaseModel
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
* @author xaboy
|
||||||
|
* @day 2020-03-30
|
||||||
|
*/
|
||||||
|
public static function tablePk(): string
|
||||||
|
{
|
||||||
|
return 'id';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
* @author xaboy
|
||||||
|
* @day 2020-03-30
|
||||||
|
*/
|
||||||
|
public static function tableName(): string
|
||||||
|
{
|
||||||
|
return 'market_company';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
15
app/common/repositories/enter/EnterCompanyRepository.php
Normal file
15
app/common/repositories/enter/EnterCompanyRepository.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace app\common\repositories\enter;
|
||||||
|
|
||||||
|
use app\common\dao\enter\EnterCompanyDao;
|
||||||
|
use app\common\repositories\BaseRepository;
|
||||||
|
|
||||||
|
class EnterCompanyRepository extends BaseRepository
|
||||||
|
{
|
||||||
|
protected $dao;
|
||||||
|
|
||||||
|
public function __construct(EnterCompanyDao $dao)
|
||||||
|
{
|
||||||
|
$this->dao = $dao;
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -382,12 +382,15 @@ class Auth extends BaseController
|
|||||||
$repository->loginAfter($user);
|
$repository->loginAfter($user);
|
||||||
$find=Db::name('nk_user')->where('user_id',$user['uid'])->find();
|
$find=Db::name('nk_user')->where('user_id',$user['uid'])->find();
|
||||||
$user['no_update']=1;
|
$user['no_update']=1;
|
||||||
|
$user['group_ids'] = 1;
|
||||||
if ($find && $find['n_user_id']!=0){
|
if ($find && $find['n_user_id']!=0){
|
||||||
|
$user['group_ids'] = $find['group_id'];
|
||||||
$msg=Db::connect('nongke')->name('szxc_information_usermsg')->where('user_id',$find['n_user_id'])->cache(true)->find();
|
$msg=Db::connect('nongke')->name('szxc_information_usermsg')->where('user_id',$find['n_user_id'])->cache(true)->find();
|
||||||
if ($msg){
|
if ($msg){
|
||||||
$user['no_update']=0;
|
$user['no_update']=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($user['phone']==''){
|
if ($user['phone']==''){
|
||||||
Db::name('user')->where('uid',$user['uid'])->update(['phone'=>$user['account']]);
|
Db::name('user')->where('uid',$user['uid'])->update(['phone'=>$user['account']]);
|
||||||
$user['phone']=$user['account'];
|
$user['phone']=$user['account'];
|
||||||
|
73
app/controller/api/enter/EnterCompany.php
Normal file
73
app/controller/api/enter/EnterCompany.php
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
<?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\controller\api\enter;
|
||||||
|
|
||||||
|
use crmeb\basic\BaseController;
|
||||||
|
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;
|
||||||
|
|
||||||
|
class EnterCompany extends BaseController
|
||||||
|
{
|
||||||
|
protected $repository;
|
||||||
|
|
||||||
|
public function __construct(App $app, EnterCompanyRepository $repository)
|
||||||
|
{
|
||||||
|
parent::__construct($app);
|
||||||
|
$this->repository = $repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param EnterCompanyValidate $validate
|
||||||
|
* @return mixed
|
||||||
|
* @author xaboy
|
||||||
|
* @day 2020/5/28
|
||||||
|
*/
|
||||||
|
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);
|
||||||
|
return app('json')->success('添加成功');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function list($page=1,$limit=10)
|
||||||
|
{
|
||||||
|
$where = ['shop_user_id' => $this->request->uid()];
|
||||||
|
$list = Db::connect('dev')->name('market_company')->where($where)->page($page,$limit)->order('id desc')->field('id,shop_user_id,company,company_image,master,master_idcar_positive,master_idcar_negative,supervisor,director,create_time')
|
||||||
|
->withAttr('supervisor',function($value,$data){
|
||||||
|
return json_decode($value,true);
|
||||||
|
})
|
||||||
|
->withAttr('director',function($value,$data){
|
||||||
|
return json_decode($value,true);
|
||||||
|
})
|
||||||
|
->withAttr('create_time',function($value,$data){
|
||||||
|
return date('Y-m-d H:i:s',$value);
|
||||||
|
})
|
||||||
|
->withAttr('shop_user',function($value,$data){
|
||||||
|
return User::where('uid',$data['shop_user_id'])->field('nickname,phone')->find();
|
||||||
|
})
|
||||||
|
->select();
|
||||||
|
return app('json')->success($list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
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',
|
||||||
|
];
|
||||||
|
}
|
@ -68,24 +68,63 @@ return [
|
|||||||
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
||||||
],
|
],
|
||||||
'nongke' => [
|
'nongke' => [
|
||||||
// 数据库类型
|
// 数据库类型
|
||||||
'type' => Env::get('databasenk.type', 'mysql'),
|
'type' => Env::get('databasenk.type', 'mysql'),
|
||||||
// 服务器地址
|
// 服务器地址
|
||||||
'hostname' => Env::get('databasenk.hostname', '127.0.0.1'),
|
'hostname' => Env::get('databasenk.hostname', '127.0.0.1'),
|
||||||
// 数据库名
|
// 数据库名
|
||||||
'database' => Env::get('databasenk.database', ''),
|
'database' => Env::get('databasenk.database', ''),
|
||||||
// 用户名
|
// 用户名
|
||||||
'username' => Env::get('databasenk.username', 'root'),
|
'username' => Env::get('databasenk.username', 'root'),
|
||||||
// 密码
|
// 密码
|
||||||
'password' => Env::get('databasenk.password', ''),
|
'password' => Env::get('databasenk.password', ''),
|
||||||
// 端口
|
// 端口
|
||||||
'hostport' => Env::get('databasenk.hostport', '3306'),
|
'hostport' => Env::get('databasenk.hostport', '3306'),
|
||||||
// 数据库连接参数
|
// 数据库连接参数
|
||||||
'params' => [],
|
'params' => [],
|
||||||
// 数据库编码默认采用utf8
|
// 数据库编码默认采用utf8
|
||||||
'charset' => Env::get('databasenk.charset', 'utf8'),
|
'charset' => Env::get('databasenk.charset', 'utf8'),
|
||||||
// 数据库表前缀
|
// 数据库表前缀
|
||||||
'prefix' => Env::get('databasenk.prefix', ''),
|
'prefix' => Env::get('databasenk.prefix', ''),
|
||||||
|
],
|
||||||
|
'dev' => [
|
||||||
|
// 数据库类型
|
||||||
|
'type' => env('database3.type', 'mysql'),
|
||||||
|
// 服务器地址
|
||||||
|
'hostname' => env('database3.hostname', '127.0.0.1'),
|
||||||
|
// 数据库名
|
||||||
|
'database' => env('database3.database', ''),
|
||||||
|
// 用户名
|
||||||
|
'username' => env('database3.username', 'root'),
|
||||||
|
// 密码
|
||||||
|
'password' => env('database3.password', ''),
|
||||||
|
// 端口
|
||||||
|
'hostport' => env('database3.hostport', '3306'),
|
||||||
|
// 数据库连接参数
|
||||||
|
'params' => [],
|
||||||
|
// 数据库编码默认采用utf8
|
||||||
|
'charset' => env('database3.charset', 'utf8'),
|
||||||
|
// 数据库表前缀
|
||||||
|
'prefix' => env('database3.prefix', ''),
|
||||||
|
|
||||||
|
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
|
||||||
|
'deploy' => 0,
|
||||||
|
// 数据库读写是否分离 主从式有效
|
||||||
|
'rw_separate' => false,
|
||||||
|
// 读写分离后 主服务器数量
|
||||||
|
'master_num' => 1,
|
||||||
|
// 指定从服务器序号
|
||||||
|
'slave_no' => '',
|
||||||
|
// 是否严格检查字段是否存在
|
||||||
|
'fields_strict' => true,
|
||||||
|
// 是否需要断线重连
|
||||||
|
'break_reconnect' => true,
|
||||||
|
// 监听SQL
|
||||||
|
'trigger_sql' => env('app_debug', true),
|
||||||
|
// 开启字段缓存
|
||||||
|
'fields_cache' => false,
|
||||||
|
// 字段缓存路径
|
||||||
|
'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
|
||||||
],
|
],
|
||||||
// 更多的数据库配置信息
|
// 更多的数据库配置信息
|
||||||
],
|
],
|
||||||
|
@ -333,6 +333,12 @@ Route::group('api/', function () {
|
|||||||
|
|
||||||
Route::get('order/:id', 'Community/getSpuByOrder');
|
Route::get('order/:id', 'Community/getSpuByOrder');
|
||||||
})->prefix('api.community.');
|
})->prefix('api.community.');
|
||||||
|
|
||||||
|
//录入公司信息
|
||||||
|
Route::post('entercompany', 'api.enter.EnterCompany/add');
|
||||||
|
// 获取已录入公司
|
||||||
|
Route::get('enter/list', 'api.enter.EnterCompany/list');
|
||||||
|
|
||||||
})->middleware(UserTokenMiddleware::class, true);
|
})->middleware(UserTokenMiddleware::class, true);
|
||||||
|
|
||||||
//非强制登录
|
//非强制登录
|
||||||
@ -578,6 +584,9 @@ Route::group('api/', function () {
|
|||||||
Route::get('ajcaptcha', 'api.Auth/ajcaptcha');
|
Route::get('ajcaptcha', 'api.Auth/ajcaptcha');
|
||||||
Route::post('ajcheck', 'api.Auth/ajcheck');
|
Route::post('ajcheck', 'api.Auth/ajcheck');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
})->middleware(AllowOriginMiddleware::class)->middleware(InstallMiddleware::class)
|
})->middleware(AllowOriginMiddleware::class)->middleware(InstallMiddleware::class)
|
||||||
->middleware(CheckSiteOpenMiddleware::class);
|
->middleware(CheckSiteOpenMiddleware::class);
|
||||||
|
|
||||||
@ -593,3 +602,4 @@ Route::group('/open-location', function () {
|
|||||||
Route::miss('View/h5');
|
Route::miss('View/h5');
|
||||||
})->middleware(InstallMiddleware::class)
|
})->middleware(InstallMiddleware::class)
|
||||||
->middleware(CheckSiteOpenMiddleware::class);
|
->middleware(CheckSiteOpenMiddleware::class);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user