new-admin-api/app/controller/admin/supplier/Apply.php

56 lines
1.7 KiB
PHP

<?php
namespace app\controller\admin\supplier;
use app\services\supplier\SystemSupplierApplyServices;
use crmeb\basic\BaseController;
use think\App;
use think\exception\ValidateException;
class Apply extends BaseController{
public function __construct(App $app, SystemSupplierApplyServices $services){
parent::__construct($app);
$this->services = $services;
}
/**
* Common: 列表获取
* Author: wu-hui
* Time: 2024/01/30 15:13
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function applyList(){
$search = $this->request->params(['winery_name','contacts_name','contacts_phone','invite_agent_id','status']);
[$page, $limit] = $this->getPage();
$data = $this->services->getList($search, $page, $limit);
return app('json')->success($data);
}
/**
* Common: 审核
* Author: wu-hui
* Time: 2024/01/30 15:53
* @return mixed
*/
public function toExamine(){
// 参数获取
$params = $this->request->params(['id','status','reason']);
if($params['id'] <= 0) throw new ValidateException('方法请求,信息不明确!');
// 审核通过 主动生成账号
if((int)$params['status'] === 1){
// 审核通过
$this->services->toExaminePass((array)$params);
}else{
// 驳回
$this->services->update($params['id'],['status'=>$params['status'],'reason'=>$params['reason']]);
}
return app('json')->success('操作成功');
}
}