コード例 #1
0
 public function actionIndex()
 {
     $models_type = new FinPartType();
     //实例化分类
     $models_region = new Region();
     //实例化地区
     $models_part = new FinJobDetails();
     //实例化兼职
     $types = $models_type->partComment();
     $region_id = '52';
     $regions = $models_region->getRegion($region_id);
     //接受查询分类
     $keyword = Yii::$app->request->get('1');
     $new_key = Yii::$app->request->get('2');
     if ($new_key) {
         foreach ($new_key as $key => $value) {
             $keyword[$key] = $value;
         }
     }
     if (empty($keyword['type'])) {
         $keyword['type'] = 0;
     }
     if (empty($keyword['region'])) {
         $keyword['region'] = 0;
     }
     $parts = $models_part->getParts($keyword);
     $pages = $parts['pages'];
     unset($parts['pages']);
     return $this->render('index', ['types' => $types, 'regions' => $regions, 'parts' => $parts, 'keyword' => $keyword, 'pages' => $pages]);
 }
コード例 #2
0
 public function actionPart()
 {
     /* 表单模型 */
     $model = new FinJobDetails();
     /* 兼职类型数据 */
     $part = new FinPartType();
     $parttype = $part->partComment();
     foreach ($parttype as $k => $v) {
         $data[$v['part_id']] = $v['part_name'];
     }
     /* 查询省份 */
     $region = new FinRegion();
     $province = $region->getProvince();
     return $this->render("part", ['model' => $model, 'data' => $data, 'province' => $province]);
 }
コード例 #3
0
 public function actionPartorder()
 {
     //获取用户id
     $session = Yii::$app->session->get('userinfo');
     $user_id = $session['user_id'];
     $request = Yii::$app->request->post();
     $search['search'] = '';
     $search['type'] = '';
     if ($request) {
         if ($request['type'] == 'order_sn') {
             if ($request['search']) {
                 $where = ['and', ['=', 'user_id', $user_id], ['=', 'order_sn', $request['search']]];
                 $search['search'] = $request['search'];
                 $search['type'] = 'order_sn';
             } else {
                 $where = ['=', 'user_id', $user_id];
             }
         } elseif ($request['type'] == 'mer_name') {
             if ($request['search']) {
                 $where = ['and', ['=', 'user_id', $user_id], ['like', 'mer_name', $request['search']]];
                 $search['search'] = $request['search'];
                 $search['type'] = 'mer_name';
             } else {
                 $where = ['=', 'user_id', $user_id];
             }
         } elseif ($request['type'] == 'job_name') {
             if ($request['search']) {
                 $where = ['and', ['=', 'user_id', $user_id], ['like', 'job_name', $request['search']]];
                 $search['search'] = $request['search'];
                 $search['type'] = 'job_name';
             } else {
                 $where = ['=', 'user_id', $user_id];
             }
         }
     } else {
         $where = ['=', 'user_id', $user_id];
     }
     $ParttimeOrder = new ParttimeOrder();
     $pagination = new Pagination(['defaultPageSize' => 10, 'totalCount' => $ParttimeOrder->Count($where)]);
     $Porder = $ParttimeOrder->Porder($where, $pagination);
     $FinPartType = new FinPartType();
     $type = $FinPartType->partComment();
     return $this->render('partorder', ['pagination' => $pagination, 'porder' => $Porder, 'type' => $type, 'search' => $search]);
 }