164 lines
5.3 KiB
PHP
164 lines
5.3 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\school;
|
|
|
|
use app\common\model\dyqc\ManystoreShop;
|
|
|
|
/**
|
|
* 机构接口
|
|
*/
|
|
class Shop extends Base
|
|
{
|
|
protected $noNeedLogin = ["detail",'people','spec'];
|
|
protected $noNeedRight = '*';
|
|
|
|
protected $model = null;
|
|
|
|
/**
|
|
* 初始化操作
|
|
* @access protected
|
|
*/
|
|
protected function _initialize()
|
|
{
|
|
|
|
$this->model = new ManystoreShop;
|
|
parent::_initialize();
|
|
|
|
//判断登录用户是否是员工
|
|
}
|
|
|
|
|
|
/**
|
|
* @ApiTitle( 机构详情)
|
|
* @ApiSummary(机构详情)
|
|
* @ApiRoute(/api/school/shop/detail)
|
|
* @ApiMethod(GET)
|
|
* @ApiParams(name = "id", type = "int",required=true,description = "机构id")
|
|
* @ApiReturn({
|
|
|
|
*
|
|
*})
|
|
*/
|
|
public function detail(){
|
|
$id = $this->request->get('id/d','');
|
|
|
|
if(empty($id)){
|
|
$this->error(__('缺少必要参数'));
|
|
}
|
|
|
|
try {
|
|
$res = $this->model->detail($id);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('获取成功', ['detail' => $res]);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** 机构申请
|
|
* @ApiTitle( 机构申请)
|
|
* @ApiSummary(机构申请)
|
|
* @ApiRoute(/api/school/shop/shopapply)
|
|
* @ApiMethod(POST)
|
|
* @ApiParams(name = "name", type = "string",required=true,description = "机构名称")
|
|
* @ApiParams(name = "tel", type = "string",required=false,description = "服务电话(非必填)")
|
|
* @ApiParams(name = "desc", type = "string",required=false,description = "申请备注(非必填)")
|
|
* @ApiParams(name = "front_idcard_image", type = "string",required=true,description = "法人身份证正面")
|
|
* @ApiParams(name = "reverse_idcard_image", type = "string",required=true,description = "法人身份证反面")
|
|
* @ApiParams(name = "images", type = "string",required=true,description = "机构环境照片(多个逗号拼接)")
|
|
* @ApiParams(name = "yyzz_images", type = "string",required=true,description = "营业执照照片(多个逗号拼接)")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function shopapply(){
|
|
$params=[];
|
|
$params["name"] = $this->request->post('name/s','');
|
|
$params["tel"] = $this->request->post('tel/s','');
|
|
$params["desc"] = $this->request->post('desc/s','');
|
|
$params["front_idcard_image"] = $this->request->post('front_idcard_image/s','');
|
|
$params["reverse_idcard_image"] = $this->request->post('reverse_idcard_image/s','');
|
|
|
|
$params["images"] = $this->request->post('images/s','');
|
|
$params["yyzz_images"] = $this->request->post('yyzz_images/s','');
|
|
|
|
if(empty($id)){
|
|
$this->error(__('缺少必要参数'));
|
|
}
|
|
$type = "2";
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
try {
|
|
$res = $this->model->apply($type,$user_id,$params,true,true);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('获取成功', ['detail' => $res]);
|
|
}
|
|
|
|
|
|
|
|
/** 个人申请
|
|
* @ApiTitle( 个人申请)
|
|
* @ApiSummary(个人申请)
|
|
* @ApiRoute(/api/school/shop/userapply)
|
|
* @ApiMethod(POST)
|
|
* @ApiParams(name = "name", type = "string",required=true,description = "姓名")
|
|
* @ApiParams(name = "tel", type = "string",required=false,description = "服务电话(非必填)")
|
|
* @ApiParams(name = "desc", type = "string",required=false,description = "申请备注(非必填)")
|
|
* @ApiParams(name = "front_idcard_image", type = "string",required=true,description = "身份证正面")
|
|
* @ApiParams(name = "reverse_idcard_image", type = "string",required=true,description = "身份证反面")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function userapply(){
|
|
$params=[];
|
|
$params["name"] = $this->request->post('name/s','');
|
|
$params["tel"] = $this->request->post('tel/s','');
|
|
$params["desc"] = $this->request->post('desc/s','');
|
|
$params["front_idcard_image"] = $this->request->post('front_idcard_image/s','');
|
|
$params["reverse_idcard_image"] = $this->request->post('reverse_idcard_image/s','');
|
|
|
|
// if(empty($id)){
|
|
// $this->error(__('缺少必要参数'));
|
|
// }
|
|
$type = "1";
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
try {
|
|
$res = $this->model->apply($type,$user_id,$params,true,true);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('获取成功', ['detail' => $res]);
|
|
}
|
|
|
|
|
|
/**
|
|
* @ApiTitle(机构申请状态)
|
|
* @ApiSummary(机构申请状态)
|
|
* @ApiRoute(/api/school/shop/auth_info)
|
|
* @ApiMethod(GET)
|
|
*/
|
|
public function auth_info(){
|
|
|
|
try {
|
|
$res = ManystoreShop::getAuthInfo($this->auth->id);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('获取成功', $res);
|
|
}
|
|
|
|
|
|
} |