<?php

namespace app\api\controller;

use app\api\model\User;
use app\manager\model\FollowRecord;

class Hujiao
{
    public function callback() {
        $data = json_decode(file_get_contents("php://input"), true);

        $telstarttime = $data['starttime'];
        $druation = $data['druation'];

        $follow_model = new FollowRecord;
        $user_model = new User;

        $user_info = $user_model->getOne(['LoginCode' => $data['telB']],'Id,ManagerId');

        $add_data = [
            'user_id' => $user_info['Id'],
            'op_user' => $user_info['ManagerId'],
            'telstarttime' => $telstarttime,
            'druation' => $druation.'s',
        ];

        $follow_model->add($add_data);
    }
}
