添加:烟酒馆代销商邀请烟酒馆商户入驻

This commit is contained in:
wuhui_zzw 2024-03-23 16:56:33 +08:00
parent 7bfc8433f6
commit 1afadcfd97
5 changed files with 60 additions and 31 deletions

View File

@ -17,24 +17,35 @@ class MerchantIntentionDao extends BaseDao
public function search(array $where)
{
$query = $this->getModel()::getDB()->when(isset($where['mer_id']) && $where['mer_id'] !== '', function ($query) use ($where) {
$query->where('mer_id', $where['mer_id']);
})->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) {
$query->where('uid', $where['uid']);
})->when(isset($where['status']) && $where['status'] !== '', function ($query) use ($where) {
$query->where('status', (int)$where['status']);
})->when(isset($where['mer_intention_id']) && $where['mer_intention_id'] !== '', function ($query) use ($where) {
$query->where('mer_intention_id', $where['mer_intention_id']);
})->when(isset($where['category_id']) && $where['category_id'] !== '', function ($query) use ($where) {
$query->where('merchant_category_id', $where['category_id']);
})->when(isset($where['type_id']) && $where['type_id'] !== '', function ($query) use ($where) {
$query->where('mer_type_id', $where['type_id']);
})->when(isset($where['keyword']) && $where['keyword'] !== '', function ($query) use ($where) {
$query->where('mer_name|phone|mark', 'like', '%' . $where['keyword'] . '%');
})->when(isset($where['date']) && $where['date'] !== '', function ($query) use ($where) {
getModelTime($query, $where['date']);
})->where('is_del', 0);
$query = $this->getModel()::getDB()
->when(isset($where['mer_id']) && $where['mer_id'] !== '',function($query) use ($where){
$query->where('mer_id',$where['mer_id']);
})
->when(isset($where['merchant_type']) && $where['merchant_type'] !== '',function($query) use ($where){
$query->where('merchant_type',$where['merchant_type']);
})
->when(isset($where['uid']) && $where['uid'] !== '',function($query) use ($where){
$query->where('uid',$where['uid']);
})
->when(isset($where['status']) && $where['status'] !== '',function($query) use ($where){
$query->where('status',(int)$where['status']);
})
->when(isset($where['mer_intention_id']) && $where['mer_intention_id'] !== '',function($query) use ($where){
$query->where('mer_intention_id',$where['mer_intention_id']);
})
->when(isset($where['category_id']) && $where['category_id'] !== '',function($query) use ($where){
$query->where('merchant_category_id',$where['category_id']);
})
->when(isset($where['type_id']) && $where['type_id'] !== '',function($query) use ($where){
$query->where('mer_type_id',$where['type_id']);
})
->when(isset($where['keyword']) && $where['keyword'] !== '',function($query) use ($where){
$query->where('mer_name|phone|mark','like','%'.$where['keyword'].'%');
})
->when(isset($where['date']) && $where['date'] !== '',function($query) use ($where){
getModelTime($query,$where['date']);
})
->where('is_del',0);
return $query;
}

View File

