public function actionIndex()
 {
     /*
      *显示
      */
     //分类
     $model = new Type();
     $data['type'] = $model->find()->limit(14)->asArray()->all();
     //地区
     $address = new Region();
     $id = 52;
     $data['region'] = $address->find()->where("pid='{$id}'")->asArray()->all();
     $session = \Yii::$app->session;
     $user_id = $session->get('user_id');
     //判断用户登录显示不同信息后分页
     if (empty($user_id)) {
         $partjob = new Partjob();
         $part_list = $partjob->jobfind();
         $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $part_list->count()]);
         $data['job'] = $part_list->offset($pagination->offset)->asArray()->limit($pagination->limit)->all();
         $data['pagination'] = $pagination;
     } else {
         $user = new User();
         $usertype = $user->usertype($user_id);
         if ($usertype["user_type"] == '1') {
             $partjob = new Partjob();
             $part_list = $partjob->jobfind();
             $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $part_list->count()]);
             $data['job'] = $part_list->offset($pagination->offset)->asArray()->limit($pagination->limit)->all();
             $data['pagination'] = $pagination;
         } else {
             $partjob = new Partjob();
             $part_list = $partjob->jobselect($user_id);
             $pagination = new Pagination(['defaultPageSize' => 2, 'totalCount' => $part_list->count()]);
             $data['job'] = $part_list->offset($pagination->offset)->asArray()->limit($pagination->limit)->all();
             $data['pagination'] = $pagination;
         }
     }
     return $this->render('index', $data);
 }
 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]);
 }
Beispiel #3
0
 public function actionRegionList()
 {
     $region = new Region();
     $request = \YII::$app->request;
     $region_id = $request->get('region_id');
     $regionList = $region->getParentList($region_id);
     echo json_encode($regionList);
 }