'名称', 'mobile' => '联系电话', 'address' => '详细地址', 'longitude' => '经纬度', 'latitude' => '经纬度', 'cover_url' => '头像', 'province' => '省', 'city' => '市', 'district' => '区', ]; } public function search() { if (!$this->validate()) { return [ 'code' => 1, 'msg' => $this->getErrorSummary(false)[0], ]; } $shop = Shop::findOne(['user_id' => get_user_id(), 'is_delete' => 0]); if(empty($shop)) { $shop = new Shop(); $shop->store_id = get_store_id(); $shop->user_id = get_user_id(); } $shop->shop_audit = 0; $shop->address = $this->address; $shop->name = $this->name; $shop->mobile = $this->mobile; $shop->cover_url = $this->cover_url; $shop->pic_url = $this->cover_url; $shop->province = $this->province; $shop->city = $this->city; $shop->district = $this->district; $shop->longitude = $this->longitude; $shop->latitude = $this->latitude; if ($shop->save()) { return [ 'code' => 0, 'msg' => '保存成功' ]; } else { return [ 'code' => 1, 'msg' => $shop->errors[0] ]; } } }