Commit 141eeeed authored by suntengda's avatar suntengda

Merge branch 'pindan_activity_list_optimize' into develop

parents 5f530313 7e5019b9
......@@ -48,6 +48,14 @@ class UserController extends Base
$this->success($userInfo);
}
public function generate_url_linkAction()
{
$params = $this->params;
$user = UserService::generateUrllink($params);
$userInfo['result'] = $user;
$this->success($userInfo);
}
}
\ No newline at end of file
......@@ -486,8 +486,11 @@ class MarketingService
$params['activity_status'] = MarketingPindan::ACTIVITY_STATUS_START_TODAY;//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list['prepare'] = self::marketingList($params)['result'];
$list['prepare'] = $list['prepare'] ? array_column((array)$list['prepare'], null, 'marketing_id') : [];
$marketingIdsPrepare = array_keys($list['prepare']);
return self::_fillSkuAndOrderInfo($marketingIdsDoing,$list);
$marketingIds = array_merge($marketingIdsDoing, $marketingIdsPrepare);
return self::_fillSkuAndOrderInfo($marketingIds,$list);
}
/**
......
......@@ -407,6 +407,46 @@ class UserService
return $update;
}
public static function generateUrllink()
{
//请求接口,获取用户openid
$generateUrl = 'https://api.weixin.qq.com/wxa/generate_urllink?access_token='.self::getAccessToken();
$params = [
'access_token' => self::getAccessToken(),
];
$params = [
"path" => "/pages/product-info/index",
"query" => "marketing_id=10000107&from=square",
"is_expire" => true,
"expire_type" => 1,
"expire_interval" => 10,
];
$response = (new Request())->post($generateUrl, $params,5000,'json');
$jsoninfo = $response['response'];
return $jsoninfo;
}
/**
* 获取accessToken
* @return mixed
*/
public static function getAccessToken()
{
$appid = \Yaf\Registry::get('config')->wechat->appid;
$appsecret = \Yaf\Registry::get('config')->wechat->secret;
$url = "https://api.weixin.qq.com/cgi-bin/token";
$params = [
'grant_type' => 'client_credential',
'appid' => $appid,
'secret' => $appsecret,
];
$response = (new Request())->get($url, $params);
$jsoninfo = $response['response'];
$accessToken = $jsoninfo["access_token"];
return $accessToken;
}
private static function generate3rdSession($openid) {
return md5(mt_rand() . $openid);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment