<?php
|
|
namespace app\admin\controller;
|
|
use app\supplier\model\GoodsAnnex;
|
use think\facade\Config;
|
use think\facade\Db;
|
use think\facade\Request;
|
use think\facade\View;
|
use think\Exception;
|
|
class BigvInfo extends Common {
|
/*
|
* 品牌管理
|
*/
|
public function index(): string {
|
$other['title'] = '大V管理';
|
$guide['one']['text'] = '数据审核';
|
$guide['two']['text'] = '大V管理';
|
View::assign('guide', $guide);
|
View::assign('other', $other);
|
return View::fetch('index');
|
}
|
|
/*
|
* 获取商品品牌列表
|
*/
|
public function getBigvInfoList() {
|
try {
|
if (!Request::isPost()) {
|
throw new Exception(lang('request_method_incorrect'));
|
}
|
$kw = input('kw');
|
|
if (!empty($kw)) {
|
$condition[] = array('SBI.first_name', 'like', "%$kw%");
|
}
|
$p = input('page', 1);
|
$_GET['p'] = $p;
|
$other['page_size'] = input('page_size', 20);
|
$order = 'BIGV.is_show desc,BIGV.id asc';
|
|
$count = Db::name('seller_bigv_info')->alias('BIGV')
|
->join('seller_base_info SBI', 'SBI.seller_id=BIGV.seller_id')->where($condition)->count();
|
$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)->page($p, $other['page_size'])->select()->toArray();
|
$other['count'] = $count;
|
if (!$list) {
|
$list = [];
|
}
|
$result['code'] = 200;
|
$result['list'] = $list;
|
$result['other'] = $other;
|
return $this->successResponse($result);
|
|
} catch (\Exception $exc) {
|
return $this->errorResponse($exc->getMessage());
|
}
|
}
|
|
function updateExt() {
|
try {
|
if (!Request::isPost()) {
|
throw new Exception(lang('request_method_incorrect'));
|
}
|
$postField = 'id,is_show';
|
$data = Request::only(explode(',', $postField), 'post');
|
if (!$data['id']) {
|
throw new Exception(lang('parameter_error'));
|
}
|
Db::name('seller_bigv_info')->update($data);
|
$result['message'] = '操作成功';
|
return $this->successResponse($result);
|
} catch (\Exception $exc) {
|
return $this->errorResponse($exc->getMessage());
|
}
|
}
|
|
|
}
|