REAPI/app/setting/service/DongService.php

50 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2024-09-29 15:43:18 +08:00
<?php
namespace app\setting\service;
use app\core\Service;
use app\channel\service\ProductService;
use app\merchant\service\MerchantService;
use app\merchant\service\MerchantLogService;
use app\merchant\service\PercentService;
/**
* 冻结记录服务
* Class ChannelService
* @package app\channel\service
*/
class DongService extends Service
{
/**
* 设置默认操作表
* @var string
*/
public $table = 'merchant_dong_log';
# 更新统计
public function up($day, $mid, $num)
{
$where['day'] = $day;
$where['mid'] = $mid;
$info = $this->db()->where($where)->find();
if ($num <= 0) {
if ($info) {
return $info['num'];
} else {
return 0;
}
}
if (!$info) {
$update = $where;
$update['num'] = $num;
$this->db()->insert($update);
} else {
$where['id'] = $info['id'];
$update['num'] = $num;
$this->db()->where($where)->update($update);
}
return $num;
}
}