初始化代码
This commit is contained in:
116
app/farm/model/ShopRefundGoods.php
Normal file
116
app/farm/model/ShopRefundGoods.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
namespace app\farm\model;
|
||||
|
||||
use app\BaseModel;
|
||||
use think\facade\Db;
|
||||
|
||||
class ShopRefundGoods extends BaseModel
|
||||
{
|
||||
//定义表名
|
||||
protected $name = 'lbfarm_shop_refund_order_goods';
|
||||
|
||||
|
||||
|
||||
protected $append = [
|
||||
|
||||
'pay_price'
|
||||
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2021-12-17 14:10
|
||||
* @功能说明:获取商品实付价格
|
||||
*/
|
||||
public function getPayPriceAttr($value,$data){
|
||||
|
||||
if(!empty($data['order_goods_id'])){
|
||||
|
||||
$order_goods_model = new ShopOrderGoods();
|
||||
|
||||
$price = $order_goods_model->where(['id'=>$data['order_goods_id']])->sum('singe_pay_price');
|
||||
|
||||
return $price;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:04
|
||||
* @功能说明:添加
|
||||
*/
|
||||
public function dataAdd($data){
|
||||
|
||||
$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('id desc')->paginate($page)->toArray();
|
||||
|
||||
return $data;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @author chenniang
|
||||
* @DataTime: 2020-09-29 11:06
|
||||
* @功能说明:列表
|
||||
*/
|
||||
public function dataSelect($dis){
|
||||
|
||||
$data = $this->where($dis)->order('id desc')->select()->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