Application/Common/Myfun/WxAction.class.php

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
namespace Common\Myfun;

class WxAction {

    /**
	 * 企业零钱支付
	 * userid 用户id,$tixianid 提现记录ID
	 */
	public function wxxianjin($userid = 0 , $tixianid = 0){
		$user_tixian = M('user_tixian')->where("id=%d and tcode=1 and ttype=1",$tixianid)->find();
		if($user_tixian){
			$user = M('user')->where("id=%d",$userid)->find();
			$sysconfig = M('sys_config')->cache(true,60)->field('cwxappkey,cwxmchid,cwxappid')->find();
			define('CERTPATH',substr(THINK_PATH,0,-9));//证书路径		
			define('PARTNERKEY',$sysconfig['cwxappkey']);//密钥		
			vendor("wxpay.WxXianjinHelper");		
			$commonUtil = new \CommonUtil();
			$wxHongBaoHelper = new \WxHongBaoHelper();
			$wxHongBaoHelper->setParameter("nonce_str", $commonUtil->create_noncestr());//随机字符串
			$wxHongBaoHelper->setParameter("partner_trade_no",$user_tixian['udanhao']);//商户订单号 
			$wxHongBaoHelper->setParameter("mchid", $sysconfig['cwxmchid']);//商户号
			$wxHongBaoHelper->setParameter("mch_appid", $sysconfig['cwxappid']); //公众账号appid
			$wxHongBaoHelper->setParameter("openid", $user['uopenid']);//用户openid
			$wxHongBaoHelper->setParameter("check_name","NO_CHECK");//校验用户姓名选项
			$wxHongBaoHelper->setParameter("amount", $user_tixian['tjine']);//金额
			$wxHongBaoHelper->setParameter("re_user_name", "提现");//企业付款描述信息
			$wxHongBaoHelper->setParameter("desc", "零钱入账");//企业付款描述信息
			$wxHongBaoHelper->setParameter("spbill_create_ip", $wxHongBaoHelper->Getip());
			$postXml = $wxHongBaoHelper->create_hongbao_xml();
			$url = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers';
			$responseXml = $wxHongBaoHelper->curl_post_ssl($url, $postXml);
			$responseObj = simplexml_load_string($responseXml);
			if($responseObj->result_code=="SUCCESS" && $responseObj->return_code=="SUCCESS"){
				M('user_tixian')->save(array('id'=>$tixianid,'tcode'=>2));
				return 7;
			} else {
				M("sys_log")->add(array("lbiaoshi" => "微信企业付款到零钱".$tixianid, "lcon" => $responseXml, "ltime" => time()));	
				return 8;
			}
		}
			
	}
	
    /**
	 * 现金红包
	 * userid 用户id,$tixianid 提现记录ID
	 */
	public function wxhb($userid = 0 , $tixianid = 0){
		$user_tixian = M('user_tixian')->where("id=%d and tcode=1 and ttype=1",$tixianid)->find();
		if($user_tixian){
			$user = M('user')->where("id=%d",$userid)->find();
			$sysconfig = M('sys_config')->cache(true,60)->field('cwxname,cwxappkey,cwxmchid,cwxappid,cwxname')->find();
			define('CERTPATH',substr(THINK_PATH,0,-9));//证书路径		
			define('PARTNERKEY',$sysconfig['cwxappkey']);//密钥		
			vendor("wxpay.WxXianjinHelper");
			$commonUtil = new \CommonUtil();
			$wxHongBaoHelper = new \WxHongBaoHelper();	
			$wxHongBaoHelper->setParameter("nonce_str", $commonUtil->create_noncestr());//随机字符串
			$wxHongBaoHelper->setParameter("mch_billno", $user_tixian['udanhao']);//商户订单号 
后面还有 138 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。