Esempio n. 1
1
 public function index($enc_str)
 {
     $app_define = utils::decrypt($enc_str);
     $action_url = urldecode($action_url);
     $obj_wstage = vmc::singleton('wechat_stage');
     $access_token = $obj_wstage->get_access_token(false, $app_define);
     $app_id = $app_define['app_id'];
     vmc::singleton('base_session')->start();
     $session_str = utils::encrypt(array('session_id' => vmc::singleton('base_session')->sess_id() . '|' . time()));
     $session_str = app::get('mobile')->router()->encode_args($session_str);
     $redirect_uri = vmc::openapi_url('openapi.toauth', 'callback', array('wechat_toauth_pam' => 'callback')) . '?qrlp=' . $session_str;
     $forward = $_GET['forward'];
     $state = app::get('mobile')->router()->gen_url(array('app' => 'wechat', 'ctl' => 'mobile_wxqrlogin', 'act' => 'dologin'));
     $long_url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$app_id}&redirect_uri={$redirect_uri}&response_type=code&scope=snsapi_userinfo&state={$state}#wechat_redirect";
     if (!$access_token) {
         $this->splash('error', '', '二维码生成失败');
     }
     if ($surl = $obj_wstage->gen_surl($long_url, $access_token, $msg)) {
         $this->pagedata['surl'] = $surl;
     } else {
         $this->splash('error', '', '二维码生成失败:' . $msg);
     }
     // if($this->_reqeust->is_ajax()){
     //     $qrcode = vmc::singleton('wechat_qrcode')->create($surl);
     //     $qrcode_url = base_storager::inmage_path($qrcode['image_id']);
     //     $this->splash('success','',array('qrcode_url'=>$qrcode_url));
     // }
     $this->pagedata['forward'] = $forward;
     $this->page('site/loginqrcode.html');
 }
Esempio n. 2
0
 public function input_category($params)
 {
     $mdl_goods_cat = app::get('b2c')->model('goods_cat');
     $render = new base_render(app::get('b2c'));
     $params['cat_openapi'] = vmc::openapi_url('openapi.goods', 'catalog');
     $params['cat_path_openapi'] = vmc::openapi_url('openapi.goods', 'catalog_path');
     $params['domid'] = substr(md5(uniqid()), 0, 6);
     $render->pagedata['tree_data_root'] = $mdl_goods_cat->get_tree();
     if ($params['value'] && $params['value'] > 0) {
         $cat = $mdl_goods_cat->getRow('cat_path,cat_id', array('cat_id' => $params['value']));
         if ($cat) {
             $cat_path = $cat['cat_path'];
             $cat_path_arr = explode(',', $cat_path);
             $cat_path_length = count($cat_path_arr);
             $render->pagedata['root'] = $cat_path_arr[0];
             $render->pagedata['cat_path_length'] = $cat_path_length;
             foreach ($cat_path_arr as $k => $cat_id) {
                 $clist = $mdl_goods_cat->get_tree($cat_id);
                 if ($clist) {
                     $tree_data[$cat_id] = $clist;
                     if ($tree_data[$cat_id][$cat_path_arr[$k + 1]]) {
                         $tree_data[$cat_id][$cat_path_arr[$k + 1]]['selected'] = true;
                     }
                 }
             }
             $render->pagedata['tree_data'] = $tree_data;
         }
     }
     $render->pagedata['params'] = $params;
     return $render->fetch('common/category.html');
 }
Esempio n. 3
0
 /**
  * 构造方法.
  *
  * @param null
  *
  * @return bool
  */
 public function __construct($app)
 {
     parent::__construct($app);
     if (!$this->login_type) {
         trigger_error('login_type 未定义!', E_USER_ERROR);
     }
     $this->callback_url = vmc::openapi_url('openapi.toauth', 'callback', array(__CLASS__ => 'callback'));
 }
Esempio n. 4
0
 /**
  * 构造方法.
  *
  * @param null
  *
  * @return bool
  */
 public function __construct($app)
 {
     parent::__construct($app);
     $this->callback_url = vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('ectools_payment_applications_alipay' => 'callback'));
     $this->notify_url = vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('ectools_payment_applications_alipay' => 'notify'));
     $this->submit_url = 'https://mapi.alipay.com/gateway.do?_input_charset=utf-8';
     $this->submit_method = 'POST';
     $this->submit_charset = 'utf-8';
 }
