admin/app/shop/controller/NewBaseShop.php

70 lines
2.0 KiB
PHP

<?php
/** ZJMall商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2022-2032 四川正今科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.zjphp.com
* 这不是自由软件!未经允许不得用于商业目或程序代码摘取及修改。
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布传播。
* 唯一发布渠道官方颁发授权证书,无纸质授权凭证书视为侵权行为。
* =========================================================
*/
namespace app\shop\controller;
error_reporting(E_ALL ^ E_NOTICE);
class NewBaseShop extends BaseShop{
protected $thisDefaultModel = '';// 当前控制器默认的模型 为空则不存在
/**
* Common: 公共内容 —— 列表获取
* Author: wu-hui
* Time: 2022/10/18 14:05
*/
public function index(){
return $this->thisDefaultModel->getList($this->site_id);
}
/**
* Common: 公共内容 —— 添加/编辑信息
* Author: wu-hui
* Time: 2022/10/18 14:09
*/
public function editInfo(){
if (request()->isAjax()) {
// 参数获取
$info = input('info',[]);
$info['site_id'] = $this->site_id;
return $this->thisDefaultModel->editInfo($info);
} else {
// 获取id
$id = input('id',0);
$this->assign('id',$id);
// 获取信息
if($id > 0){
$info = $this->thisDefaultModel->singleInfo($id);
$this->assign('info',$info['data'] ?? []);
}else{
$this->assign('info',[]);
}
}
}
/**
* Common: 删除单条信息
* Author: wu-hui
* Time: 2022/10/18 14:13
*/
public function delete(){
$id = input('id', 0);
return $this->thisDefaultModel->delInfo($id);
}
}