apiClient = new \DefaultIcbcClient( $this->APP_ID, $this->PRI_KEY, $this->signType, 'UTF-8', '', $this->APIGW_PUBLIC_KEY, '', '', '', '' ); } public function test($empowerPhone="13067694782",$crftNo1="91330401MADP554D6P",$crftType1="101",$mcc="9703"){ // 110-营业执照(个体工商户),101-营业执照(企业法人) // var_dump(132);die; $msg_id = $this->getMsgId(); $request = [ 'serviceUrl' => 'https://gw.open.icbc.com.cn/api/mybank/cardbusiness/shop/MerRegistrationAdd/V1', 'method' => 'POST', 'isNeedEncrypt'=>false, 'biz_content' => array( "channelFlag"=>"2", "notify_url"=>"https://dlh.hainings.com/index/index/localReturn", "empowerPhone"=>$empowerPhone, "applyType"=>"00001", "crftType1"=>$crftType1, "crftNo1"=>$crftNo1, // "crftNo1"=>"914310236828465718", "serId"=>"120400005722", "mcc"=>$mcc // "mcc"=>"5732" // "mcc"=>"4816" ), 'extraParams'=>[] ]; print_r("
");
var_dump($request);
$res = $this->apiClient->execute($request,$msg_id,"");
}
public function test1(){
$msg_id = $this->getMsgId();
$request = [
'serviceUrl' => 'https://gw.open.icbc.com.cn/api/mybank/cardbusiness/shop/MerRegistrationQuery/V1',
'method' => 'POST',
'isNeedEncrypt'=>false,
'biz_content' => array(
"notify_url"=>"https://dlh.hainings.com/index/index/localReturn",
"applyType"=>"00001",
"crftType"=>"101",
"crftNo"=>"91330401MADP554D6P",
"serId"=>"120400005722"
),
'extraParams'=>[]
];
// print_r("");
// var_dump($request);
$res = $this->apiClient->execute($request,$msg_id,"");
var_dump($res);
$result = json_decode($res,true);
$r = json_decode($result['results'],true);
var_dump($r);
}
public function payTest(){
$user_id = 1;
$msg_id = $this->getMsgId();
$out = "dlh".time().$user_id;
$request = [
'serviceUrl' => 'https://gw.open.icbc.com.cn/api/cardbusiness/aggregatepay/b2c/online/consumepurchase/V2',
'method' => 'POST',
'isNeedEncrypt'=>false,
'biz_content' => array(
"mer_id"=>"120448160200",
"ser_Id"=>"120400005722",
"out_trade_no"=>$out,
"pay_mode"=>"9",
"access_type"=>"9",
"mer_prtcl_no"=>"1204481602000201",
"orig_date_time"=>date("Y-m-d\TH:i:s"),
"decive_info"=>"11",
"body"=>"泰宇",
"fee_type"=>"001",
"spbill_create_ip"=>"183.141.48.230",
"total_fee"=>"1000",
"mer_url"=>"https://dlh.hainings.com/index/index/localReturn",
"notify_type"=>"HS",
"shop_appid"=>"wx586d77b9edb0636d",
"icbc_appid"=>$this->APP_ID,
"open_id"=>"ouOMm41xnIKqoZ66ygwJa-qJQpgw",
"notify_url"=>"https://dlh.hainings.com/index/index/localReturn",
"order_submit_act_input"=>array(
"rec_num"=>"1",
"sub_order_id"=>"dlh".time().$user_id."1",
"oper_flag"=>"0",
"busi_type"=>"1",
"seq_no"=>$out,
"ori_trx_date"=>date("Y-m-d"),
"sub_mer_id"=>"120448160198",
"sub_mer_prtcl_no"=>"120448160198",
"classify_amt"=>"600"
)
),
'extraParams'=>[]
];
$res = $this->apiClient->execute($request,$msg_id,"");
$result = json_decode($res,true);
print_r("");
var_dump($result);
}
public function payTestCheck(){
$user_id = 1;
$msg_id = $this->getMsgId();
// $out = "dlh".time().$user_id;
$request = [
'serviceUrl' => 'https://gw.open.icbc.com.cn/api/cardbusiness/aggregatepay/b2c/online/orderqry/V2',
'method' => 'POST',
'isNeedEncrypt'=>false,
'biz_content' => array(
"mer_id"=>"120448160201",
"deal_flag"=>'0',
"out_trade_no"=>"dlh1722085369979",
// "order_id"=>"120448160200000582407190000053",
"mer_prtcl_no"=>"1204481602000201",
"icbc_appid"=>$this->APP_ID
),
'extraParams'=>[]
];
print_r("");
var_dump($request);
$res = $this->apiClient->execute($request,$msg_id,"");
$result = json_decode($res,true);
// print_r("");
// var_dump($res);die;
$r = json_decode($result['order_submit_act_output'],true);
// $result = json_decode($res,true);
var_dump($r);
}
public function setTest(){
$user = Db::name("user")->where("first_leader",629)->select()->toArray();
foreach($user as $key=>$value){
Db::name("user")->where("id",$value['id'])->update(["divide_role_user_id"=>$value['first_leader']]);
$second_user = Db::name("user")->where("first_leader",$value['id'])->select()->toArray();
foreach($second_user as $k=>$v){
Db::name("user")->where("id",$v['id'])->update(["divide_role_user_id"=>$value['first_leader']]);
$third_user = Db::name("user")->where("first_leader",$v['id'])->select()->toArray();
foreach($third_user as $k1=>$v1){
Db::name("user")->where("id",$v1['id'])->update(["divide_role_user_id"=>$value['first_leader']]);
// $four_user = Db::name("user")->where("first_leader",$v1['id'])->select()->toArray();
}
}
}
}
public function getMsgId(){
return substr(md5("donglonghui".time().mt_rand(1,1000000)),8,13);
}
public function abutmentContent(){
$data=[
"app_id"=> $this->app_id,
"timestamp"=>date("Y-m-dH:i:s"),
"notify_url"=>"https://dlh.hainings.com/index/index/localReturn"
];
ksort($data);
print("");
var_dump($data);
$data['msg_id'] = $this->getId("donglonghui",$data);
$data1 = http_build_query($data);
$url = "https://gw.open.icbc.com.cn/api/mybank/enterprise/pay/payent/V1";
$res = $this->curl_post($url,$data1);
// var_dump($res);
$data['sign'] = $res['sign'];
// var_dump($data);
$d=[
"channelFlag"=>2,
"empowerPhone"=>"18868040087",
"applyType"=>"00100",
"crftType1"=>"101",
"crftNo1"=>"914310236828465718"
];
$u = "https://gw.open.icbc.com.cn/api/mybank/cardbusiness/shop/MerRegistrationAdd/V1";
$d1= http_build_query($d);
$rest = $this->curl_post($u,$d1);
var_dump($rest);
}
function getId($app_secret, $req_param=[])
{
// 排序所有请求参数
ksort($req_param);
$src_value = "";
// 按照key1value1key2value2...keynvaluen拼接
foreach ($req_param as $key => $value) {
$src_value .= ($key . $value);
}
//计算md5
return md5($app_secret . $src_value . $app_secret);
}
private function curl_post($url,$postdata){
$curl = curl_init(); // 启动一个CURL会话
curl_setopt($curl, CURLOPT_URL, $url); // 要访问的地址
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // 对认证证书来源的检测
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Expect:'
)); // 解决数据包大不能提交
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); // 使用自动跳转
curl_setopt($curl, CURLOPT_AUTOREFERER, 1); // 自动设置Referer
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
curl_setopt($curl, CURLOPT_POSTFIELDS, $postdata); // Post提交的数据包
curl_setopt($curl, CURLOPT_TIMEOUT, 30); // 设置超时限制防止死循
curl_setopt($curl, CURLOPT_HEADER, 0); // 显示返回的Header区域内容
curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 获取的信息以文件流的形式返回
// curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // 跳过证书检查
$tmpInfo = curl_exec($curl); // 执行操作
if (curl_errno($curl)) {
echo 'Errno' . curl_error($curl);
}
curl_close($curl); // 关键CURL会话
$tmpInfo=json_decode($tmpInfo,true);
return $tmpInfo;
}
}