初始化代码
This commit is contained in:
108
app/shop/model/SeckillConfig.php
Normal file
108
app/shop/model/SeckillConfig.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
namespace app\shop\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class SeckillConfig extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_v2_seckill_config';
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'spe_name'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-10-29 18:54
|
||||
* @功能说明:规格名字
|
||||
*/
|
||||
public function getSpeNameAttr($value,$data){
|
||||
|
||||
if(!empty($data['spe_id'])){
|
||||
|
||||
$spe_model = new GoodsSpePrice();
|
||||
|
||||
$info = $spe_model->dataInfo(['id'=>$data['spe_id']]);
|
||||
|
||||
if(!empty($info)){
|
||||
|
||||
return $info['spe_name_text'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$data['create_time'] = time();
|
||||
|
||||
$res = $this->insert($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:05
|
||||
* @功能说明:编辑
|
||||
*/
|
||||
public function dataUpdate($dis,$data){
|
||||
|
||||
$res = $this->where($dis)->update($data);
|
||||
|
||||
return $res;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataList($dis,$page){
|
||||
|
||||
$data = $this->where($dis)->order('top desc,id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:43
|
||||
* @功能说明:
|
||||
*/
|
||||
public function dataInfo($dis){
|
||||
|
||||
$data = $this->where($dis)->find();
|
||||
|
||||
return !empty($data)?$data->toArray():[];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user