Skip to content

Commit

Permalink
V1.3.13
Browse files Browse the repository at this point in the history
新增:悬浮窗
优化:编辑商品的规格值数量限制问题
修复:公众号商城的商品海报二维码无法访问
修复:商品采集的草稿箱数据问题
修复:优惠券发放总量为1时的判断问题
  • Loading branch information
wj005 committed Aug 23, 2021
1 parent b72fcea commit 2f45958
Show file tree
Hide file tree
Showing 275 changed files with 4,053 additions and 4,059 deletions.
5 changes: 2 additions & 3 deletions Map.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
/**
* @link http://www.heshop.com/
* @copyright Copyright (c) 2020 HeShop Software LLC
* @license http://www.heshop.com/license/
* @link https://www.leadshop.vip/
* @copyright Copyright ©2020-2021 浙江禾成云计算有限公司
*/
namespace leadmall;

Expand Down
7 changes: 3 additions & 4 deletions Module.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
/**
* @link http://www.heshop.com/
* @copyright Copyright (c) 2020 HeShop Software LLC
* @license http://www.heshop.com/license/
* @link https://www.leadshop.vip/
* @copyright Copyright ©2020-2021 浙江禾成云计算有限公司
*/

namespace leadmall;
Expand Down Expand Up @@ -50,7 +49,7 @@ public function eventList()
$this->on('pay_order', ["\coupon\api\IndexController", 'sendUserCoupon']); //下单发放优惠券
$this->on('pay_order', ["\users\api\LabellogController", 'giveLabel']); //付款判断用户是否有新的标签
$this->on('refunded', ["\coupon\api\IndexController", 'invalidateUserCoupon']); //退款后失效优惠券

$this->on('send_sms', ["\sms\app\IndexController", 'sendSms']); //发送短信

$this->on('user_register', ["\users\app\IndexController", 'register']); //用户注册事件
Expand Down
32 changes: 16 additions & 16 deletions api/AddressController.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?php
/**
* 地址管理
* @link http://www.heshop.com/
* @copyright Copyright (c) 2020 HeShop Software LLC
* @license http://www.heshop.com/license/
*/
namespace leadmall\api;

use leadmall\Map;
use setting\api\AddressController as AddressModules;

class AddressController extends AddressModules implements Map
{

}
<?php
/**
* 地址管理
* @link https://www.leadshop.vip/
* @copyright Copyright ©2020-2021 浙江禾成云计算有限公司
*/

namespace leadmall\api;

use leadmall\Map;
use setting\api\AddressController as AddressModules;

class AddressController extends AddressModules implements Map
{

}
276 changes: 138 additions & 138 deletions api/AppconfigController.php
Original file line number Diff line number Diff line change
@@ -1,138 +1,138 @@
<?php
/**
* 应用管理
* @link http://www.heshop.com/
* @copyright Copyright (c) 2020 HeShop Software LLC
* @license http://www.heshop.com/license/
*/
namespace leadmall\api;

use basics\api\BasicsController as BasicsModules;
use framework\wechat\WechatAccesstoken;
use leadmall\Map;
use Yii;

class AppconfigController extends BasicsModules implements Map
{

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

public function actionIndex()
{
$url = Yii::$app->basePath . '/stores/' . Yii::$app->params['AppID'] . '.json';
if (file_exists($url)) {
$json = file_get_contents($url);
$arr = to_array($json);
$arr['apply']['wechat']['url'] = Yii::$app->request->hostInfo;
$arr['apply']['wechat']['token'] = $arr['apply']['wechat']['token'] ? $arr['apply']['wechat']['token'] : get_random(6);
$arr['apply']['wechat']['encodingAesKey'] = $arr['apply']['wechat']['encodingAesKey'] ? $arr['apply']['wechat']['token'] : get_random(43);
return $arr;
} else {
Error('文件不存在');
}
}

public function actionCreate()
{
//获取操作
$behavior = Yii::$app->request->get('behavior', '');
switch ($behavior) {
case 'upload':
return $this->upload();
break;
case 'save':
return $this->save();
break;
default:
return 111222;
break;
}

}

public function save()
{
$post = Yii::$app->request->post();
$key = Yii::$app->request->get('key', '');
if (empty($post)) {
Error('数据为空');
}
$url = Yii::$app->basePath . '/stores/' . Yii::$app->params['AppID'] . '.json';
if (file_exists($url)) {
$json = file_get_contents($url);
$data = to_array($json);
$key = explode('_', $key);
if (isset($data[$key[0]][$key[1]])) {
$data[$key[0]][$key[1]] = $post;
} else {
Error('配置不存在');
}
$data = to_json($data);
if ($key[0] == 'apply') {
$this->check($key[1]);
}
return to_mkdir($url, $data, true, true);
} else {
Error('文件不存在');
}
}

private function check($type)
{
$platform = '微信小程序';
if ($type == 'wechat') {
$platform = '微信公众号';
}
$appId = Yii::$app->request->post('AppID', false);
$appSecret = Yii::$app->request->post('AppSecret', false);
if (!$appId) {
throw new \Exception($platform . 'AppId有误');
}
if (!$appSecret) {
throw new \Exception($platform . 'AppSecret有误');
}
try {
$weapp = new WechatAccesstoken();
$weapp->resetAuth($appId);
$weapp->getAccessToken($appId, $appSecret);
} catch (\Exception $exception) {
if (isset($weapp->errCode) && isset($weapp->errMsg)) {
if ($weapp->errCode == '40013') {
Error($platform . 'AppId有误(' . $weapp->errMsg . ')');
}
if ($weapp->errCode == '40125') {
Error($platform . 'appSecret有误(' . $weapp->errMsg . ')');
}
}
Error($platform . $exception->getMessage());
}
return true;
}

public function upload()
{
$file = $_FILES['file'];
preg_match('|\.(\w+)$|', $file['name'], $ext);
$ext = strtolower($ext[1]);
if (!in_array($ext, ['txt','ico'])) {
Error('不被允许的文件类型');
}
if (move_uploaded_file($file['tmp_name'], Yii::$app->basePath . '/web/' . $file['name'])) {
$url = Yii::$app->request->hostInfo;
return $url . '/' . $file['name'];
} else {
Error('上传失败');
}
}

}
<?php
/**
* 应用管理
* @link https://www.leadshop.vip/
* @copyright Copyright ©2020-2021 浙江禾成云计算有限公司
*/

