<?php
|
|
namespace app\home\controller;
|
|
use app\supplier\model\Goods as GoodsModel;
|
use think\facade\Db;
|
use think\facade\View;
|
use think\facade\Request;
|
use app\BaseController;
|
|
class Index extends BaseController {
|
public function index() {
|
$list = Db::name('blog')->where('status', 1)->limit(10)->order('id desc')->select()->toArray();
|
View::assign('list', $list);
|
return View::fetch('index');
|
}
|
|
public function talent() {
|
return View::fetch();
|
}
|
|
public function test() {
|
return View::fetch();
|
}
|
|
public function test1() {
|
return View::fetch();
|
}
|
|
public function getGoodsList() {
|
try {
|
if (!Request::isPost()) {
|
throw new Exception(lang('request_method_incorrect'));
|
}
|
$condition[] = ['g.status', '=', 1];
|
$condition[] = ['g.is_show', '=', 1];
|
$order = 'g.id asc';
|
$list = GoodsModel::alias('g')
|
->join('goods_desc gd', 'g.id=gd.goods_id')
|
->field("g.id,g.supplier_goods_code,g.status,gd.goods_title_cn,gd.goods_title_en,(select url from web_goods_picture where goods_id=g.id order by id asc limit 1) as picture")->where($condition)->order($order)->limit(18)->select()->toArray();
|
if (!$list) {
|
$list = [];
|
} else {
|
foreach ($list as $key => $value) {
|
$list[$key]['picture'] = get_img_url($value['picture']);
|
}
|
}
|
$result['list'] = $list;
|
return $this->successResponse($result);
|
} catch (Exception $exc) {
|
return $this->errorResponse($exc->getMessage());
|
}
|
}
|
|
public function getBigvList() {
|
try {
|
if (!Request::isPost()) {
|
throw new Exception(lang('request_method_incorrect'));
|
}
|
$condition[] = ['BIGV.is_show', '=', 1];
|
$order = 'BIGV.id asc';
|
$list = Db::name('seller_bigv_info')->alias('BIGV')
|
->join('seller_base_info SBI', 'SBI.seller_id=BIGV.seller_id')
|
->field("BIGV.*,SBI.first_name")->withAttr('personal_images', function ($value) {
|
return json_decode($value, TRUE);
|
})->where($condition)->order($order)->limit(6)->select()->toArray();
|
if (!$list) {
|
$list = [];
|
}
|
$result['list'] = $list;
|
return $this->successResponse($result);
|
} catch (Exception $exc) {
|
return $this->errorResponse($exc->getMessage());
|
}
|
}
|
|
public function getSchoolList() {
|
try {
|
if (!Request::isPost()) {
|
throw new Exception(lang('request_method_incorrect'));
|
}
|
$order = 'order_id asc,id asc';
|
$list = Db::name('partner_school')->field("*")->order($order)->limit(30)->select()->toArray();
|
if (!$list) {
|
$list = [];
|
}
|
$result['list'] = $list;
|
return $this->successResponse($result);
|
} catch (Exception $exc) {
|
return $this->errorResponse($exc->getMessage());
|
}
|
}
|
|
public function getSalesPlatformList() {
|
try {
|
if (!Request::isPost()) {
|
throw new Exception(lang('request_method_incorrect'));
|
}
|
$condition[] = ['is_show', '=', 1];
|
$order = 'order_id asc,id asc';
|
$list = Db::name('sales_platform')->field("*")->where($condition)->order($order)->limit(6)->select()->toArray();
|
if (!$list) {
|
$list = [];
|
}
|
else{
|
foreach ($list as $key => $value) {
|
$list[$key]['logo'] = get_img_url($value['logo']);
|
}
|
}
|
$result['list'] = $list;
|
return $this->successResponse($result);
|
} catch (Exception $exc) {
|
return $this->errorResponse($exc->getMessage());
|
}
|
}
|
|
}
|