<?php

namespace app\mainapp\controller;

use app\common\service\BalanceService;
use app\mainapp\BaseController;

use app\common\model\User as UserModel;

class Jbangjia extends BaseController
{

    public function getMemberByMobile()
    {
        $mobile = input('mobile');
        $user   = UserModel::where('mobile', $mobile)->find();
        if (empty($user)) {
            page_result(1, "手机号不存在");
        }

        page_result(0, '', [
            'nickname' => $user['nickname'],
            'avatar'   => $user['avatar'],
        ]);
    }

    public function dealIncomeByMobile()
    {
        $mobile = input('mobile');
        $user   = UserModel::where('mobile', $mobile)->find();

        if (empty($user)) {
            page_result(1, "用户不存在");
        }

        $balanceService = new BalanceService();
        $balanceService->add($user['id'], BalanceService::SERVICE_SUCCESS);
    }
}