105 行
6.0 KiB
PHP
可执行文件
105 行
6.0 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace Common\Model;
|
||
|
||
use Think\Model;
|
||
|
||
//[1.6.36]
|
||
|
||
/**
|
||
* 加盟店对账记录表
|
||
* Class RetailFranchiseeBillModel
|
||
* @package Common\Model
|
||
*/
|
||
class RetailFranchiseeBillModel extends BaseModel
|
||
{
|
||
protected $tableName = 'retail_franchisee_bill';
|
||
protected $fields = array(
|
||
'id', //int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||
'merchant_id', //int(11) DEFAULT NULL COMMENT '商户id',
|
||
'store_id', //int(11) DEFAULT NULL COMMENT '门店id',
|
||
'name', //varchar(16) DEFAULT NULL COMMENT '门店名称(弃用)',
|
||
'franchisee_time', //varchar(40) DEFAULT NULL COMMENT '结算日期',
|
||
'apply_time', //varchar(11) DEFAULT NULL COMMENT '申请时间',
|
||
'data_type', //tinyint(1) DEFAULT NULL COMMENT '结算方式描述:1提现 2平账 ',
|
||
'all_income', //decimal(20,2) DEFAULT '0.00' COMMENT '总收入',
|
||
'business_income', //decimal(20,2) DEFAULT '0.00' COMMENT '现金+其他支付的营业订单/快捷收入',
|
||
'business_recharge',//decimal(20,2) DEFAULT NULL COMMENT '现金+其他支付的充值',
|
||
'online_income', //decimal(20,2) DEFAULT NULL COMMENT '微信+支付宝的营业订单/快捷收入',
|
||
'balance_income', //decimal(20,2) DEFAULT NULL COMMENT '余额支付的营业/快捷收入',
|
||
'online_recharge', //decimal(20,2) DEFAULT NULL COMMENT '微信+支付宝的充值',
|
||
'give_recharge', //decimal(20,2) DEFAULT NULL COMMENT '所有充值赠送的金额(仅记账使用,不做计算)',
|
||
'offline_refund_money',//decimal(20,2) DEFAULT NULL COMMENT '现金+其他支付的营业订单/快捷退款',
|
||
'offline_refund_recharge',//decimal(20,2) DEFAULT NULL COMMENT '现金+其他支付的充值退款',
|
||
'online_refund_money',//decimal(20,2) DEFAULT NULL COMMENT '微信+支付宝的营业订单/快捷退款',
|
||
'balance_refund_money',//decimal(20,2) DEFAULT NULL COMMENT '余额支付的营业/快捷退款',
|
||
'online_refund_recharge',//decimal(20,2) DEFAULT NULL COMMENT '微信+支付宝的充值退款',
|
||
'other_money', //decimal(20,2) DEFAULT '0.00' COMMENT '其他金额(结算需要减少的金额:分销佣金,其他待定)',
|
||
'actual_income', //decimal(20,2) DEFAULT '0.00' COMMENT '实际可结算营收金额',
|
||
'money', //decimal(20,2) DEFAULT '0.00' COMMENT '实际可提现/平账金额',
|
||
'status', //tinyint(1) DEFAULT NULL COMMENT '审核状态:1待提现 2提现待审核 3提现驳回 4提现通过待贷款 5已打款 6平账待审核 7平账驳回 8已平账 9待平账 10无需操作',
|
||
'service_charge', //decimal(20,2) DEFAULT '0.00' COMMENT '营业/快捷收入手续费(不含现金与其他支付)',
|
||
'refund_service_charge',//decimal(20,2) DEFAULT '0.00' COMMENT '营业/快捷退款手续费(不含现金与其他支付)',
|
||
'periods', //int(10) DEFAULT '0' COMMENT '结算周期',
|
||
'add_time', //varchar(20) DEFAULT NULL COMMENT '创建时间',
|
||
'rate', //decimal(6,2) DEFAULT NULL COMMENT '费率',
|
||
'reject_reason', //varchar(255) DEFAULT NULL COMMENT '驳回原因',
|
||
'type', //tinyint(1) DEFAULT NULL COMMENT '计算周期:1日结 2周结 3月结',
|
||
'reject_time', //varchar(20) DEFAULT NULL COMMENT '驳回时间',
|
||
'reject_img_id', //varchar(128) DEFAULT NULL COMMENT '平账截图图片ID',
|
||
'settlement_json', //varchar(1000) DEFAULT NULL COMMENT '打款信息(json串)',
|
||
'version', //tinyint(2) DEFAULT '1' COMMENT '版本类型 1:1.0版本账单 2:2.0版本账单',
|
||
'recharge_income', //decimal(20,2) DEFAULT '0.00' COMMENT '充值金额(2.0废弃)',
|
||
'refund_money', //decimal(20,2) DEFAULT '0.00' COMMENT '退款金额(不含现金与其他支付的金额)(2.0废弃)',
|
||
);
|
||
|
||
/**
|
||
* 列表条件
|
||
* @param $parameter [user_type=>[ 1商户 2门店],type=>[ 1日结 2周结 3月结],
|
||
* data_type=>[ 1提现 2平账],status=>[审核状态 1待提现 2提现待审核 3提现驳回 4提现通过待贷款 5已打款 6平账待审核 7平账驳回 8已平账 9待平账 10无需操作],
|
||
* ]
|
||
* @return mixed
|
||
*/
|
||
public function getMap($parameter)
|
||
{
|
||
if (!empty($parameter['id'])) {
|
||
$map['id'] = $parameter['id'];
|
||
} else {
|
||
if ($parameter['user_type'] == 1) {
|
||
if (!empty($parameter['name'])) {
|
||
$map['name'] = array('like', '%' . $parameter['name'] . '%');
|
||
}
|
||
$field = 'id,name,periods,store_id,franchisee_time,apply_time,data_type,money,status,add_time';
|
||
} else {
|
||
$map['store_id'] = $parameter['store_id'];
|
||
$field = 'id,periods,store_id,franchisee_time,data_type,money,status,add_time,name,apply_time';
|
||
}
|
||
if (!empty($parameter['type'])) {
|
||
$map['type'] = $parameter['type'];
|
||
}
|
||
if (!empty($parameter['data_type'])) {
|
||
$map['data_type'] = $parameter['data_type'];
|
||
}
|
||
if (!empty($parameter['status'])) {
|
||
$map['status'] = $parameter['status'];
|
||
}
|
||
// 账单生成时间
|
||
if (!empty($parameter['start_time']) && !empty($parameter['end_time'])) {
|
||
$start_time = strtotime($parameter['start_time']);
|
||
$end_time = strtotime($parameter['end_time']);
|
||
$map['add_time'] = array('between', array($start_time, $end_time));
|
||
}
|
||
}
|
||
$map['merchant_id'] = $parameter['merchant_id'];
|
||
|
||
$res = array(
|
||
'status'=>1,
|
||
'msg'=>'条件查询成功',
|
||
'data'=>array(
|
||
'where'=>$map,
|
||
'field'=>$field?$field:"*"
|
||
)
|
||
);
|
||
return $res;
|
||
}
|
||
} |