application/admin/controller/Goods.php

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace app\admin\controller;
use think\Request;
use app\admin\model\GoodsBrandSpace;
use app\admin\model\GoodsTypeSpace;
use app\admin\model\GoodsSpace;
use app\admin\model\AuthGroup;
class Goods extends Base {
    //管理员列表
    public function index() {
        $brandlist = GoodsBrandSpace::all();
        $typelist = GoodsTypeSpace::all();
            foreach ($typelist as $value) {
           $new_typelist[$value['id'] ] = $value['type_name'] ;
            }
             foreach ($brandlist as $value) {
           $new_typelist[$value['id'] ] = $value['brand_name'] ;
            }
        $goodslist = GoodsSpace::all();
        foreach ($goodslist as $value) {
            $value['arr_pic'] = explode(",", $value['pic']);
             $value['type_name1'] = $new_typelist[$value['goods_type']];
               $value['type_name2'] = $new_typelist[$value['goods_type2']];
                 $value['type_name3'] = $new_typelist[$value['goods_type3']];
                 $value['brand_name'] = $new_typelist[$value['brand']];
            $goodslist_new[] = $value;
        }
        $this->assign('brandlist', $brandlist);
        $this->assign('typelist', $typelist);
        $this->assign('goodslist', $goodslist_new);
        return $this->fetch();
    }

    //添加管理员 页面
    public function add_goods() {
        $AuthGroup = AuthGroup::all();
        $this->assign('AuthGroup', $AuthGroup);
        $brandlist = GoodsBrandSpace::all();
        $this->assign('brandlist', $brandlist);
        $cate = goods_type_tree();
        $this->assign('cate', $cate);
        return $this->fetch();
    }

    //编辑管理员 页面
    public function edit_goods($id) {
        $GoodsSpace = GoodsSpace::get(['id' => $id]);
        $cate = goods_type_tree();
        $brandlist = GoodsBrandSpace::all();
        $this->assign('brandlist', $brandlist);
        if ($GoodsSpace['pic']) {
            $arr_pic = explode(",", $GoodsSpace['pic']);
        }
        if ($GoodsSpace['file']) {
            $arr_file = explode(",", $GoodsSpace['file']);
        }
        if ($GoodsSpace['color']) {
            $arr_color = explode(",", $GoodsSpace['color']);
        }
后面还有 51 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。