修正wechat类,

This commit is contained in:
2023-02-20 14:13:01 +08:00
parent 24a6a529fb
commit 61114f0e92
4 changed files with 15 additions and 29 deletions
+4 -7
View File
@@ -9,7 +9,7 @@ use App\Model\UserPatient as UserPatientModel;
use App\Model\UserPharmacist as UserPharmacistModel;
use App\Utils\Http;
use App\Utils\Jwt;
use App\Utils\WeChat;
use Extend\Wechat\Wechat;
use Hyperf\DbConnection\Db;
use Hyperf\Redis\Redis;
use Psr\Container\ContainerExceptionInterface;
@@ -29,7 +29,7 @@ class LoginService extends BaseService
$wx_code = $this->request->input('wx_code');
$user_type = $this->request->input('user_type');
$weChat = $this->container->get(WeChat::class);
$weChat = new Wechat($user_type);
// 获取手机号
$phone_info = $weChat->getPhone($phone_code);
@@ -111,6 +111,7 @@ class LoginService extends BaseService
Db::rollBack();
return fail(HttpEnumCode::SERVER_ERROR);
}
$client_user_id = $user_doctor['doctor_id'];
}
} else {
@@ -187,12 +188,8 @@ class LoginService extends BaseService
$data = array();
$data['login_ip'] = $login_ip ?? "";
$data['last_login_at'] = date('Y-m-d H:i:s', time());
$res = UserModel::editUser($params,$data);
if (!$res){
Db::rollBack();
return fail(HttpEnumCode::SERVER_ERROR);
}
UserModel::editUser($params,$data);
// 组合生成token的数据
$token_user_data = array();
$token_user_data['user_id'] = $user['user_id']; // 用户id
-1
View File
@@ -10,7 +10,6 @@ use App\Model\UserPatient as UserPatientModel;
use App\Model\UserPharmacist as UserPharmacistModel;
use App\Utils\Http;
use App\Utils\Jwt;
use App\Utils\WeChat;
use Hyperf\DbConnection\Db;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
+3
View File
@@ -19,6 +19,9 @@ use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
/**
* 废弃
*/
class WeChat
{
protected Application $app;