|
@@ -3,6 +3,7 @@
|
|
|
namespace crmeb\services;
|
|
|
|
|
|
use app\models\system\Cache as CacheModel;
|
|
|
+use app\models\system\SystemStore;
|
|
|
use crmeb\exceptions\AuthException;
|
|
|
use crmeb\interfaces\ProviderInterface;
|
|
|
use crmeb\traits\LogicTrait;
|
|
@@ -82,12 +83,20 @@ class YLYService extends HttpService implements ProviderInterface
|
|
|
$this->getAccessToken();
|
|
|
}
|
|
|
|
|
|
+ public function selectStore($store_id)
|
|
|
+ {
|
|
|
+ $terminal_number = SystemStore::where('id',$store_id)->value('terminal_number');
|
|
|
+ $this->terminal = $terminal_number;
|
|
|
+ $this->getAccessToken($store_id);
|
|
|
+ return $this;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
* 获取AccessToken
|
|
|
* */
|
|
|
- protected function getAccessToken()
|
|
|
+ protected function getAccessToken($store_id=0)
|
|
|
{
|
|
|
- $this->access_token = CacheModel::getDbCache('YLY_access_token', function () {
|
|
|
+ $this->access_token = CacheModel::getDbCache('YLY_access_token'.$store_id, function () {
|
|
|
$request = self::postRequest($this->apiUrl . 'oauth/oauth', [
|
|
|
'client_id' => $this->client_id,
|
|
|
'grant_type' => 'client_credentials',
|