104 行
4.1 KiB
PHP
可执行文件
104 行
4.1 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Vip\Controller;
|
|
|
|
use Think\Controller;
|
|
use Think\Jssdk;
|
|
use Think\Jssdks;
|
|
|
|
//[1.3.53]
|
|
class OnlinepayController extends BaseController
|
|
{
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize(); // TODO: Change the autogenerated stub
|
|
//获取jsSdk
|
|
$merchant_id = session('merchantid');
|
|
$wMap = array(
|
|
'merchantid' => $merchant_id
|
|
);
|
|
$weChat = M('wxconfig')->where($wMap)->find();
|
|
if ($weChat['type'] == 1) {
|
|
$jsSdk = new Jssdk($weChat['appid'], $weChat['appsecret']);
|
|
} else if ($weChat['type'] == 2) {
|
|
$access_token = get_authorizer_access_token($merchant_id);
|
|
$jsSdk = new Jssdks($weChat['authorizer_appid'], $access_token);
|
|
} else {
|
|
$this->error('微信配置参数有误');
|
|
}
|
|
$signPackage = $jsSdk->GetSignPackage();
|
|
$this->assign('signPackage', $signPackage);
|
|
}
|
|
|
|
/*
|
|
* 2019-11-13 新版PLUS套餐充值
|
|
*/
|
|
public function index()
|
|
{
|
|
$self_url = $_SERVER['PHP_SELF'];
|
|
if (strpos($self_url, 'Onlinepay') == false) {
|
|
header('location:' . $this->REQUEST_URL . '/index.php/Vip/Onlinepay/index.html');
|
|
}
|
|
//充值重新获取数据
|
|
$vid = session('vid');
|
|
$merchant_id = session('merchantid');
|
|
$userInfo = session('userinfo');//vip信息
|
|
$mMap = array(
|
|
'id' => $merchant_id
|
|
);
|
|
$mFields = array(
|
|
'inputrecharge',
|
|
'auto_read_recharge_grade',
|
|
);
|
|
$merchant = M('retail_merchant')->where($mMap)->field($mFields)->find();//查询商户信息
|
|
$vip_type = A('PayApi/Recharge')->getVipType($vid);
|
|
|
|
$VipRechargeModel = D('RetailVipRecharge'); // 活动表模型
|
|
$recharge_activity = $VipRechargeModel->getRechargeActivity($merchant_id, $userInfo['storeid'], $vid, $vip_type, 1);//充值活动列表
|
|
$user = array(
|
|
"vid" => $userInfo['id'],
|
|
"store_id" => $userInfo['storeid'],
|
|
"merchant_id" => $userInfo['merchantid'],
|
|
"openid" => $userInfo['openid'],
|
|
"card_num" => substr($userInfo['mobile_phone'], 0, 4) . "****" . substr($userInfo['mobile_phone'], -(strlen($userInfo['mobile_phone']) - 8)),
|
|
"mobile_phone" => $userInfo['mobile_phone'],
|
|
"balance" => $userInfo['balance'],
|
|
);
|
|
|
|
$vip_recharge_activity = $recharge_activity['vip_recharge_activity'] ? $recharge_activity['vip_recharge_activity'] : array();
|
|
$plus_recharge_activity = $recharge_activity['plus_recharge_activity'] ? $recharge_activity['plus_recharge_activity'] : array();
|
|
$this->assign('canInput', $merchant['inputrecharge']); //自定义充值 1 开启 2,关闭
|
|
$this->assign('auto_read_recharge_grade', $merchant['auto_read_recharge_grade']); //自动充值赠送 1自动读取赠送 2不自动读取赠送
|
|
$this->assign("rechargeList", json_encode($vip_recharge_activity)); //常规活动
|
|
$this->assign("plusRechargeList", json_encode($plus_recharge_activity)); //plus活动
|
|
$this->assign("user_type", $vip_type); //会员类型
|
|
$this->assign("user", json_encode($user));
|
|
|
|
//判断商户当前使用的模板
|
|
if ($userInfo['style_model'] == 2) {
|
|
$this->display('index2');
|
|
} else if ($userInfo['style_model'] == 3) {
|
|
$this->display('index3');
|
|
} else {
|
|
$this->display();
|
|
}
|
|
}
|
|
|
|
public function score_mall_details()
|
|
{
|
|
$id = I('get.id');
|
|
$merchant_id = session('merchantid');
|
|
$map = array(
|
|
'id' => $id,
|
|
'merchantid' => $merchant_id,
|
|
);
|
|
$details = M("retail_scoremall")->where($map)->find();
|
|
|
|
$vid = session('vid');
|
|
$this->assign('vid', $vid);
|
|
$this->assign('merchant_id', $merchant_id);
|
|
$this->assign('details', json_encode($details));
|
|
|
|
$this->display();
|
|
}
|
|
} |