first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,380 @@
<?php
namespace app\api\controller;
use app\common\service\UserService;
use app\ydyd_service\model\BuyerModel;
use app\ydyd_service\model\UserCertificateModel;
use app\ydyd_service\service\UserActionService;
use think\Db;
use think\Exception;
use think\facade\Config;
use think\Request;
class UserController extends ApiController
{
protected $noAuth = ['register_app','phonecode_app','forgetPassword_app','tell','editPassword'];
/**
* @apiDefine User 用户管理
*/
/**
* @apiVersion 1.0.0
* @api {post} /user/register_app 1.注册(李程)
* @apiName register_app
* @apiGroup User
* @apiParam {Int} phone 手机号
* @apiParam {Int} smscode 收到的验证码
* @apiParam {String} password 密码
* @apiSuccessExample Success-Response:
*{"code":200,"message":"成功","data":{"errmsg":"用户注册成功"}}
*/
public function register_App()
{
try {
$post = $this->request->param('');
$data = model(UserActionService::class)->register_App($post);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'),$data);
} catch (Exception $exception) {
return self::returnMsg(self::ERR_NONE, $exception->getMessage());
}
}
/**
* @apiVersion 1.0.0
* @api {post} /user/phonecode_app 2.手机验证码(李程)
* @apiName phonecode_app
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiParam {Int} phone 手机号
* @apiParam {Int} smscode 收到的验证码
* @apiParam {int} status 1表示注册2表示忘记密码
* @apiSuccessExample Success-Response:
*{"code":200,"message":"成功","data":{"errmsg":"短信已经发送到你的手机,请注意查收"}}
*/
public function phonecode_App()
{
$parames = $this->request->param('');
$data = model(UserActionService::class)->phonecode_App($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}
/**
* @apiVersion 1.0.0
* @api {post} /user/forgetPassword_app 3.重置密码(李程)
* @apiName forgetPassword_app
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiParam {Int} phone 手机号
* @apiParam {Int} smscode 收到的验证码
* @apiParam {Int} password 密碼
* @apiSuccessExample Success-Response:
*{"code":200,"message":"成功","data":{"errmsg":"用户找回密码成功"}}
*/
public function forgetPassword_app(Request $request)
{
$parames = $this->request->param('');
$data = model(UserActionService::class)->forgetPassword_app($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}
/**
* @apiVersion 1.0.0
* @api {post} /user/checkAuth 4.企业认证检测(朱晓伟)
* @apiName checkAuth
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": "finish|authBaisc|authCertificate|authBank"
}
*/
public function checkAuth(Request $request)
{
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->checkAuth($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}
/**
* @apiVersion 1.0.0
* @api {get|post} /user/authBaisc 5.企业认证第一步(基础信息 get查看 post新增编辑朱晓伟
* @apiName authBaisc
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiParam {String} sub_type 企业类型 post
* @apiParam {String} name 企业名称 post
* @apiParam {String} consignee 联系人 post
* @apiParam {Int} consignee 联系人 post
* @apiParam {String} business_address 地址 post
* @apiParam {String} area_id 区域id post
* @apiParam {String} service_number 客服编号 post
* @apiSuccessExample GET Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"buyer_user_id": 298,
"area_id": 3,
"name": "对方水电费",
"business_address": "",
"sub_type": "drugstore",
"consignee": "王子军",
"tel": "17075808888",
"custom_service_id": 9,
"is_edit": false
}
}
* @apiSuccessExample POST Success-Response:
*{
"code": 200,
"message": "成功",
"data": true
}
*/
public function authBaisc(Request $request)
{
if($request->isPost()){
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->authBaisc($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}else{
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->viewBaisc($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}
}
/**
* @apiVersion 1.0.0
* @api {get|post} /user/authCertificate 6.企业认证第二步(资质信息 get查看 post新增编辑朱晓伟
* @apiName authCertificate
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiParam {String} sub_type 企业类型 post
* @apiParam {String} business_license 资质url post(所有资质都按照这种格式)
* @apiSuccessExample GET Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"list": [
{
"certificate_type": "business_license",
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/business_license_img_url_1560330649970.jpg"
},
{
"certificate_type": "gsp_license",
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/gsp_license_img_url_1560330653130.jpg"
},
{
"certificate_type": "trade_license",
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/trade_license_img_url_1560330651312.jpg"
},
{
"certificate_type": "purchase_identity",
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/purchase_identity_img_url_1560330656292.jpg"
},
{
"certificate_type": "authority_purchase",
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/authority_purchase_img_url_1560330654577.jpg"
},
{
"certificate_type": "tax_regcate",
"img_url": "ydyd-develop-file.oss-cn-hangzhou.aliyuncs.com/tax_regcate_img_url_1560330657786.jpg"
}
],
"is_edit": true
}
}
* @apiSuccessExample POST Success-Response:
*{
"code": 200,
"message": "成功",
"data": true
}
*
*/
public function authCertificate(Request $request)
{
if($request->isPost()){
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->authCertificate($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}else{
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->viewCertificate($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}
}
/**
* @apiVersion 1.0.0
* @api {get|post} /user/authBank 7.企业认证第三步(银行信息 get查看 post新增编辑朱晓伟
* @apiName authBank
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiParam {String} invoice_rise 开票抬头 post
* @apiParam {String} tax_number 税号 post
* @apiParam {String} [bank_name] 开户行 post
* @apiParam {String} [bank_account] 银行账号 post
* @apiParam {String} [account_name] 持卡人姓名 post
* @apiSuccessExample GET Success-Response:
*{
"code": 200,
"message": "成功",
"data": {
"id": 307,
"user_id": 298,
"account_name": "测试",
"bank_name": "肥东",
"bank_account": "46546546546546",
"create_time": "2019-06-04 16:35:22",
"invoice_title": "测试企业",
"tax_number": "",
"is_edit": true
}
}
* @apiSuccessExample POST Success-Response:
*{
"code": 200,
"message": "成功",
"data": true
}
*
*/
public function authBank(Request $request)
{
if($request->isPost()){
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->authBank($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}else{
try{
$parames = input('');
$parames['user_id'] = $this->uid;
$data = model(UserService::class)->viewBank($parames);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $data);
}catch (Exception $exception){
return self::returnMsg(self::ERR_DENY, $exception->getMessage());
}
}
}
/**
* @apiVersion 1.0.0
* @api {post} /user/tell 8.获取手机号(登录时)(李程)
* @apiName tell
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": "15056810203"
}
*/
public function tell()
{
$phone = $this->clientInfo['phone'];
if($phone){
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $phone);
}
}
/**
* @apiVersion 1.0.0
* @api {post} /user/editPassword 8.修改密码(登录时)(李程)
* @apiName editPassword
* @apiGroup User
* @apiHeader {String} authentication 验证
* @apiParam {String} ordpassword 旧密码
* @apiParam {String} password 新密码
* @apiSuccessExample Success-Response:
*{
"code": 200,
"message": "成功",
"data": "15056810203"
}
*/
public function editPassword()
{
//
$params = input('');
$params['phone'] = $this->clientInfo['phone'];
$user = Db::name("users")->where('phone',$params['phone'])->find();
$pwd = md5($params['ordpassword'] . $user['secure_password_key']);
if ($pwd != $user['password']) {
return self::returnMsg(401, '账号密码有误', []);
}
$tmp = model('User', 'service')->editPassword($params);
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $tmp);
}
/**
* 保存更新的资源
*
* @param \think\Request $request
* @param int $id
* @return \think\Response
*/
public function update(Request $request, $id)
{
//
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
//
}
}