...
|
...
|
@@ -10,6 +10,7 @@ namespace api\portal\controller; |
|
|
|
|
|
|
|
|
use api\portal\model\AgencyModel;
|
|
|
use api\portal\model\OrderModel;
|
|
|
use api\portal\model\UserNeedModel;
|
|
|
use cmf\controller\HomeBaseController;
|
|
|
use api\portal\model\PortalPostModel;
|
...
|
...
|
@@ -59,7 +60,7 @@ class ThirdsendController extends HomeBaseController |
|
|
|
|
|
// 查询中介报价(暂未用)
|
|
|
// $need_id 需求id
|
|
|
public function Offer($user_id,$need_id){
|
|
|
public function Offer($user_id,$need_id){
|
|
|
$where_agency['status'] = 2;
|
|
|
$where_agency['create_time'] = array('lt',time());
|
|
|
$where_agency['need_id'] = $need_id;
|
...
|
...
|
@@ -83,7 +84,7 @@ class ThirdsendController extends HomeBaseController |
|
|
foreach ($agency_list as $finalk=>$finalv){
|
|
|
foreach ($money_arr as $monryk=>$moneyv){
|
|
|
if($finalv['true_money'] == $moneyv){
|
|
|
$return[] = $finalv;
|
|
|
$return[] = $finalv;
|
|
|
}
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -184,166 +185,139 @@ class ThirdsendController extends HomeBaseController |
|
|
// 查询相应报价
|
|
|
$final_time = $userNeedList['pay_time'] + $userNeedList['quotation_time'] * 86400;
|
|
|
// 判断时间是否正确
|
|
|
if ($time >= $final_time) {
|
|
|
if ($time >= $final_time) {
|
|
|
// $us_middleid = $uNeedv['id'];
|
|
|
$where_agency['a.status'] = 2;
|
|
|
$where_agency['a.pay_time'] = array('lt', time());
|
|
|
$where_agency['a.need_id'] = $userNeedList['id'];
|
|
|
$where_agency['m.type'] = 2;
|
|
|
$where_agency['m.status'] = 1;
|
|
|
$agency_list = Db::name('Agency')->alias('a')
|
|
|
->where($where_agency)
|
|
|
->join("hp_Member m", 'm.id = a.agency_id')
|
|
|
->field('a.*,m.company')
|
|
|
->select()->toArray();
|
|
|
$where_agency['a.status'] = 2;
|
|
|
$where_agency['a.pay_time'] = array('lt', time());
|
|
|
$where_agency['a.need_id'] = $userNeedList['id'];
|
|
|
$where_agency['m.type'] = 2;
|
|
|
$where_agency['m.status'] = 1;
|
|
|
$agency_list = Db::name('Agency')->alias('a')
|
|
|
->where($where_agency)
|
|
|
->join("hp_Member m", 'm.id = a.agency_id')
|
|
|
->field('a.*,m.company')
|
|
|
->select()->toArray();
|
|
|
// 查询品牌企业
|
|
|
$where_brand['status'] = 1;
|
|
|
$band_list = Db::name('Brand')->where($where_brand)->column('name');
|
|
|
$agen_arr = array();
|
|
|
if ($agency_list) {
|
|
|
$where_brand['status'] = 1;
|
|
|
$band_list = Db::name('Brand')->where($where_brand)->column('name');
|
|
|
$agen_arr = array();
|
|
|
if ($agency_list) {
|
|
|
// 删除十万以内报价
|
|
|
foreach ($agency_list as $tenk=>$tenv){
|
|
|
$ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge'];
|
|
|
if($ten_money > 1000000){
|
|
|
$is_trueMoney[] = $tenv;
|
|
|
}
|
|
|
foreach ($agency_list as $tenk=>$tenv){
|
|
|
$ten_money = $tenv['housing_price'] * 10000 + $tenv['assessment_tax'] + $tenv['security_tax'] + $tenv['else_tax'] + $tenv['service_charge'];
|
|
|
if($ten_money > 1000000){
|
|
|
$is_trueMoney[] = $tenv;
|
|
|
}
|
|
|
// 判断是否超过三个报价人
|
|
|
if (count($is_trueMoney) >= 3) {
|
|
|
}
|
|
|
// 判断是否超过三个报价人
|
|
|
if (count($is_trueMoney) >= 3) {
|
|
|
|
|
|
|
|
|
// 查询三人中是否有品牌中介
|
|
|
// 循环匹配品牌企业
|
|
|
foreach ($is_trueMoney as $agencyk => $agencyv) {
|
|
|
foreach ($band_list as $brak => $brav) {
|
|
|
foreach ($is_trueMoney as $agencyk => $agencyv) {
|
|
|
foreach ($band_list as $brak => $brav) {
|
|
|
// 判断是否在品牌企业中
|
|
|
if (strstr($brav, $agencyv['company']) !== false) {
|
|
|
if (strstr($brav, $agencyv['company']) !== false) {
|
|
|
// 存在
|
|
|
$agen_money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
|
|
|
if (empty($agen_arr)) {
|
|
|
$agen_money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
|
|
|
if (empty($agen_arr)) {
|
|
|
$agen_arr[0]['money'] = $agen_money;
|
|
|
$agen_arr[0]['id'] = $agencyv['id'];
|
|
|
} else {
|
|
|
// 判断大小
|
|
|
if ($agen_money < $agen_arr[0]['money']) {
|
|
|
$agen_arr[0]['money'] = $agen_money;
|
|
|
$agen_arr[0]['id'] = $agencyv['id'];
|
|
|
} else {
|
|
|
// 判断大小
|
|
|
if ($agen_money < $agen_arr[0]['money']) {
|
|
|
$agen_arr[0]['money'] = $agen_money;
|
|
|
$agen_arr[0]['id'] = $agencyv['id'];
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// 取出前三报价
|
|
|
$money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
|
|
|
$money_list[$agencyv['id']] = $money;
|
|
|
}
|
|
|
asort($money_list);
|
|
|
$k = 0;
|
|
|
foreach ($money_list as $mok => $mov) {
|
|
|
$else_changeList[] = $mok;
|
|
|
if ($k < 3) {
|
|
|
$fin_list[$k]['id'] = $mok;
|
|
|
$fin_list[$k]['money'] = $mov;
|
|
|
$fin_arr[] = $mok;
|
|
|
}
|
|
|
$k += 1;
|
|
|
// 取出前三报价
|
|
|
$money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
|
|
|
$money_list[$agencyv['id']] = $money;
|
|
|
}
|
|
|
asort($money_list);
|
|
|
$k = 0;
|
|
|
foreach ($money_list as $mok => $mov) {
|
|
|
$else_changeList[] = $mok;
|
|
|
if ($k < 3) {
|
|
|
$fin_list[$k]['id'] = $mok;
|
|
|
$fin_list[$k]['money'] = $mov;
|
|
|
$fin_arr[] = $mok;
|
|
|
}
|
|
|
if($agen_arr){
|
|
|
if(!in_array($agen_arr[0]['id'],$fin_arr)){
|
|
|
$k += 1;
|
|
|
}
|
|
|
if($agen_arr){
|
|
|
if(!in_array($agen_arr[0]['id'],$fin_arr)){
|
|
|
// 品牌中介不在取出三个最低价中
|
|
|
$middle_agen[0] = $agen_arr[0]['id'];
|
|
|
$get_list = array_merge($fin_arr,$middle_agen);
|
|
|
}else{
|
|
|
$get_list = $fin_arr;
|
|
|
}
|
|
|
$middle_agen[0] = $agen_arr[0]['id'];
|
|
|
$get_list = array_merge($fin_arr,$middle_agen);
|
|
|
}else{
|
|
|
$get_list = $fin_arr;
|
|
|
}
|
|
|
foreach ($else_changeList as $getk=>$getv){
|
|
|
if(in_array($getv,$get_list)){
|
|
|
$change_final['id'] = $getv;
|
|
|
$change_final['status'] = 4;
|
|
|
}else{
|
|
|
$change_final['id'] = $getv;
|
|
|
$change_final['status'] = 3;
|
|
|
}
|
|
|
$agencyModel = new AgencyModel();
|
|
|
$fianl_AgsaveFirst = $agencyModel->isUpdate(true)->save($change_final);
|
|
|
if(!$fianl_AgsaveFirst){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
foreach ($else_changeList as $getk=>$getv){
|
|
|
if(in_array($getv,$get_list)){
|
|
|
$change_final['id'] = $getv;
|
|
|
$change_final['status'] = 4;
|
|
|
}else{
|
|
|
$change_final['id'] = $getv;
|
|
|
$change_final['status'] = 3;
|
|
|
// 中介报价未进入决赛,执行订单退款
|
|
|
$refund_result = $this->agency_order_refund($getv,'中介报价未进入决赛圈退款');
|
|
|
}
|
|
|
// 报价成功,更改状态
|
|
|
$userSave_statusFirst['id'] = $userNeedList['need_id'];
|
|
|
$userSave_statusFirst['status'] = 5;
|
|
|
$userSave_statusFirst['choose_time'] = time();
|
|
|
$userNeedModel = new UserNeedModel();
|
|
|
$fianl_Ussave = $userNeedModel->isUpdate(true)->save($userSave_statusFirst);
|
|
|
if(!$fianl_Ussave){
|
|
|
$agencyModel = new AgencyModel();
|
|
|
$fianl_AgsaveFirst = $agencyModel->isUpdate(true)->save($change_final);
|
|
|
if(!$fianl_AgsaveFirst){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
} else {
|
|
|
}
|
|
|
// 报价成功,更改状态
|
|
|
$userSave_statusFirst['id'] = $userNeedList['need_id'];
|
|
|
$userSave_statusFirst['status'] = 5;
|
|
|
$userSave_statusFirst['choose_time'] = time();
|
|
|
$userNeedModel = new UserNeedModel();
|
|
|
$fianl_Ussave = $userNeedModel->isUpdate(true)->save($userSave_statusFirst);
|
|
|
if(!$fianl_Ussave){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
} else {
|
|
|
// 报价小于3人,更改订单状态,报价失败
|
|
|
foreach ($agency_list as $changeka=>$changeva){
|
|
|
$change_final['id'] = $changeva['id'];
|
|
|
$change_final['status'] = 7;
|
|
|
$agencyModel = new AgencyModel();
|
|
|
$fianl_AgsaveNext = $agencyModel->isUpdate(true)->save($change_final);
|
|
|
foreach ($agency_list as $changeka=>$changeva){
|
|
|
$change_final['id'] = $changeva['id'];
|
|
|
$change_final['status'] = 7;
|
|
|
$agencyModel = new AgencyModel();
|
|
|
$fianl_AgsaveNext = $agencyModel->isUpdate(true)->save($change_final);
|
|
|
|
|
|
if(!$fianl_AgsaveNext){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 退回中介保证金
|
|
|
$add_a['user_id'] = $changeva['agency_id'];
|
|
|
$add_a['title'] = '报价人数不足';
|
|
|
$add_a['type'] = 1;
|
|
|
$add_a['reason'] = 1;
|
|
|
$add_a['money'] = $changeva['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 用户表增加金额
|
|
|
$where_member['type'] = 2;
|
|
|
$where_member['id'] = $changeva['agency_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$changeva['deposit']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
$userSave_status['id'] = $userNeedList['id'];
|
|
|
$userSave_status['status'] = 4;
|
|
|
$userNeedModel = new UserNeedModel();
|
|
|
$fianl_Ussave = $userNeedModel->isUpdate(true)->save($userSave_status);
|
|
|
if(!$fianl_Ussave){
|
|
|
if(!$fianl_AgsaveNext){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 中介报价订单退款
|
|
|
$refund_result = $this->agency_order_refund($changeva,'中介报价少于3人退款');
|
|
|
|
|
|
// 退回保证金
|
|
|
// 用户
|
|
|
// 加用户金额明细表
|
|
|
$add_del['need_id'] = $userNeedList['id'];
|
|
|
$add_del['user_id'] = $userNeedList['user_id'];
|
|
|
$add_del['title'] = '报价人数不足';
|
|
|
$add_del['reason'] = 1;
|
|
|
$add_del['type'] = 1;
|
|
|
$add_del['money'] = $userNeedList['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_memberNext['type'] = 1;
|
|
|
$where_memberNext['id'] = $userNeedList['user_id'];
|
|
|
$add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);
|
|
|
if (!$add_moneyNext) {
|
|
|
// 退回中介保证金
|
|
|
// $add_a['user_id'] = $changeva['agency_id'];
|
|
|
// $add_a['title'] = '报价人数不足';
|
|
|
// $add_a['type'] = 1;
|
|
|
// $add_a['reason'] = 1;
|
|
|
// $add_a['money'] = $changeva['deposit'];
|
|
|
// $add_a['create_time'] = time();
|
|
|
// $add_a['update_time'] = time();
|
|
|
// $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
// if (!$amoney_id) {
|
|
|
// Db::rollback();
|
|
|
// }
|
|
|
// 用户表增加金额
|
|
|
$where_member['type'] = 2;
|
|
|
$where_member['id'] = $changeva['agency_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$changeva['deposit']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} else {
|
|
|
// 没有报价
|
|
|
$userSave_status['id'] = $userNeedList['id'];
|
|
|
$userSave_status['status'] = 4;
|
|
|
$userNeedModel = new UserNeedModel();
|
...
|
...
|
@@ -352,39 +326,76 @@ class ThirdsendController extends HomeBaseController |
|
|
Db::rollback();
|
|
|
}
|
|
|
|
|
|
// 用户需求订单退款
|
|
|
$refund_result = $this->need_order_refund($userNeedList,'报价人数不足');
|
|
|
|
|
|
// 退回保证金
|
|
|
// 用户
|
|
|
// 加用户金额明细表
|
|
|
$add_del['need_id'] = $userNeedList['id'];
|
|
|
$add_del['user_id'] = $userNeedList['user_id'];
|
|
|
$add_del['title'] = '报价人数不足';
|
|
|
$add_del['type'] = 1;
|
|
|
$add_del['money'] = $userNeedList['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
$this->apiResponse('0','金额明细添加失败');
|
|
|
}
|
|
|
// $add_del['need_id'] = $userNeedList['id'];
|
|
|
// $add_del['user_id'] = $userNeedList['user_id'];
|
|
|
// $add_del['title'] = '报价人数不足';
|
|
|
// $add_del['reason'] = 1;
|
|
|
// $add_del['type'] = 1;
|
|
|
// $add_del['money'] = $userNeedList['pay_money'];
|
|
|
// $add_del['create_time'] = time();
|
|
|
// $add_del['update_time'] = time();
|
|
|
// $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
// if (!$umoney_id) {
|
|
|
// Db::rollback();
|
|
|
// }
|
|
|
$where_memberNext['type'] = 1;
|
|
|
$where_memberNext['id'] = $userNeedList['user_id'];
|
|
|
$add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);
|
|
|
if (!$add_moneyNext) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
// 没有报价
|
|
|
$userSave_status['id'] = $userNeedList['id'];
|
|
|
$userSave_status['status'] = 4;
|
|
|
$userNeedModel = new UserNeedModel();
|
|
|
$fianl_Ussave = $userNeedModel->isUpdate(true)->save($userSave_status);
|
|
|
if(!$fianl_Ussave){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 用户需求订单退款
|
|
|
$refund_result = $this->need_order_refund($userNeedList,'报价人数不足');
|
|
|
|
|
|
// 退回保证金
|
|
|
// 用户
|
|
|
// 加用户金额明细表
|
|
|
// $add_del['need_id'] = $userNeedList['id'];
|
|
|
// $add_del['user_id'] = $userNeedList['user_id'];
|
|
|
// $add_del['title'] = '报价人数不足';
|
|
|
// $add_del['type'] = 1;
|
|
|
// $add_del['money'] = $userNeedList['pay_money'];
|
|
|
// $add_del['create_time'] = time();
|
|
|
// $add_del['update_time'] = time();
|
|
|
// $umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
// if (!$umoney_id) {
|
|
|
// Db::rollback();
|
|
|
// $this->apiResponse('0','金额明细添加失败');
|
|
|
// }
|
|
|
$where_memberNext['type'] = 1;
|
|
|
$where_memberNext['id'] = $userNeedList['user_id'];
|
|
|
$add_moneyNext = Db::name('Member')->where($where_memberNext)->setInc('money',$userNeedList['pay_money']);
|
|
|
if (!$add_moneyNext) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
|
|
|
}
|
|
|
// 插入数据库
|
|
|
// 用户需求表
|
|
|
// 中介报价表
|
|
|
Db::commit();
|
|
|
$where_return['id'] = $data['need_id'];
|
|
|
$return = Db::name('UserNeed')->where($where_return)->find();
|
|
|
$this->apiResponse('1','成功',$return);
|
|
|
}else{
|
|
|
$this->apiResponse('0','时间不正确');
|
|
|
}
|
|
|
Db::commit();
|
|
|
$where_return['id'] = $data['need_id'];
|
|
|
$return = Db::name('UserNeed')->where($where_return)->find();
|
|
|
$this->apiResponse('1','成功',$return);
|
|
|
}else{
|
|
|
$this->apiResponse('0','时间不正确');
|
|
|
}
|
|
|
|
|
|
// }
|
|
|
}
|
...
|
...
|
@@ -413,61 +424,65 @@ class ThirdsendController extends HomeBaseController |
|
|
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,choose_time,user_id,pay_money,choose_time')->find();
|
|
|
if($userNeedList){
|
|
|
// foreach ($userNeedList as $needk=>$needv) {
|
|
|
if (time() >= ($userNeedList['choose_time'] + 259200)) {
|
|
|
$where_agency['need_id'] = $userNeedList['id'];
|
|
|
$where_agency['status'] = 4;
|
|
|
$agency_list = Db::name('Agency')->where($where_agency)->select()->toArray();
|
|
|
if ($agency_list) {
|
|
|
$where_agencyUpdate['need_id'] = $userNeedList['id'];
|
|
|
$where_agencyUpdate['status'] = 4;
|
|
|
$agency_save['status'] = 8;
|
|
|
$agency_save['update_time'] = time();
|
|
|
$agency_result = Db::name('Agency')->where($where_agencyUpdate)->update($agency_save);
|
|
|
if (!$agency_result) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
$where_needUpdate['id'] = $userNeedList['id'];
|
|
|
$needUpdate['status'] = 6;
|
|
|
$need_result = Db::name('UserNeed')->where($where_needUpdate)->update($needUpdate);
|
|
|
if (!$need_result) {
|
|
|
if (time() >= ($userNeedList['choose_time'] + 259200)) {
|
|
|
$where_agency['need_id'] = $userNeedList['id'];
|
|
|
$where_agency['status'] = 4;
|
|
|
$agency_list = Db::name('Agency')->where($where_agency)->select()->toArray();
|
|
|
if ($agency_list) {
|
|
|
$where_agencyUpdate['need_id'] = $userNeedList['id'];
|
|
|
$where_agencyUpdate['status'] = 4;
|
|
|
$agency_save['status'] = 8;
|
|
|
$agency_save['update_time'] = time();
|
|
|
$agency_result = Db::name('Agency')->where($where_agencyUpdate)->update($agency_save);
|
|
|
if (!$agency_result) {
|
|
|
Db::rollback();
|
|
|
} else {
|
|
|
}
|
|
|
foreach ($agency_list as $agency_key=>$agency_val) {
|
|
|
// 中介报价订单退款
|
|
|
$refund_result = $this->agency_order_refund($agency_val,'用户未选择中标中介退款');
|
|
|
}
|
|
|
}
|
|
|
$where_needUpdate['id'] = $userNeedList['id'];
|
|
|
$needUpdate['status'] = 6;
|
|
|
$need_result = Db::name('UserNeed')->where($where_needUpdate)->update($needUpdate);
|
|
|
if (!$need_result) {
|
|
|
Db::rollback();
|
|
|
} else {
|
|
|
// 加用户金额明细表
|
|
|
$add_del['need_id'] = $userNeedList['id'];
|
|
|
$add_del['user_id'] = $userNeedList['user_id'];
|
|
|
$add_del['title'] = '未选择中介';
|
|
|
$add_del['type'] = 2;
|
|
|
$add_del['money'] = $userNeedList['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$add_del['need_id'] = $userNeedList['id'];
|
|
|
$add_del['user_id'] = $userNeedList['user_id'];
|
|
|
$add_del['title'] = '未选择中介';
|
|
|
$add_del['type'] = 2;
|
|
|
$add_del['money'] = $userNeedList['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 中介金额明细表
|
|
|
foreach ($agency_list as $agenk=>$agenv){
|
|
|
$add_a['ag_id'] = $agenv['id'];
|
|
|
$add_a['user_id'] = $agenv['agency_id'];
|
|
|
$add_a['title'] = '用户未选择中介';
|
|
|
$add_a['type'] = 1;
|
|
|
$add_a['money'] = $agenv['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 2;
|
|
|
$where_member['id'] = $agenv['agency_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$agenv['deposit']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
// foreach ($agency_list as $agenk=>$agenv){
|
|
|
// $add_a['ag_id'] = $agenv['id'];
|
|
|
// $add_a['user_id'] = $agenv['agency_id'];
|
|
|
// $add_a['title'] = '用户未选择中介';
|
|
|
// $add_a['type'] = 1;
|
|
|
// $add_a['money'] = $agenv['deposit'];
|
|
|
// $add_a['create_time'] = time();
|
|
|
// $add_a['update_time'] = time();
|
|
|
// $amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
// if (!$amoney_id) {
|
|
|
// Db::rollback();
|
|
|
// }
|
|
|
// $where_member['type'] = 2;
|
|
|
// $where_member['id'] = $agenv['agency_id'];
|
|
|
// $add_money = Db::name('Member')->where($where_member)->setInc('money',$agenv['deposit']);
|
|
|
// if (!$add_money) {
|
|
|
// Db::rollback();
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
Db::commit();
|
|
|
$where_return['id'] = $data['need_id'];
|
...
|
...
|
@@ -501,59 +516,59 @@ class ThirdsendController extends HomeBaseController |
|
|
$need_list = Db::name('UserNeed')->where($where_need)->field('id,choose_time')->find();
|
|
|
if($need_list){
|
|
|
// foreach ($need_list as $needk=>$needv){
|
|
|
if(time() >= ($need_list['choose_time']+259200)){
|
|
|
$where_agency['status'] = 5;
|
|
|
$where_agency['need_id'] = $need_list['id'];
|
|
|
$agency = Db::name('Agency')->where($where_agency)->find();
|
|
|
if(time() >= ($need_list['choose_time']+259200)){
|
|
|
$where_agency['status'] = 5;
|
|
|
$where_agency['need_id'] = $need_list['id'];
|
|
|
$agency = Db::name('Agency')->where($where_agency)->find();
|
|
|
// 修改中介报价状态
|
|
|
if($agency){
|
|
|
$where_changeAgency['id'] = $agency['id'];
|
|
|
$changeAgency['status'] = 10;
|
|
|
$changeAgency['update_time'] = time();
|
|
|
$update_a = Db::name('Agency')->where($where_changeAgency)->update($changeAgency);
|
|
|
if(!$update_a){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
// 增加中介保证金变化
|
|
|
$add_a['ag_id'] = $agency['id'];
|
|
|
$add_a['user_id'] = $agency['agency_id'];
|
|
|
$add_a['title'] = '中介未确认';
|
|
|
$add_a['type'] = 2;
|
|
|
$add_a['money'] = $agency['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
if($agency){
|
|
|
$where_changeAgency['id'] = $agency['id'];
|
|
|
$changeAgency['status'] = 10;
|
|
|
$changeAgency['update_time'] = time();
|
|
|
$update_a = Db::name('Agency')->where($where_changeAgency)->update($changeAgency);
|
|
|
if(!$update_a){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
// 增加中介保证金变化
|
|
|
$add_a['ag_id'] = $agency['id'];
|
|
|
$add_a['user_id'] = $agency['agency_id'];
|
|
|
$add_a['title'] = '中介未确认';
|
|
|
$add_a['type'] = 2;
|
|
|
$add_a['money'] = $agency['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 修改用户需求状态
|
|
|
$where_needChange['id'] = $need_list['id'];
|
|
|
$update_need['status'] = 8;
|
|
|
$update_need['update_time'] = time();
|
|
|
$change_needFinal = Db::name('UserNeed')->where($where_needChange)->update($update_need);
|
|
|
if (!$change_needFinal) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_needChange['id'] = $need_list['id'];
|
|
|
$update_need['status'] = 8;
|
|
|
$update_need['update_time'] = time();
|
|
|
$change_needFinal = Db::name('UserNeed')->where($where_needChange)->update($update_need);
|
|
|
if (!$change_needFinal) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 增加用户保证金,余额
|
|
|
$add_del['need_id'] = $need_list['id'];
|
|
|
$add_del['user_id'] = $need_list['user_id'];
|
|
|
$add_del['title'] = '中介未确认';
|
|
|
$add_del['type'] = 1;
|
|
|
$add_del['money'] = $need_list['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 1;
|
|
|
$where_member['id'] = $need_list['user_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$need_list['pay_money']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$add_del['need_id'] = $need_list['id'];
|
|
|
$add_del['user_id'] = $need_list['user_id'];
|
|
|
$add_del['title'] = '中介未确认';
|
|
|
$add_del['type'] = 1;
|
|
|
$add_del['money'] = $need_list['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 1;
|
|
|
$where_member['id'] = $need_list['user_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$need_list['pay_money']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
// }
|
|
|
Db::commit();
|
|
|
$where_return['id'] = $data['need_id'];
|
...
|
...
|
@@ -569,7 +584,7 @@ class ThirdsendController extends HomeBaseController |
|
|
|
|
|
|
|
|
// 30分钟后发布(sure)(分钟执行)
|
|
|
public function thirdSend(){
|
|
|
public function thirdSend(){
|
|
|
Db::startTrans();
|
|
|
$where_need['status'] = 2;
|
|
|
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->select()->toArray();
|
...
|
...
|
@@ -594,7 +609,7 @@ class ThirdsendController extends HomeBaseController |
|
|
}
|
|
|
|
|
|
// 规定时间结束报价(sure)(分钟执行)
|
|
|
public function over()
|
|
|
public function over()
|
|
|
{
|
|
|
Db::startTrans();
|
|
|
// 查询用户发布需求信息
|
...
|
...
|
@@ -813,122 +828,38 @@ class ThirdsendController extends HomeBaseController |
|
|
}
|
|
|
|
|
|
// 三天用户选择(sure)(天执行)
|
|
|
public function userChoose(){
|
|
|
Db::startTrans();
|
|
|
public function userChoose(){
|
|
|
Db::startTrans();
|
|
|
// 查询用户发布需求信息
|
|
|
$where_need['status'] = 5;
|
|
|
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,choose_time,user_id,pay_money,choose_time')->select()->toArray();
|
|
|
if($userNeedList){
|
|
|
foreach ($userNeedList as $needk=>$needv) {
|
|
|
if (time() >= ($needv['choose_time'] + 259200)) {
|
|
|
$where_agency['need_id'] = $needv['id'];
|
|
|
$where_agency['status'] = 4;
|
|
|
$agency_list = Db::name('Agency')->where($where_agency)->select()->toArray();
|
|
|
if ($agency_list) {
|
|
|
$where_agencyUpdate['need_id'] = $needv['id'];
|
|
|
$where_agencyUpdate['status'] = 4;
|
|
|
$agency_save['status'] = 8;
|
|
|
$agency_save['update_time'] = time();
|
|
|
$agency_result = Db::name('Agency')->where($where_agencyUpdate)->update($agency_save);
|
|
|
if (!$agency_result) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
$where_needUpdate['id'] = $needv['id'];
|
|
|
$needUpdate['status'] = 6;
|
|
|
$need_result = Db::name('UserNeed')->where($where_needUpdate)->update($needUpdate);
|
|
|
if (!$need_result) {
|
|
|
Db::rollback();
|
|
|
} else {
|
|
|
// 加用户金额明细表
|
|
|
$add_del['need_id'] = $needv['id'];
|
|
|
$add_del['user_id'] = $needv['user_id'];
|
|
|
$add_del['title'] = '未选择中介';
|
|
|
$add_del['type'] = 2;
|
|
|
$add_del['money'] = $needv['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 中介金额明细表
|
|
|
foreach ($agency_list as $agenk=>$agenv){
|
|
|
$add_a['ag_id'] = $agenv['id'];
|
|
|
$add_a['user_id'] = $agenv['agency_id'];
|
|
|
$add_a['title'] = '用户未选择中介';
|
|
|
$add_a['type'] = 1;
|
|
|
$add_a['money'] = $agenv['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 2;
|
|
|
$where_member['id'] = $agenv['agency_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$agenv['deposit']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Db::commit();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// 三天中介确认
|
|
|
public function intermediaryChoose(){
|
|
|
Db::startTrans();
|
|
|
$where_need['status'] = 7;
|
|
|
$need_list = Db::name('UserNeed')->where($where_need)->field('id,choose_time')->select()->toArray();
|
|
|
if($need_list){
|
|
|
foreach ($need_list as $needk=>$needv){
|
|
|
if(time() >= ($needv['choose_time']+259200)){
|
|
|
$where_agency['status'] = 5;
|
|
|
$where_agency['need_id'] = $needv['id'];
|
|
|
$agency = Db::name('Agency')->where($where_agency)->find();
|
|
|
// 修改中介报价状态
|
|
|
if($agency){
|
|
|
$where_changeAgency['id'] = $agency['id'];
|
|
|
$changeAgency['status'] = 10;
|
|
|
$changeAgency['update_time'] = time();
|
|
|
$update_a = Db::name('Agency')->where($where_changeAgency)->update($changeAgency);
|
|
|
if(!$update_a){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
// 增加中介保证金变化
|
|
|
$add_a['ag_id'] = $agency['id'];
|
|
|
$add_a['user_id'] = $agency['agency_id'];
|
|
|
$add_a['title'] = '中介未确认';
|
|
|
$add_a['type'] = 2;
|
|
|
$add_a['money'] = $agency['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 修改用户需求状态
|
|
|
$where_needChange['id'] = $needv['id'];
|
|
|
$update_need['status'] = 8;
|
|
|
$update_need['update_time'] = time();
|
|
|
$change_needFinal = Db::name('UserNeed')->where($where_needChange)->update($update_need);
|
|
|
if (!$change_needFinal) {
|
|
|
$where_need['status'] = 5;
|
|
|
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,choose_time,user_id,pay_money,choose_time')->select()->toArray();
|
|
|
if($userNeedList){
|
|
|
foreach ($userNeedList as $needk=>$needv) {
|
|
|
if (time() >= ($needv['choose_time'] + 259200)) {
|
|
|
$where_agency['need_id'] = $needv['id'];
|
|
|
$where_agency['status'] = 4;
|
|
|
$agency_list = Db::name('Agency')->where($where_agency)->select()->toArray();
|
|
|
if ($agency_list) {
|
|
|
$where_agencyUpdate['need_id'] = $needv['id'];
|
|
|
$where_agencyUpdate['status'] = 4;
|
|
|
$agency_save['status'] = 8;
|
|
|
$agency_save['update_time'] = time();
|
|
|
$agency_result = Db::name('Agency')->where($where_agencyUpdate)->update($agency_save);
|
|
|
if (!$agency_result) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 增加用户保证金,余额
|
|
|
}
|
|
|
$where_needUpdate['id'] = $needv['id'];
|
|
|
$needUpdate['status'] = 6;
|
|
|
$need_result = Db::name('UserNeed')->where($where_needUpdate)->update($needUpdate);
|
|
|
if (!$need_result) {
|
|
|
Db::rollback();
|
|
|
} else {
|
|
|
// 加用户金额明细表
|
|
|
$add_del['need_id'] = $needv['id'];
|
|
|
$add_del['user_id'] = $needv['user_id'];
|
|
|
$add_del['title'] = '中介未确认';
|
|
|
$add_del['type'] = 1;
|
|
|
$add_del['title'] = '未选择中介';
|
|
|
$add_del['type'] = 2;
|
|
|
$add_del['money'] = $needv['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
...
|
...
|
@@ -936,18 +867,201 @@ class ThirdsendController extends HomeBaseController |
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 1;
|
|
|
$where_member['id'] = $needv['user_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$needv['pay_money']);
|
|
|
if (!$add_money) {
|
|
|
// 中介金额明细表
|
|
|
foreach ($agency_list as $agenk=>$agenv){
|
|
|
$add_a['ag_id'] = $agenv['id'];
|
|
|
$add_a['user_id'] = $agenv['agency_id'];
|
|
|
$add_a['title'] = '用户未选择中介';
|
|
|
$add_a['type'] = 1;
|
|
|
$add_a['money'] = $agenv['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 2;
|
|
|
$where_member['id'] = $agenv['agency_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$agenv['deposit']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
Db::commit();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// 三天中介确认
|
|
|
public function intermediaryChoose(){
|
|
|
Db::startTrans();
|
|
|
$where_need['status'] = 7;
|
|
|
$need_list = Db::name('UserNeed')->where($where_need)->field('id,choose_time')->select()->toArray();
|
|
|
if($need_list){
|
|
|
foreach ($need_list as $needk=>$needv){
|
|
|
if(time() >= ($needv['choose_time']+259200)){
|
|
|
$where_agency['status'] = 5;
|
|
|
$where_agency['need_id'] = $needv['id'];
|
|
|
$agency = Db::name('Agency')->where($where_agency)->find();
|
|
|
// 修改中介报价状态
|
|
|
if($agency){
|
|
|
$where_changeAgency['id'] = $agency['id'];
|
|
|
$changeAgency['status'] = 10;
|
|
|
$changeAgency['update_time'] = time();
|
|
|
$update_a = Db::name('Agency')->where($where_changeAgency)->update($changeAgency);
|
|
|
if(!$update_a){
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
// 增加中介保证金变化
|
|
|
$add_a['ag_id'] = $agency['id'];
|
|
|
$add_a['user_id'] = $agency['agency_id'];
|
|
|
$add_a['title'] = '中介未确认';
|
|
|
$add_a['type'] = 2;
|
|
|
$add_a['money'] = $agency['deposit'];
|
|
|
$add_a['create_time'] = time();
|
|
|
$add_a['update_time'] = time();
|
|
|
$amoney_id = Db::name('AmoenyDetail')->insertGetId($add_a);
|
|
|
if (!$amoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 修改用户需求状态
|
|
|
$where_needChange['id'] = $needv['id'];
|
|
|
$update_need['status'] = 8;
|
|
|
$update_need['update_time'] = time();
|
|
|
$change_needFinal = Db::name('UserNeed')->where($where_needChange)->update($update_need);
|
|
|
if (!$change_needFinal) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
// 增加用户保证金,余额
|
|
|
$add_del['need_id'] = $needv['id'];
|
|
|
$add_del['user_id'] = $needv['user_id'];
|
|
|
$add_del['title'] = '中介未确认';
|
|
|
$add_del['type'] = 1;
|
|
|
$add_del['money'] = $needv['pay_money'];
|
|
|
$add_del['create_time'] = time();
|
|
|
$add_del['update_time'] = time();
|
|
|
$umoney_id = Db::name('UmoenyDetail')->insertGetId($add_del);
|
|
|
if (!$umoney_id) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
$where_member['type'] = 1;
|
|
|
$where_member['id'] = $needv['user_id'];
|
|
|
$add_money = Db::name('Member')->where($where_member)->setInc('money',$needv['pay_money']);
|
|
|
if (!$add_money) {
|
|
|
Db::rollback();
|
|
|
}
|
|
|
}
|
|
|
Db::commit();
|
|
|
}
|
|
|
Db::commit();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 需求订单退款
|
|
|
* @param needInfo 用户需求信息
|
|
|
* @param reason 退款原因
|
|
|
*/
|
|
|
private function need_order_refund($needInfo,$reason) {
|
|
|
$order_model = new OrderModel();
|
|
|
$where = [
|
|
|
'user_id' => $needInfo['user_id'],
|
|
|
'type' => 1,
|
|
|
'need_id' => $needInfo['id'],
|
|
|
'is_get' => 2,
|
|
|
'status' => 2
|
|
|
];
|
|
|
// 根据不同订单类型执行退款操作
|
|
|
$orderInfo = $order_model->where($where)->find();
|
|
|
$transaction_id = $orderInfo['transaction_id'];
|
|
|
$order_sn = $orderInfo['order_sn'];
|
|
|
$money = $orderInfo['money'];
|
|
|
$out_refund_no = cmf_get_order_sn();
|
|
|
// 微信
|
|
|
$refund_result = false;
|
|
|
if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) {
|
|
|
$refund_result = $this->wxpay_refund($transaction_id,$out_refund_no,$money,$money,$reason);
|
|
|
}
|
|
|
// 支付宝
|
|
|
if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) {
|
|
|
$refund_result = $this->alipay_refund($transaction_id,$order_sn,$money,$reason);
|
|
|
}
|
|
|
return $refund_result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 中介报价退款
|
|
|
* @param agencyInfo 中介报价信息
|
|
|
* @param reason 退款原因
|
|
|
*/
|
|
|
private function agency_order_refund($agencyInfo,$reason) {
|
|
|
$order_model = new OrderModel();
|
|
|
$where = [
|
|
|
'user_id' => $agencyInfo['agency_id'],
|
|
|
'type' => 2,
|
|
|
'need_id' => $agencyInfo['id'],
|
|
|
'is_get' => 2,
|
|
|
'status' => 2
|
|
|
];
|
|
|
// 根据不同订单类型执行退款操作
|
|
|
$orderInfo = $order_model->where($where)->find();
|
|
|
$transaction_id = $orderInfo['transaction_id'];
|
|
|
$order_sn = $orderInfo['order_sn'];
|
|
|
$money = $orderInfo['money'];
|
|
|
$out_refund_no = cmf_get_order_sn();
|
|
|
$refund_result = false;
|
|
|
// 微信
|
|
|
if($orderInfo['pay_type'] == 1 || $orderInfo['pay_type'] == 2) {
|
|
|
$refund_result = $this->wxpay_refund($transaction_id,$out_refund_no,$money,$money,$reason);
|
|
|
}
|
|
|
// 支付宝
|
|
|
if($orderInfo['pay_type'] == 3 || $orderInfo['pay_type'] == 4) {
|
|
|
$refund_result = $this->alipay_refund($transaction_id,$order_sn,$money,$reason);
|
|
|
}
|
|
|
return $refund_result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 支付宝退款接口(两个订单号不能同时为空)
|
|
|
* @param trade_no 支付宝交易号
|
|
|
* @param out_trade_no 商户支付订单号
|
|
|
* @param refund_amount 退款金额
|
|
|
* @param refund_reason 退款原因
|
|
|
* @param out_request_no 如需部分退款,传此参数
|
|
|
*/
|
|
|
private function alipay_refund($trade_no = null, $out_trade_no = null, $refund_amount, $refund_reason, $out_request_no = null) {
|
|
|
$refund = controller('Alipay','controller');
|
|
|
$data = [
|
|
|
'trade_no' => $trade_no,
|
|
|
'out_trade_no' => $out_trade_no,
|
|
|
'refund_amount' => $refund_amount,
|
|
|
'refund_reason' => $refund_reason,
|
|
|
'out_request_no' => $out_request_no
|
|
|
];
|
|
|
return $refund->refund($data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 微信退款接口(两个订单号不能同时为空)
|
|
|
* @param transaction_id 微信业务订单号
|
|
|
* @param out_refund_no 商户退款订单号
|
|
|
* @param total_fee 订单金额
|
|
|
* @param refund_fee 退款金额
|
|
|
* @param refund_desc 退款原因
|
|
|
*/
|
|
|
private function wxpay_refund($transaction_id = null, $out_refund_no = null, $total_fee, $refund_fee, $refund_desc) {
|
|
|
require_once VENDOR_PATH.'WxpayAPI/WxRefund.php';
|
|
|
$refund = new \WxRefund(Config::get('wx_appid'),Config::get('wx_mch_id'),Config::get('wx_key'),$transaction_id,
|
|
|
$out_refund_no,$total_fee,$refund_fee,$refund_desc);
|
|
|
return $refund->pay();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|