/** * 用于初始化 * 组合关键字 */ public function getKeyword($data, $genre) { $model = new SearchModel(); if ($genre == 'product') { $keyword = $data->name . $data->uname; $genre = 1; } elseif ($genre == 'goods') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; $genre = 2; } elseif ($genre == 'idea') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; $genre = 3; } elseif ($genre == 'storyboard') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; $genre = 4; } elseif ($genre == 'company') { $companyModel = new CompanyModel(); $genreName = array_key_exists($data->genre, $companyModel['genres']) ? $companyModel['genres'][$data->genre] : ''; $keyword = $data->name . $data->uname . $genreName . $companyModel->getAreaName($data->area) . $data->address; $genre = 5; } elseif ($genre == 'works') { $keyword = $data->name . $model['cates2'][$data->cate]; $genre = 6; } elseif ($genre == 'actor') { $education = new StaffModel(); $keyword = $data->name . $data->realname . $data->origin . $education['educations'][$data->education] . $data->school . $education->getAreaName($data->area); $genre = 7; } elseif ($genre == 'rent') { $rentModel = new RentModel(); $keyword = $data->name . $rentModel->getAreaName($data->area) . $data->money . '元'; $genre = 8; } elseif ($genre == 'design') { $keyword = $data->name . $model['cates1'][$data->cate] . $data->money . '元'; $genre = 9; } return array('keyword' => $keyword, 'genre' => $genre); }
/** * 将对这些表的操作,插入或更新到数据库 * genre==1创作,2样片,3创意,4分镜,5企业,6影视,7演员,8设备,9设计, */ public static function change($data, $genre, $oper) { $model = new SearchModel(); if ($oper == 'create') { if ($genre == 'product') { $keyword = $data->name . $data->uname; SearchModel::intoDB($keyword, 1, $data->id); } elseif ($genre == 'goods') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 2, $data->id); } elseif ($genre == 'idea') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 3, $data->id); } elseif ($genre == 'storyboard') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 4, $data->id); } elseif ($genre == 'company') { $companyModel = new CompanyModel(); $genreName = array_key_exists($data->genre, $companyModel['genres']) ? $companyModel['genres'][$data->genre] : ''; $keyword = $data->name . $data->uname . $genreName . $companyModel->getAreaName($data->area) . $data->address; SearchModel::intoDB($keyword, 5, $data->id); } elseif ($genre == 'works') { $keyword = $data->name . $model['cates2'][$data->cate]; SearchModel::intoDB($keyword, 6, $data->id); } elseif ($genre == 'actor') { $education = new StaffModel(); $keyword = $data->name . $data->realname . $data->origin . $education['educations'][$data->education] . $data->school . $education->getAreaName($data->area); SearchModel::intoDB($keyword, 7, $data->id); } elseif ($genre == 'rent') { $rentModel = new RentModel(); $keyword = $data->name . $rentModel->getAreaName($data->area) . $data->money . '元'; SearchModel::intoDB($keyword, 8, $data->id); } elseif ($genre == 'design') { $keyword = $data->name . $model['cates1'][$data->cate] . $data->money . '元'; SearchModel::intoDB($keyword, 9, $data->id); } } elseif ($oper == 'update') { if ($genre == 'product') { $keyword = $data->name . $data->uname; SearchModel::updateDB($keyword, 1, $data->id); } elseif ($genre == 'goods') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 2, $data->id); } elseif ($genre == 'idea') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 3, $data->id); } elseif ($genre == 'storyboard') { $keyword = $data->name . $data->uname . $model['cates2'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 4, $data->id); } elseif ($genre == 'company') { $companyModel = new CompanyModel(); $keyword = $data->name . $data->uname . $companyModel['genres'][$data->genre] . $companyModel->getAreaName($data->area) . $data->address; SearchModel::updateDB($keyword, 5, $data->id); } elseif ($genre == 'works') { $keyword = $data->name . $model['cates2'][$data->cate]; SearchModel::updateDB($keyword, 6, $data->id); } elseif ($genre == 'actor') { $education = new StaffModel(); $keyword = $data->name . $data->realname . $data->origin . $education['educations'][$data->education] . $data->school . $education->getAreaName($data->area); SearchModel::updateDB($keyword, 7, $data->id); } elseif ($genre == 'rent') { $rentModel = new RentModel(); $keyword = $data->name . $rentModel->getAreaName($data->area) . $data->money . '元'; SearchModel::updateDB($keyword, 8, $data->id); } elseif ($genre == 'design') { $keyword = $data->name . $model['cates1'][$data->cate] . $data->money . '元'; SearchModel::updateDB($keyword, 9, $data->id); } } elseif ($oper == 'del') { } }