init
This commit is contained in:
316
app/mobile/controller/Group.php
Executable file
316
app/mobile/controller/Group.php
Executable file
@@ -0,0 +1,316 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: ORICO
|
||||
* Date: 2018-09-21
|
||||
* Time: 17:36
|
||||
*/
|
||||
|
||||
namespace app\mobile\controller;
|
||||
|
||||
use think\Loader;
|
||||
|
||||
class Group extends BaseController
|
||||
{
|
||||
public function index(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function odm(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function special(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function h_speed(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function job(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function policy(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function culture(){
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function decennial(){
|
||||
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 faq(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function honor(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function industry(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function weare(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function wewill(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function vision(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function distributor2023(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function introduction(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function business(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function rdcenter(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function brand(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function achievement(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function mileage(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function search(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function transparent(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function distributor(){
|
||||
|
||||
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 ufo(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function ssd(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function thunderbolt_3(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function stripe(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function pssd(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function series_95(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function backup(){
|
||||
|
||||
return $this->view->fetch();
|
||||
}
|
||||
public function download(){
|
||||
$keywords_pa = $this->request->param();
|
||||
$keywords = '';
|
||||
$map['stat'] = 0;
|
||||
$map['cid'] = 43;
|
||||
if ( !empty($keywords_pa['keywords']) ) {
|
||||
$keywords = $keywords_pa['keywords'];
|
||||
$map['name|app_model'] = array('like',"%$keywords%");
|
||||
}
|
||||
$downloads = model('download')->where($map)->select();
|
||||
$this->assign('downloads',$downloads);
|
||||
$this->assign('keywords',$keywords);
|
||||
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 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 question_detail()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$question = model('question')->where(['id' => $id, 'stat' => 0])->find();
|
||||
if (empty($question))
|
||||
return $this->error('没有该问题');
|
||||
|
||||
// tiaoshi($question);die;
|
||||
$this->assign('question', $question);
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user