<?php
/**
 * Created by PhpStorm.
 * User: tandunzhao
 * Date: 2018/3/22
 * Time: 下午6:00
 */

namespace App\Modules\Channel\Services;

use App\Modules\Channel\Models\ChannelQuestionNaire;
use App\Modules\Manage\Services\ManageService;
use DB;

class ChannelQuestionNaireService
{
    /**
     * 添加问卷调查信息
     * @param $item
     * @return mixed
     */
    static function addQuestionNaire($item)
    {
        return ChannelQuestionNaire::addQuestionNaire($item);
    }

    /**
     * 获取问卷调查信息
     * @param $param 查询字段
     * @param bool $isAll 是否获取所有
     */
    static function getQuestionNaires($param, $isAll = false)
    {
        return ChannelQuestionNaire::getQuestionNaires($param, $isAll);
    }

    /**
     * 更新调查信息
     * @param $id
     * @param $reply_grade
     * @return mixed
     */
    static function updateInfo($id, $reply_grade, $business_name)
    {
        return ChannelQuestionNaire::updateInfo($id, $reply_grade, $business_name);
    }


    static function getNickName($channel_user_id)
    {
        $mecioal = '';
        $channelUser = ChannelUserService::getById($channel_user_id);
        $manage = ManageService::getById($channelUser->distribution_manages_id);
        if ($manage) {
            $mecioal = $manage->nickname;
        }
        return $mecioal;
    }

}