chengkun
2025-09-04 2e12809f4d16aa00239b5e2c6a13a9a51842d134
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?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());
        }
    }
 
 
}