Esempio n. 1
0
 public function actionStudentInfo()
 {
     $user = new User();
     $model = new Student();
     $model1 = new Type();
     $region = new Region();
     $file = new UploadForm();
     //兼职的分类
     $typeInfo = $model1->getTypes();
     //获取省
     $parentOne = $region->getParentOne();
     if (Yii::$app->request->isPost) {
         $request = \YII::$app->request;
         $post = $request->post();
         $file->student_file = UploadedFile::getInstances($file, 'student_file');
         foreach ($file->student_file as $v) {
             $path = 'uploads/' . time() . rand('111', '999') . '.' . $v->extension;
             $v->saveAs($path);
             $imgUrl[] = $path;
         }
         $model->addStudent($imgUrl, $post);
     }
     $userInfo = $user->getUser(1);
     //用户信息
     return $this->render('studentinfo', ['model' => $model, 'typeInfo' => $typeInfo, 'file' => $file, 'parentOne' => $parentOne, 'userInfo' => $userInfo]);
 }
 public function actionBusinessData()
 {
     $model = new Merchant();
     $discount = new Discount();
     $user_id = yii::$app->session->get('user_id');
     $merchantInfo = $model->find()->where(['user_id' => $user_id])->one();
     $aptitude = new Aptitude();
     $merchant_id = $merchantInfo['merchant_id'];
     //获得商家开店牌照
     $aptitudeInfo = $aptitude->find()->where(['merchant_id' => $merchant_id])->asArray()->all();
     //获得商家店铺照片
     $garllery = new MerchantGarllery();
     $garlleryInfo = $garllery->find()->where(['merchant_id' => $merchant_id])->asArray()->all();
     $category = new MerchantCategory();
     $region = new Region();
     //修改时候获得市 和 区
     $merchant_province = $merchantInfo['merchant_province'];
     $merchant_city = $merchantInfo['merchant_city'];
     $city = $region->find()->where(['pid' => $merchant_province])->asArray()->all();
     $areas = $region->find()->where(['pid' => $merchant_city])->asArray()->all();
     $parentOne = $region->getParentOne();
     $categoryOne = $category->getCategoryOne();
     //修改时获得二级分类
     $category_id = $merchantInfo['merchant_categoryparent'];
     $categoryTwo = $category->find()->where(['Parent_id' => $category_id])->asArray()->all();
     return $this->render('business-data', ['model' => $merchantInfo, 'parentOne' => $parentOne, 'areas' => $areas, 'city' => $city, 'aptitude' => $aptitudeInfo, 'garllery' => $garlleryInfo, 'categoryOne' => $categoryOne, 'categoryTwo' => $categoryTwo, 'discount' => $discount]);
 }