推广分佣功能开发

This commit is contained in:
Dev
2026-10-14 14:44:01 +08:00
parent da26eb5306
commit 1754df972d
34 changed files with 1414 additions and 16 deletions
@@ -4,6 +4,7 @@ namespace app\api\controller;
use app\common\controller\Api;
use app\common\model\User;
use app\common\service\PromotionService;
use app\common\service\UserService;
use think\exception\HttpResponseException;
use think\Validate;
@@ -65,6 +66,8 @@ class Auth extends Api
$this->error('参数错误');
}
$user = UserService::wxLogin($code);
//通过分享链接/小程序码进入时携带推广人ID,首次进入即绑定
PromotionService::bindPromoter(intval($user->id), intval($this->request->post('promoter_id', 0)));
$this->auth->direct($user->id);
$userInfo = $this->auth->getUserinfo();
$this->success('登录成功', ['userinfo' => $this->auth->getUserinfo(), 'token' => $userInfo['token']]);