查询商家主页

        详情请参考
        http://mp.weixin.qq.com/wiki/6/2732f3cf83947e0e4971aa8797ee9d6a.html

        :param shop_id: 门店 ID
        :return: 返回的 JSON 数据包
3915
def get_homepage(self, shop_id):
        
        res = self._post(
            'homepage/get',
            data={'shop_id': shop_id},
            result_processor=lambda x: x['data']
        )
        return res
82320
public function UpdateUnimartStore()
        {

            // 參數初始化
            $ParamList = [
                'MerchantID' => '',
                'AllPayLogisticsID' => '',
                'CVSPaymentNo' => '',
                'CVSValidationNo' => '',
                'StoreType' => '',
                'ReceiverStoreID' => '',
                'ReturnStoreID' => '',
                'PlatformID' => '',
            ];
            $this->PostParams = $this->GetPostParams($this->Send, $ParamList);

            // 參數檢查
            $this->ValidateHashKey();
            $this->ValidateHashIV();
            $this->ValidateID('MerchantID', $this->PostParams['MerchantID'], 10);
            $this->ServiceURL = $this->GetURL('UNIMART_UPDATE_STORE_INFO');
            $this->ValidateID('AllPayLogisticsID', $this->PostParams['AllPayLogisticsID'], 20);
            $this->ValidateMixTypeID('CVSPaymentNo', $this->PostParams['CVSPaymentNo'], 15);
            $this->ValidateID('CVSValidationNo', $this->PostParams['CVSValidationNo'], 10);
            $this->ValidateStoreType();

            if ($this->PostParams['StoreType'] == StoreType::RECIVE_STORE) {
                $this->ValidateMixTypeID('ReceiverStoreID', $this->PostParams['ReceiverStoreID'], 6);
            } else {
                unset($this->PostParams['ReceiverStoreID']);
            }

            if ($this->PostParams['StoreType'] == StoreType::RETURN_STORE) {
                $this->ValidateMixTypeID('ReturnStoreID', $this->PostParams['ReturnStoreID'], 6);
            } else {
                unset($this->PostParams['ReturnStoreID']);
            }

            $this->ValidateID('PlatformID', $this->PostParams['PlatformID'], 10, true);

            // 產生 CheckMacValue
            $this->PostParams['CheckMacValue'] = ECPay_CheckMacValue::generate($this->PostParams, $this->HashKey, $this->HashIV);

            // 解析回傳結果
            // 正確：1|OK
            // 錯誤：0|ErrorMessage
            $Feedback = ECPay_IO::ServerPost($this->PostParams, $this->ServiceURL);
            $Result = $this->ParseFeedback($Feedback);

            return $Result;
        }
777060
public function delPayGiftCard($rule_id)
    {
        $url = "https://api.weixin.qq.com/card/paygiftcard/add?access_token=ACCESS_TOKEN";
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['rule_id' => $rule_id]);
    }
1349686
public function clearShopWifi($shop_id)
    {
        $url = 'https://api.weixin.qq.com/bizwifi/shop/clean?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['shop_id' => $shop_id]);
    }
827646
function (jsonObj, successCB, failedCB) {
    var $t = this;

    var _json = jsonObj || {};

    // 传递参数
    var newJson = {
      'command': ' --port=' + $bc_$5.App.getServerPort(), // {要求string}
      'currentDirectoryPath': _json.currentDirectoryPath || '',
      'environmentDic': _json.environmentDic || {},
      'mainThread': _json.mainThread !== false
    };

    $t.exec(newJson, successCB, failedCB);
  }
