示例#1
0
 public function authorize($auth)
 {
     //dump($_POST);
     $vau = M('escrow_account')->where("uid={$this->uid}")->find();
     $MoneyId = $vau['qdd_marked'];
     //用户乾多多标识
     $Platform = $vau['platform_marked'];
     //平台乾多多标识//"";//
     $str = implode(',', $auth);
     //dump($auth);
     $TypeOpen = $str;
     //$_POST['AuthorizeTypeOpen'];//开启授权类型1.投标 2.还款。3.二次分配审核。将所有数字有英文(,)连成字符串
     $TypeClose = "";
     //$_POST['AuthorizeTypeClose'];//关闭授权类型1.投标 2.还款。3.二次分配审核。将所有数字有英文(,)连成字符串
     $Remark1 = '';
     //$_POST['Remark1'];
     $Remark2 = '';
     //$_POST['Remark2'];
     $Remark3 = '';
     //$_POST['Remark3'];
     $ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . U("/member/authorize/authorizereturn");
     // 返回地址
     $NotifyURL = 'http://' . $_SERVER['HTTP_HOST'] . "/Notice/authorizenotify";
     // 通知地址
     $row = M("escrow_account")->where("uid=" . $this->uid)->find();
     //dump($row);exit;
     $open = explode(',', $TypeOpen);
     $close = explode(',', $TypeClose);
     import("ORG.Loan.Escrow");
     $loan = new Escrow();
     //dump($loan);
     $authdata = $loan->authorize($MoneyId, $Platform, $TypeOpen, $TypeClose, $Remark1, $Remark2, $Remark3, $ReturnURL, $NotifyURL);
     //dump($authdata);exit;
     $form = $loan->setForm($authdata, 'authorize');
     echo $form;
     //return $form;
 }
 /**
  **检测是否开启授权
  **/
 function checkAuthorize()
 {
     $jsoncode = file_get_contents("php://input");
     $arr = array();
     $arr = json_decode($jsoncode, true);
     if (intval($arr['uid']) != $this->uid) {
         ajaxmsg("用户错误!", 0);
     }
     $data = array('invest_auth', 'repayment', 'secondary_percent');
     $row = M("escrow_account")->where("uid=" . $this->uid)->find();
     if (!is_array($row)) {
         ajaxmsg('您还未绑定托管账号后在操作', 0);
     }
     if (is_array($row)) {
         // foreach($data as $key=>$v){
         //     if($row[$v]!=1){
         //         switch($v){
         //         case 'invest_auth':
         //             $auth[]=1;
         //             break;
         //         case 'repayment':
         //             $auth[]=2;
         //             break;
         //         case 'secondary_percent':
         //             $auth[]=3;
         //             break;
         //         }
         //     }
         // }
         $auth[] = 1;
         $auth[] = 2;
         $auth[] = 3;
         // $auth[]=
         if ($auth == null) {
             return false;
         }
         $vau = M('escrow_account')->where("uid={$this->uid}")->find();
         $MoneyId = $vau['qdd_marked'];
         //用户乾多多标识
         $Platform = $vau['platform_marked'];
         //平台乾多多标识//"";//
         $str = implode(',', $auth);
         $TypeOpen = $str;
         //$_POST['AuthorizeTypeOpen'];//开启授权类型1.投标 2.还款。3.二次分配审核。将所有数字有英文(,)连成字符串
         $TypeClose = "";
         //$_POST['AuthorizeTypeClose'];//关闭授权类型1.投标 2.还款。3.二次分配审核。将所有数字有英文(,)连成字符串
         $Remark1 = '';
         //$_POST['Remark1'];
         $Remark2 = '';
         //$_POST['Remark2'];
         $Remark3 = '';
         //$_POST['Remark3'];
         $ReturnURL = 'http://' . $_SERVER['HTTP_HOST'] . U("/member/authorize/authorizereturn");
         // 返回地址
         $NotifyURL = 'http://' . $_SERVER['HTTP_HOST'] . "/Notice/authorizenotify";
         // 通知地址
         $row = M("escrow_account")->where("uid=" . $this->uid)->find();
         $open = explode(',', $TypeOpen);
         $close = explode(',', $TypeClose);
         import("ORG.Loan.Escrow");
         $loan = new Escrow();
         //dump($loan);
         $authdata = $loan->authorize($MoneyId, $Platform, $TypeOpen, $TypeClose, $Remark1, $Remark2, $Remark3, $ReturnURL, $NotifyURL);
         $data1['MoneymoremoreId'] = $authdata['MoneymoremoreId'];
         $data1['PlatformMoneymoremore'] = $authdata['PlatformMoneymoremore'];
         $data1['AuthorizeTypeOpen'] = $authdata['AuthorizeTypeOpen'];
         $data1['AuthorizeTypeClose'] = $authdata['AuthorizeTypeClose'];
         //$data1['RandomTimeStamp']="";
         $data1['Remark1'] = $authdata['Remark1'];
         $data1['Remark2'] = $authdata['Remark2'];
         $data1['Remark3'] = $authdata['Remark3'];
         $data1['NotifyURL'] = $authdata['NotifyURL'];
         ajaxmsg($data1);
         //dump($authdata);exit;
         //$form =  $loan->setForm($authdata,'authorize');
     }
 }