@ -92,6 +92,12 @@ class AgentRepository extends BaseRepository{
$path = 'pages/agent/invite/index';
return app()->make(QrcodeService::class)->createQrCode($valueData,$path);
break;
case 'wine':
// 参数长度超过 简写aid=agent_idmt=merchant_type
$valueData = 'aid=' . $params['agent_id'].'&mt=3';
$path = 'pages/store/settled/index';
return app()->make(QrcodeService::class)->createQrCode($valueData,$path);
break;
}
throw new ValidateException('小程序码生成失败!');
@ -108,7 +114,7 @@ class AgentRepository extends BaseRepository{
* @throws \think\db\exception\ModelNotFoundException
*/
public function getIdentityList(int $uid,string $type = 'headquarters'):array{
// 根据身份类型,获取代理中心角色类型数组headquarters=总部province=省公司county=区县
// 根据身份类型,获取代理中心角色类型数组headquarters=总部province=省公司county=区县wine=烟酒馆
// 类型1=总部发起人,2=省公司发起人,3=省合伙人(外勤),4=省合伙人(内勤),5=区县运营商,6=区县合伙人,7=餐厅,8=配送商,9=总部外勤,10=总部内勤
switch($type){
case 'headquarters':
@ -120,6 +126,9 @@ class AgentRepository extends BaseRepository{
case 'county':
$agentType = [5,6,7,8];
break;
case 'wine':
$agentType = [11];
break;
default:
throw new ValidateException('身份查询失败!');
}

View File

@ -295,6 +295,7 @@ class Agent extends BaseController{
$headquartersList = (array)$this->repository->getIdentityList($uid);
$provinceList = (array)$this->repository->getIdentityList($uid,'province');
$countyList = (array)$this->repository->getIdentityList($uid,'county');
$wineList = (array)$this->repository->getIdentityList($uid,'wine');
// 省公司信息:仅显示省公司信息,如果存在多个则只显示一个,如果是内勤或者外勤则查询省公司信息
$newProvince = [];
foreach($provinceList as $k => $v){
@ -334,11 +335,13 @@ class Agent extends BaseController{
array_multisort(array_column($headquartersList,'id'), SORT_DESC, $headquartersList);
array_multisort(array_column($provinceList,'id'), SORT_DESC, $provinceList);
array_multisort(array_column($countyList,'id'), SORT_DESC, $countyList);
array_multisort(array_column($wineList,'id'), SORT_DESC, $wineList);
return app('json')->success([
'headquarters_list' => $headquartersList,
'province_list' => $provinceList,
'county_list' => $countyList,
'wine_list' => $wineList,
]);
}
/**

View File

@ -73,10 +73,14 @@ class MerchantIntention extends BaseController
return app('json')->success('修改成功');
}
public function lst()
{
public function lst(){
$merchantType = $this->request->param('merchant_type', 0);
[$page, $limit] = $this->getPage();
$data = $this->repository->getList(['uid' => $this->userInfo->uid], $page, $limit);
$data = $this->repository->getList([
'uid' => $this->userInfo->uid,
'merchant_type' => $merchantType
],$page,$limit);
return app('json')->success($data);
}
@ -95,17 +99,19 @@ class MerchantIntention extends BaseController
// 接收参数处理
protected function checkParams($id = 0){
// 参数获取
$data = $this->request->params(['phone','mer_name','name','code','images','merchant_category_id','mer_type_id','manage_uid']);
$data = $this->request->params(['phone','mer_name','name','code','images','merchant_category_id','mer_type_id','manage_uid',['agent_id', 0],['merchant_type',0]]);
app()->make(MerchantIntentionValidate::class)->check($data);
// $check = app()->make(SmsService::class)->checkSmsCode($data['phone'],$data['code'],'intention');
$data['mer_type_id'] = (int)$data['mer_type_id'];
// if(!$check) throw new ValidateException('验证码不正确');
// 判断:商户分类是否存在
$cateIsHas = app()->make(MerchantCategoryRepository::class)->get($data['merchant_category_id']);
if(!$cateIsHas) throw new ValidateException('商户分类不存在');
// 判断:商户类型是否存在
$typeIsHas = app()->make(MerchantTypeRepository::class)->exists($data['mer_type_id']);
if($data['mer_type_id'] && !$typeIsHas) throw new ValidateException('店铺类型不存在');
if((int)$data['merchant_type'] != 3){
// 判断:商户分类是否存在
$cateIsHas = app()->make(MerchantCategoryRepository::class)->get($data['merchant_category_id']);
if(!$cateIsHas) throw new ValidateException('商户分类不存在');
// 判断:商户类型是否存在
$typeIsHas = app()->make(MerchantTypeRepository::class)->exists($data['mer_type_id']);
if($data['mer_type_id'] && !$typeIsHas) throw new ValidateException('店铺类型不存在');
}
// 判断:当前管理员身份是否有效
$isService = app()->make(StoreServiceRepository::class)->isService($data['manage_uid'], $id, 1);// 是否存在店员信息
if($isService) throw new ValidateException('管理员身份无效,已成为其他商户管理员或店员!');

View File

@ -15,8 +15,8 @@ class MerchantIntentionValidate extends Validate
'phone|手机号' => 'require|mobile',
'name|姓名' => 'require',
'mer_name|姓名' => 'require|max:32',
'merchant_category_id|商户分类' => 'require',
'mer_type_id|店铺类型' => 'integer',
// 'merchant_category_id|商户分类' => 'require',
// 'mer_type_id|店铺类型' => 'integer',
// 'code|验证码' => 'require',
'images|资质' => 'array',
'manage_uid|管理员' => 'require',