119622
public function addNews($news_id) {
		$news = WechatNews::findOne($news_id);
		if(!$news) {
			throw new ErrorException('数据查询失败');
		} else if($newsMedia = WechatNewsMedia::findOne(['appid' => $this->app->appid, 'news_id' => $news->id])) {
			return $newsMedia->id;
		}

		$articles = $news->getArticles($this);
		$data = $this->getData('/cgi-bin/material/add_news', [
			'access_token' => $this->getAccessToken(),
		], Json::encode(['articles' => $articles]));

		if($this->errcode == 0) {
			$newsMedia = new WechatNewsMedia;
			$newsMedia->appid = $this->app->appid;
			$newsMedia->news_id = $news->id;
			$newsMedia->media_id = $data['media_id'];
			$newsMedia->thumb_material_media_ids = Json::encode(ArrayHelper::getColumn($articles, 'thumb_material_media_id'));
			if($details = $this->getNews($newsMedia->media_id)) {
				$newsMedia->urls = Json::encode(ArrayHelper::getColumn($details['news_item'], 'url'));
				$newsMedia->thumb_urls = Json::encode(ArrayHelper::getColumn($details['news_item'], 'thumb_url'));
			}
			if($newsMedia->save()) {
				return $newsMedia->id;
			}
		}

		return 0;
	}
1339897
def register(self, *args, **kwargs):
        '''
        
        '''
        return {
            'name': zhihu.name,
            'display_name': zhihu.display_name,
            'author': zhihu.author,
            'email': zhihu.email,
            'description': zhihu.description,
            'meta': {
                # 爬取计划，参考 crontab 配置方法
                'crawl_schedule': '0 23 * * *',

                # 执行爬取的随机延时，单位秒，用于避免被 Ban
                'crawl_random_delay': str(60 * 60),

                'package_module': 'mobi',
                'language': 'zh-CN',
                'book_mode': 'periodical',  # 'periodical' | 'book'
                'img_cover': os.path.join(
                    _images_path, 'cv_zhihudaily.jpg'),
                'img_masthead': os.path.join(
                    _images_path, 'mh_zhihudaily.gif'),
                'image_filter': json.dumps(['zhihu.com/equation']),
                'css_package': os.path.join(
                    _css_path, 'package.css')
            }
        }
1315346
public function actionIndex()
    {
        $searchModel = new MenuSearch;
        $dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());

        if (Yii::$app->request->isAjax) {
            Yii::$app->getResponse()->format = 'json';
            $id = intval(Yii::$app->request->post('id'));
            $menuRows = MenuHelper::getMenu(Yii::$app->user->id, $id);
            $menus = [
                'status' => 'OK',
                'data' => null,
            ];
            if ($menuRows) {
                foreach ($menuRows as $key => $menuRow) {
                    if (isset($menuRow['items'])) {
                        $menus['data'][$key]['name'] = $menuRow['label'] . ' <span title="排序"> <i class="fa fa-sort"> </i> ' . $menuRow['order'] . '</span><div class="tree-actions"><a href="' . Url::toRoute(['update', 'id' => $menuRow['id']]) . '"><i class="fa fa-edit"></i></a> <a href="' . Url::toRoute(['delete', 'id' => $menuRow['id']]) . '" data-confirm="您确定要删除此项吗？" data-method="post" data-pjax="0"><i class="fa fa-trash-o"></i></a> <i class="fa fa-refresh"></i></div>';
                        $menus['data'][$key]['type'] = 'folder';
                        $menus['data'][$key]['additionalParameters'] = ['id' => $menuRow['id'], 'children' => true];
                    } else {
                        $menus['data'][$key]['name'] = $menuRow['label'] . ' <span title="排序"> <i class="fa fa-sort"> </i> ' . $menuRow['order'] . '</span><div class="tree-actions"><a href="' . Url::toRoute(['update', 'id' => $menuRow['id']]) . '"><i class="fa fa-edit"></i></a> <a href="' . Url::toRoute(['delete', 'id' => $menuRow['id']]) . '" data-confirm="您确定要删除此项吗？" data-method="post" data-pjax="0"><i class="fa fa-trash-o"></i></a> <i class="fa fa-refresh"></i></div>';
                        $menus['data'][$key]['type'] = 'item';
                        $menus['data'][$key]['additionalParameters'] = ['id' => $menuRow['id']];
                    }
                }
            }
            return $menus;
        }

        return $this->render('index', [
                'dataProvider' => $dataProvider,
                'searchModel' => $searchModel,
        ]);
    }
