Esempio n. 1
0
 public function getCityList($provinceId)
 {
     if (!isset($provinceId) || empty($provinceId)) {
         return null;
     }
     $cityList = Area::find()->where(array('parentId' => $provinceId))->asArray()->all();
     if ($cityList) {
         return $cityList;
     }
     return null;
 }
 public function actionArea()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $query = Area::find();
     $pagination = new Pagination(['defaultPageSize' => 20, 'totalCount' => $query->count()]);
     $countries = $query->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render(Variable::$area_view, ['countries' => $countries, 'pagination' => $pagination]);
 }
Esempio n. 3
0
 public function getArea()
 {
     return $this->hasOne(Area::className(), ['id' => 'areaId']);
 }
Esempio n. 4
0
 public function getCity()
 {
     return $this->hasOne(Area::className(), ['id' => 'sellerCity']);
 }
 public function actionEidtseller()
 {
     $user = new AdminUser();
     if (!$user->checkUserIsLogin()) {
         $this->redirect(Variable::$home_url);
         return;
     }
     $req = Yii::$app->request;
     //创建一个请求对象
     $form = new SellerForm();
     $form->setScenario('update');
     $areaModel = new Area();
     $sellerId = trim($req->get('id'));
     if (!is_numeric($sellerId) || $sellerId == 0) {
         $this->redirect(Variable::$sellerManger_url);
         return;
     }
     //修改
     if ($form->load($req->post()) && $form->validate()) {
         $isSuccess = (new Seller())->updateSeller($sellerId, $form->sellerProvince, $form->sellerCity, $form->contacts, $form->phone, $form->sellerBrief);
         if ($isSuccess) {
             $form->addError('', '资料更新成功');
         } else {
             $form->addError('', '资料更新失败');
         }
     }
     $sellerModel = (new Seller())->findSellerById($sellerId);
     $form->sellerName = $sellerModel->sellerName;
     $form->sellerProvince = $sellerModel->sellerProvince;
     $form->sellerCity = $sellerModel->sellerCity;
     $form->contacts = $sellerModel->contacts;
     $form->phone = $sellerModel->phone;
     $form->sellerBrief = $sellerModel->sellerBrief;
     return $this->render(Variable::$editSeller_view, ['model' => $form, 'sellerModel' => $sellerModel, 'provinceMode' => $areaModel->getProvinceList()]);
 }