|
|
|
@ -236,18 +236,8 @@ class PaymentController extends BaseController
|
|
|
|
|
public function IsCanChangeCompanyInfo($id = 0)
|
|
|
|
|
{
|
|
|
|
|
//获取原值
|
|
|
|
|
$oldInfo = M("company_statement_info","tab_")->field("company_info,company_id,company_type,company_name")->where("id = {$id}")->find();
|
|
|
|
|
if(empty($oldInfo)){
|
|
|
|
|
$this->ajaxReturn(['status' =>0 ,'msg'=>'未找到此结算单信息','data'=>[]]);
|
|
|
|
|
}
|
|
|
|
|
list($oldInfo, $newCompanyInfo) = $this->getStatementCompanyInfo($id);
|
|
|
|
|
$oldCompanyInfo = json_decode($oldInfo['company_info'],true);
|
|
|
|
|
//获取新值
|
|
|
|
|
if($oldInfo['company_type'] == 3){
|
|
|
|
|
$Model = M("partner","tab_");
|
|
|
|
|
}else{
|
|
|
|
|
$Model = M("promote_company","tab_");
|
|
|
|
|
}
|
|
|
|
|
$newCompanyInfo = $Model->field("ali_user,ali_account")->where("id = {$oldInfo['company_id']}")->find();
|
|
|
|
|
if( ($oldCompanyInfo['ali_user'] == $newCompanyInfo['ali_user']) && ($oldCompanyInfo['ali_account'] == $newCompanyInfo['ali_account']) ){
|
|
|
|
|
$this->ajaxReturn(['status' =>0 ,'msg'=>'支付宝打款信息已是最新,无需更新','data'=>[]]);
|
|
|
|
|
}
|
|
|
|
@ -264,29 +254,21 @@ class PaymentController extends BaseController
|
|
|
|
|
public function DoChangeCompanyInfo()
|
|
|
|
|
{
|
|
|
|
|
$id = I("post.id",0);
|
|
|
|
|
$oldInfo = M("company_statement_info","tab_")->field("id,company_info,company_id,company_type,company_name,pool_id,withdraw_type")->where("id = {$id}")->find();
|
|
|
|
|
$oldCompanyInfo = json_decode($oldInfo['company_info'],true);
|
|
|
|
|
//获取新值
|
|
|
|
|
if($oldInfo['company_type'] == 3){
|
|
|
|
|
$Model = M("partner","tab_");
|
|
|
|
|
}else{
|
|
|
|
|
$Model = M("promote_company","tab_");
|
|
|
|
|
}
|
|
|
|
|
$newCompanyInfo = $Model->field("ali_user,ali_account")->where("id = {$oldInfo['company_id']}")->find();
|
|
|
|
|
list($oldInfo, $newCompanyInfo) = $this->getStatementCompanyInfo($id);
|
|
|
|
|
//子单修改
|
|
|
|
|
$sWhere = [
|
|
|
|
|
'company_id' => $oldInfo['company_id'],
|
|
|
|
|
'pay_status'=> ['neq',1],
|
|
|
|
|
'statement_info_id' => $id
|
|
|
|
|
];
|
|
|
|
|
$StatementDB = M("pay_statement_info","tab_");
|
|
|
|
|
$statementInfo = $StatementDB
|
|
|
|
|
$PayStatementDB = M("pay_statement_info","tab_");
|
|
|
|
|
$statementInfo = $PayStatementDB
|
|
|
|
|
->where($sWhere)
|
|
|
|
|
->field('id,company_info')
|
|
|
|
|
->select();
|
|
|
|
|
foreach ($statementInfo as $k => $v) {
|
|
|
|
|
$v['company_info'] = $this->changeAliInfo($v['company_info'],$newCompanyInfo);
|
|
|
|
|
$StatementDB->save($v);
|
|
|
|
|
$PayStatementDB->save($v);
|
|
|
|
|
}
|
|
|
|
|
//修改结算单
|
|
|
|
|
if($oldInfo['company_type'] != 2 || $oldInfo['withdraw_type'] == 3){
|
|
|
|
@ -312,6 +294,22 @@ class PaymentController extends BaseController
|
|
|
|
|
$this->ajaxReturn(['status' =>1 ,'msg'=>'支付信息更新成功','data'=>[]]);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//获取新旧公司信息
|
|
|
|
|
protected function getStatementCompanyInfo($id = 0){
|
|
|
|
|
$oldInfo = M("company_statement_info","tab_")->field("id,company_info,company_id,company_type,company_name,pool_id,withdraw_type")->where("id = {$id}")->find();
|
|
|
|
|
if(empty($oldInfo)){
|
|
|
|
|
$this->ajaxReturn(['status' =>0 ,'msg'=>'未找到此结算单信息','data'=>[]]);
|
|
|
|
|
}
|
|
|
|
|
//获取新值
|
|
|
|
|
if($oldInfo['company_type'] == 3){
|
|
|
|
|
$Model = M("partner","tab_");
|
|
|
|
|
}else{
|
|
|
|
|
$Model = M("promote_company","tab_");
|
|
|
|
|
}
|
|
|
|
|
$newCompanyInfo = $Model->field("ali_user,ali_account")->where("id = {$oldInfo['company_id']}")->find();
|
|
|
|
|
return [$oldInfo,$newCompanyInfo];
|
|
|
|
|
}
|
|
|
|
|
//改变支付宝信息
|
|
|
|
|
protected function changeAliInfo($item,$newInfo)
|
|
|
|
|
{
|
|
|
|
|
$companyInfo = json_decode($item,true);
|
|
|
|
|