907486
public function getdepositcount($card_id)
    {
        if (!is_string($card_id)) {
            $this->setError('参数错误');

            return false;
        }

        $queryStr            = [];
        $queryStr['card_id'] = $card_id;

        $this->apitype = 'card';
        $this->module  = 'code';
        $res           = $this->_post('getdepositcount', $queryStr);

        return $res;
    }
658763
public function addShopWifi($shop_id, $ssid, $password = null)
    {
        $data = ['shop_id' => $shop_id, 'ssid' => $ssid, 'password' => $password];
        $url = 'https://api.weixin.qq.com/bizwifi/device/add?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
1357111
def get_foreign_page_id_from_type(self, page_type):
        '''
        
        '''
        # TODO: log this
        response = requests.get("{}pages/?type={}".format(
            self.api_url, page_type))
        content = json.loads(response.content)
        return content["items"][0]["id"]
168938
public function getCouponput($shop_id)
    {
        $url = 'https://api.weixin.qq.com/bizwifi/couponput/get?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, ['shop_id' => $shop_id]);
    }
748842
async def _get_person_json(self, id_, url_params=None):
        
        url = self.url_builder(
            'person/{person_id}',
            dict(person_id=id_),
            url_params=url_params or OrderedDict(),
        )
        data = await self.get_data(url)
        return data
854197
public function get($shopId)
    {
        $resource = 'shop/' . $shopId . '.json';
        $response = $this->getServiceResponse($resource);

        $getShopResponse = new Models\ResponseShopGet($response);

        return $getShopResponse->getShop();
    }
849894
public static boolean checkSign(PurchaseInfoResult result, String pubKey) {

        if (result == null || pubKey == null) {
            return false;
        }

        StringBuilder sb = new StringBuilder();

        Map<String, Object> paramsa = new HashMap<String, Object>();
        paramsa.put("pageCount", result.getPageCount());
        paramsa.put("rtnCode", result.getRtnCode());
        sb.append(getNoSign(paramsa, false)).append('&');

        List<PurchaseInfo> purchaseInfos = result.getPurchaseInfoList();
        if (purchaseInfos != null) {
            for (PurchaseInfo info : purchaseInfos) {
                if (info != null) {
                    Map<String, Object> paramsaSub = new HashMap<String, Object>();
                    //必选参数
                    paramsaSub.put("requestId", info.getRequestId());
                    paramsaSub.put("merchantId", info.getMerchantId());
                    paramsaSub.put("appId", info.getAppId());
                    paramsaSub.put("productId", info.getProductId());
                    paramsaSub.put("tradeTime", info.getTradeTime());

                    sb.append(getNoSign(paramsaSub, false)).append('&');
                }
            }
        }

        if (sb.charAt(sb.length()-1) == '&') {
            sb.deleteCharAt(sb.length()-1);
        }

        return doCheck(sb.toString(), result.getSign(), pubKey);
    }
789418
public function upShopWifi($shop_id, $old_ssid, $ssid, $password = null)
    {
        $data = ['shop_id' => $shop_id, 'old_ssid' => $old_ssid, 'ssid' => $ssid];
        is_null($password) || $data['password'] = $password;
        $url = 'https://api.weixin.qq.com/bizwifi/shop/update?access_token=ACCESS_TOKEN';
        $this->registerApi($url, __FUNCTION__, func_get_args());
        return $this->httpPostForJson($url, $data);
    }
1010243
public function getDeviceStat($device_id)
    {
        if (!$this->access_token && !$this->getAccessToken()) {
            return false;
        }
        $result = Tools::httpGet(self::API_BASE_URL_PREFIX . self::DEVICE_GET_STAT . "access_token={$this->access_token}&device_id=$device_id");
        if ($result) {
            $json = json_decode($result, true);
            if (empty($json) || !empty($json['errcode'])) {
                $this->errCode = isset($json['errcode']) ? $json['errcode'] : '505';
                $this->errMsg = isset($json['errmsg']) ? $json['errmsg'] : '无法解析接口返回内容！';
                return $this->checkRetry(__FUNCTION__, func_get_args());
            }
            return $json;
        }
        return false;
    }