12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- namespace App\Http\Services\V1_1;
- use App\Generated\V1_1\Messages\Partner\GetPartnerUserMessage;
- use App\Generated\V1_1\Messages\Partner\ThumbPartnerMessage;
- use App\Generated\V1_1\Messages\Partner\SetPartnerSellMessage;
- use App\Generated\V1_1\Messages\Partner\LockLikeMeMessage;
- use App\Http\Controllers\Core\Auth;
- use App\Managers\PartnerManager;
- use App\Models\PartnerModel;
- use App\Models\User\UserModel;
- class PartnerService
- {
- public function getPartnerUser(GetPartnerUserMessage $message)
- {
- $uid = Auth::auth();
- if ($partner_id = $message->getPartnerId()) {
- $partner = PartnerModel::findOrFail($partner_id);
- } else {
- $uid = $message->getUid();
- $partner = PartnerModel::whereUid($uid)->firstOrFail();
- }
- /** @var PartnerModel $partner */
- $partnerManager = new PartnerManager();
- $message->setResponse($partnerManager->partnerUser($uid, $partner));
- }
- public function thumbPartner(ThumbPartnerMessage $message)
- {
- $uid = Auth::auth();
- $partnerId = $message->getPartnerId();
- $thumb = $message->getThumb();
- $ps = new \App\Services\User\PartnerService();
- $data = $ps->thumb($uid, $partnerId, $thumb);
- $message->setResponse($data);
- }
- public function lockLikeMe(LockLikeMeMessage $message)
- {
- $origin = $message->getOrigin() ?: 'supvip';
- $partnerId = $message->getPartnerId();
- $uid = Auth::auth();
- $ps = new \App\Services\User\PartnerService();
- if ($origin == 'app_sign') {
- $ps->appLockLikeMe($uid, $partnerId);
- } else {
- $ps->lockLikeme($uid, $partnerId);
- }
- }
- /**
- * 设置(开/关)隐身模式
- * @param SetPartnerSellMessage $message
- * @throws \App\Exceptions\AlertException
- */
- public function setPartnerSell(SetPartnerSellMessage $message)
- {
- $uid = Auth::auth();
- $sell = $message->getIs_sell();
- $user = UserModel::find($uid);
- $ups = new \App\Services\User\PartnerService();
- $ups->sell($user->partner_id, $sell);
- }
- }
|