Files
2020-08-06 15:26:41 +08:00

71 lines
1.8 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +------------------------------------------------+
// |http://www.cjango.com |
// +------------------------------------------------+
// | 修复BUG不是一朝一夕的事情等我喝醉了再说吧 |
// +------------------------------------------------+
// | Author: 小陈叔叔 <Jason.Chen> |
// +------------------------------------------------+
namespace app\common\service;
use app\common\model\Banner as BannerModel;
use app\common\validate\Banner as BannerValidate;
class Banner extends _Init
{
/**
* 添加信息
* @param [type] $data 广告数据
*/
public static function create($data)
{
$validate = new BannerValidate();
if (!$validate->scene('add')->check($data)) {
return $validate->getError();
}
$info = BannerModel::create($data);
if ($info) {
return true;
} else {
return '创建广告失败';
}
}
/**
* 编辑广告
* @param [type] $data 更新的数据
* @return [type] 返回 修改的结果
*/
public static function edit($data)
{
$validate = new BannerValidate();
if (!$validate->scene('add')->check($data)) {
return $validate->getError();
}
$info = BannerModel::update($data);
if ($info) {
return true;
} else {
return '编辑广告失败';
}
}
/**
* 删除广告
* @param [type] $id 要删除的广告id
* @return [type] 返回 结果
*/
public static function del($uid)
{
if (BannerModel::where('uid',$uid)->delete()) {
return true;
} else {
return '删除失败';
}
}
}