添加:烟酒店相关兼容

This commit is contained in:
wuhui_zzw 2024-03-14 14:03:54 +08:00
parent 7b45836832
commit 825026be42
2 changed files with 4 additions and 3 deletions

View File

@ -57,7 +57,7 @@ class Agent extends BaseModel{
* @return string
*/
public function getAgentTypeTextAttr():string{
// 类型1=总部发起人,2=省公司发起人,3=省合伙人(外勤),4=省合伙人(内勤),5=区县运营商,6=区县合伙人,7=餐厅,8=配送商,9=总部外勤,10=总部内勤
// 类型1=总部发起人,2=省公司发起人,3=省合伙人(外勤),4=省合伙人(内勤),5=区县运营商,6=区县合伙人,7=餐厅,8=配送商,9=总部外勤,10=总部内勤,10=烟酒店代销商
$agentType = $this->agent_type ?? -1;
switch($agentType){
case 1: return '总部发起人';break;
@ -70,6 +70,7 @@ class Agent extends BaseModel{
case 8: return '配送商';break;
case 9: return '总部外勤';break;
case 10: return '总部内勤';break;
case 11: return '烟酒店代销商';break;
}
return '';

View File

@ -119,10 +119,10 @@ class Agent extends BaseController{
$data['uid'] = $this->request->uid();
// 信息验证
if((int)$data['pid'] <= 0) throw new ValidateException('非法请求,无邀请信息!');
if(!in_array((int)$data['agent_type'], [2,3,4,5,6,7,8,9,10])) throw new ValidateException('非法请求,代理类型错误!');
if(!in_array((int)$data['agent_type'], [2,3,4,5,6,7,8,9,10,11])) throw new ValidateException('非法请求,代理类型错误!');
if(empty($data['contact_name'])) throw new ValidateException('请输入联系人姓名!');
if(empty($data['contact_phone'])) throw new ValidateException('请输入联系人电话!');
if(!in_array((int)$data['agent_type'], [2,3,4,9,10]) && (int)$data['province_id'] <= 0) throw new ValidateException('请选择地区!');
if(!in_array((int)$data['agent_type'], [2,3,4,9,10,11]) && (int)$data['province_id'] <= 0) throw new ValidateException('请选择地区!');
if(in_array((int)$data['agent_type'], [5,6,7])){
if((int)$data['city_id'] <= 0) throw new ValidateException('请选择地区!');
if((int)$data['area_id'] <= 0) throw new ValidateException('请选择地区!');