Skip to content

Commit

Permalink
V1.3.4
Browse files Browse the repository at this point in the history
修复:体验版购物车商品结算后,返回购物车,购物车未刷新问题
修复:公众号商城填写评价页面空白问题
修复:添加商品-无法上传视频问题
修复:公众号商城设置跳转微页面,微页面不显示内容问题
修复:售后订单首次拒绝后不能发货问题
修复:山东省济南市缺失行政区问题
  • Loading branch information
wj005 committed Aug 2, 2021
1 parent aa6cd5a commit 1d946da
Show file tree
Hide file tree
Showing 103 changed files with 7,724 additions and 504 deletions.
109 changes: 56 additions & 53 deletions api/CloudController.php
Original file line number Diff line number Diff line change
@@ -1,53 +1,56 @@
<?php

namespace leadmall\api;

use basics\api\BasicsController as BasicsModules;
use leadmall\Map;
use Yii;

class CloudController extends BasicsModules implements Map
{
public $modelClass = 'setting\models\Setting';

/**
* 重写父类
* @return [type] [description]
*/
public function actions()
{
$actions = parent::actions();
unset($actions['create']);
unset($actions['update']);
return $actions;
}

public function actionIndex()
{
$headers = \Yii::$app->getRequest()->getHeaders();
//获取分页信息
$pageSize = $headers->get('X-Pagination-Per-Page') ?? 5;
$page = \Yii::$app->request->get('page', 1);
return \Yii::$app->cloud->update->getVersionData([
'page' => $page,
'limit' => $pageSize,
]);
}

public function actionCreate($value = '')
{
$res = $this->modelClass::find()->where(['keyword' => 'mysql_version'])->one();
if (!$res) {
$article = new $this->modelClass();
$article->keyword = 'mysql_version';
$article->merchant_id = 1;
$article->content = app_version();
$article->save();
}
if (file_exists(Yii::$app->basePath . "/install.lock")) {
return @file_get_contents(Yii::$app->basePath . "/install.lock");
} else {
Error("锁文件不存在");
}
}
}
<?php

namespace leadmall\api;

use basics\api\BasicsController as BasicsModules;
use leadmall\Map;
use Yii;

class CloudController extends BasicsModules implements Map
{
public $modelClass = 'setting\models\Setting';

/**
* 重写父类
* @return [type] [description]
*/
public function actions()
{
$actions = parent::actions();
unset($actions['create']);
unset($actions['update']);
return $actions;
}

public function actionIndex()
{
$headers = \Yii::$app->getRequest()->getHeaders();
//获取分页信息
$pageSize = $headers->get('X-Pagination-Per-Page') ?? 5;
$page = \Yii::$app->request->get('page', 1);
return [
'version' => \Yii::$app->cloud->update->getVersionData([
'page' => $page,
'limit' => $pageSize,
]),
'auth' => \Yii::$app->cloud->auth->getAuthData(),
];
}

public function actionCreate($value = '')
{
$res = $this->modelClass::find()->where(['keyword' => 'mysql_version'])->one();
if (!$res) {
$article = new $this->modelClass();
$article->keyword = 'mysql_version';
$article->merchant_id = 1;
$article->content = app_version();
$article->save();
}
if (file_exists(Yii::$app->basePath . "/install.lock")) {
return @file_get_contents(Yii::$app->basePath . "/install.lock");
} else {
Error("锁文件不存在");
}
}
}
Binary file modified applet/app.zip
Binary file not shown.
61 changes: 32 additions & 29 deletions components/cloud/Cloud.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<?php
/**
* @copyright ©2020 浙江禾成云计算有限公司
* Created by PhpStorm.
* User: Andy - 阿德 [email protected]
* Date: 2021/1/18
* Time: 11:21
*/

namespace app\components\cloud;

use yii\base\Component;

/**
* 云服务组件
* Class Cloud
* @package app\components\cloud
*/
class Cloud extends Component
{
/** @var CloudUpdate $update */
public $update;

public function init()
{
parent::init();
$this->update = new CloudUpdate();
}
}
<?php
/**
* @copyright ©2020 浙江禾成云计算有限公司
* Created by PhpStorm.
* User: Andy - 阿德 [email protected]
* Date: 2021/1/18
* Time: 11:21
*/

namespace app\components\cloud;

use yii\base\Component;

