leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); Yii::log('paramArray:'.json_encode($paramArray)); $up_file = []; $up_file[] = IMAGEDOMAIN.$pic_url; Yii::log('paramArray:'.json_encode($paramArray)); Yii::log('up_file:'.json_encode($up_file)); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_upload_url, $paramArray, $up_file); Yii::log('result:'.$result); $res = json_decode($result,true); return $res; } /** * 乐刷进件 * @Author wulingao * @DateTime 2017-10-17 * @param [type] $id [description] * @return [type] [description] */ public static function registerLeshuaAccount1($id) { if (!isset($id) || empty($id)){ return '该客户不存在!'; } $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $sql = 'select * from wx_leshua_apply where license = :license;'; $license = Yii::app()->db->createCommand($sql)->queryAll(true,array(':license'=>$data['license'])); if (empty($data) || $data == false || count($license) > 1) { // return '营业执照信息已经存在'; } /*if ($data['merchant_type'] > 2 || $data['merchant_type'] < 1) { return '商户类型不正确!'; }*/ $paramArray = array(); $info = array(); //基本信息 $info['base']['merchantType'] = $data['merchant_type'] == 2 ? 3 : $data['merchant_type']; $info['base']['name'] = $data['applicant']; //?? $info['base']['idcard'] = $data['idcard']; $info['base']['mobile'] = $data['mobile']; $info['base']['merchantName'] = $data['merchant_name']; $sql1 = 'select * from wx_leshua_pos_province where tag = :tag;'; $provinceData = Yii::app()->db->createCommand($sql1)->queryRow(true,array(':tag'=>$data['province_code'])); if (empty($provinceData) || $provinceData == false) { return '系统繁忙,请重试2!'; } $sql2 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $cityData = Yii::app()->db->createCommand($sql2)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); if (empty($cityData) || $cityData == false) { return '系统繁忙,请重试3!'; } $sql3 = 'select * from wx_leshua_pos_area where area_tag = :area_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':area_tag'=>$data['area_code'])); if (empty($areaData) || $areaData == false) { $sql3 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); // if (empty($areaData) || $areaData == false) { // return '系统繁忙,请重试3!'; // } } //商户基本信息(base) $info['base']['province'] = $provinceData['name']; $info['base']['city'] = $cityData['name']; $info['base']['area'] = !isset($areaData['name']) || empty($areaData['name']) ? $cityData['name'] : $areaData['name'];//缺地区 $info['base']['address'] = $data['address']; // if ($data['merchant_type'] == 2){ //企业商户必传 $info['base']['license'] = $data['license']; $info['base']['licenseFullName'] = $data['license_name'];//缺营业执照注册名称 $info['base']['licenseAddress'] = $data['license_address'];//缺营业执照注册地址 $info['base']['licenseStart'] = $data['license_start']; $info['base']['licenseEnd'] = $data['license_end']; // } //账户信息 $info['account']['type'] = $data['bank_account_type']; $info['account']['branch'] = $data['bank_branch']; $info['account']['unionpay'] = $data['bank_unionpay_code']; $info['account']['holder'] = $data['bank_holder']; $info['account']['cardId'] = $data['bank_account']; $info['account']['mobile'] = $data['bank_phone']; if($data['settle_type']==1){ //法人 $info['account']['legalFlag'] = 1; }else if($data['settle_type']==2){ //非法人 $info['account']['legalFlag'] = 0; $info['account']['bankIdCard'] = $data['un_idcard']; $info['base']['legalName'] = $data['legal_person_name']; } //其他信息 // if ($data['merchant_type'] == 2){ //企业商户必传 if ($data['mcc_type'] == 1){ $info['other']['isIndustryDining'] = 1; //餐娱类??? }else{ $info['other']['isIndustryDining'] = 0; } // } $info['other']['oemMerchantMode'] = 0; $info['other']['preferentialType'] = 0; $info['other']['uploadToUnionpay'] = 0; $info['other']['mccCode'] = $data['mcc_code']; $info['other']['mccType'] = $data['mcc_type']; //新增 if (empty($data['appid'])) { $info['other']['publicsignalAppid'] = 'wx2e7e5a2a92bd1efe'; $info['other']['gzhMerchantName'] = '深圳市迅享同城科技有限公司'; } else { //必须和公众号主体一致(营业执照上公司全称一致) $info['other']['gzhMerchantName'] = $data['public_pull_name']; if (empty($data['public_pull_name'])) { if (!empty($data['license_name'])) { $info['other']['gzhMerchantName'] = $data['license_name']; } else { if (!empty($data['merchant_name'])) { $info['other']['gzhMerchantName'] = $data['public_pull_name']; } } } //公众号appid(支付) $info['other']['publicsignalAppid'] = $data['appid']; } //公众号授权目录(支付) $info['other']['publicsignalAuthorizationDirectory'] = 'https://wap-test.lewaimai.com/lewaimaigod/;https://wap-beta.lewaimai.com/lewaimaigod/;https://wap-dev.lewaimai.com/lewaimaigod/;https://wap.lewaimai.com/lewaimaigod/'; //默认关注迅享同城的公众号 $info['other']['publicsignalAppidGZ'] = 'wx2e7e5a2a92bd1efe'; $newLeshua = new Newleshua(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $params = array(); // if ($data['merchant_type'] == 2){} $res = array('respCode'=>'1','respMsg'=>'失败'); if (empty($data['idcard_front']) || empty($data['idcard_back'])) { $res['respMsg'] = '缺少身份证照片'; return $res; } if (empty($data['bankcard_front'])) { $res['respMsg'] = '缺少银行卡照片'; return $res; } if (empty($data['business_license_c'])) { $res['respMsg'] = '缺少公司营业执照照片'; return $res; } if (empty($data['business_inside_c'])) { $res['respMsg'] = '缺少经营场所内设照片'; return $res; } if (empty($data['business_door_c'])) { $res['respMsg'] = '缺少门头照片'; return $res; } if (empty($data['business_cashier_desk_c'])) { $res['respMsg'] = '缺少收银台招盘照'; return $res; } if (empty($data['lease_property_c'])) { $res['respMsg'] = '缺少租赁协议或房产证明照'; return $res; } if($data['settle_type']==2){ if (empty($data['notlegal_idcard_front'])) { $res['respMsg'] = '缺少非法人身份证正面照片'; return $res; } if (empty($data['notlegal_idcard_back'])) { $res['respMsg'] = '缺少非法人身份证反面照片'; return $res; } if (empty($data['authorization_letter_pic'])) { $res['respMsg'] = '缺少非法人结算书授权函照片或扫描文件'; return $res; } } //企业号需传证照 $params['idcardFrontPic'] = IMAGEDOMAIN.$data['idcard_front']; $params['idcardBackPic'] = IMAGEDOMAIN.$data['idcard_back']; $params['bankCardFrontPic'] = IMAGEDOMAIN.$data['bankcard_front']; $params['licensePic'] = IMAGEDOMAIN.$data['business_license_c']; $params['insidePic'] = IMAGEDOMAIN.$data['business_inside_c'];//缺经营场所内设照片 $params['doorPic'] = IMAGEDOMAIN.$data['business_door_c'];//缺门头照 $params['cashierDeskPic'] = IMAGEDOMAIN.$data['business_cashier_desk_c'];//缺收银台招盘照 $params['agreementPic'] = IMAGEDOMAIN.$data['lease_property_c'];//租赁协议或房产证明图片 if($data['settle_type']==2){ $params['nonLegSettleAuthPic'] = IMAGEDOMAIN.$data['authorization_letter_pic']; $params['nonLegIdcardFrontPic'] = IMAGEDOMAIN.$data['notlegal_idcard_front']; $params['nonLlegIdcardBackPic'] = IMAGEDOMAIN.$data['notlegal_idcard_back']; } // } $paramArray['data'] = json_encode($info); Yii::log('paramArray:'.json_encode($paramArray)); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_upload_url, $paramArray, $params); Yii::log('result:'.$result); $res = json_decode($result,true); return $res; } public static function registerLeshuaAccount($id) { if (!isset($id) || empty($id)){ return '该客户不存在!'; } $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $sql = 'select * from wx_leshua_apply where license = :license;'; $license = Yii::app()->db->createCommand($sql)->queryAll(true,array(':license'=>$data['license'])); if (empty($data) || $data == false || count($license) > 1) { // return '营业执照信息已经存在'; } /*if ($data['merchant_type'] > 2 || $data['merchant_type'] < 1) { return '商户类型不正确!'; }*/ $sql1 = 'select * from wx_leshua_pos_province where tag = :tag;'; $provinceData = Yii::app()->db->createCommand($sql1)->queryRow(true,array(':tag'=>$data['province_code'])); if (empty($provinceData) || $provinceData == false) { return '系统繁忙,请重试2!'; } $sql2 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $cityData = Yii::app()->db->createCommand($sql2)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); if (empty($cityData) || $cityData == false) { return '系统繁忙,请重试3!'; } $sql3 = 'select * from wx_leshua_pos_area where area_tag = :area_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':area_tag'=>$data['area_code'])); if (empty($areaData) || $areaData == false) { $sql3 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); // if (empty($areaData) || $areaData == false) { // return '系统繁忙,请重试3!'; // } } $adminModel = Admin::model()->findByPk($data['admin_id']); $paramArray = array(); $info = array(); //商户基本信息 $info['baseInfo']['merchantType'] = $data['merchant_type'] == 2 ? 3 : $data['merchant_type']; $info['baseInfo']['merchantName'] = $data['merchant_name']; $info['baseInfo']['mccCode'] = $data['mcc_code']; //法人信息 $info['legalPerson']['idCardNo'] = $data['idcard']; $info['legalPerson']['idcardFrontPic'] = $data['idcard_front_ls']; $info['legalPerson']['idcardBackPic'] = $data['idcard_back_ls']; if($data['settle_type']==1){//法人 $info['legalPerson']['legalName'] = $data['applicant']; $info['contactInfo']['name'] = $data['applicant']; }elseif($data['settle_type']==2) {//非法人 $info['legalPerson']['legalName'] = $data['legal_person_name']; $info['contactInfo']['name'] = $data['applicant']; } //联系人信息 $info['contactInfo']['mobile'] = $data['mobile']; //店铺地址信息addressInfo $info['addressInfo']['province'] = $provinceData['name']; $info['addressInfo']['city'] = $cityData['name']; $info['addressInfo']['area'] = !isset($areaData['name']) || empty($areaData['name']) ? $cityData['name'] : $areaData['name'];//缺地区 $info['addressInfo']['address'] = $data['address']; //营业资质信息licenseInfo $info['licenseInfo']['license'] = $data['license']; $info['licenseInfo']['licenseFullName'] = trim($data['license_name']," ");//缺营业执照注册名称 $info['licenseInfo']['licenseAddress'] = $data['license_address'];//缺营业执照注册地址 $info['licenseInfo']['licenseStart'] = $data['license_start']; $info['licenseInfo']['licenseEnd'] = $data['license_end']; $info['licenseInfo']['licensePic'] = $data['business_license_c_ls']; //结算信息 $info['accountInfo']['type'] = $data['bank_account_type']; $info['accountInfo']['branch'] = $data['bank_branch']; $info['accountInfo']['unionpay'] = $data['bank_unionpay_code']; $info['accountInfo']['holder'] = trim($data['bank_holder']," "); $info['accountInfo']['idCardNo'] = $data['idcard']; $info['accountInfo']['mobile'] = $data['bank_phone']; $info['accountInfo']['bankCardNo'] = $data['bank_account']; $info['accountInfo']['bankCardFrontPic'] = $data['bankcard_front_ls']; if($data['settle_type']==1){ //法人 $info['accountInfo']['legalFlag'] = 1; }else if($data['settle_type']==2){//非法人 $info['accountInfo']['legalFlag'] = 0; $info['accountInfo']['nonLegSettleAuthPic'] = $data['authorization_letter_pic_ls']; $info['accountInfo']['nonLegIdcardFrontPic'] = $data['notlegal_idcard_front_ls']; $info['accountInfo']['nonLegIdcardBackPic'] = $data['notlegal_idcard_back_ls']; } //门店信息 $info['shopInfo']['insidePic'] = $data['business_inside_c_ls']; $info['shopInfo']['doorPic'] = $data['business_door_c_ls']; $info['shopInfo']['cashierDeskPic'] = $data['business_cashier_desk_c_ls']; //微信信息 $info['wechatInfo']['subAppid'] = "wx2e7e5a2a92bd1efe"; $info['wechatInfo']['jsapiPath'] = 'https://wap-test.lewaimai.com/lewaimaigod/;https://wap-beta.lewaimai.com/lewaimaigod/;https://wap-dev.lewaimai.com/lewaimaigod/;https://wap.lewaimai.com/lewaimaigod/'; $info['wechatInfo']['subscribeAppid'] = 'wx2e7e5a2a92bd1efe'; if ($data['attention_type']==2){ $info['wechatInfo']['subAppid'] = $adminModel->appid; } //其它信息otherInfo $info['wechatInfo']['otherInfo'] = []; $newLeshua = new Newleshua(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $params = array(); $res = array('respCode'=>'1','respMsg'=>'失败'); if (empty($data['idcard_front']) || empty($data['idcard_back'])) { $res['respMsg'] = '缺少身份证照片'; return $res; } if (empty($data['bankcard_front'])) { $res['respMsg'] = '缺少银行卡照片'; return $res; } if (empty($data['business_license_c'])) { $res['respMsg'] = '缺少公司营业执照照片'; return $res; } if (empty($data['business_inside_c'])) { $res['respMsg'] = '缺少经营场所内设照片'; return $res; } if (empty($data['business_door_c'])) { $res['respMsg'] = '缺少门头照片'; return $res; } if (empty($data['business_cashier_desk_c'])) { $res['respMsg'] = '缺少收银台招盘照'; return $res; } if($data['settle_type']==2){ if (empty($data['notlegal_idcard_front'])) { $res['respMsg'] = '缺少非法人身份证正面照片'; return $res; } if (empty($data['notlegal_idcard_back'])) { $res['respMsg'] = '缺少非法人身份证反面照片'; return $res; } if (empty($data['authorization_letter_pic'])) { $res['respMsg'] = '缺少非法人结算书授权函照片或扫描文件'; return $res; } } $paramArray['data'] = json_encode($info); Yii::log('paramArray:'.json_encode($paramArray)); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_register_url, $paramArray, $params); Yii::log('result:'.$result); $res = json_decode($result,true); return $res; } public static function upgradeLeshuaAccount($id) { if (!isset($id) || empty($id)){ return '该客户不存在!'; } $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $sql = 'select * from wx_leshua_apply where license = :license;'; $license = Yii::app()->db->createCommand($sql)->queryAll(true,array(':license'=>$data['license'])); if (empty($data) || $data == false || count($license) > 1) { // return '营业执照信息已经存在'; } /*if ($data['merchant_type'] > 2 || $data['merchant_type'] < 1) { return '商户类型不正确!'; }*/ $paramArray = array(); $info = array(); //基本信息 $info['base']['merchantId'] = $data['leshua_id']; $info['base']['merchantType'] = $data['merchant_type'] == 2 ? 3 : $data['merchant_type']; $info['base']['mobile'] = $data['mobile']; $info['base']['merchantName'] = $data['merchant_name']; $sql1 = 'select * from wx_leshua_pos_province where tag = :tag;'; $provinceData = Yii::app()->db->createCommand($sql1)->queryRow(true,array(':tag'=>$data['province_code'])); if (empty($provinceData) || $provinceData == false) { return '系统繁忙,请重试2!'; } $sql2 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $cityData = Yii::app()->db->createCommand($sql2)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); if (empty($cityData) || $cityData == false) { return '系统繁忙,请重试3!'; } $sql3 = 'select * from wx_leshua_pos_area where area_tag = :area_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':area_tag'=>$data['area_code'])); if (empty($areaData) || $areaData == false) { $sql3 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); // if (empty($areaData) || $areaData == false) { // return '系统繁忙,请重试3!'; // } } //商户基本信息(base) $info['base']['province'] = $provinceData['name']; $info['base']['city'] = $cityData['name']; $info['base']['area'] = !isset($areaData['name']) || empty($areaData['name']) ? $cityData['name'] : $areaData['name'];//缺地区 $info['base']['address'] = $data['address']; // if ($data['merchant_type'] == 2){ //企业商户必传 $info['base']['license'] = $data['license']; $info['base']['licenseFullName'] = $data['license_name'];//缺营业执照注册名称 $info['base']['licenseAddress'] = $data['license_address'];//缺营业执照注册地址 $info['base']['licenseStart'] = $data['license_start']; $info['base']['licenseEnd'] = $data['license_end']; // } //账户信息 $info['account']['type'] = $data['bank_account_type']; $info['account']['branch'] = $data['bank_branch']; $info['account']['unionpay'] = $data['bank_unionpay_code']; $info['account']['holder'] = $data['bank_holder']; $info['account']['cardId'] = $data['bank_account']; $info['account']['mobile'] = $data['bank_phone']; //其他信息 // if ($data['merchant_type'] == 2){ //企业商户必传 if ($data['mcc_type'] == 1){ $info['other']['isIndustryDining'] = 1; //餐娱类??? }else{ $info['other']['isIndustryDining'] = 0; } // } $info['other']['oemMerchantMode'] = 0; $info['other']['preferentialType'] = 0; $info['other']['uploadToUnionpay'] = 0; $info['other']['mccCode'] = $data['mcc_code']; $info['other']['mccType'] = $data['mcc_type']; //新增 if (empty($data['appid'])) { $info['other']['publicsignalAppid'] = 'wx2e7e5a2a92bd1efe'; $info['other']['gzhMerchantName'] = '深圳市迅享同城科技有限公司'; } else { //必须和公众号主体一致(营业执照上公司全称一致) $info['other']['gzhMerchantName'] = $data['public_pull_name']; if (empty($data['public_pull_name'])) { if (!empty($data['license_name'])) { $info['other']['gzhMerchantName'] = $data['license_name']; } else { if (!empty($data['merchant_name'])) { $info['other']['gzhMerchantName'] = $data['public_pull_name']; } } } //公众号appid(支付) $info['other']['publicsignalAppid'] = $data['appid']; } //公众号授权目录(支付) $info['other']['publicsignalAuthorizationDirectory'] = 'https://wap-test.lewaimai.com/lewaimaigod/;https://wap-beta.lewaimai.com/lewaimaigod/;https://wap-dev.lewaimai.com/lewaimaigod/;https://wap.lewaimai.com/lewaimaigod/'; //默认关注迅享同城的公众号 $info['other']['publicsignalAppidGZ'] = 'wx2e7e5a2a92bd1efe'; $newLeshua = new Newleshua(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $params = array(); // if ($data['merchant_type'] == 2){ $res = array('respCode'=>'1','respMsg'=>'失败'); if (empty($data['idcard_front']) || empty($data['idcard_back'])) { $res['respMsg'] = '缺少身份证照片'; return $res; } if (empty($data['bankcard_front'])) { $res['respMsg'] = '缺少银行卡照片'; return $res; } if (empty($data['business_license_c'])) { $res['respMsg'] = '缺少公司营业执照照片'; return $res; } if (empty($data['business_inside_c'])) { $res['respMsg'] = '缺少经营场所内设照片'; return $res; } if (empty($data['business_door_c'])) { $res['respMsg'] = '缺少门头照片'; return $res; } if (empty($data['business_cashier_desk_c'])) { $res['respMsg'] = '缺少收银台招盘照'; return $res; } if (empty($data['lease_property_c'])) { $res['respMsg'] = '缺少租赁协议或房产证明照'; return $res; } //企业号需传证照 $params['idcardFrontPic'] = IMAGEDOMAIN.$data['idcard_front']; $params['idcardBackPic'] = IMAGEDOMAIN.$data['idcard_back']; $params['bankCardFrontPic'] = IMAGEDOMAIN.$data['bankcard_front']; $params['licensePic'] = IMAGEDOMAIN.$data['business_license_c']; $params['insidePic'] = IMAGEDOMAIN.$data['business_inside_c'];//缺经营场所内设照片 $params['doorPic'] = IMAGEDOMAIN.$data['business_door_c'];//缺门头照 $params['cashierDeskPic'] = IMAGEDOMAIN.$data['business_cashier_desk_c'];//缺收银台招盘照 $params['agreementPic'] = IMAGEDOMAIN.$data['lease_property_c'];//租赁协议或房产证明图片 // } $paramArray['data'] = json_encode($info); Yii::log('upgradeLeshuaAccount paramArray:'.json_encode($paramArray)); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_update_url, $paramArray, $params); Yii::log('upgradeLeshuaAccount result:'.$result); $res = json_decode($result,true); return $res; } public static function completeLeshuaAccount($id) { if (!isset($id) || empty($id)){ return '该客户不存在!'; } $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $sql = 'select * from wx_leshua_apply where license = :license;'; $license = Yii::app()->db->createCommand($sql)->queryAll(true,array(':license'=>$data['license'])); if (empty($data) || $data == false || count($license) > 1) { // return '营业执照信息已经存在'; } /*if ($data['merchant_type'] > 2 || $data['merchant_type'] < 1) { return '商户类型不正确!'; }*/ $paramArray = array(); $info = array(); //基本信息 $info['base']['merchantType'] = $data['merchant_type'] == 2 ? 3 : $data['merchant_type']; $info['base']['name'] = $data['applicant']; //?? $info['base']['idcard'] = $data['idcard']; $info['base']['mobile'] = $data['mobile']; $info['base']['merchantName'] = $data['merchant_name']; $sql1 = 'select * from wx_leshua_pos_province where tag = :tag;'; $provinceData = Yii::app()->db->createCommand($sql1)->queryRow(true,array(':tag'=>$data['province_code'])); if (empty($provinceData) || $provinceData == false) { return '系统繁忙,请重试2!'; } $sql2 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $cityData = Yii::app()->db->createCommand($sql2)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); if (empty($cityData) || $cityData == false) { return '系统繁忙,请重试3!'; } $sql3 = 'select * from wx_leshua_pos_area where area_tag = :area_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':area_tag'=>$data['area_code'])); if (empty($areaData) || $areaData == false) { $sql3 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); // if (empty($areaData) || $areaData == false) { // return '系统繁忙,请重试3!'; // } } //商户基本信息(base) $info['base']['province'] = $provinceData['name']; $info['base']['city'] = $cityData['name']; $info['base']['area'] = !isset($areaData['name']) || empty($areaData['name']) ? $cityData['name'] : $areaData['name'];//缺地区 $info['base']['address'] = $data['address']; // if ($data['merchant_type'] == 2){ //企业商户必传 $info['base']['license'] = $data['license']; $info['base']['licenseFullName'] = $data['license_name'];//缺营业执照注册名称 $info['base']['licenseAddress'] = $data['license_address'];//缺营业执照注册地址 $info['base']['licenseStart'] = $data['license_start']; $info['base']['licenseEnd'] = $data['license_end']; // } //账户信息 $info['account']['type'] = $data['bank_account_type']; $info['account']['branch'] = $data['bank_branch']; $info['account']['unionpay'] = $data['bank_unionpay_code']; $info['account']['holder'] = $data['bank_holder']; $info['account']['cardId'] = $data['bank_account']; $info['account']['mobile'] = $data['bank_phone']; //其他信息 // if ($data['merchant_type'] == 2){ //企业商户必传 if ($data['mcc_type'] == 1){ $info['other']['isIndustryDining'] = 1; //餐娱类??? }else{ $info['other']['isIndustryDining'] = 0; } // } $info['other']['oemMerchantMode'] = 0; $info['other']['preferentialType'] = 0; $info['other']['uploadToUnionpay'] = 0; $info['other']['mccCode'] = $data['mcc_code']; $info['other']['mccType'] = $data['mcc_type']; //新增 if (empty($data['appid'])) { $info['other']['publicsignalAppid'] = 'wx2e7e5a2a92bd1efe'; $info['other']['gzhMerchantName'] = '深圳市迅享同城科技有限公司'; } else { //必须和公众号主体一致(营业执照上公司全称一致) $info['other']['gzhMerchantName'] = $data['public_pull_name']; if (empty($data['public_pull_name'])) { if (!empty($data['license_name'])) { $info['other']['gzhMerchantName'] = $data['license_name']; } else { if (!empty($data['merchant_name'])) { $info['other']['gzhMerchantName'] = $data['public_pull_name']; } } } //公众号appid(支付) $info['other']['publicsignalAppid'] = $data['appid']; } //公众号授权目录(支付) $info['other']['publicsignalAuthorizationDirectory'] = 'https://wap-test.lewaimai.com/lewaimaigod/;https://wap-beta.lewaimai.com/lewaimaigod/;https://wap-dev.lewaimai.com/lewaimaigod/;https://wap.lewaimai.com/lewaimaigod/'; //默认关注迅享同城的公众号 $info['other']['publicsignalAppidGZ'] = 'wx2e7e5a2a92bd1efe'; $newLeshua = new Newleshua(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $params = array(); // if ($data['merchant_type'] == 2){ //企业号需传证照 $params['idcardFrontPic'] = IMAGEDOMAIN.$data['idcard_front']; $params['idcardBackPic'] = IMAGEDOMAIN.$data['idcard_back']; $params['bankCardFrontPic'] = IMAGEDOMAIN.$data['bankcard_front']; $params['licensePic'] = IMAGEDOMAIN.$data['business_license_c']; $params['insidePic'] = IMAGEDOMAIN.$data['business_inside_c'];//缺经营场所内设照片 $params['doorPic'] = IMAGEDOMAIN.$data['business_door_c'];//缺门头照 $params['cashierDeskPic'] = IMAGEDOMAIN.$data['business_cashier_desk_c'];//缺收银台招盘照 $params['agreementPic'] = IMAGEDOMAIN.$data['lease_property_c'];//租赁协议或房产证明图片 // } $paramArray['data'] = json_encode($info); Yii::log('paramArray:'.json_encode($paramArray)); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_update_url, $paramArray, array()); Yii::log('completeLeshuaAccount result:'.$result); $result = json_decode($result,true); if (is_array($result) && $result['respCode'] == '000000' && $result['respMsg'] == '成功') { Yii::log('completeLeshuaAccount is '.$result['respMsg']); } else { Yii::log('completeLeshuaAccount result is false; '.$result['respMsg']); } return $result; } /** * 修改乐刷信息111 * @Author wulingao * @DateTime 2017-10-17 * @param [type] $id [description] * @return [type] [description] */ public static function editLeshuaAccount($id) { if (!isset($id) || empty($id)){ return '该客户不存在!'; } $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $sql = 'select * from wx_leshua_apply where license = :license;'; $license = Yii::app()->db->createCommand($sql)->queryAll(true,array(':license'=>$data['license'])); if (empty($data) || $data == false || count($license) > 1) { // return '营业执照信息已经存在'; } if (empty($data['bank_branch'])) { $res = '请完善结算银行卡信息'; return $res; } $data['merchant_type'] = 2; /*if ($data['merchant_type'] > 2 || $data['merchant_type'] < 1) { return '商户类型不正确!'; }*/ $paramArray = array(); $info = array(); //基本信息 $info['base']['merchantId'] = $data['leshua_id']; $info['base']['merchantType'] = $data['merchant_type'] == 2 ? 3 : $data['merchant_type']; $info['base']['mobile'] = $data['mobile']; $info['base']['merchantName'] = $data['merchant_name']; $sql1 = 'select * from wx_leshua_pos_province where tag = :tag;'; $provinceData = Yii::app()->db->createCommand($sql1)->queryRow(true,array(':tag'=>$data['province_code'])); if (empty($provinceData) || $provinceData == false) { return '系统繁忙,请重试2!'; } $sql2 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $cityData = Yii::app()->db->createCommand($sql2)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); if (empty($cityData) || $cityData == false) { return '系统繁忙,请重试3!'; } $sql3 = 'select * from wx_leshua_pos_area where area_tag = :area_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':area_tag'=>$data['area_code'])); if (empty($areaData) || $areaData == false) { $sql3 = 'select * from wx_leshua_pos_city where province_tag = :province_tag and city_tag = :city_tag;'; $areaData = Yii::app()->db->createCommand($sql3)->queryRow(true,array(':province_tag'=>$data['province_code'],':city_tag'=>$data['city_code'])); // if (empty($areaData) || $areaData == false) { // return '系统繁忙,请重试3!'; // } } //商户基本信息(base) $info['base']['province'] = $provinceData['name']; $info['base']['city'] = $cityData['name']; $info['base']['area'] = !isset($areaData['name']) || empty($areaData['name']) ? $cityData['name'] : $areaData['name'];//缺地区 $info['base']['address'] = $data['address']; if (empty($data['license'])) { $res = '请完善营业执照信息'; return $res; } if (empty($data['license_name'])) { $res = '请完善营业执照信息'; return $res; } if (empty($data['license_address'])) { $res = '请完善营业执照信息'; return $res; } if (empty($data['license_start'])) { $res = '请完善营业执照信息'; return $res; } if (empty($data['license_end'])) { $res = '请完善营业执照信息'; return $res; } // if ($data['merchant_type'] == 2){ //企业商户必传 $info['base']['license'] = $data['license']; $info['base']['licenseFullName'] = $data['license_name'];//缺营业执照注册名称 $info['base']['licenseAddress'] = $data['license_address'];//缺营业执照注册地址 $info['base']['licenseStart'] = $data['license_start']; $info['base']['licenseEnd'] = $data['license_end']; // } if (empty($data['bank_account_type'])) { $res = '请完善结算银行卡信息'; return $res; } if (empty($data['bank_branch'])) { $res = '请完善结算银行卡信息'; return $res; } if (empty($data['bank_unionpay_code'])) { $res = '请完善结算银行卡信息'; return $res; } if (empty($data['bank_holder'])) { $res = '请完善结算银行卡信息'; return $res; } if (empty($data['bank_account'])) { $res = '请完善结算银行卡信息'; return $res; } if (empty($data['bank_phone'])) { $res = '请完善结算银行卡信息'; return $res; } //账户信息 $info['account']['type'] = $data['bank_account_type']; $info['account']['branch'] = $data['bank_branch']; $info['account']['unionpay'] = $data['bank_unionpay_code']; //$info['account']['holder'] = $data['bank_holder']; $info['account']['cardId'] = $data['bank_account']; $info['account']['mobile'] = $data['bank_phone']; //其他信息 // if ($data['merchant_type'] == 2){ //企业商户必传 if ($data['mcc_type'] == 1){ $info['other']['isIndustryDining'] = 1; //餐娱类??? }else{ $info['other']['isIndustryDining'] = 0; } // } $info['other']['oemMerchantMode'] = 0; $info['other']['preferentialType'] = 0; $info['other']['uploadToUnionpay'] = 0; $info['other']['mccCode'] = $data['mcc_code']; $info['other']['mccType'] = $data['mcc_type']; //新增 if (empty($data['appid'])) { $info['other']['publicsignalAppid'] = 'wx2e7e5a2a92bd1efe'; $info['other']['gzhMerchantName'] = '深圳市迅享同城科技有限公司'; } else { //必须和公众号主体一致(营业执照上公司全称一致) $info['other']['gzhMerchantName'] = $data['public_pull_name']; if (empty($data['public_pull_name'])) { if (!empty($data['license_name'])) { $info['other']['gzhMerchantName'] = $data['license_name']; } else { if (!empty($data['merchant_name'])) { $info['other']['gzhMerchantName'] = $data['public_pull_name']; } } } //公众号appid(支付) $info['other']['publicsignalAppid'] = $data['appid']; } //公众号授权目录(支付) $info['other']['publicsignalAuthorizationDirectory'] = 'https://wap-test.lewaimai.com/lewaimaigod/;https://wap-beta.lewaimai.com/lewaimaigod/;https://wap-dev.lewaimai.com/lewaimaigod/;https://wap.lewaimai.com/lewaimaigod/'; //默认关注迅享同城的公众号 $info['other']['publicsignalAppidGZ'] = 'wx2e7e5a2a92bd1efe'; Yii::log('乐刷参数012901:'.json_encode($info)); $newLeshua = new Newleshua(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $params = array(); $res = array('respCode'=>'1','respMsg'=>'失败'); if (empty($data['idcard_front']) || empty($data['idcard_back'])) { $res['respMsg'] = '缺少身份证照片'; return $res; } if (empty($data['bankcard_front'])) { $res['respMsg'] = '缺少银行卡照片'; return $res; } if (empty($data['business_license_c'])) { $res['respMsg'] = '缺少公司营业执照照片'; return $res; } if (empty($data['business_inside_c'])) { $res['respMsg'] = '缺少经营场所内设照片'; return $res; } if (empty($data['business_door_c'])) { $res['respMsg'] = '缺少门头照片'; return $res; } if (empty($data['business_cashier_desk_c'])) { $res['respMsg'] = '缺少收银台招盘照'; return $res; } if (empty($data['lease_property_c'])) { $res['respMsg'] = '缺少租赁协议或房产证明照'; return $res; } // if ($data['merchant_type'] == 2){ //企业号需传证照 $params['idcardFrontPic'] = IMAGEDOMAIN.$data['idcard_front']; $params['idcardBackPic'] = IMAGEDOMAIN.$data['idcard_back']; $params['bankCardFrontPic'] = IMAGEDOMAIN.$data['bankcard_front']; $params['licensePic'] = IMAGEDOMAIN.$data['business_license_c']; $params['insidePic'] = IMAGEDOMAIN.$data['business_inside_c'];//缺经营场所内设照片 $params['doorPic'] = IMAGEDOMAIN.$data['business_door_c'];//缺门头照 $params['cashierDeskPic'] = IMAGEDOMAIN.$data['business_cashier_desk_c'];//缺收银台招盘照 $params['agreementPic'] = IMAGEDOMAIN.$data['lease_property_c'];//租赁协议或房产证明图片 // } $paramArray['data'] = json_encode($info); Yii::log('editLeshuaAccount paramArray:'.json_encode($paramArray)); Yii::log('editLeshuaAccount paramArray:'.json_encode($params)); LewaimaiDebug::LogArray($paramArray); LewaimaiDebug::LogArray($params); LewaimaiDebug::LogArray($newLeshua->leshua_agent_update_url); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_update_url, $paramArray, $params); LewaimaiDebug::LogArray($result); Yii::log('乐刷参数调试0129:'.$result); Yii::log('result:'.$result); $res = json_decode($result,true); return $res; } /** * 修改乐刷信息 * @Author wulingao * @DateTime 2017-10-17 * @param [type] $id [description] * @return [type] [description] */ public static function editLeshuaAccount2($id) { if (!isset($id) || empty($id)){ return '该客户不存在!'; } $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $paramArray = array(); $info = array(); //基本信息 $info['base']['merchantId'] = $data['leshua_id']; $info['base']['mobile'] = $data['mobile']; // $info['account']['type'] = $data['bank_account_type']; // $info['account']['branch'] = $data['bank_branch']; // $info['account']['unionpay'] = $data['bank_unionpay_code']; // $info['account']['holder'] = $data['bank_holder']; // $info['account']['cardId'] = $data['bank_account']; // $info['account']['mobile'] = $data['bank_phone']; $newLeshua = new Newleshua(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $params = array(); $paramArray['data'] = json_encode($info); Yii::log('editLeshuaAccount2 paramArray:'.json_encode($paramArray)); Yii::log('editLeshuaAccount2 paramArray:'.json_encode($params)); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_update_url, $paramArray, $params); Yii::log('result:'.$result); $res = json_decode($result,true); return $res; } /** * 设置商户费率 * @Author wulingao * @DateTime 2017-10-17 * @param [type] $merchantId [description] * @return [type] [description] */ public static function openFee($merchantId, $zhifubao_rate = 60, $weixin_rate = 60){ $newLeshua = new Newleshua(); $paramArray = array(); $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; //开通扫码支付 //$saomaParamString = '{"merchantId":"'.$merchantId.'","fee":{"openType":1,"T0":"0","weixin":{"t1":{"rate":'.$weixin_rate.'},"t0":{"rate":'.$weixin_rate.'}},"alipay":{"t1":{"rate":'.$zhifubao_rate.'},"t0":{"rate":'.$zhifubao_rate.'}}}}'; $info['merchantId'] = $merchantId; $info['fee']['openType'] = 1;//1.开通扫码支付(微信和支付宝支付)3.pos 刷卡(card)4.银联扫码(unionScan) $info['fee']['weixin']['t1']['rate'] = $weixin_rate; $info['fee']['alipay']['t1']['rate'] = $zhifubao_rate; Yii::log('扫码支付明文参数:'.json_encode($info)); $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_open_url, $paramArray); Yii::log('paramArray:'.json_encode($paramArray)); Yii::log('扫码支付result:'.$result); // var_dump('开通扫码支付:'.$result); $result = json_decode($result, true); if (!isset($result['respCode']) || $result['respCode'] != '000000') { return '设置费率失败,请重新设置费率1'; } //开通快捷支付 // $fastpayParamString = '{"fee":{"openType":2,"T0":"0","merchantId":"'.$merchantId.'","fastpay":{"t1Credit":{"rate":70},"t1Debit":{"rate":60,"maxCharge":30000000},"t1OverSee":{"rate":300},"t0Credit":{"rate":70},"t0Debit":{"rate":60,"fixedCharge":2000000},"t0OverSee":{"rate":300}}}}'; // $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); // $paramArray['sign'] = $newLeshua->getLeshuaSign(json_decode($fastpayParamString,true)); // $paramArray['data'] = $fastpayParamString; // $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_open_url, $paramArray); // Yii::log('paramArray:'.json_encode($paramArray)); // var_dump('开通快捷支付:'.$result); // $result = json_decode($result, true); // if (!isset($result['respCode']) || $result['respCode'] != '000000') { // return '设置费率失败,请重新设置费率2'; // } //开通pos支付 /*$pospayParamString = '{"fee":{"openType":3,"T0":"0","merchantId":"'.$merchantId.'","card":{"t1Credit":{"rate":70},"t1Debit":{"rate":60,"maxCharge":30000000},"t1OverSee":{"rate":300},"t0Credit":{"rate":70},"t0Debit":{"rate":60,"maxCharge":30000000,"fixedCharge":2000000},"t0OverSee":{"rate":320}}}}'; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign(json_decode($pospayParamString,true)); $paramArray['data'] = $pospayParamString; $result = $newLeshua->curl_custom_postfields($newLeshua->leshua_agent_open_url, $paramArray); Yii::log('paramArray:'.json_encode($paramArray)); Yii::log('result:'.$result); // var_dump('开通pos支付:'.$result); $result = json_decode($result, true); if (!isset($result['respCode']) || $result['respCode'] != '000000') { return '设置费率失败,请重新设置费率3'; }*/ return true; } public static function TestgetMerchantInfo($merchantId){ $newLeshua = new Newleshua(); $paramArray = array(); $info = array(); $info['merchantId'] = $merchantId; $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); // $result = LewaimaiHttp::POST('http://pos.yeahka.com/api/merchant/get.do',$paramArray); // $result = LewaimaiHttp::POST('https://saas.yeahka.com/api/merchant/info_qry',$paramArray); $result = LewaimaiHttp::POST('https://saas-mch.leshuazf.comapi/merchant/info_qry',$paramArray); Yii::log('查询信息结果3333'.$result); $resultArr = json_decode($result,true); if ($resultArr['respCode'] == '000000' && $resultArr['respMsg'] =='成功' && isset($resultArr['data'])){ return $resultArr['data']; }else{ return false; } } /** * 提交进件信息到乐刷服务器 * @Author wulingao * @DateTime 2017-10-17 * @param [type] $url [description] * @param array $assoc [description] * @param array $files [description] * @return [type] [description] */ private function curl_custom_postfields($url, array $assoc = array(), array $files = array()) { static $disallow = array("\0", "\"", "\r", "\n"); foreach ($assoc as $k => $v) { $k = str_replace($disallow, "_", $k); $body[] = implode("\r\n", array( "Content-Disposition: form-data; name=\"{$k}\"", "", filter_var($v), )); } if (!empty($files)) { foreach ($files as $k => $v) { $data = file_get_contents($v); // $v = call_user_func("end", explode(DIRECTORY_SEPARATOR, $v)); $k = str_replace($disallow, "_", $k); $v = str_replace($disallow, "_", $v); $body[] = implode("\r\n", array( "Content-Disposition: form-data; name=\"media\"; filename=\"{$v}\"", "Content-Type: application/octet-stream", "", $data, )); } } do { $boundary = "---------------------" . md5(mt_rand() . microtime()); } while (preg_grep("/{$boundary}/", $body)); // add boundary for each parameters array_walk($body, function (&$part) use ($boundary) { $part = "--{$boundary}\r\n{$part}"; }); // add final boundary $body[] = "--{$boundary}--"; $body[] = ""; $ch1 = curl_init (); // $newLeshua = new Newleshua(); curl_setopt ( $ch1, CURLOPT_URL, $url); curl_setopt ( $ch1, CURLOPT_POST, 1 ); curl_setopt ( $ch1, CURLOPT_RETURNTRANSFER, 1 ); curl_setopt ( $ch1, CURLOPT_CONNECTTIMEOUT, 30 ); curl_setopt ( $ch1, CURLOPT_SSL_VERIFYPEER, FALSE ); curl_setopt ( $ch1, CURLOPT_SSL_VERIFYHOST, false ); Yii::log('curl_custom_postfields:'.json_encode($body)); // set options @curl_setopt_array($ch1, array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => implode("\r\n", $body), CURLOPT_HTTPHEADER => array( "Expect: 100-continue", "Content-Type: multipart/form-data; boundary={$boundary}", // change Content-Type ), )); $result = curl_exec ( $ch1 ); if(!$result){ Yii::log('curl_error0221:'.curl_error($ch1)); } curl_close ( $ch1 ); return $result; } /** * 修改乐刷商户微信和支付宝的费率111 * @Author wulingao * @DateTime 2017-10-17 * @param [type] $id [description] * @return [type] [description] */ public static function editMerchantInfo($id) { $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $newLeshua = new Newleshua(); $info = array(); $paramArray = array(); $info['merchantId'] = $data['leshua_id']; $info['fee']['openType'] = $data['open_type'];//1.开通扫码支付(微信和支付宝支付)3.pos 刷卡(card)4.银联扫码(unionScan) if($data['open_type']==1){ $info['fee']['weixin']['t1']['rate'] = $data['weixin_commission_updating']*10000; $info['fee']['alipay']['t1']['rate'] = $data['zhifubao_commission_updating']*10000; }elseif($data['open_type']==3){ $info['fee']['card']['t1Credit']['rate'] = $data['weixin_commission_updating']*10000; $info['fee']['card']['t1Debit']['rate'] = $data['zhifubao_commission_updating']*10000; $info['fee']['card']['t1OverSee']['rate'] = $data['zhifubao_commission_updating']*10000; }elseif($data['open_type']==4){ $info['fee']['unionScan']['t1Credit']['rate'] = $data['weixin_commission_updating']*10000; $info['fee']['unionScan']['t1Debit']['rate'] = $data['zhifubao_commission_updating']*10000; $info['fee']['unionScan']['t1OverSee']['rate'] = $data['zhifubao_commission_updating']*10000; } $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); $result = LewaimaiHttp::POST($newLeshua->leshua_agent_open_url,$paramArray); Yii::log('修改结果413122'.$result); $resultArr = json_decode($result,true); if ($resultArr['respCode'] == '000000' && $resultArr['respMsg'] =='成功'){ return true; }else{ return false; } } /** * 修改商户信息接口 * @param $id * @return bool|string */ public static function updateMerchantInfo($id) { $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $newLeshua = new Newleshua(); $info = array(); $paramArray = array(); $info['base']['merchantId'] = $data['leshua_id']; $info['account']['branch'] = $data['bank_branch']; // //新增 // //必须和公众号主体一致(营业执照上公司全称一致) // $info['other']['gzhMerchantName'] = $data['public_pull_name']; // //公众号appid(支付) // $info['other']['publicsignalAppid'] = $data['appid']; /*$info['fee']['openType'] = $data['open_type'];//1.开通扫码支付(微信和支付宝支付)2.开通快捷支付 $info['fee']['weixin']['t1']['rate'] = $data['weixin_commission_updating']*10000; $info['fee']['weixin']['t0']['rate'] = $data['weixin_commission_updating']*10000; $info['fee']['alipay']['t1']['rate'] = $data['zhifubao_commission_updating']*10000; $info['fee']['alipay']['t0']['rate'] = $data['zhifubao_commission_updating']*10000; $info['fee']['merchantId'] = $data['leshua_id'];*/ $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); //var_dump(json_encode($info));die; $result = LewaimaiHttp::POST($newLeshua->leshua_agent_update_url,$paramArray); Yii::log('修改结果413122'.$result); $resultArr = json_decode($result,true); return $resultArr; if ($resultArr['respCode'] == '000000' && $resultArr['respMsg'] =='成功'){ Yii::log(66668886666888); return true; }else{ return false; } } /** * 设置商户支付信息 * @param $id * @return bool|string */ public static function setMerchantPayInfo($data) { $newLeshua = new Newleshua(); $info = array(); $paramArray = array(); $info = $data; /*$info['merchantId'] = $data['merchantID']; $info['configType'] = $data['configType']; $info['sub_appid'] = $data['sub_appid']; if(isset($data['subscribe_appid'])){ $info['subscribe_appid'] = $data['subscribe_appid']; }*/ $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); $result = LewaimaiHttp::POST($newLeshua->leshua_agent_update_url,$paramArray); Yii::log('设置支付参数结果'.$result); $resultArr = json_decode($result,true); if ($resultArr['respCode'] == '000011' && $resultArr['respMsg'] =='成功'){ Yii::log(66668886666888); return true; }else{ return false; } } //查询乐刷商户信息 public static function getMerchantInfo($id) { $sql = 'select * from wx_leshua_apply where id = :id;'; $data = Yii::app()->db->createCommand($sql)->queryRow(true,array(':id'=>$id)); if (empty($data) || $data == false) { return '系统繁忙,请重试!'; } $newLeshua = new Newleshua(); $paramArray = array(); $info = array(); $info['merchantId'] = $data['leshua_id']; $paramArray['agentId'] = $newLeshua->leshua_agent_id; $paramArray['version'] = $newLeshua->leshua_agent_version; $paramArray['reqSerialNo'] = $newLeshua->getreqSerialNo(); $paramArray['sign'] = $newLeshua->getLeshuaSign($info); $paramArray['data'] = json_encode($info); $result = LewaimaiHttp::POST($newLeshua->leshua_wxpayconfig_qry_url,$paramArray); Yii::log('查询信息结果3333'.$result); $resultArr = json_decode($result,true); if ($resultArr['respCode'] == '000000' && $resultArr['respMsg'] =='成功' && isset($resultArr['data'])){ return $resultArr['data']; }else{ return false; } } //获取签名 private function getLeshuaSign($paramArray) { $sign = base64_encode(md5('lepos'.$this->leshua_agent_key.json_encode($paramArray))); Yii::log('qianming:'.$sign); return $sign; } private function getreqSerialNo() { $date = date('Ymd'); $strNo = '00000001'; //unset(Yii::app()->session['req_serial_no_num']); if (isset(Yii::app()->session['req_serial_no_num'])){ $strNo = Yii::app()->session['req_serial_no_num']; $num = intval($strNo); $num += 1; $length = strlen($num); $finaLength = 8-$length; if ($finaLength > 0){ for ( $i = 0;$i < $finaLength;$i++){ $num = '0'.$num; } } $strNo = $num; } Yii::app()->session['req_serial_no_num'] = $strNo; $reqSerialNo = $date.$strNo; return $reqSerialNo; } }