Пример #1
0
 function redPacket()
 {
     //        self::clear();
     vendor('WxApi.WxPay#Api');
     //        var_dump(\WxPayApi::gethbinfo());exit;
     $this->assign('begin', self::getTime());
     $this->assign('url', urlencode(\WxPayConfig::REDIRECT_URI));
     //分享给朋友
     vendor('WxApi.JSSDK#Api');
     $jssdk = new \JSSDK(\WxPayConfig::APPID, \WxPayConfig::APPSECRET);
     $signPackage = $jssdk->GetSignPackage();
     $this->assign('signPackage', $signPackage);
     $this->assign('rand', uniqid());
     $this->theme('bootstrap')->display();
 }
Пример #2
0
  /**
   *  微信JSAPI
   */
  public function wxsign(){
	header("Access-Control-Allow-Origin: ".DOMAIN_NAME);
	require_once "lib/api/wxwebpay/jssdk.php";
	require_once "lib/api/wxwebpay/lib/WxPay.Config.php";
	//来源地址
	$url = $_GET['url'];
	$appid = WxPayConfig::APPID;
	$appsecret = WxPayConfig::APPSECRET;
	$jssdk = new JSSDK($appid,$appsecret,$url);
	$signPackage = $jssdk->GetSignPackage();
	echo json_encode($signPackage);exit;
  }
Пример #3
0
 public function detail($id)
 {
     $carData = M('Car')->where('id =' . $id)->find();
     if (!$carData) {
         $this->redirect(__APP__ . '/car/');
     }
     if (!in_array($carData['status'], array(1, 2))) {
         $this->redirect(__APP__ . '/car/');
     }
     $saleMan = M('Saleman')->find($carData['uid']);
     $carBrand = M('CarBrand')->where('id =' . $carData['brand_id'])->find();
     $carClass = M('CarClass')->where('id =' . $carData['class_id'])->find();
     $carEsid = M('CarEsid')->where('id =' . $carData['esid_id'])->find();
     $carColor = M('CarColor')->where('id =' . $carData['color_id'])->find();
     $storeInfo = M('Store')->where('id =' . $carData['store_id'])->find();
     $webcity = session('webcity');
     $redMap = array('price' => array(array('egt', intval($carData['price']) - 15), array('elt', intval($carData['price']) + 15), 'and'), 'id' => array('neq', $carData['id']), 'status' => array('in', '1,2'));
     if (!empty($webstore)) {
         $redMap['city_id'] = $webcity['id'];
     }
     $redCarList = M('Car')->where($redMap)->limit(4)->select();
     $cookieUser = explode('-', cookie('user_cars'));
     if (!in_array($id, $cookieUser)) {
         M('Car')->where(array('id' => $id))->setInc('clicktimes', 1);
         cookie('user_cars', $id . '-' . cookie('user_cars'), 3600);
     }
     //接入微信
     $jssdk = new JSSDK("wx1151866347a84fcb", "bb430075f413abb20865537ebece2959");
     $signPackage = $jssdk->GetSignPackage();
     $this->assign('signPackage', $signPackage);
     $this->assign(array('carData' => $carData, 'carImg' => json_decode($carData['imglist'], true), 'carBrand' => $carBrand, 'carClass' => $carClass, 'carEsid' => $carEsid, 'carColor' => $carColor, 'saleMan' => $saleMan, 'storeInfo' => $storeInfo, 'storeImg' => json_decode($storeInfo['imglist'], true), 'redCarList' => $redCarList));
     $this->display();
 }
Пример #4
0
  /**
   * 微信js分享调用
   */
  public function wxsign(){
	header("Access-Control-Allow-Origin: ".C('WAP_URL'));
	if($_GET['token']){
      $model = M('WxUser');
      $data['token'] = $_GET['token'];
      $wx_msg = $model->where($data)->find();
	  $appid = $wx_msg['appid'];
	  $appsecret = $wx_msg['appsecret'];
	  require_once "jssdk.php";
	  $url = $_GET['url'];
	  $jssdk = new JSSDK($appid,$appsecret,$url);
	  $jssdk->cacheDir = C('PUBLIC_CACHE').'/'.$_GET['token'];
	  $signPackage = $jssdk->GetSignPackage();
	  echo json_encode($signPackage);exit;
	  //dump($signPackage);
	}
  }