王总上门按摩后台代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

153 lines
2.5 KiB

<?php
namespace app\massage\model;
use app\BaseModel;
use think\facade\Db;
class CommShare extends BaseModel
{
//定义表名
protected $name = 'massage_service_order_commission_share';
/**
* @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('status 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():[];
}
/**
* @author chenniang
* @DataTime: 2021-03-19 16:08
* @功能说明:开启默认
*/
public function updateOne($id){
$user_id = $this->where(['id'=>$id])->value('user_id');
$res = $this->where(['user_id'=>$user_id])->where('id','<>',$id)->update(['status'=>0]);
return $res;
}
/**
* @param $uniacid
* @param $balance
* @param $cash
* @param $id
* @param $type
* @param int $share_id
* @功能说明:
* @author chenniang
* @DataTime: 2023-05-23 17:41
*/
public function addData($uniacid,$balance,$cash,$id,$type,$order_id,$share_id=0){
$insert = [
'uniacid' => $uniacid,
'comm_id' => $id,
'share_balance' => $balance,
'share_cash' => $cash,
'type' => $type,
'share_id' => $share_id,
'order_id' => $order_id,
];
$res = $this->insert($insert);
return $res;
}
/**
* @author chenniang
* @DataTime: 2023-05-23 18:03
* @功能说明:获取分摊比例
*/
public function getShareBalance($comm_id,$type){
$dis = [
'comm_id' => $comm_id,
'type' => $type
];
$balance = $this->where($dis)->value('share_balance');
return !empty($balance)?$balance:0;
}
}