| | |
| | | */ |
| | | class Supplier extends SupplierModel |
| | | { |
| | | |
| | | protected $append=['coordinate']; |
| | | public function getCoordinateAttr($v,$data) |
| | | { |
| | | return $data['latitude'].','.$data['longitude']; |
| | | } |
| | | /** |
| | | *检查登录 |
| | | */ |
| | |
| | | */ |
| | | public function edit($data){ |
| | | $isexist = $this->where('name','=',$data['name'])->where('shop_supplier_id','<>',$data['shop_supplier_id'])->find(); |
| | | $latitude=0; |
| | | $longitude=0; |
| | | if (!empty($data['coordinate'])){ |
| | | $coordinate=explode(',',$data['coordinate']); |
| | | $latitude=$coordinate[0]; |
| | | $longitude=$coordinate[1]; |
| | | } |
| | | if($isexist){ |
| | | $this->error = '店铺名称已存在'; |
| | | return false; |
| | |
| | | 'description' => $data['description'], |
| | | 'logo_id' => $data['logo_id'], |
| | | 'business_id' => $data['business_id'], |
| | | 'latitude' =>$latitude, |
| | | 'longitude' => $longitude, |
| | | 'app_id' => self::$app_id, |
| | | 'name' => $data['name'], |
| | | 'is_full' => 1, |