getChangedData(); //如果修改了用户或或密码则需要重新登录 if (isset($changed['username']) || isset($changed['password']) || isset($changed['salt'])) { $row->token = ''; } }); } public function getAddressCityList(){ return SearchCity::column("address_city","id"); } public static function getHaveShopId($adminId){ $admin = self::get($adminId); if(!$admin)throw new \Exception("管理员不存在"); $area_json = $admin->area_json; $shop_id = "*"; if($area_json){ $shop_id = []; $searchCity = SearchCity::where("id","in",$area_json)->select(); foreach ($searchCity as $item){ $province = $item->province; $city = $item->city; $district = $item->district; //查询在该区域的店铺id $manystoreShop = new ManystoreShop; if($province)$manystoreShop = $manystoreShop->where("province",$province); if($city)$manystoreShop = $manystoreShop->where("city",$city); if($district)$manystoreShop = $manystoreShop->where("district",$district); $shop_id = array_merge($shop_id,$manystoreShop->column("id")); } } return $shop_id; } public static function getHaveCity($adminId){ $provinces = $citys = $districts = $address_citys = []; $admin = self::get($adminId); if(!$admin)return compact("provinces","citys","districts","address_citys"); $area_json = $admin->area_json; if($area_json){ $searchCity = SearchCity::where("id","in",$area_json)->select(); foreach ($searchCity as $item){ $address_citys[] = $item->address_city; $province = $item->province; if($province)$provinces[] = $province; $city = $item->city; if($city)$citys[] = $city; $district = $item->district; if($district)$districts[] = $district; } } if(!$provinces)$provinces="*"; if(!$citys)$citys="*"; if(!$districts)$districts="*"; if(!$address_citys)$address_citys="*"; return compact("provinces","citys","districts","address_citys"); } public static function checkAuthMsg($adminId){ ["provinces" =>$provinces,"citys"=> $citys, "districts"=>$districts,"address_citys"=>$address_citys] = self::getHaveCity($adminId); if(is_array($address_citys))$address_citys = implode(",",$address_citys); //必要信息已完善 return '