Esempio n. 5
0
 public function index()
 {
     $this->pagedata['wxpay_classname'] = 'wechat_payment_applications_wxpay';
     $jsapi_url = vmc::singleton('mobile_router')->gen_url(array('app' => 'b2c', 'ctl' => 'mobile_checkout', 'act' => 'dopayment', 'full' => true));
     $jsapi_url = explode('/', $jsapi_url);
     array_pop($jsapi_url);
     $jsapi_dir = implode('/', $jsapi_url) . '/';
     $this->pagedata['wx_business_api'] = array('JSAPI网页支付' => array('支付授权目录' => $jsapi_dir), 'NATIVE原生支付' => array('支付回调URL' => vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('wechat_payment_applications_alipay' => 'notify'))), 'APP客户端支付成功通知' => array('支付回调URL' => vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('wechat_payment_applications_alipay' => 'notify'))));
     $this->page('admin/business/setting.html');
 }
Esempio n. 6
0
 /**
  * 构造方法.
  *
  * @param null
  *
  * @return bool
  */
 public function __construct($app)
 {
     parent::__construct($app);
     $this->callback_url = vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('ectools_payment_applications_chinapay' => 'callback'));
     $this->notify_url = vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('ectools_payment_applications_chinapay' => 'notify'));
     $this->submit_url = 'https://payment.ChinaPay.com/pay/TransGet';
     if (constant('CHINAPAY_TEST')) {
         $this->submit_url = 'http://payment-test.ChinaPay.com/pay/TransGet';
     }
     $this->submit_method = 'POST';
     $this->submit_charset = 'utf-8';
 }
Esempio n. 7
0
 public function runtask($task_id)
 {
     $http = new base_httpclient();
     $_POST['task_id'] = $task_id;
     $url = vmc::openapi_url('openapi.queue', 'worker', array('task_id' => $task_id));
     logger::info('Spawn [Task-' . $task_id . '] ' . $url);
     //99%概率不会有问题
     $http->hostaddr = $_SERVER['SERVER_ADDR'] ? $_SERVER['SERVER_ADDR'] : '127.0.0.1';
     $http->hostport = $_SERVER['SERVER_PORT'] ? $_SERVER['SERVER_PORT'] : '80';
     $http->set_timeout(2);
     logger::info($http->post($url, $_POST));
 }
Esempio n. 8
0
 public function detail_products($gid)
 {
     $mdl_products = app::get('b2c')->model('products');
     $products = $mdl_products->getList('*', array('goods_id' => $gid));
     $mdl_stock = app::get('b2c')->model('stock');
     $sku_bn = array_keys(utils::array_change_key($products, 'bn'));
     $stock_list = $mdl_stock->getList('*', array('sku_bn' => $sku_bn));
     $stock_list = utils::array_change_key($stock_list, 'sku_bn');
     $render = $this->app->render();
     $render->pagedata['data_detail'] = app::get('b2c')->model('goods')->dump($gid, '*', 'default');
     $render->pagedata['products'] = $products;
     $render->pagedata['stock_list'] = $stock_list;
     $render->pagedata['gpromotion_openapi'] = vmc::openapi_url('openapi.goods', 'promotion', array('goods_id' => $gid));
     return $render->fetch('admin/goods/detail/detail.html');
 }
Esempio n. 9
0
 public function get_api($eid)
 {
     return $url = vmc::openapi_url('openapi.wechat', 'api', array('eid' => $eid));
 }
Esempio n. 10
0
 /**
  * 获取回调的openapi地址.
  *
  * @param string $module 认证方式类名
  *
  * @return string 返回回调的openapi地址
  */
 public function get_callback_url($module)
 {
     return vmc::openapi_url('openapi.pam_callback', 'login', array('module' => $module, 'type' => $this->type, 'appid' => $this->appid, 'redirect' => $this->redirect_url));
 }
Esempio n. 11
0
 /**
  * 构造方法.
  *
  * @param null
  *
  * @return bool
  */
 public function __construct($app)
 {
     parent::__construct($app);
     $this->callback_url = vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('wechat_payment_applications_wxpay' => 'callback'));
     $this->notify_url = vmc::openapi_url('openapi.ectools_payment', 'getway_callback', array('wechat_payment_applications_wxpay' => 'notify'));
 }