/**
* 云服务组件
* Class Cloud
* @package app\components\cloud
*/
class Cloud extends Component
{
/** @var CloudUpdate $update */
public $update;
/** @var CloudAuth $auth */
public $auth;

public function init()
{
parent::init();
$this->update = new CloudUpdate();
$this->auth = new CloudAuth();
}
}
18 changes: 18 additions & 0 deletions components/cloud/CloudAuth.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/**
* Created by PhpStorm.
* User: Andy - 阿德 [email protected]
* Date: 2021/7/30
* Time: 10:42
*/

namespace app\components\cloud;


class CloudAuth extends BaseCloud
{
public function getAuthData($params = [])
{
return $this->httpGet('mall/auth/index', $params);
}
}
4 changes: 4 additions & 0 deletions forms/install/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,7 @@ CREATE TABLE `heshop_initialize_prefix_order_freight` (
`updated_time` bigint(10) NULL DEFAULT NULL COMMENT '修改时间',
`deleted_time` bigint(10) NULL DEFAULT NULL COMMENT '删除时间',
`is_deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
`preview_image` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '电子面单预览图',
PRIMARY KEY (`id`) USING BTREE,
INDEX `订单编号`(`order_sn`) USING BTREE,
INDEX `物流编号`(`freight_sn`) USING BTREE
Expand Down Expand Up @@ -1095,3 +1096,6 @@ CREATE TABLE `heshop_initialize_prefix_waybill` (
`is_deleted` tinyint(100) DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4;

ALTER TABLE `heshop_initialize_prefix_goods`
MODIFY COLUMN `video` varchar(8192) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '视频地址' AFTER `is_video`;
6,676 changes: 6,675 additions & 1 deletion modules/setting/app/address.json

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions modules/system/api/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,33 +199,6 @@ public function actionApply()
return $menusArray;
}

/**
* 获取Token信息
* 超时时间:21600
* @param string $id [description]
* @return [type] [description]
*/
public function getToken($id = '')
{
/** @var Jwt $jwt */
$jwt = Yii::$app->jwt;
$signer = $jwt->getSigner('HS256');
$key = $jwt->getKey();
$time = time();
$host = Yii::$app->request->hostInfo;
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
// Adoption for lcobucci/jwt ^4.0 version
$token = $jwt->getBuilder()
->issuedBy($host) // Configures the issuer (iss claim)
->permittedFor($origin) // Configures the audience (aud claim)
->identifiedBy(Yii::$app->params['AppID'] ? Yii::$app->params['AppID'] : '', true) // Configures the id (jti claim), replicating as a header item
->issuedAt($time) // Configures the time that the token was issue (iat claim)
->expiresAt($time + 21600) // Configures the expiration time of the token (exp claim)
->withClaim('id', $id) // Configures a new claim, called "id"
->getToken($signer, $key); // Retrieves the generated token
return (string) $token;
}

public function changePwd()
{
$host = Yii::$app->request->hostInfo;
Expand Down
6 changes: 5 additions & 1 deletion modules/users/app/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace users\app;

use framework\common\BasicController;
use framework\common\GenerateIdentify;
use sizeg\jwt\Jwt;
use users\models\LoginUserInfo;
use users\models\Oauth;
Expand All @@ -24,6 +25,8 @@
*/
abstract class LoginController extends BasicController
{
use GenerateIdentify;

public $modelClass = 'users\models\Oauth';

/**
Expand Down Expand Up @@ -163,7 +166,8 @@ public function getToken($id = '')
/** @var Jwt $jwt */
$jwt = Yii::$app->jwt;
$signer = $jwt->getSigner('HS256');
$key = $jwt->getKey();
$identify = $this->getIdentify();
$key = $jwt->getKey($identify);
$time = time();
$host = Yii::$app->request->hostInfo;
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
Expand Down
11 changes: 8 additions & 3 deletions modules/users/models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace users\models;

use framework\common\CommonModels;
use framework\common\GenerateIdentify;
use sizeg\jwt\Jwt;
use Yii;
use yii\web\UnauthorizedHttpException;
Expand All @@ -32,6 +33,7 @@
*/
class User extends CommonModels implements \yii\web\IdentityInterface
{
use GenerateIdentify;

const id = ['bigkey' => 20, 'unique', 'comment' => 'ID'];
const nickname = ['varchar' => 50, 'notNull', 'comment' => '昵称'];
Expand Down Expand Up @@ -127,16 +129,19 @@ public static function findIdentity($id)

public static function findIdentityByAccessToken($token, $type = null)
{
$token = Yii::$app->jwt->getParser()->parse((string) $token);
$data = Yii::$app->jwt->getValidationData();
/** @var Jwt $jwt */
$jwt = Yii::$app->jwt;
$jwt->key = (new User)->getIdentify();
$token = $jwt->getParser()->parse((string) $token);
$data = $jwt->getValidationData();
$AppID = Yii::$app->params['AppID'] ? Yii::$app->params['AppID'] : '';
$host = Yii::$app->request->hostInfo;
$origin = isset($_SERVER['HTTP_ORIGIN']) ? $_SERVER['HTTP_ORIGIN'] : '';
$data->setIssuer($host);
$data->setAudience($origin);
$data->setId($AppID);
$data->setCurrentTime(time());
if ($token->validate($data)) {
if ($token->validate($data) && $jwt->verifyToken($token)) {
$id = $token->getClaim('id');
if ($id) {
$data = static::find()->where(['id' => $id])->with(['oauth'])->one();
Expand Down
22 changes: 2 additions & 20 deletions sql.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,2 @@
CREATE TABLE `heshop_initialize_prefix_waybill` (
`id` bigint(10) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`code` varchar(10) NOT NULL COMMENT '物流公司编号',
`name` varchar(256) NOT NULL COMMENT '名称',
`mobile` varchar(32) NOT NULL COMMENT '联系方式',
`province` varchar(50) NOT NULL COMMENT '省',
`city` varchar(50) NOT NULL COMMENT '市',
`district` varchar(50) NOT NULL COMMENT '区县',
`address` varchar(255) NOT NULL COMMENT '详细地址',
`AppID` varchar(50) NOT NULL COMMENT '应用ID',
`merchant_id` bigint(10) NOT NULL COMMENT '商户ID',
`created_time` int(10) DEFAULT '0' COMMENT '创建时间',
`updated_time` int(10) DEFAULT '0' COMMENT '更新时间',
`deleted_time` int(10) DEFAULT '0' COMMENT '删除时间',
`is_deleted` tinyint(100) DEFAULT '0' COMMENT '是否删除',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=21 DEFAULT CHARSET=utf8mb4;

ALTER TABLE `heshop_initialize_prefix_order_after`
ADD COLUMN `return_freight` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '退款运费' ;
ALTER TABLE `heshop_initialize_prefix_goods`
MODIFY COLUMN `video` varchar(8192) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '视频地址' AFTER `is_video`;
14 changes: 10 additions & 4 deletions system/common/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
*/
namespace framework\common;

use sizeg\jwt\Jwt;
use Yii;

class AccessToken
{
use GenerateIdentify;

/**
* 获取Token信息
Expand All @@ -24,7 +26,8 @@ public static function getToken($id = '', $type = 1)
/** @var Jwt $jwt */
$jwt = Yii::$app->jwt;
$signer = $jwt->getSigner('HS256');
$key = $jwt->getKey();
$identify = (new AccessToken())->getIdentify();
$key = $jwt->getKey($identify);
$time = time();
$host = Yii::$app->request->hostInfo;

Expand Down Expand Up @@ -56,14 +59,17 @@ public static function getToken($id = '', $type = 1)
*/
public static function accessToken($token)
{
$token = Yii::$app->jwt->getParser()->parse((string) $token);
$data = Yii::$app->jwt->getValidationData();
/** @var Jwt $jwt */
$jwt = Yii::$app->jwt;
$jwt->key = (new AccessToken())->getIdentify();
$token = $jwt->getParser()->parse((string) $token);
$data = $jwt->getValidationData();
$AppID = Yii::$app->params['AppID'] ? Yii::$app->params['AppID'] : '';
$host = Yii::$app->request->hostInfo;
$data->setIssuer($host);
$data->setId($AppID);
$data->setCurrentTime(time());
if ($token->validate($data)) {
if ($token->validate($data) && $jwt->verifyToken($token)) {
$id = $token->getClaim('id');
if ($id) {
return $token;
Expand Down
Loading

0 comments on commit 1d946da

Please sign in to comment.