diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 2c14aa8a1..d8fbfc593 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -430,17 +430,33 @@ class PaymentController extends BaseController // $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find(); - $dbres['company_info'] = json_decode($v['company_info'],true); + $company_info = json_decode($dbres['company_info'],true); //TODO:未进行真实打款 if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){ //执行打款 - // $payres = json_decode( json_encode( $object),true); + $title = "测试-".$dbres['company_name']."结算"; + $amount = $dbres['statement_money']; + $amount = 0.1;//测试金额为0 + $payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title); + $resultCode = $payres->code; + + + $savedata = ["id"=>$dbres['id']]; + if(!empty($resultCode)&&$resultCode == 10000){ + $savedata["pay_status"]=1; + } else { + $savedata["pay_status"]=-1; + } + + $payres = json_decode( json_encode($payres),true); $payres["remark"] = $remark; - $dbres["payinfo"] = json_encode($payres,JSON_UNESCAPED_UNICODE); - $dbres["pay_status"]=1; - $dbres["pay_type"]=2; + + $savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE); + $savedata["pay_type"]=2; + $savedata["pay_time"]=time(); + } - M("company_statement_info","tab_")->save($dbres); + M("company_statement_info","tab_")->save($savedata); $this->ajaxReturn(["success"=>"打款成功","data"=>[]]); # code... } diff --git a/Data/update.sql b/Data/update.sql index 18277380e..860db67b1 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1751,12 +1751,9 @@ ADD COLUMN `old_change_promote_id` int(11) NULL DEFAULT 0 COMMENT '修改配置 ADD COLUMN `old_change_promote_account` varchar(30) NULL COMMENT '修改配置前渠道账号' ; --20200518 chenzhi - ---新增支付宝打款配置项 -INSERT INTO `tab_tool` (`name`,`title`, `config`,`type`, `status`, `create_time`) VALUES ('transfer_set', '支付宝打款设置','{"user_id":"","user_num":"","phone":"","type":"1","typestr":"支付宝"}', '1', '1','1589270284'); - --新增上游结算接口 INSERT INTO `sys_kv` (`key`, `value`, `type`, `remark`) VALUES ('aggregate_cp_settlement_api', 'http://admin.wmtxkj.com/index.php?g=api&m=FinanceWeekCount&a=returnCPSettlement', 'string', '聚合cp结算Api地址'); +INSERT INTO `sys_kv` (`key`, `value`, `type`, `remark`) VALUES ('payment_check_mobile', '18959188422', 'string', '打款登陆验证手机'); --新增游戏分成模板 CREATE TABLE `tab_game_ratio_mould` ( @@ -1803,12 +1800,12 @@ CREATE TABLE `tab_company_game_ratio_log` ( `company_id` int(11) NOT NULL DEFAULT '0' COMMENT '推广公司id', `relation_game_id` int(11) NOT NULL DEFAULT '0' COMMENT '关联游戏id', `ratio` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '分成比例', - `turnover_ratio` varchar(2000) COLLATE utf8mb4_bin NOT NULL COMMENT '流水分成比例', + `turnover_ratio` varchar(2000) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '流水分成比例', `last_ratio` decimal(5,2) NOT NULL DEFAULT '0.00' COMMENT '上次的分成比例', - `last_turnover_ratio` varchar(2000) COLLATE utf8mb4_bin NOT NULL COMMENT '上次流水分成比例', + `last_turnover_ratio` varchar(2000) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '上次流水分成比例', `begin_time` int(11) NOT NULL DEFAULT '0' COMMENT '开始时间', `end_time` int(11) NOT NULL DEFAULT '0' COMMENT '过期时间', - `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '备注', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', `status` tinyint(3) NOT NULL DEFAULT '0' COMMENT '审核状态:-2管理员拒绝 -1市场部拒绝 0-待审核 1-市场部通过 2管理员通过', `verify_log` varchar(2000) COLLATE utf8mb4_bin NOT NULL COMMENT '审核详细信息', PRIMARY KEY (`id`), @@ -1858,7 +1855,6 @@ CREATE TABLE `tab_company_relation_log` ( KEY `status` (`status`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='公司关系绑定申请记录'; --- CREATE TABLE `tab_company_statement` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', `withdraw_type` tinyint(2) DEFAULT '0' COMMENT '对账类型(0-周结 1月结 2补点)', @@ -1876,13 +1872,13 @@ CREATE TABLE `tab_company_statement` ( `platform_amount` decimal(10,2) DEFAULT '0.00' COMMENT '平台流水金额', `verify_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '审核状态 -2:汇总驳回 -1审批拒绝 0:系统生成 1:审核通过 2:对外发起 3:合作确认 4:汇总', - `verify_log` text NOT NULL DEFAULT '' COMMENT '审批相关信息json', + `verify_log` text NOT NULL COMMENT '审批相关信息json', `pay_type` tinyint(2) DEFAULT '0' COMMENT '1甲方收款;2乙方收款', - `first_party_info` text NOT NULL DEFAULT '' COMMENT '甲方相关信息json', - `second_party_info` text NOT NULL DEFAULT '' COMMENT '乙方相关信息json', - `statement_info` text NOT NULL DEFAULT '' COMMENT '订单相关信息json', + `first_party_info` text NOT NULL COMMENT '甲方相关信息json', + `second_party_info` text NOT NULL COMMENT '乙方相关信息json', + `statement_info` text NOT NULL COMMENT '订单相关信息json', `op_time` int(11) NOT NULL DEFAULT '0' COMMENT '操作时间', - `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '备注', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`), KEY `withdraw_type` (`withdraw_type`) USING BTREE, KEY `company_id` (`company_id`) USING BTREE, @@ -1914,13 +1910,13 @@ CREATE TABLE `tab_company_statement_pool` ( `withdraw_money` decimal(10,2) DEFAULT '0.00' COMMENT '提现成功金额', `verify_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '审核状态 -2:打款失败 -1审批拒绝 0:未审批 1:审核通过 2:待打款 3:打款中 4:打款成功', - `verify_log` text NOT NULL DEFAULT '' COMMENT '审批相关信息json', + `verify_log` text NOT NULL COMMENT '审批相关信息json', `ext_file` text COMMENT '凭证地址', `company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质: 1-下游公司 2-下游个人 3上游公司', `is_payment` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否需要打款:1-是 2-否(线下)', `op_time` int(11) NOT NULL DEFAULT '0' COMMENT '操作时间', - `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '备注', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`), KEY `statement_num` (`statement_num`) USING BTREE, KEY `statement_begin_time` (`statement_begin_time`) USING BTREE, @@ -1935,7 +1931,7 @@ CREATE TABLE `tab_company_statement_info` ( `company_id` int(11) DEFAULT '0' COMMENT '对账公司id', `company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质: 1-下游公司 2-下游个人 3上游公司', `company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '对账公司名称', - `company_info` text NOT NULL DEFAULT '' COMMENT '公司其他信息json', + `company_info` text NOT NULL COMMENT '公司其他信息json', `statement_money` decimal(10,2) DEFAULT '0.00' COMMENT '对账金额', `pay_amount` decimal(10,2) DEFAULT '0.00' COMMENT '总计', @@ -1946,14 +1942,14 @@ CREATE TABLE `tab_company_statement_info` ( `statement_begin_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账开始时间', `statement_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账截止时间', `statement_num` varchar(500) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '结算单号', - `statement_info` text NOT NULL DEFAULT '' COMMENT '订单相关信息json', + `statement_info` text NOT NULL COMMENT '订单相关信息json', `verify_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '验证状态 -1:配置信息不全 0:信息未确认 1:允许打款 2:线下无需打款', `pay_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '打款状态 -1:打款失败 0:未打款 1:打款成功', `pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '支付完成时间', `pay_type` tinyint(2) NOT NULL DEFAULT '0' COMMENT '打款类型 1提现 2线上打款 3线下打款', - `pay_info` text NOT NULL DEFAULT '' COMMENT '打款信息', + `pay_info` text NOT NULL COMMENT '打款信息', - `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL COMMENT '备注', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`), KEY `company_tid` (`company_id`,`company_type`) USING BTREE, KEY `statement_begin_time` (`statement_begin_time`) USING BTREE, @@ -1967,7 +1963,7 @@ CREATE TABLE `tab_company_lack_statement_info` ( `company_id` int(11) DEFAULT '0' COMMENT '对账公司id', `company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质: 1-下游公司 2-下游个人 3上游公司', `company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '对账公司名称', - `company_info` text NOT NULL DEFAULT '' COMMENT '公司其他信息json', + `company_info` text NOT NULL COMMENT '公司其他信息json', `statement_money` decimal(10,2) DEFAULT '0.00' COMMENT '对账金额', `pay_amount` decimal(10,2) DEFAULT '0.00' COMMENT '总计', @@ -1977,7 +1973,7 @@ CREATE TABLE `tab_company_lack_statement_info` ( `statement_begin_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账开始时间', `statement_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账截止时间', - `statement_info` text NOT NULL DEFAULT '' COMMENT '订单相关信息json', + `statement_info` text NOT NULL COMMENT '订单相关信息json', `statement_pool_num` varchar(500) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '生成此单的汇总单单号', `is_payment` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否需要打款:1-是 2-否(线下)', `is_pool` tinyint(3) NOT NULL DEFAULT '0' COMMENT '是否被汇总:0否/1是',