智慧教务系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

96 lines
3.1 KiB

<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的多应用管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\api\controller\apiController;
use app\Request;
use app\service\api\apiService\CommonService;
use core\base\BaseApiService;
/**
* 公共控制器相关接口
* Class Personnel
* @package app\api\controller\apiController
*/
class Common extends BaseApiService
{
//获取字典
public function getDictionary(Request $request){
//获取员工信息
$where = [
'key'=>$request->param('key','')
];
$res = (new CommonService())->getDictionary($where);
if(!$res){
return fail('账户信息有误');
}
return success($res);
}
//忘记密码-通过短信验证码进行密码重置(学生/员工通用)
public function forgetPassword(Request $request)
{
$phone = $request->param('phone', '');//手机号
$code = $request->param('code', '');//短信验证码
$code_type = $request->param('code_type', '');//短信验证码类型(发送/验证 短信验证码的类型)|修改密码=editPassword
$password = $request->param('password', '');//新密码
$user_type = $request->param('user_type', '');//用户类型|customer=学生|personnel=员工(销售/教师)
if (empty($phone) || empty($code) || empty($code_type) || empty($password) || empty($user_type)) {
return fail('缺少必填参数');
}
//@todo 验证短信验证码是否正确(等发送短信验证码接入后在写)
//...
//重置密码
$res = (new CommonService())->forgetPassword($phone, $password, $user_type);
if(!$res['code']){
return fail($res['msg']);
}
return success([]);
}
//获取配置信息
public function getConfig(Request $request){
$config_key = $request->param('config_key', '');//配置项关键字
if (empty($config_key)) {
return fail('缺少必填参数');
}
$where = [
'config_key'=>$config_key
];
$res = (new CommonService())->getConfig($where);
if (!$res){
return fail('配置信息有误');
}
return success($res);
}
public function getMiniWxOpenId(Request $request){
$code = $request->param('code', '');//微信code
if (empty($code)) {
return fail('缺少必填参数');
}
$res = (new CommonService())->getMiniWxOpenId($code);
if (!$res['code']){
return fail($res['msg']);
}
return success($res['data']);
}
}