<?php
// +----------------------------------------------------------------------
// | whitef快速开发前后端分离管理后台（PHP版）
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码，建议反馈是我们前进的动力
// | 开源版本可自由商用，可去除界面版权logo
// | gitee下载：https://gitee.com/likeshop_gitee/whitef
// | github下载：https://github.com/likeshop-github/whitef
// | 访问官网：https://www.whitef.cn
// | whitef团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: whitefTeam
// +----------------------------------------------------------------------

namespace app\workerapi\controller;

use app\common\enum\notice\NoticeEnum;
use app\common\model\master_worker\MasterWorker;
use app\common\model\master_worker_register\MasterWorkerRegister;
use app\common\model\notice\NoticeSetting;
use app\common\model\sale\Sale;
use app\common\service\wechat\WeChatOaService;
use app\workerapi\lists\MasterWorkerRegisterLists;
use app\workerapi\lists\PropertyHeadLists;
use app\workerapi\lists\TenantRegisterLists;
use app\workerapi\logic\DictLogic;
use app\workerapi\logic\LoginLogic;
use app\workerapi\logic\MasterWorkerRegisterLogic;
use app\workerapi\logic\PropertyHeadLogic;
use app\workerapi\logic\SaleLogic;
use app\workerapi\logic\TenantRegisterLogic;
use app\workerapi\validate\LoginAccountValidate;
use app\workerapi\validate\RegisterValidate;


/**
 * 销售
 * Class SaleController
 * @package app\workerapi\controller
 */
class SaleController extends BaseApiController
{

    public array $notNeedLogin = ['register', 'account','getTenantList','getTenantDetail','getWorkerList','getWorkerDetail','getPropertyList','getPropertyDetail'];


    /**
     * @notes 注册账号
     * @return \think\response\Json
     * @author 段誉
     * @date 2022/9/7 15:38
     */
    public function register()
    {
        return $this->success('注册成功', [], 1, 1);
    }

    /**
     * @notes 手机号密码/手机号验证码登录
     * @return \think\response\Json
     * @author 段誉
     * @date 2022/9/16 10:42
     */
    public function account()
    {
        $params = request()->post();
        $result = SaleLogic::login($params);
        if (false === $result) {
            return $this->fail(SaleLogic::getError());
        }
        return $this->data($result);
    }

    /**
     * 销售查看门店入驻情况列表
     */
    public function getTenantList()
    {
        return $this->dataLists(new TenantRegisterLists());
    }
    /**
     * 销售查看门店入驻详情
     */
    public function getTenantDetail()
    {
        $params = request()->get();
        $result = TenantRegisterLogic::detail($params);
        return $this->data($result);
    }

    /**
     * 销售查看工程师入驻情况列表
     */
    public function getWorkerList()
    {
        return $this->dataLists(new MasterWorkerRegisterLists());
    }
    /**
     * 销售查看工程师入驻详情
     */
    public function getWorkerDetail()
    {
        $params = request()->get();
        $result = MasterWorkerRegisterLogic::detail($params);
        return $this->data($result);
    }


    /**
     * 销售查看代理列表
     */
    public function getPropertyList()
    {
        return $this->dataLists(new PropertyHeadLists());
    }
    /**
     * 销售查看代理详情
     */
    public function getPropertyDetail()
    {
        $params = request()->get();
        $result = PropertyHeadLogic::detail($params);
        return $this->data($result);
    }

}