<?php

use App\Base\Base;
use App\Services\distribution\DistributorService;
use App\Exception\custom\DistributorException;
class DistributorController extends Base
{
    
    /**
     * 获取团长列表
     * 后台管理
     *
     */
    public function distributor_listAction()
    {
        $params = $this->params;
        $distributionList = DistributorService::distributorList($params);
        $this->success($distributionList);
    }
    
    /**
     * 获取详情数据
     * 后台管理
     *
     */
    public function distributor_infoAction()
    {
        $params = $this->params;
        $distributorInfo = DistributorService::distributorInfo($params);
        $this->success(['result' => $distributorInfo]);
    }
    
    /**
     * 更新数据
     * 后台管理
     *
     */
    public function update_distributorAction()
    {
        $params = $this->params;

        $where['distributor_id'] = $params['distributor_id'];
        
        if (!empty($params['audit_status'])) {
            $param['audit_status'] = $params['audit_status'];
        }

        if (!empty($params['audit_user_name'])) {
            $param['audit_user_name'] = $params['audit_user_name'];
        }
         
        $srt = DistributorService::updateDistributor($param,$where);

        if (!empty($srt)) {
            $this->success();
        }else{
            throw new DistributorException(['cus'=>1]);
        }
    }
    
    /**
     * 添加团长
     * 后台管理
     *
     */
    public function add_distributorAction()
    {
    	 
    }

    
 



}