application/admin/controller/product/Category.php

(开头部分) 4KB

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

<?php
/**
 * 易想会员管理营销系统
 * =========================================================
 * 天津市华易动力信息科技有限公司 , 保留所有权利。
 * ----------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
 * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
 * =========================================================
 * @author : hy_team
 * @date : 2019-08-10
 */

namespace app\admin\controller\product;
use app\common\controller\Common;
use app\common\model\ProductCategory;

class Category extends Common
{
	// 分类列表
	public function index()
	{
		$nameAll = ProductCategory::column('name','id');
		$list = ProductCategory::where('depth','<=',2)->order(['rank'=>'desc','id'=>'desc'])->select();
		foreach ($list as $key => $value) {
			if($value['pid'] > 0){
				$list[$key]['pname'] = $nameAll[$value['pid']];
			}else{
				$list[$key]['pname'] = '产品';
			}
		}
	    
		$listCategory = fun_category_tree($list,0,1);
		$this->assign('list',$list);
		$this->assign('listCategory',$listCategory);
		return view();
	}

	// 新增分类
	public function add()
	{
		$map = [];
		$map[] = ['depth','<=',1];
		$list = ProductCategory::where($map)->order(['rank'=>'desc','id'=>'desc'])->select();
		$listCategory = fun_category_tree($list,0,1);

		if (check_form_token() && $this->request->isPost()) {
			$data = $this->request->param();
			if(!$data['name']){
				$this->error('分类名称不能为空');
			}

			if($data['depth'] > 2){
				$this->error('分类不能超过二级分类');
			}

			$data['create_time'] = time();
			$data['update_time'] = time();
			unset($data['__token__']);
			unset($data['submit']);
后面还有 109 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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