123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <?php
- namespace App\Http\Controllers\Wechat\OfficialAccount;
- use App\Http\Controllers\Channel\BaseController as ChannelBaseController;
- use App\Modules\OfficialAccount\Models\OfficialAccount;
- use App\Modules\OfficialAccount\Models\OfficialInteractiveEvent;
- use App\Modules\Channel\Models\Channel;
- use App\Http\Controllers\Wechat\OfficialAccount\Transformers\OfficialMenuTransformer;
- use Illuminate\Http\Request;
- use GuzzleHttp\Client;
- use App\Libs\OSS;
- class OfficialMenusController extends ChannelBaseController
- {
-
-
- function officialMenusList(Request $request)
- {
- $appid = $request->has('appid') ? $request->input('appid') : '';
- if (empty($appid)) {
- return response()->error("PARAM_EMPTY");
- }
- $officialAccount = OfficialAccount::officialAccountByAppid($appid);
- if (!empty($officialAccount)) {
- $distribution_channel_id = $officialAccount['distribution_channel_id'];
- $host = env('WECHAT_CUSTOM_HOST');
-
- if(in_array($distribution_channel_id,array(5,123))){
- }
-
-
-
- $channel = Channel::getById($distribution_channel_id);
- $is_yq_move = isset($channel->is_yq_move)?$channel->is_yq_move:'0';
- $is_domain_simple = isset($channel->is_domain_simple)?$channel->is_domain_simple:'0';
- if($is_domain_simple == '1'){
- $encodeDistributionChannelId = $distribution_channel_id;
- }else{
- $encodeDistributionChannelId = encodeDistributionChannelId($distribution_channel_id);
- }
- \Log::info('officialMenusList:distribution_channel_id:'.$distribution_channel_id.' encodeDistributionChannelId:'.$encodeDistributionChannelId.' is_yq_move:'.$is_yq_move.' is_domain_simple:'.$is_domain_simple);
-
- $base_url = env('PROTOCOL') . '://site' . $encodeDistributionChannelId . '.' . $host . '.com/';
- $help_url = 'https://help.zhuishuyun.com?distribution_channel_id='.$encodeDistributionChannelId;
- if($is_yq_move){
- \Log::info('officialMenusList_is_yunqi_move:'.$distribution_channel_id);
-
- $buttons =
- [
- [
- "type" => "click",
- "name" => "最近阅读",
- "key" => "recent_read",
- ],
- ];
-
- }else{
- \Log::info('officialMenusList_not_yunqi_move:'.$distribution_channel_id);
-
- $buttons =
- [
- [
- "type" => "click",
- "name" => "最近阅读",
- "key" => "recent_read",
- ],
- [
- "type" => "click",
- "name" => "今日签到",
- "key" => 'daily_sign',
- ],
- [
- "name" => "用户中心",
- "sub_button" =>
- [
- [
- "type" => "view",
- "name" => "个人中心",
- "url" => $base_url . 'person',
- ],
- [
- "type" => "view",
- "name" => "书城首页",
- "url" => $base_url,
- ],
- [
- "type" => "view",
- "name" => "优惠充值",
- "url" => $base_url . 'pay',
- ],
- [
- "type" => "view",
- "name" => "帮助中心",
- "url" => $help_url,
- ],
- ],
- ],
- ];
-
- }
-
- return response()->success($buttons);
- }
- }
- }
|