namespace leadmall\api;

use basics\api\BasicsController as BasicsModules;
use framework\wechat\WechatAccesstoken;
use leadmall\Map;
use Yii;

class AppconfigController extends BasicsModules implements Map
{

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

public function actionIndex()
{
$url = Yii::$app->basePath . '/stores/' . Yii::$app->params['AppID'] . '.json';
if (file_exists($url)) {
$json = file_get_contents($url);
$arr = to_array($json);
$arr['apply']['wechat']['url'] = Yii::$app->request->hostInfo;
$arr['apply']['wechat']['token'] = $arr['apply']['wechat']['token'] ? $arr['apply']['wechat']['token'] : get_random(6);
$arr['apply']['wechat']['encodingAesKey'] = $arr['apply']['wechat']['encodingAesKey'] ? $arr['apply']['wechat']['token'] : get_random(43);
return $arr;
} else {
Error('文件不存在');
}
}

public function actionCreate()
{
//获取操作
$behavior = Yii::$app->request->get('behavior', '');
switch ($behavior) {
case 'upload':
return $this->upload();
break;
case 'save':
return $this->save();
break;
default:
return 111222;
break;
}

}

public function save()
{
$post = Yii::$app->request->post();
$key = Yii::$app->request->get('key', '');
if (empty($post)) {
Error('数据为空');
}
$url = Yii::$app->basePath . '/stores/' . Yii::$app->params['AppID'] . '.json';
if (file_exists($url)) {
$json = file_get_contents($url);
$data = to_array($json);
$key = explode('_', $key);
if (isset($data[$key[0]][$key[1]])) {
$data[$key[0]][$key[1]] = $post;
} else {
Error('配置不存在');
}
$data = to_json($data);
if ($key[0] == 'apply') {
$this->check($key[1]);
}
return to_mkdir($url, $data, true, true);
} else {
Error('文件不存在');
}
}

private function check($type)
{
$platform = '微信小程序';
if ($type == 'wechat') {
$platform = '微信公众号';
}
$appId = Yii::$app->request->post('AppID', false);
$appSecret = Yii::$app->request->post('AppSecret', false);
if (!$appId) {
throw new \Exception($platform . 'AppId有误');
}
if (!$appSecret) {
throw new \Exception($platform . 'AppSecret有误');
}
try {
$weapp = new WechatAccesstoken();
$weapp->resetAuth($appId);
$weapp->getAccessToken($appId, $appSecret);
} catch (\Exception $exception) {
if (isset($weapp->errCode) && isset($weapp->errMsg)) {
if ($weapp->errCode == '40013') {
Error($platform . 'AppId有误(' . $weapp->errMsg . ')');
}
if ($weapp->errCode == '40125') {
Error($platform . 'appSecret有误(' . $weapp->errMsg . ')');
}
}
Error($platform . $exception->getMessage());
}
return true;
}

public function upload()
{
$file = $_FILES['file'];
preg_match('|\.(\w+)$|', $file['name'], $ext);
$ext = strtolower($ext[1]);
if (!in_array($ext, ['txt','ico'])) {
Error('不被允许的文件类型');
}
if (move_uploaded_file($file['tmp_name'], Yii::$app->basePath . '/web/' . $file['name'])) {
$url = Yii::$app->request->hostInfo;
return $url . '/' . $file['name'];
} else {
Error('上传失败');
}
}

}
Loading

0 comments on commit 2f45958

Please sign in to comment.