diff --git a/api/config/params.php b/api/config/params.php index d1d3b77a7..90b9bea1d 100644 --- a/api/config/params.php +++ b/api/config/params.php @@ -8,8 +8,9 @@ ], 'user.log.except.code' => [], // 不记录的code - // token有效期是否验证 默认不关闭验证 - 'user.accessTokenValidity' => false, + /** ------ token相关 ------ **/ + // token有效期是否验证 默认开启验证 + 'user.accessTokenValidity' => true, // token有效期 默认 2 小时 'user.accessTokenExpire' => 2 * 60 * 60, // refresh token有效期是否验证 默认开启验证 diff --git a/api/controllers/ActiveController.php b/api/controllers/ActiveController.php index 12eef6c07..816133690 100644 --- a/api/controllers/ActiveController.php +++ b/api/controllers/ActiveController.php @@ -82,7 +82,10 @@ public function behaviors() HttpBasicAuth::class, HttpBearerAuth::class, HttpHeaderAuth::class, - QueryParamAuth::class, + [ + 'class' => QueryParamAuth::class, + 'tokenParam' => 'access-token' + ], ], // 不进行认证判断方法 'optional' => $this->optional, diff --git a/api/modules/v1/controllers/MiniProgramController.php b/api/modules/v1/controllers/MiniProgramController.php index 519bdfec3..62207f993 100644 --- a/api/modules/v1/controllers/MiniProgramController.php +++ b/api/modules/v1/controllers/MiniProgramController.php @@ -121,7 +121,7 @@ public function actionDecode() { $member = new MemberInfo(); $member->attributes = [ - 'sex' => $userinfo['gender'], + 'gender' => $userinfo['gender'], 'nickname' => $userinfo['nickName'], 'head_portrait' => $userinfo['avatarUrl'], ]; diff --git a/api/modules/v1/controllers/member/InfoController.php b/api/modules/v1/controllers/member/InfoController.php index 16d085ef8..f0c28546f 100644 --- a/api/modules/v1/controllers/member/InfoController.php +++ b/api/modules/v1/controllers/member/InfoController.php @@ -28,7 +28,7 @@ public function actionView($id) { $model = $this->modelClass::find() ->where(['id' => $id, 'status' => StatusEnum::ENABLED]) - ->select(['id', 'username', 'nickname', 'realname', 'head_portrait', 'sex', 'qq', 'email', 'birthday', 'user_money', 'user_integral', 'status', 'created_at']) + ->select(['id', 'username', 'nickname', 'realname', 'head_portrait', 'gender', 'qq', 'email', 'birthday', 'user_money', 'user_integral', 'status', 'created_at']) ->asArray() ->one(); diff --git a/backend/assets/AppAsset.php b/backend/assets/AppAsset.php index d6a7d173d..d91199663 100644 --- a/backend/assets/AppAsset.php +++ b/backend/assets/AppAsset.php @@ -23,7 +23,6 @@ class AppAsset extends AssetBundle 'plugins/toastr/toastr.min.css', // 状态通知 'dist/css/AdminLTE.min.css', 'dist/css/rageframe.css', - 'dist/css/wechat.css', ]; public $js = [ @@ -33,6 +32,7 @@ class AppAsset extends AssetBundle 'plugins/sweetalert/sweetalert.min.js', 'plugins/fancybox/jquery.fancybox.min.js', 'dist/js/adminlte.js', + 'dist/js/demo.js', 'dist/js/template.js', 'dist/js/rageframe.js', 'dist/js/ueditor.all.min.js', diff --git a/backend/config/main.php b/backend/config/main.php index a1a927a1e..b13297cd4 100644 --- a/backend/config/main.php +++ b/backend/config/main.php @@ -82,7 +82,7 @@ 'assetManager' => [ // 线上建议将forceCopy设置成false,如果访问量不大无所谓 'forceCopy' => true, - 'appendTimestamp' => true, + // 'appendTimestamp' => true, 'bundles' => [ 'yii\web\JqueryAsset' => [ 'sourcePath' => null, @@ -108,8 +108,9 @@ 'provinces' => [ 'class' => 'backend\widgets\provinces\ProvincesController', ], - 'wechat-select-attachment' => [ - 'class' => 'backend\widgets\wechatselectattachment\WechatSelectAttachment', + // 微信资源选择 + 'selector' => [ + 'class' => 'backend\widgets\selector\SelectorController', ], ], 'params' => $params, diff --git a/backend/config/params.php b/backend/config/params.php index 99b28e18e..82ebf4308 100644 --- a/backend/config/params.php +++ b/backend/config/params.php @@ -4,6 +4,9 @@ 'adminAcronym' => 'RF', 'adminTitle' => 'RageFrame', + /** ------ 总管理员配置 ------ **/ + 'adminAccount' => 1,// 系统管理员账号id + /** ------ 日志记录 ------ **/ 'user.log' => true, 'user.log.level' => ['error'], // 级别 ['info', 'warning', 'error'] @@ -15,13 +18,9 @@ ], 'user.log.except.code' => [], // 不记录的code - /** ------ 总管理员配置 ------ **/ - 'adminAccount' => 1,// 系统管理员账号id - /** ------ 开发者信息 ------ **/ - 'exploitName' => '简言', - 'exploitVersions' => '2.2.21', - 'exploitSysName' => 'RageFrame应用开发引擎', + 'exploitDeveloper' => '简言', + 'exploitFullName' => 'RageFrame应用开发引擎', 'exploitOfficialWebsite' => 'www.rageframe.com', 'exploitGitHub' => 'https://github.com/jianyan74/rageframe2', diff --git a/backend/controllers/AddonsController.php b/backend/controllers/AddonsController.php index 956aa5238..dfef9582f 100644 --- a/backend/controllers/AddonsController.php +++ b/backend/controllers/AddonsController.php @@ -13,6 +13,7 @@ use common\helpers\AddonHelper; use common\models\sys\AddonsAuthItemChild; use common\helpers\AddonAuthHelper; +use common\helpers\DebrisHelper; use backend\modules\wechat\models\RuleForm; /** @@ -33,7 +34,7 @@ public function behaviors() 'rules' => [ [ 'allow' => true, - 'roles' => ['@'],// 登录 + 'roles' => ['@'], // 登录 ], ], ], @@ -48,6 +49,14 @@ public function behaviors() */ public function beforeAction($action) { + if (Yii::$app->user->isGuest) + { + throw new UnauthorizedHttpException('对不起,请先登录'); + } + + // 判断是否手机 + Yii::$app->params['isMobile'] = DebrisHelper::isMobile(); + // 验证是否登录且验证是否超级管理员 if (!Yii::$app->user->isGuest && Yii::$app->services->sys->isAuperAdmin()) { @@ -61,9 +70,9 @@ public function beforeAction($action) // 当前菜单路由 $route = $this->route; - in_array($action->id, ['cover', 'qr-code']) && $route = AddonsAuthItemChild::AUTH_COVER; + in_array($action->id, ['cover']) && $route = AddonsAuthItemChild::AUTH_COVER; in_array($action->id, ['rule', 'rule-edit', 'rule-delete', 'ajax-update']) && $route = AddonsAuthItemChild::AUTH_RULE; - if (AddonAuthHelper::verify($route) == false) + if (AddonAuthHelper::verify($route) === false) { throw new UnauthorizedHttpException('对不起,您现在还没获此操作的权限'); } @@ -113,8 +122,9 @@ public function actionRule() $request = Yii::$app->request; $keyword = $request->get('keyword', null); - $data = Rule::find()->with('ruleKeyword') + $data = Rule::find() ->where(['module' => Rule::RULE_MODULE_ADDON]) + ->with('ruleKeyword') ->joinWith('addon as b') ->andWhere(['b.addon' => Yii::$app->params['addon']['name']]) ->andFilterWhere(['like', 'name', $keyword]); @@ -248,26 +258,4 @@ public function actionAjaxUpdate($id) return ResultDataHelper::json(200, '修改成功'); } - - /** - * 二维码渲染 - * - * @return mixed - * @throws \yii\base\InvalidConfigException - * @throws \yii\web\NotFoundHttpException - */ - public function actionQrCode() - { - // 初始化模块 - AddonHelper::initAddon($this->addonName, $this->route); - - $qr = Yii::$app->get('qr'); - Yii::$app->response->format = Response::FORMAT_RAW; - Yii::$app->response->headers->add('Content-Type', $qr->getContentType()); - - return $qr->setText(Yii::$app->request->get('url', null)) - ->setSize(150) - ->setMargin(7) - ->writeString(); - } } \ No newline at end of file diff --git a/backend/controllers/MController.php b/backend/controllers/MController.php index bd333a090..be4618482 100644 --- a/backend/controllers/MController.php +++ b/backend/controllers/MController.php @@ -1,10 +1,10 @@ */ class MController extends \common\controllers\BaseController { - /** - * 微信实例化SDK - * - * @var - */ - protected $app; - - /** - * 服务 - * - * @var - */ - protected $services; - - /** - * @throws \yii\base\InvalidConfigException - */ - public function init() - { - parent::init(); - - empty($this->app) && $this->app = Yii::$app->wechat->app; - empty($this->services) && $this->services = Yii::$app->services; - } - /** * @return array */ diff --git a/backend/modules/member/Module.php b/backend/modules/member/Module.php index 3f5261134..75a087894 100644 --- a/backend/modules/member/Module.php +++ b/backend/modules/member/Module.php @@ -4,6 +4,7 @@ /** * Class Module * @package backend\modules\member + * @author jianyan74 <751393839@qq.com> */ class Module extends \yii\base\Module { diff --git a/backend/modules/member/views/auth/edit.php b/backend/modules/member/views/auth/edit.php index 39af4a239..8a1eba9bf 100644 --- a/backend/modules/member/views/auth/edit.php +++ b/backend/modules/member/views/auth/edit.php @@ -1,5 +1,4 @@ field($model, 'head_portrait')->widget('common\widgets\webuploader\Images', [ 'config' => [ // 可设置自己的上传地址, 不设置则默认地址 - // 'server' => '', 'pick' => [ 'multiple' => false, ], - 'formData' => [ - // 不配置则不生成缩略图 - // 'thumb' => [ - // [ - // 'widget' => 100, - // 'height' => 100, - // ], - // ] - ], - 'chunked' => false,// 开启分片上传 - 'chunkSize' => 512 * 1024,// 分片大小 ] ]);?> = $form->field($model, 'country')->textInput() ?> @@ -68,7 +55,7 @@
diff --git a/backend/modules/member/views/member/ajax-edit.php b/backend/modules/member/views/member/ajax-edit.php index 3d8b721bb..4ff52a240 100644 --- a/backend/modules/member/views/member/ajax-edit.php +++ b/backend/modules/member/views/member/ajax-edit.php @@ -29,4 +29,4 @@ - + \ No newline at end of file diff --git a/backend/modules/member/views/member/edit.php b/backend/modules/member/views/member/edit.php index 239ace026..e8808bdf7 100644 --- a/backend/modules/member/views/member/edit.php +++ b/backend/modules/member/views/member/edit.php @@ -9,7 +9,6 @@ $this->params['breadcrumbs'][] = ['label' => $this->title]; ?> -