新增药师微信登录
This commit is contained in:
@@ -9,9 +9,11 @@ use App\Model\User as UserModel;
|
||||
use App\Model\UserDoctor;
|
||||
use App\Model\UserDoctorInfo;
|
||||
use App\Model\UserPatient;
|
||||
use App\Model\UserShipAddress;
|
||||
use App\Utils\PcreMatch;
|
||||
use Extend\TencentIm\Profile;
|
||||
use Extend\Wechat\Wechat;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Hyperf\Amqp\Result;
|
||||
use Hyperf\DbConnection\Db;
|
||||
use Hyperf\Redis\Redis;
|
||||
@@ -74,6 +76,7 @@ class UserService extends BaseService
|
||||
/**
|
||||
* 修改用户头像
|
||||
* @return array
|
||||
* @throws GuzzleException
|
||||
*/
|
||||
public function putUserAvatar(): array
|
||||
{
|
||||
@@ -236,7 +239,8 @@ class UserService extends BaseService
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function putLoginout(){
|
||||
public function putLoginout(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
// 获取用户信息
|
||||
@@ -269,6 +273,90 @@ class UserService extends BaseService
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收获地址列表
|
||||
* @return array
|
||||
*/
|
||||
public function getUserAddress(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$user_ship_address = UserShipAddress::getList($params);
|
||||
if (empty($user_ship_address)){
|
||||
return success();
|
||||
}
|
||||
|
||||
return success($user_ship_address->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户收获地址详情
|
||||
* @return array
|
||||
*/
|
||||
public function getUserAddressInfo(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$address_id = $this->request->route('address_id');
|
||||
|
||||
$params = array();
|
||||
$params['address_id'] = $address_id;
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$user_ship_address = UserShipAddress::getOne($params);
|
||||
if (empty($user_ship_address)){
|
||||
return fail();
|
||||
}
|
||||
|
||||
return success($user_ship_address->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户收获地址列表
|
||||
* @return array
|
||||
*/
|
||||
public function addUserAddress(): array
|
||||
{
|
||||
$user_info = $this->request->getAttribute("userInfo") ?? [];
|
||||
|
||||
$request_params = $this->request->all();
|
||||
|
||||
$areaService = new AreaService();
|
||||
$req = $areaService->checkAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
if(empty($req)){
|
||||
return fail(HttpEnumCode::HTTP_ERROR,"地区选择错误");
|
||||
}
|
||||
|
||||
$area = $areaService->getAreaById($request_params['province_id'],$request_params['city_id'],$request_params['county_id']);
|
||||
|
||||
if ($request_params['is_default'] == 1){
|
||||
// 获取默认地址
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['is_default'] = $request_params['is_default'];
|
||||
$user_ship_address = UserShipAddress::getOne($params);
|
||||
if (!empty($user_ship_address)){
|
||||
// 存在默认
|
||||
}
|
||||
}
|
||||
|
||||
// 获取默认地址
|
||||
$params = array();
|
||||
$params['user_id'] = $user_info['user_id'];
|
||||
$params['is_default'] = $request_params['is_default'];
|
||||
$user_ship_address = UserShipAddress::getOne($params);
|
||||
if (empty($user_ship_address)){
|
||||
// 不存在默认
|
||||
}else{
|
||||
// 存在默认
|
||||
}
|
||||
|
||||
|
||||
|
||||
return success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过user_id获取用户openid
|
||||
* @param string|int $user_id
|
||||
|
||||
Reference in New Issue
Block a user