444 lines
21 KiB
PHP
444 lines
21 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\school;
|
|
|
|
use app\common\model\dyqc\ManystoreShop;
|
|
|
|
/**
|
|
* 机构接口
|
|
*/
|
|
class Shop extends Base
|
|
{
|
|
protected $noNeedLogin = ["detail",'people','spec','shop_list','auth_info'];
|
|
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 = "yyzzdm", type = "string",required=true,description = "社会统一信用代码")
|
|
* @ApiParams(name = "yyzz_images", type = "string",required=true,description = "营业执照照片(多个逗号拼接)")
|
|
* @ApiParams(name = "address", type = "string",required=true,description = "店铺地址")
|
|
* @ApiParams(name = "address_detail", type = "string",required=true,description = "店铺详细地址")
|
|
* @ApiParams(name = "longitude", type = "string",required=true,description = "经度")
|
|
* @ApiParams(name = "latitude", type = "string",required=true,description = "纬度")
|
|
* @ApiParams(name = "province", type = "int",required=true,description = "省编号")
|
|
* @ApiParams(name = "city", type = "int",required=true,description = "市编号")
|
|
* @ApiParams(name = "district", type = "int",required=true,description = "县区编号")
|
|
*
|
|
* @ApiParams(name = "establish_time", type = "int",required=true,description = "成立时间10位秒级时间戳")
|
|
* @ApiParams(name = "people", type = "int",required=true,description = "员工人数")
|
|
* @ApiParams(name = "legal_entity", type = "string",required=true,description = "法人姓名")
|
|
* @ApiParams(name = "gender", type = "int",required=true,description = "法人性别:0=女,1=男")
|
|
* @ApiParams(name = "nation", type = "string",required=true,description = "法人民族")
|
|
* @ApiParams(name = "out_look", type = "string",required=true,description = "法人政治面貌")
|
|
* @ApiParams(name = "birthtime", type = "int",required=true,description = "法人出生日期10位秒级时间戳")
|
|
* @ApiParams(name = "native_place", type = "string",required=true,description = "法人籍贯")
|
|
* @ApiParams(name = "card_number", type = "string",required=true,description = "法人身份证号码")
|
|
* @ApiParams(name = "diploma", type = "string",required=true,description = "法人学历")
|
|
* @ApiParams(name = "post", type = "string",required=true,description = "法人职务")
|
|
* @ApiParams(name = "social_position", 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','');
|
|
$params["yyzzdm"] = $this->request->post('yyzzdm/s','');
|
|
|
|
|
|
$params["address"] = $this->request->post('address/s','');
|
|
$params["address_detail"] = $this->request->post('address_detail/s','');
|
|
$params["longitude"] = $this->request->post('longitude/s','');
|
|
$params["latitude"] = $this->request->post('latitude/s','');
|
|
|
|
|
|
|
|
|
|
$params["province"] = $this->request->post('province/d','');
|
|
$params["city"] = $this->request->post('city/d','');
|
|
$params["district"] = $this->request->post('district/d','');
|
|
|
|
|
|
|
|
$params["establish_time"] = $this->request->post('establish_time/d','');
|
|
$params["people"] = $this->request->post('people/d','');
|
|
$params["legal_entity"] = $this->request->post('legal_entity/s','');
|
|
$params["gender"] = $this->request->post('gender/d','');
|
|
$params["nation"] = $this->request->post('nation/s','');
|
|
$params["out_look"] = $this->request->post('out_look/s','');
|
|
$params["birthtime"] = $this->request->post('birthtime/d','');
|
|
$params["native_place"] = $this->request->post('native_place/s','');
|
|
$params["card_number"] = $this->request->post('card_number/s','');
|
|
$params["diploma"] = $this->request->post('diploma/s','');
|
|
$params["post"] = $this->request->post('post/s','');
|
|
$params["social_position"] = $this->request->post('social_position/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 = "身份证反面")
|
|
* @ApiParams(name = "address", type = "string",required=true,description = "地址")
|
|
* @ApiParams(name = "address_detail", type = "string",required=true,description = "详细地址")
|
|
* @ApiParams(name = "longitude", type = "string",required=true,description = "经度")
|
|
* @ApiParams(name = "latitude", type = "string",required=true,description = "纬度")
|
|
* @ApiParams(name = "province", type = "int",required=true,description = "省编号")
|
|
* @ApiParams(name = "city", type = "int",required=true,description = "市编号")
|
|
* @ApiParams(name = "district", type = "int",required=true,description = "县区编号")
|
|
* @ApiParams(name = "gender", type = "int",required=true,description = "个人性别:0=女,1=男")
|
|
* @ApiParams(name = "nation", type = "string",required=true,description = "个人民族")
|
|
* @ApiParams(name = "out_look", type = "string",required=true,description = "个人政治面貌")
|
|
* @ApiParams(name = "birthtime", type = "int",required=true,description = "个人出生日期10位秒级时间戳")
|
|
* @ApiParams(name = "native_place", type = "string",required=true,description = "个人籍贯")
|
|
* @ApiParams(name = "card_number", type = "string",required=true,description = "个人身份证号码")
|
|
* @ApiParams(name = "diploma", type = "string",required=true,description = "个人学历")
|
|
* @ApiParams(name = "post", type = "string",required=true,description = "个人职务")
|
|
* @ApiParams(name = "social_position", 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','');
|
|
|
|
|
|
$params["address"] = $this->request->post('address/s','');
|
|
$params["address_detail"] = $this->request->post('address_detail/s','');
|
|
$params["longitude"] = $this->request->post('longitude/s','');
|
|
$params["latitude"] = $this->request->post('latitude/s','');
|
|
|
|
|
|
$params["province"] = $this->request->post('province/d','');
|
|
$params["city"] = $this->request->post('city/d','');
|
|
$params["district"] = $this->request->post('district/d','');
|
|
|
|
|
|
|
|
$params["establish_time"] = $this->request->post('establish_time/d','');
|
|
$params["people"] = $this->request->post('people/d','');
|
|
$params["legal_entity"] = $this->request->post('legal_entity/s','');
|
|
$params["gender"] = $this->request->post('gender/d','');
|
|
$params["nation"] = $this->request->post('nation/s','');
|
|
$params["out_look"] = $this->request->post('out_look/s','');
|
|
$params["birthtime"] = $this->request->post('birthtime/d','');
|
|
$params["native_place"] = $this->request->post('native_place/s','');
|
|
$params["card_number"] = $this->request->post('card_number/s','');
|
|
$params["diploma"] = $this->request->post('diploma/s','');
|
|
$params["post"] = $this->request->post('post/s','');
|
|
$params["social_position"] = $this->request->post('social_position/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(){
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
try {
|
|
$res = ManystoreShop::getAuthInfo($user_id);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('获取成功', $res);
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* @ApiTitle( 通用机构大索索列表)
|
|
* @ApiSummary(通用机构大索索列表)
|
|
* @ApiMethod(GET)
|
|
* @ApiParams(name = "keywords", type = "string",required=false,description = "搜索关键字")
|
|
|
|
* @ApiParams(name = "page", type = "string",required=true,description = "页数")
|
|
* @ApiParams(name = "limit", type = "string",required=true,description = "条数")
|
|
* @ApiParams(name = "user_id", type = "int",required=false,description = "主讲师用户id")
|
|
* @ApiParams(name = "shop_id", type = "int",required=false,description = "机构店铺id")
|
|
* @ApiParams(name = "teacher_id", type = "int",required=false,description = "老师id")
|
|
* @ApiParams(name = "keyword", type = "string",required=false,description = "关键字搜索")
|
|
* @ApiParams(name = "type", type = "string",required=false,description = "类型:1=个人,2=机构")
|
|
* @ApiParams(name = "province", type = "string",required=false,description = "省编号")
|
|
* @ApiParams(name = "city", type = "string",required=false,description = "市编号")
|
|
* @ApiParams(name = "district", type = "string",required=false,description = "县区编号")
|
|
* @ApiParams(name = "status", type = "string",required=false,description = "不传则默认查上架的 审核状态:0=待审核,1=审核通过,2=审核失败")
|
|
* @ApiParams(name = "order", type = "string",required=false,description = " normal=综合排序優先,distance=距离优先")
|
|
* @ApiParams(name = "nearby", type = "string",required=false,description = "限制最大搜索距离(米)")
|
|
* @ApiParams(name = "latitude", type = "string",required=false,description = "latitude")
|
|
* @ApiParams(name = "longitude", type = "string",required=false,description = "longitude")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function shop_list()
|
|
{
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
$params =[];
|
|
$params["my_user_id"] = $user_id;
|
|
$params["page"] = $this->request->get('page/d', 1); //页数
|
|
$params["limit"] = $this->request->get('limit/d', 10); //条数
|
|
$params["keywords"] = $this->request->get('keywords/s', ''); //搜索关键字
|
|
$params["user_id"] = $this->request->get('user_id/d', ''); //主讲师用户id
|
|
$params["id"] = $this->request->get('shop_id/d', ''); //机构店铺id
|
|
$params["teacher_id"] = $this->request->get('teacher_id/d', ''); //机构店铺id
|
|
$params["keyword"] = $this->request->get('keyword/s', ''); //机构店铺id
|
|
$params["type"] = $this->request->get('type/s', ''); //机构店铺id
|
|
$params["province"] = $this->request->get('province/s', ''); //机构店铺id
|
|
|
|
|
|
$params["city"] = $this->request->get('city/s', ''); //机构店铺id
|
|
$params["district"] = $this->request->get('district/s', ''); //机构店铺id
|
|
$params["status"] = $this->request->get('status/s', ''); //机构店铺id
|
|
|
|
|
|
|
|
$params["order"] = $this->request->get('order/s', ''); //机构店铺id
|
|
$params["nearby"] = $this->request->get('nearby/s', ''); //机构店铺id
|
|
|
|
|
|
$params["latitude"] = $this->request->get('latitude/s', ''); //机构店铺id
|
|
$params["longitude"] = $this->request->get('longitude/s', ''); //机构店铺id
|
|
|
|
// $type = $this->request->get('type/s', ''); //筛选学员和教练单
|
|
|
|
try{
|
|
//当前申请状态
|
|
$res = $this->model::getVaildList($params);
|
|
// if($user_id =='670153'){
|
|
// file_put_contents("ceshi66.txt",(new AppointmentOrder())->getLastSql());
|
|
// }
|
|
}catch (\Exception $e){
|
|
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('查询成功', ["list"=>$res]);
|
|
}
|
|
|
|
|
|
|
|
/** 编辑认证信息
|
|
* @ApiTitle( 编辑认证信息)
|
|
* @ApiSummary(编辑认证信息)
|
|
* @ApiRoute(/api/school/shop/edit)
|
|
* @ApiMethod(POST)
|
|
* @ApiParams(name = "name", type = "string",required=true,description = "机构名称")
|
|
* @ApiParams(name = "logo", type = "string",required=true,description = "logo单图")
|
|
* @ApiParams(name = "image", type = "string",required=true,description = "封面单图")
|
|
* @ApiParams(name = "content", type = "string",required=true,description = "店铺详情")
|
|
* @ApiParams(name = "tel", type = "string",required=true,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 = "yyzzdm", type = "string",required=true,description = "社会统一信用代码")
|
|
* @ApiParams(name = "yyzz_images", type = "string",required=true,description = "营业执照照片(多个逗号拼接)")
|
|
* @ApiParams(name = "address", type = "string",required=true,description = "店铺地址")
|
|
* @ApiParams(name = "address_detail", type = "string",required=true,description = "店铺详细地址")
|
|
* @ApiParams(name = "longitude", type = "string",required=true,description = "经度")
|
|
* @ApiParams(name = "latitude", type = "string",required=true,description = "纬度")
|
|
* @ApiParams(name = "province", type = "int",required=true,description = "省编号")
|
|
* @ApiParams(name = "city", type = "int",required=true,description = "市编号")
|
|
* @ApiParams(name = "district", type = "int",required=true,description = "县区编号")
|
|
* @ApiParams(name = "establish_time", type = "int",required=true,description = "成立时间10位秒级时间戳")
|
|
* @ApiParams(name = "people", type = "int",required=true,description = "员工人数")
|
|
* @ApiParams(name = "legal_entity", type = "string",required=true,description = "法人姓名")
|
|
* @ApiParams(name = "gender", type = "int",required=true,description = "法人性别:0=女,1=男")
|
|
* @ApiParams(name = "nation", type = "string",required=true,description = "法人民族")
|
|
* @ApiParams(name = "out_look", type = "string",required=true,description = "法人政治面貌")
|
|
* @ApiParams(name = "birthtime", type = "int",required=true,description = "法人出生日期10位秒级时间戳")
|
|
* @ApiParams(name = "native_place", type = "string",required=true,description = "法人籍贯")
|
|
* @ApiParams(name = "card_number", type = "string",required=true,description = "法人身份证号码")
|
|
* @ApiParams(name = "diploma", type = "string",required=true,description = "法人学历")
|
|
* @ApiParams(name = "post", type = "string",required=true,description = "法人职务")
|
|
* @ApiParams(name = "social_position", type = "string",required=true,description = "法人社会职务")
|
|
*
|
|
*
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function edit(){
|
|
$params=[];
|
|
$params["name"] = $this->request->post('name/s','');
|
|
$params["logo"] = $this->request->post('logo/s','');
|
|
$params["image"] = $this->request->post('image/s','');
|
|
$params["content"] = $this->request->post('content/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','');
|
|
$params["yyzzdm"] = $this->request->post('yyzzdm/s','');
|
|
|
|
|
|
$params["address"] = $this->request->post('address/s','');
|
|
$params["address_detail"] = $this->request->post('address_detail/s','');
|
|
$params["longitude"] = $this->request->post('longitude/s','');
|
|
$params["latitude"] = $this->request->post('latitude/s','');
|
|
|
|
|
|
|
|
|
|
$params["province"] = $this->request->post('province/d','');
|
|
$params["city"] = $this->request->post('city/d','');
|
|
$params["district"] = $this->request->post('district/d','');
|
|
|
|
|
|
|
|
$params["establish_time"] = $this->request->post('establish_time/d','');
|
|
$params["people"] = $this->request->post('people/d','');
|
|
$params["legal_entity"] = $this->request->post('legal_entity/s','');
|
|
$params["gender"] = $this->request->post('gender/d','');
|
|
$params["nation"] = $this->request->post('nation/s','');
|
|
$params["out_look"] = $this->request->post('out_look/s','');
|
|
$params["birthtime"] = $this->request->post('birthtime/d','');
|
|
$params["native_place"] = $this->request->post('native_place/s','');
|
|
$params["card_number"] = $this->request->post('card_number/s','');
|
|
$params["diploma"] = $this->request->post('diploma/s','');
|
|
$params["post"] = $this->request->post('post/s','');
|
|
$params["social_position"] = $this->request->post('social_position/s','');
|
|
|
|
|
|
|
|
|
|
// if(empty($id)){
|
|
// $this->error(__('缺少必要参数'));
|
|
// }
|
|
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
try {
|
|
$res = $this->model->updateData($user_id,$params,true,true);
|
|
} catch (\Exception $e){
|
|
// Log::log($e->getMessage());
|
|
$this->error($e->getMessage(),['errcode'=>$e->getCode()]);
|
|
}
|
|
$this->success('编辑成功', ['detail' => $res]);
|
|
}
|
|
|
|
|
|
} |