public function testQuery() { $result = Company::query()->result(); $this->assertInstanceOf('troba\\EQM\\AbstractResultSet', $result); $result = Company::query()->innerJoin(Project::class, 'Company.id = Project.companyId')->innerJoin(ProjectActivity::class, 'Project.id = ProjectActivity.projectId')->where('ProjectActivity.id = :id', ['id' => 100])->groupBy('Company.id')->result(); $this->assertEquals(27, $result->count()); }
/*require_once("Util.php"); require_once("../admin/include/common.php"); //静态化 if(is_file("../head.html") && !isset($_GET["sp"])){ //存在静态页面,并且不是执行静态化处理 Tool::logger(__METHOD__, __LINE__, "加载静态页头", _LOG_DEBUG); //header("Location: head.html"); require_once("../head.html"); exit; }*/ $navHtml = ""; $proMapHtml = ""; $query = new Company(_QUERY_ALL); $query->companyKey = "brand_recommend"; $brands = Company::query($query); $cusNavCount = 0; //自定义导航栏个数 if (!empty($brands)) { $cusNavCount = count($brands); foreach ($brands as $brand) { $navHtml .= sprintf("\n <span class='n_menu'>\n\t\t\t\t\t<a title='%s' target='_blank' style='width: 105px;' href='%s'>%s</a>\n </span>\n\t\t\t\t", $brand->subject, $brand->content, $brand->subject); $proMapHtml .= sprintf("<li><a target='_blank' href='%s'>%s</a></li>", $brand->content, $brand->subject); } } ?> <?php //二维码 if (empty($barcode)) { $files = Company::files("company_barcode");
//首页Banner foreach ($banners as $i => $banner) { $bannerHtml .= sprintf("<li class='%s'><a href='%s'><img src='%s' alt='%s' class='home_banner_img'></a></li>", $bannerHtml == "" ? "" : "hidden", empty($banner->fileUrl) ? "index.php" : $banner->fileUrl, str_replace("../", "", $banner->savedPath), empty($banner->fileDesc) ? Company::content("site_desc", false) : $banner->fileDesc); $bannerBtn .= sprintf("<li %s>%u</li>", $i == 0 ? "class='selected'" : "", $i + 1); } $bannerHtml = sprintf("<ul>%s</ul>", $bannerHtml); $bannerBtn = sprintf("<ul>%s</ul>", $bannerBtn); } else { //内页Banner $banner = $banners[0]; $bannerHtml = sprintf("<a href='%s'><img src='%s' alt='%s' class='inner_banner_img'></a>", empty($banner->fileUrl) ? "index.php" : $banner->fileUrl, str_replace("../", "", $banner->savedPath), empty($banner->fileDesc) ? Company::content("site_desc", false) : $banner->fileDesc); } $hot_search = ""; $query = new Company(_QUERY_ALL); $query->companyKey = "hot_search"; $hots = Company::query($query); if (!empty($hots)) { foreach ($hots as $hot) { $hot_search .= sprintf("\n <span class='n_menu'>\n\t\t\t\t\t<a title='%s' target='_blank' style='width: 105px;' href='%s'>%s</a>\n </span>\n\t\t\t\t", $hot->subject, $hot->content, $hot->subject); } } ?> <!--banner start--> <div id="banner_box"> <?php if ($showHomeBanner) { ?> <div class="home_banner"> <div class="home_banner_imgs"> <?php
/** * Set the company id for the contact * and create a new one if doesn't exists. * @param object EventControler */ function eventSetCompany(EventControler $event_controler) { $fields = $event_controler->getParam('fields'); $newCompany = new Company($this->getDbCon()); $newCompany->query("select * from company where name='" . trim($fields['company']) . "' and iduser = "******"\n Company id:" . $fields['idcompany'] . " for " . $fields['company']); $event_controler->updateParam("fields", $fields); return true; }
//读取友情连接 $links = DocFile::get("company_links"); $linkTemp = "<p><a href=\"%s\" title=\"%s\"><img src=\"%s\" width=\"88\" height=\"31\" alt=\"%s\" /></a></p>"; $linkStr = ""; if (!empty($links)) { foreach ($links as $link) { $linkStr .= sprintf($linkTemp, $link->fileUrl, $link->fileDesc, str_replace("../", "", $link->savedPath), $link->fileDesc); } } //联系方式 $contacts = sprintf("<p>电话:%s</p><p>传真:%s</p><p>手机:%s</p><p>联系人:%s</p><p>Q Q:%s</p><p>旺旺:%s</p><p>邮箱:%s</p><p>官网:%s</p><p>旺铺:%s</p><p>地址:%s</p><p>%s</p>", Company::content("company_phone"), Company::content("company_fax"), Company::content("mobile_phone"), Company::content("contact_person"), Company::content("company_qq"), Company::content("ali_wangwang"), Company::content("company_email"), Company::content("official_site"), Company::content("ali_store"), Company::content("company_addr"), Company::content("other_contact")); //读取常见问题 $pro_problems = ""; $query = new Company(_QUERY_ALL); $query->companyKey = "product_problem"; $problems = Company::query($query); if (!empty($problems)) { foreach ($problems as $problem) { $pro_problems .= sprintf("<li><a target='_blank' href='%s' title='%s'>%s</a></li>", $problem->content, $problem->subject, $problem->subject); } } ?> <style type="text/css"> .sitemap_sec{z-index:10; font-size:14px; color:#8f8f8f; position:relative; background:#333; height:180px;} .sitemap{margin: 5px auto 0 auto; width: 960px;} .link_sec {width: 25%; float:left;} .sitemap_sec p{font-size: 16px;color: #fff;margin-bottom: 8px; margin-top: 5px; padding-bottom:5px; font-family:"微软雅黑";} .sitemap_sec a{line-height:27px; font-size:12px; color: #8f8f8f;} </style>
$_SESSION["CURRENT_USER"] = $user; echo "{\"status\":\"true\", \"data\": \"登录成功\"}"; } else { echo "{\"status\":\"false\", \"data\": \"" . $result . "\"}"; } } exit; } //读取公司数据 if ($module == "company") { if ($dataType == "list") { $companyKey = strtolower(isset($_REQUEST["companyKey"]) ? $_REQUEST["companyKey"] : ""); try { $company = new Company($querySize); $company->companyKey = $companyKey; $data = Company::query($company); $listJson = "[]"; if (!empty($data)) { $listJson = json_encode($data, JSON_UNESCAPED_UNICODE); } Tool::logger(__METHOD__, __LINE__, sprintf("查询文本Json: %s", $listJson), _LOG_ERROR); echo "{\"status\":\"true\", \"data\": " . $listJson . "}"; } catch (Exception $e) { echo "{\"status\":\"false\", \"data\": \"" . $e->getMessage() . "\"}"; Tool::logger(__METHOD__, __LINE__, sprintf("数据查询失败: %s", $e->getMessage()), _LOG_ERROR); } } exit; } //读取产品类型数据 if ($module == "sort") {