区域接口 添加用户
This commit is contained in:
parent
264d2bea35
commit
42b109ce08
46
app/api/controller/CommonController.php
Normal file
46
app/api/controller/CommonController.php
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\api\controller;
|
||||||
|
use think\facade\Db;
|
||||||
|
|
||||||
|
class CommonController extends BaseApiController
|
||||||
|
{
|
||||||
|
public array $notNeedLogin = ['city', 'area', 'street','province','village','brigade'];
|
||||||
|
|
||||||
|
//**省列表 */
|
||||||
|
public function province()
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_province')->where(['switch' => 1])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
} //**市列表 */
|
||||||
|
public function city($city)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_city')->where(['province_code' => $city])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**区域列表 */
|
||||||
|
public function area($area)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_area')->where(['city_code' => $area])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**街道列表 */
|
||||||
|
public function street($street)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_street')->where(['area_code' => $street])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
//**村列表 */
|
||||||
|
public function village($village)
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_village')->where(['street_code' => $village])->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
//**小队列表 */
|
||||||
|
public function brigade()
|
||||||
|
{
|
||||||
|
$data = Db::name('geo_brigade')->select();
|
||||||
|
return $this->data($data->toArray());
|
||||||
|
}
|
||||||
|
}
|
@ -16,6 +16,7 @@ namespace app\api\controller;
|
|||||||
|
|
||||||
use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
|
use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
|
||||||
use app\api\logic\LoginLogic;
|
use app\api\logic\LoginLogic;
|
||||||
|
use app\Request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录注册
|
* 登录注册
|
||||||
@ -36,6 +37,7 @@ class LoginController extends BaseApiController
|
|||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
{
|
{
|
||||||
|
return $this->fail('暂未开放注册,请联系管理员添加账号');
|
||||||
$params = (new RegisterValidate())->post()->goCheck('register');
|
$params = (new RegisterValidate())->post()->goCheck('register');
|
||||||
$result = LoginLogic::register($params);
|
$result = LoginLogic::register($params);
|
||||||
if (true === $result) {
|
if (true === $result) {
|
||||||
@ -44,6 +46,15 @@ class LoginController extends BaseApiController
|
|||||||
return $this->fail(LoginLogic::getError());
|
return $this->fail(LoginLogic::getError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add(){
|
||||||
|
$params=Request()->param();
|
||||||
|
$params['company_id']=69;//$this->userInfo['company_id'];
|
||||||
|
$result = LoginLogic::register($params);
|
||||||
|
if (true === $result) {
|
||||||
|
return $this->success('添加成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(LoginLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 账号密码/手机号密码/手机号验证码登录
|
* @notes 账号密码/手机号密码/手机号验证码登录
|
||||||
|
@ -51,14 +51,27 @@ class LoginLogic extends BaseLogic
|
|||||||
$passwordSalt = Config::get('project.unique_identification');
|
$passwordSalt = Config::get('project.unique_identification');
|
||||||
$password = create_password($params['password'], $passwordSalt);
|
$password = create_password($params['password'], $passwordSalt);
|
||||||
$avatar = ConfigService::get('default_image', 'user_avatar');
|
$avatar = ConfigService::get('default_image', 'user_avatar');
|
||||||
|
// if($params['qualification']){
|
||||||
|
// $params['qualification']=explode(',',$params['qualification']);
|
||||||
|
// }
|
||||||
User::create([
|
User::create([
|
||||||
'sn' => $userSn,
|
'sn' => $userSn,
|
||||||
'avatar' => $avatar,
|
'avatar' => $avatar,
|
||||||
'nickname' => '用户' . $userSn,
|
'nickname' =>$userSn,
|
||||||
'account' => $params['account'],
|
'account' => $params['account'],
|
||||||
|
'mobile' => $params['account'],
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'channel' => $params['channel'],
|
'channel' => 0,
|
||||||
|
'sex'=>$params['sex'],
|
||||||
|
'province'=>$params['province'],
|
||||||
|
'city'=>$params['city'],
|
||||||
|
'area'=>$params['area'],
|
||||||
|
'street'=>$params['street'],
|
||||||
|
'village'=>$params['village'],
|
||||||
|
'brigade'=>$params['brigade'],
|
||||||
|
'address'=>$params['address'],
|
||||||
|
'qualification'=>json_encode($params['qualification']),
|
||||||
|
'company_id'=>$params['company_id'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
1
app/common/cache/UserTokenCache.php
vendored
1
app/common/cache/UserTokenCache.php
vendored
@ -82,6 +82,7 @@ class UserTokenCache extends BaseCache
|
|||||||
'terminal' => $userSession->terminal,
|
'terminal' => $userSession->terminal,
|
||||||
'expire_time' => $userSession->expire_time,
|
'expire_time' => $userSession->expire_time,
|
||||||
'admin_id' => $user->admin_id,
|
'admin_id' => $user->admin_id,
|
||||||
|
'company_id'=>$user->company_id,
|
||||||
];
|
];
|
||||||
|
|
||||||
$ttl = new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time));
|
$ttl = new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time));
|
||||||
|
2
vendor/ebaoquan/junziqian_sdk
vendored
2
vendor/ebaoquan/junziqian_sdk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1294ea49ff9ecc4532821f8798304816cbf8dd74
|
Subproject commit 9acc82cd23d807280ddd29df2117e7890094d049
|
Loading…
x
Reference in New Issue
Block a user