| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace pt\controllers;
- use biz\admin\classes\AdminClass;
- use common\components\util;
- use Yii;
- class AdminController extends BaseController
- {
- //更新openId ssh 20230501
- public function actionUpdateOpenId()
- {
- $post = Yii::$app->request->post();
- $adminId = $post['adminId'] ?? 0;
- $admin = AdminClass::getById($adminId, true);
- if (empty($admin)) {
- util::fail('没有找到管理员信息');
- }
- $openId = $post['openId'] ?? '';
- if (empty($openId)) {
- util::fail('openId信息为空');
- }
- $ptStyle = $post['ptStyle'] ?? 0;
- if (in_array($ptStyle, [1, 2]) == false) {
- util::fail('参数错误');
- }
- if ($ptStyle == 1) {
- $admin->openId = $openId;
- $admin->save();
- }
- if ($ptStyle == 2) {
- $admin->ghsOpenId = $openId;
- $admin->save();
- }
- util::complete();
- }
- }
|