|
@@ -1538,48 +1538,48 @@ class ChapterController extends BaseController
|
|
|
public function getWechatJsConfig(Request $request)
|
|
|
{
|
|
|
//try {
|
|
|
- // $chapter->is_show_share_button = 1;
|
|
|
- $bid = $request->input('bid', '');
|
|
|
- $cid = $request->input('cid', '');
|
|
|
- $url = $request->input('url', '');
|
|
|
- $url = urldecode($url);
|
|
|
-
|
|
|
- \Log::info('url:' . ($this->uid) . $url);
|
|
|
- if (empty($bid) || empty($cid) || empty($url)) {
|
|
|
- return response()->error('PARAM_EMPTY');
|
|
|
- }
|
|
|
-
|
|
|
- $share_url = 'https://'._domain().'/detail?fromtype=readershare&id='.$bid.'&fromflag='.($this->uid).'&fromcid='.$cid;
|
|
|
- //$js_config = ChapterShareWechatConfigService::getConfig($url);
|
|
|
-
|
|
|
- $app_hash = array(
|
|
|
- 4025=>['appid'=>'wx80b618c9dcc940f7','appsecret'=>'255a2de8db51e4084b5e9087d26d4ecb'],
|
|
|
- 4147=>['appid'=>'wx2a99699cd9572812','appsecret'=>'0e0d57f94eeba50abb3af6883df05a5c'],
|
|
|
- 691=>['appid'=>'wx5cefcd251dc40693','appsecret'=>'755f64c85173dad21f20870e38f59d8a'],
|
|
|
- 123=>['appid'=>'wx983808610aa9dcc5','appsecret'=>'91002999590b79f3c7be35fd73c04049'],
|
|
|
- 211=>['appid'=>'wx39338e374cc2055b','appsecret'=>'1a4c2039be271b3811182be5bb53eb34'],
|
|
|
+ // $chapter->is_show_share_button = 1;
|
|
|
+ $bid = $request->input('bid', '');
|
|
|
+ $cid = $request->input('cid', '');
|
|
|
+ $url = $request->input('url', '');
|
|
|
+ $url = urldecode($url);
|
|
|
+
|
|
|
+ \Log::info('url:' . ($this->uid) . $url);
|
|
|
+ if (empty($bid) || empty($cid) || empty($url)) {
|
|
|
+ return response()->error('PARAM_EMPTY');
|
|
|
+ }
|
|
|
|
|
|
- );
|
|
|
- $appId = $app_hash[$this->distribution_channel_id]['appid'];
|
|
|
- $appSecret = $app_hash[$this->distribution_channel_id]['appsecret'];
|
|
|
- $js_config = (new ChapterShareWechatConfigService($appId,$appSecret))->getSignPackage($url);
|
|
|
- /*$appid = DB::table('official_accounts')->where('distribution_channel_id',$this->distribution_channel_id)->first();//(['distribution_channel_id'=>$this->distribution_channel_id]);
|
|
|
- $appid = $appid->appid;
|
|
|
- //\Log::info('get_appid:'.($appid));
|
|
|
- $js_config = (new ChapterShareWechatConfigService($appid))->getSignPackage($url);
|
|
|
- //$chapter->js_config = $js_config;
|
|
|
- //$chapter->share_url = $share_url;
|
|
|
- $book = BookService::getBookById(Hashids::decode($bid)[0]);
|
|
|
- $first_cid = $book->first_cid;
|
|
|
- $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
- /*if (in_array($this->uid, explode(',', env('TEST_SHARE_UIDS')))) {
|
|
|
- $share_url = 'https://site5017zqeyzwgyx9n8.zhuishuyun.com/reader?fromtype=readershare&bid=' . $bid . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
- }*/
|
|
|
- $book = BookService::getBookById(Hashids::decode($bid)[0]);
|
|
|
- $first_cid = $book->first_cid;
|
|
|
- $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
- if (in_array($this->distribution_channel_id, [2, 14])) {
|
|
|
- $js_config = ChapterShareWechatConfigService::getConfig($url);
|
|
|
+ $share_url = 'https://'._domain().'/detail?fromtype=readershare&id='.$bid.'&fromflag='.($this->uid).'&fromcid='.$cid;
|
|
|
+ //$js_config = ChapterShareWechatConfigService::getConfig($url);
|
|
|
+
|
|
|
+ $app_hash = array(
|
|
|
+ 4025=>['appid'=>'wx80b618c9dcc940f7','appsecret'=>'255a2de8db51e4084b5e9087d26d4ecb'],
|
|
|
+ 4147=>['appid'=>'wx2a99699cd9572812','appsecret'=>'0e0d57f94eeba50abb3af6883df05a5c'],
|
|
|
+ 691=>['appid'=>'wx5cefcd251dc40693','appsecret'=>'755f64c85173dad21f20870e38f59d8a'],
|
|
|
+ 123=>['appid'=>'wx983808610aa9dcc5','appsecret'=>'91002999590b79f3c7be35fd73c04049'],
|
|
|
+ 211=>['appid'=>'wx39338e374cc2055b','appsecret'=>'1a4c2039be271b3811182be5bb53eb34'],
|
|
|
+
|
|
|
+ );
|
|
|
+ $appId = $app_hash[$this->distribution_channel_id]['appid'];
|
|
|
+ $appSecret = $app_hash[$this->distribution_channel_id]['appsecret'];
|
|
|
+ $js_config = (new ChapterShareWechatConfigService($appId,$appSecret))->getSignPackage($url);
|
|
|
+ /*$appid = DB::table('official_accounts')->where('distribution_channel_id',$this->distribution_channel_id)->first();//(['distribution_channel_id'=>$this->distribution_channel_id]);
|
|
|
+ $appid = $appid->appid;
|
|
|
+ //\Log::info('get_appid:'.($appid));
|
|
|
+ $js_config = (new ChapterShareWechatConfigService($appid))->getSignPackage($url);
|
|
|
+ //$chapter->js_config = $js_config;
|
|
|
+ //$chapter->share_url = $share_url;
|
|
|
+ $book = BookService::getBookById(Hashids::decode($bid)[0]);
|
|
|
+ $first_cid = $book->first_cid;
|
|
|
+ $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
+ /*if (in_array($this->uid, explode(',', env('TEST_SHARE_UIDS')))) {
|
|
|
+ $share_url = 'https://site5017zqeyzwgyx9n8.zhuishuyun.com/reader?fromtype=readershare&bid=' . $bid . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
+ }*/
|
|
|
+ $book = BookService::getBookById(Hashids::decode($bid)[0]);
|
|
|
+ $first_cid = $book->first_cid;
|
|
|
+ $share_url = 'https://site' . encodeDistributionChannelId($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
+ if (in_array($this->distribution_channel_id, [2, 14])) {
|
|
|
+ $js_config = ChapterShareWechatConfigService::getConfig($url);
|
|
|
|
|
|
$share_url = 'https://site' . ($this->distribution_channel_id) . '.' . env('SHARE_DOMAIN') . '/reader?fromtype=readershare&bid=' . $bid . '&cid=' . ($first_cid) . '&fromflag=' . ($this->uid) . '&fromcid=' . $cid;
|
|
|
}
|