<?php

use App\Base\Base;
use App\Services\user\UserService;
use Api\PhpUtils\Validate\Validate;
use App\Exception\custom\UserException;
use \Validate\CheckIsDistributorValidate;



class UserController extends Base
{
   
    public function wechat_loginAction()
    {
        $params = $this->params;
        $user = UserService::wechatLogin($params);
        $userInfo['result'] = $user;
        $this->success($userInfo);
    }


    public function bind_phoneAction()
    {
        $params = $this->params;
        $user = UserService::bindPhone($params);
        $userInfo['result'] = $user;
        $this->success($userInfo);
    }


    public function user_wechat_bindAction()
    {
        $params = $this->params;
        $user = UserService::userWechatBind($params);
        if( $user === false ) {
            throw new UserException(['cus' => 10]);
        }
        $userInfo['result'] = $user;
        $this->success($userInfo);
    }

    public function bind_avatarAction()
    {
        $params = $this->params;
        $user = UserService::bindAvatar($params);
        $userInfo['result'] = $user;
        $this->success($userInfo);
    }



}