You've already forked qlg.tsgz.moe
Init Repo
This commit is contained in:
64
hyhproject/common/model/SysSummary.php
Executable file
64
hyhproject/common/model/SysSummary.php
Executable file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
namespace wstmart\common\model;
|
||||
use think\Db;
|
||||
/**
|
||||
* ============================================================================
|
||||
* 系统数据
|
||||
*/
|
||||
class SysSummary extends Base{
|
||||
public function addToPayFast($orderId,$payFastNum,$fastScale){
|
||||
$noticeData['orderId'] = $orderId;
|
||||
$noticeData['toPayFast'] = $payFastNum;
|
||||
$noticeData['fastScale'] = $fastScale;
|
||||
$noticeData['createTime'] = time();
|
||||
Db::name('sys_notice')->insert($noticeData);
|
||||
$this->addSysSummary($payFastNum,0);
|
||||
}
|
||||
/**
|
||||
* 添加系统数据
|
||||
* @param integer $payFastNum [代快付值]
|
||||
* @param integer $payFastSlow [代慢付值]
|
||||
* @param integer $isAdd [1加2减]
|
||||
*/
|
||||
public function addSysSummary($payFastNum=0,$payFastSlow=0,$isAdd=1){
|
||||
if($payFastNum){
|
||||
$this->addSysLog($payFastNum,1,$isAdd);
|
||||
if(1 == $isAdd){
|
||||
$this->where(['id'=>1])->setInc('toPayFast',$payFastNum);
|
||||
}else{
|
||||
$this->where(['id'=>1])->setDec('toPayFast',$payFastNum);
|
||||
}
|
||||
}
|
||||
if($payFastSlow){
|
||||
$this->addSysLog($payFastSlow,2,$isAdd);
|
||||
if(1 == $isAdd){
|
||||
$this->where(['id'=>1])->setInc('toPaySlow',$payFastSlow);
|
||||
}else{
|
||||
$this->where(['id'=>1])->setDec('toPaySlow',$payFastSlow);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 加入系统记录
|
||||
* @param [type] $num [数量]
|
||||
* @param [type] $type [1代快付值 2代慢付值]
|
||||
* @param [type] $changeType [1加 2减]
|
||||
* @param integer $adminId [操作人员ID,0为系统]
|
||||
*/
|
||||
public function addSysLog($num,$type,$changeType=1,$adminId=0){
|
||||
$data['num'] = $num;
|
||||
$data['type'] = $type;
|
||||
$data['changeType'] = $changeType;
|
||||
$data['adminId'] = $adminId;
|
||||
$data['createTime'] = time();
|
||||
Db::name('log_sys_data')->insert($data);
|
||||
}
|
||||
/**
|
||||
* 获取系统数据,代快付,代慢付
|
||||
* @param string $field [description]
|
||||
* @return [type] [description]
|
||||
*/
|
||||
public function getInfo($field='toPayFast'){
|
||||
return $this->where(['id'=>1])->field($field)->find();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user