|
|
@ -11,6 +11,7 @@ use App\Constants\v3\Tabs; |
|
|
use App\Constants\v3\UserType; |
|
|
use App\Constants\v3\UserType; |
|
|
use App\Controller\BaseController; |
|
|
use App\Controller\BaseController; |
|
|
use App\Model\v3\FinancialRecord; |
|
|
use App\Model\v3\FinancialRecord; |
|
|
|
|
|
use App\Model\v3\ImsMcFansTag; |
|
|
use App\Model\v3\Market; |
|
|
use App\Model\v3\Market; |
|
|
use App\Model\v3\Store; |
|
|
use App\Model\v3\Store; |
|
|
use App\Request\v3\StoreIndexRequest; |
|
|
use App\Request\v3\StoreIndexRequest; |
|
|
@ -25,12 +26,16 @@ use App\Service\v3\Interfaces\FinancialRecordServiceInterface; |
|
|
use App\Service\v3\Interfaces\OrderOnlineServiceInterface; |
|
|
use App\Service\v3\Interfaces\OrderOnlineServiceInterface; |
|
|
use App\Service\v3\Interfaces\OrderStatisticsServiceInterface; |
|
|
use App\Service\v3\Interfaces\OrderStatisticsServiceInterface; |
|
|
use App\Service\v3\Interfaces\RevenueListServiceInterface; |
|
|
use App\Service\v3\Interfaces\RevenueListServiceInterface; |
|
|
|
|
|
use App\Service\v3\Interfaces\ShareInfoServiceInterface; |
|
|
use App\Service\v3\Interfaces\StoreServiceInterface; |
|
|
use App\Service\v3\Interfaces\StoreServiceInterface; |
|
|
use App\Service\v3\Interfaces\TabsServiceInterface; |
|
|
use App\Service\v3\Interfaces\TabsServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserCenterBlockServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserCenterBlockServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserInfoServiceInterface; |
|
|
use App\Service\v3\Interfaces\UserInfoServiceInterface; |
|
|
use App\TaskWorker\SSDBTask; |
|
|
use App\TaskWorker\SSDBTask; |
|
|
|
|
|
use EasyWeChat\Factory; |
|
|
|
|
|
use EasyWeChat\Kernel\Exceptions\InvalidConfigException; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
|
|
use Hyperf\Guzzle\CoroutineHandler; |
|
|
use Hyperf\Redis\Redis; |
|
|
use Hyperf\Redis\Redis; |
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
use Hyperf\Utils\ApplicationContext; |
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
use Psr\Http\Message\ResponseInterface; |
|
|
@ -121,6 +126,12 @@ class HomeController extends BaseController |
|
|
*/ |
|
|
*/ |
|
|
protected $financialRecordService; |
|
|
protected $financialRecordService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Inject |
|
|
|
|
|
* @var ShareInfoServiceInterface |
|
|
|
|
|
*/ |
|
|
|
|
|
protected $shareInfoService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 小程序首页,根据market_id |
|
|
* 小程序首页,根据market_id |
|
|
* 1.banner数据 |
|
|
* 1.banner数据 |
|
|
@ -134,14 +145,18 @@ class HomeController extends BaseController |
|
|
$version = $this->request->input('version', -1); |
|
|
$version = $this->request->input('version', -1); |
|
|
$banners = $this->bannerService->all(Banner::TYPE_APPLET_INDEX, $marketId); |
|
|
$banners = $this->bannerService->all(Banner::TYPE_APPLET_INDEX, $marketId); |
|
|
$categories = $this->categoryService->allForAppletIndex(); |
|
|
$categories = $this->categoryService->allForAppletIndex(); |
|
|
$activity = $this->activityService->allForAppletIndex(env('APPLET_INDEX_ACTIVITY_TYPE'), $marketId); |
|
|
|
|
|
|
|
|
// $activity = $this->activityService->allForAppletIndex(env('APPLET_INDEX_ACTIVITY_TYPE'), $marketId);
|
|
|
|
|
|
$activity = $this->activityService->allSpecialForAppletIndex($marketId); |
|
|
$tabs = $this->tabsService->allForAppletIndex($version); |
|
|
$tabs = $this->tabsService->allForAppletIndex($version); |
|
|
|
|
|
$shareInfo = $this->shareInfoService->getForApplet(); |
|
|
|
|
|
|
|
|
return $this->success([ |
|
|
return $this->success([ |
|
|
'banners' => $banners, |
|
|
'banners' => $banners, |
|
|
'categories' => $categories, |
|
|
'categories' => $categories, |
|
|
'activity' => ['type' => ActivityType::FLASH_SALE, 'goods' => $activity], |
|
|
|
|
|
|
|
|
// 'activity' => ['type' => ActivityType::FLASH_SALE, 'goods' => $activity],
|
|
|
|
|
|
'activity' => $activity, |
|
|
'tabs' => $tabs, |
|
|
'tabs' => $tabs, |
|
|
|
|
|
'share_info' => $shareInfo, |
|
|
]); |
|
|
]); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
@ -154,6 +169,7 @@ class HomeController extends BaseController |
|
|
* 4、为你推荐的商品列表 |
|
|
* 4、为你推荐的商品列表 |
|
|
* @param UserIndexRequest $request |
|
|
* @param UserIndexRequest $request |
|
|
* @return ResponseInterface |
|
|
* @return ResponseInterface |
|
|
|
|
|
* @throws InvalidConfigException |
|
|
*/ |
|
|
*/ |
|
|
public function userIndex(UserIndexRequest $request) |
|
|
public function userIndex(UserIndexRequest $request) |
|
|
{ |
|
|
{ |
|
|
@ -195,6 +211,37 @@ class HomeController extends BaseController |
|
|
|
|
|
|
|
|
$data['block'] = $this->userCenterBlockService->all($roles); |
|
|
$data['block'] = $this->userCenterBlockService->all($roles); |
|
|
|
|
|
|
|
|
|
|
|
// 返回用户是否已经关注公众号和查看时候跳转的文章地址
|
|
|
|
|
|
try { |
|
|
|
|
|
$config = config('wechat.official'); |
|
|
|
|
|
$app = Factory::officialAccount(['app_id' => $config['app_id'], 'secret' => $config['app_secret']]); |
|
|
|
|
|
$app['guzzle_handler'] = CoroutineHandler::class; |
|
|
|
|
|
|
|
|
|
|
|
$redis = ApplicationContext::getContainer()->get(Redis::class); |
|
|
|
|
|
|
|
|
|
|
|
$fansInfo = ['subscribe' => 0]; |
|
|
|
|
|
$fansTag = ImsMcFansTag::query()->where(['unionid' => $data['user']['unionid']])->first(); |
|
|
|
|
|
if (empty($fansTag)) { // 无绑定时无关注,单需要处理老we7那边更新unionid的事宜
|
|
|
|
|
|
$subscribeInfo = $redis->hGet('official:subscribe_info', 'not_subscribed'); |
|
|
|
|
|
} else { // 有记录时去微信看有没有关注
|
|
|
|
|
|
|
|
|
|
|
|
$userOfficialOpenid = $fansTag->openid ?? ''; |
|
|
|
|
|
$fansInfo = $app->user->get($userOfficialOpenid); |
|
|
|
|
|
|
|
|
|
|
|
if (isset($fansInfo['subscribe']) && $fansInfo['subscribe'] == 1) { |
|
|
|
|
|
$subscribeInfo = $redis->hGet('official:subscribe_info', 'subscribed'); |
|
|
|
|
|
} else { |
|
|
|
|
|
$subscribeInfo = $redis->hGet('official:subscribe_info', 'not_subscribed'); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$subscribeInfo = !empty($subscribeInfo) ? json_decode($subscribeInfo, true) : []; |
|
|
|
|
|
$data['subscribe_info'] = array_merge($fansInfo, $subscribeInfo); |
|
|
|
|
|
} catch (\Exception $e) { |
|
|
|
|
|
$data['subscribe_info'] = (object)[]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $this->success($data); |
|
|
return $this->success($data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|