view->fetch(); } public function odm() { return $this->view->fetch(); } public function special() { return $this->view->fetch(); } public function policy() { return $this->view->fetch(); } public function culture() { return $this->view->fetch(); } public function backup_treasure() { return $this->view->fetch(); } public function pssd() { return $this->view->fetch(); } public function question() { $data = $this->request->param(); $where = [ 'a.stat' => 0, 'a.country_code' => $this->country_code, ]; $cid = isset($data['cid']) ? $data['cid'] : 0; if ($cid) { $where['a.cid'] = $cid; } $search['keyword'] = ''; if (isset($data['keyword']) && $data['keyword'] != '') { $where['a.title'] = ['like', '%' . $data['keyword'] . '%']; $search['keyword'] = $data['keyword']; } $order = [ 'a.sort' => 'asc', 'a.id' => 'desc', ]; $field = ['a.*', 'b.name' => 'cate_name']; $question_list = model('question')->alias('a')->join('question_category b', 'a.cid = b.id', 'LEFT')->where($where)->order($order)->field($field)->paginate(4); // echo model('question')->getLastSql();die; // tiaoshi($question_list->items());die; $question_catelist = model('question_category')->where(['stat' => 0])->select(); $value = [ 'question_list' => $question_list->isEmpty() ? null : $question_list->items(), 'page' => $question_list->render(), 'cid' => $cid, 'search' => $search, 'question_catelist' => $question_catelist, ]; $this->assign($value); return view(); } public function honor() { return $this->view->fetch(); } public function industry() { return $this->view->fetch(); } public function weare() { return $this->view->fetch(); } public function responsibility() { return $this->view->fetch(); } public function wewill() { return $this->view->fetch(); } public function oricoindex() { return $this->view->fetch(); } public function vision() { return $this->view->fetch(); } public function rdcenter() { return $this->view->fetch(); } public function search() { return $this->view->fetch(); } public function transparent() { return $this->view->fetch(); } public function headset() { return $this->view->fetch(); } public function socket() { return $this->view->fetch(); } public function charger() { return $this->view->fetch(); } public function fan() { return $this->view->fetch(); } public function sitemap() { return $this->view->fetch(); } public function ufo() { return $this->view->fetch(); } public function h_speed() { return $this->view->fetch(); } public function decennial() { return $this->view->fetch(); } public function ssd() { return $this->view->fetch(); } public function series_95() { return $this->view->fetch(); } public function series_35() { return $this->view->fetch(); } public function stripe() { return $this->view->fetch(); } public function thunderbolt_3() { return $this->view->fetch(); } public function customized() { return $this->view->fetch(); } /********20230720 顶部导航栏目************/ public function blog2023() { return $this->view->fetch(); } public function brand2023() { return $this->view->fetch(); } public function brand() { return $this->view->fetch(); } public function Contact2023() { return $this->view->fetch(); } public function product2023() { return $this->view->fetch(); } public function catelists2023() { return $this->view->fetch(); } public function download() { return $this->view->fetch(); } public function achievement() { return $this->view->fetch(); } public function business2023() { return $this->view->fetch(); } public function distributor2023() { return $this->view->fetch(); } public function introduction2023() { return $this->view->fetch(); } public function faq() { $where = ['stat' => 0]; $order = [ 'sort' => 'asc', 'id' => 'desc', ]; $fq_list = model('fq')->where($where)->order($order)->paginate(6); // echo model('question')->getLastSql();die; // tiaoshi($question_list->items());die; $value = [ 'fq_list' => $fq_list->isEmpty() ? null : $fq_list->items(), 'page' => $fq_list->render(), ]; $this->assign($value); return $this->view->fetch(); } public function mileage() { $arg_where = ['a.siteid' => $this->siteid, 'a.country_code' => $this->country_code]; $arg_order = ['a.id' => 'desc']; $arg_field = ['a.id', 'a.cid', 'a.name', 'a.sort', 'a.headline', 'a.ishot', 'a.recommend', 'a.writer', 'a.source', 'a.viewcount', 'a.zancount', 'a.commentcount', 'a.description', 'a.picture', 'a.tags', 'a.createtime', 'c.id' => 'categoryid', 'c.name' => 'categoryname']; $dataObject = model('Article')->getCateArticleLists($arg_where, $arg_order, $arg_field, 12); $category = model('ArticleCategory')->getRow(1); $value = [ 'list' => $dataObject->isEmpty() ? null : $dataObject->items(), //$dataObject->getCollection()->toArray() 'page' => $dataObject->render(), 'category' => $category, ]; //echo "
=="; print_r($category);
$this->assign($value);
return $this->view->fetch();
}
public function guide()
{
return $this->view->fetch();
}
public function query()
{
return $this->view->fetch();
}
public function contact()
{
$banners = Loader::model("Banner")->alias('b')->field([
'b.id',
'b.typeid',
'bt.name' => 'typename',
'bt.description' => 'typedesc',
'b.name',
'b.categoryid',
'b.url',
'b.picture',
'b.alt',
'b.style',
'b.description' => 'desc',
'b.descolor',
'b.btncolor',
'b.videourl',
])
->join('banner_type bt', 'bt.stat= 0 and bt.id=b.typeid')
->where('b.stat', '=', 0)
->where('b.typeid', '=', 122)
->order(['sort' => 'asc', 'id' => 'asc'])
->select();
$data = [];
foreach ($banners as $val) {
$link = $val['url'];
if (empty($val['url']) && !empty($val['categoryid'])) {
$link = url_rewrite('productsub', ['id' => $val['categoryid']]);
}
$data[] = [
'id' => $val['id'],
'name' => $val['name'],
'link' => $link,
'picture' => $val['picture'],
'alt' => $val['alt'],
'style' => $val['style'],
'desc' => $val['desc'],
'desc_color' => $val['descolor'],
'btn_color' => $val['btncolor'],
'video_url' => $val['videourl'],
];
}
$this->assign('data', $data);
return $this->view->fetch();
}
public function tutorial()
{
return $this->view->fetch();
}
public function distributor()
{
return $this->view->fetch();
}
public function business()
{
return $this->view->fetch();
}
public function introduction()
{
return $this->view->fetch();
}
public function test()
{
$field = ['a.*', 'b.name', 'b.shortname', 'b.brand_id', 'b.url_tm', 'b.url_jd'];
$special_product_list = db('special_product_relation')->alias('a')->join('product b', 'a.product_id=b.id', 'LEFT')->where(['a.special_id' => 3, 'a.stat' => 0, 'b.stat' => 0])->field($field)->limit(8)->select();
$normal_product = [];
$special_product = [];
foreach ($special_product_list as $key => $value) {
$product_two_img = model('product_two_img')->where(['stat' => 0, 'product_id' => $value['product_id']])->find();
$value['img'] = $product_two_img['image_url'];
if ($value['type'] == 0) {
array_push($normal_product, $value);
} else if ($value['type'] == 1) {
array_push($special_product, $value);
}
}
// tiaoshi($normal_product);
// tiaoshi($special_product);die;
$this->assign('normal_product', $normal_product);
$this->assign('special_product', $special_product);
return $this->view->fetch();
}
public function report()
{
if ($this->customer_id <= 0) {
$this->redirect('/login.html');
}
return $this->view->fetch();
}
public function create_report()
{
if ($this->customer_id <= 0) {
return $this->json(-100, '请先登录');
}
$data = $this->request->post();
if (empty($data) || !is_array($data)) {
return $this->json(-1, '数据错误');
}
if ($data['product_name'] == '') {
return $this->json(-2, '产品名称不能为空');
}
if ($data['product_model'] == '') {
return $this->json(-3, '产品型号不能为空');
}
if ($data['product_manufacturer'] == '') {
return $this->json(-4, '厂商不能为空');
}
// if ($data['buy_source'] == '')
// return $this->json(-5, '购买渠道不能为空');
if ($data['customer_telephone'] != '' && !preg_match("/^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/", $data['customer_telephone'])) {
return $this->json(-6, '手机格式错误');
}
if ($data['customer_email'] != '' && !preg_match("/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/", $data['customer_email'])) {
return $this->json(-7, '邮箱格式错误');
}
$insert_data = [
'customer_id' => $this->customer_id,
'product_name' => $data['product_name'],
'product_model' => $data['product_model'],
'product_manufacturer' => $data['product_manufacturer'],
'buy_source' => $data['buy_source'],
'product_price' => floatval($data['product_price']),
'customer_name' => $data['customer_name'],
'customer_email' => $data['customer_email'],
'customer_telephone' => $data['customer_telephone'],
'description' => $data['description'],
'create_time' => time(),
];
$result = model('report')->insert($insert_data);
if (!$result) {
return $this->json(-8, '提交失败');
}
return $this->json(200, 'ok');
}
public function job()
{
$sql = "SELECT * FROM cod_job
WHERE stat=0
AND NOW() >= publish_time
AND NOW() <= end_time
";
$job_list = \think\Db::query($sql);
// tiaoshi($job_list);die;
$this->assign('job_list', $job_list);
return $this->view->fetch();
}
public function Fake()
{
$data = $this->request->post();
//$this->verify_check($data['captcha'], 'authcode') || $this->error('验证码有误', url('group/test'));
$sn = $data['sn']; //dump($sn);die;
$sn = $this->https_request('http://mes.orico.com.cn:8084/api/values/', $sn);
dump($sn);die;
}
//CURL POST请求
public function https_request($url, $data = null)
{
$apiUrl = "$url$data"; //print_r($apiUrl);die;
$oCurl = curl_init();
if (stripos($apiUrl, "https://") !== false) {
curl_setopt($oCurl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($oCurl, CURLOPT_SSL_VERIFYHOST, false);
}
curl_setopt($oCurl,CURLOPT_TIMEOUT,5);
curl_setopt ($oCurl, CURLOPT_HEADER, 0);
curl_setopt($oCurl, CURLOPT_HTTPHEADER, []);
curl_setopt($oCurl, CURLOPT_URL, $apiUrl);
curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($oCurl, CURLOPT_FOLLOWLOCATION, 3);
$sContent = curl_exec($oCurl);
$aStatus = curl_getinfo($oCurl);
curl_close($oCurl);
if(intval($aStatus["http_code"])==200){
return $sContent;
}else{
return false;
}
}
//可以发送get和post的请求方式
public function curl_request($url, $method = 'get', $data = null, $https = true)
{
//1.初识化curl
$ch = curl_init($url);
//2.根据实际请求需求进行参数封装
//返回数据不直接输出
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
//如果是https请求
if($https === true){
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
}
//如果是post请求
if($method === 'post'){
//开启发送post请求选项
curl_setopt($ch,CURLOPT_POST,true);
//发送post的数据
curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
}
//3.发送请求
$result = curl_exec($ch);
dump($result);die;
//4.返回返回值,关闭连接
curl_close($ch);
return $result;
}
/**
* post
* post方式请求资源
* @param string $url 基于的baseUrl
* @param array $keysArr 请求的参数列表
* @param int $flag 标志位
* @return string 返回的资源内容
*/
public function post($url, $keysArr, $flag = 0)
{
$ch = curl_init();
if (!$flag) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $keysArr);
curl_setopt($ch, CURLOPT_URL, $url);
$ret = curl_exec($ch);
curl_close($ch);
return $ret;
}
}