Giter VIP home page Giter VIP logo

fecshop / yii2_fecshop Goto Github PK

View Code? Open in Web Editor NEW
5.2K 318.0 1.4K 9.08 MB

yii2 ( PHP ) fecmall(fecshop) core code used for ecommerce shop 多语言多货币多入口的开源电商 B2C 商城,支持移动端vue, app, html5,微信小程序微店,微信小程序商城等

Home Page: http://www.fecmall.com

License: BSD 3-Clause "New" or "Revised" License

PHP 86.59% CSS 2.77% JavaScript 10.50% Shell 0.11% Hack 0.03%
yii2-fecshop yii2 fecshop shop cart yii ecommerce shopping vue html5

yii2_fecshop's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2_fecshop's Issues

安装不上。

What steps will reproduce the problem?

mongodb is not installed ??

What is the expected result?

What do you get instead?

Additional info

Q A
Fecshop version 1.1.3.?
PHP version
Operating system

error composer update

The "extra.asset-installer-paths" option is deprecated, use the "config.fxp-asset.installer-paths" option

Average rating not update when user rating.

I. Average Rating.

I clone new account to test function Add Review in Desktop version.
When user review, the values of average rating should be updated.

Test link: https://fecshop.appfront.fancyecommerce.com/reindeer-pattern-glitter-christmas-dress-86519596

I can't see average rating is not update.

II. Admin Fecshop

Can you provider screenshot of Admin Fecshop?

I can't install yii2_fecshop because of language barriers, but I feel your project very interesting.

Have you plan to do fecshop like Magento, you need to add more function in Admin.

Please add your roadmap and checked in a feature was completed.

III. Suggestions (almost in appfront, because I don't access to appadmin)

  1. Add button Add To Card.

I think you should add button Add To Cart in the main layout of the webpage. Like:

capture

This feature will easy for end user. Quick add to the card and continues shopping, don't need to go to details of the product.

  1. Hover product shows more information about that products.

  2. Keep .top_nav (don't hide) when scroll.

I think think this easy for end user. When user click adds to the card with Ajax will update in .mycart. Customer know products are added in their card(include number item in the cart), continues to surf your shop.
The height of your .top_nav is short. So, it doesn't affect to a user experience.

Thanks.

提示 'Method fecshop\services\Store::bootstrap() does not exist'

安装了v1.1.3.3版本,在没有配置好域名情况下执行时的报错问题:提示 'Method fecshop\services\Store::bootstrap() does not exist'。需要在vendor\fancyecommerce\fecshop\services\Store.php里添加以下代码才能正常报错:

public function bootstrap($app)
{
    $this->actionBootstrap($app);
}

add

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Fecshop version 1.1.3.?
PHP version
Operating system

整合到微信公众号

现在流行新零售,先不说实体门店和网店,准备与微信公众号进行整合吗?

  1. 君不见做微信整合的收费都是超级黑吗?我感觉他们都是在给SaaS抹黑。fecshop完善了,搞个SaaS的版本,干掉它们
  2. 通过配置替换掉公众号自带的微信小店
  3. 会员与微信的卡包进行深度整合
  4. 在1和2的基础上提供营销方面的多种玩法。其实这才是最重要的,毕竟单纯的整合没太大意义,必须用到、用好微信的社交特性才值得这些付出

安装完成后,无法打开appadmin管理界面

Windows 10
phpstudy
php 7.3.4
nginx 1.15.11
mysql 5.7.26

安装完成,期间没有报错

但是打开管理界面提示404

server {
        listen        80;
        server_name  appadmin.syuez.cn;
        root   "D:/phpstudy_pro/WWW/fecmall/appadmin/web";
        location / {
            index index.php index.html error/index.html;
            autoindex  off;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}

这是nginx配置

nginx 错误日志

2020/01/04 14:32:28 [error] 2596#9956: *57 CreateFile() "D:/phpstudy_pro/WWW/fecmall/appadmin/web/fecadmin/login/index" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: appadmin.syuez.cn, request: "GET /fecadmin/login/index HTTP/1.1", host: "appadmin.syuez.cn"

为什么会出现/fecadmin/这个目录,在/appadmin/web/下,我看到没有这个目录,这是在安装过程中自动生成的吗?

roadmap about code improvement

Roadmap

To make our code more human-readable, and more IDE friendly, we could do the following:

  • remove OPTIONS request in each controller
  • Add proper comments to each variable and method, even class when they have some magic calls

Yii2 migratge方式导入表结构 mysql部分失败

What steps will reproduce the problem?

执行 ./yii migrate --interactive=0 --migrationPath=@fecshop/migrations/mysqldb

What is the expected result?

What do you get instead?

/migrations/mysqldb/m170228_072156_fecshop_tables.php 186 行 应该;结尾

Additional info

Q A
Fecshop version 1.1.3.?
PHP version
Operating system

关于 Code Style 的提议

这不是一个 bug report,这是一个关于建立代码规范的建议。

我建议,遵循 PSR1 PSR2 规范。然后基于此基础再制订其它规范。

如何写规则?

在项目里建一个 .php_cs.dist 文件。可参考 这个

如何使用工具进行检测和处理规范问题?

symfony 框架作者写的工具 php-cs-fixer

@fancyecommerce 有兴趣推动一下吗?

货运在哪里配置呢?

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Fecshop version 1.1.3.?
PHP version
Operating system

请问考虑增加 小程序入口吗?

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Fecshop version 1.1.3.?
PHP version
Operating system

安装时候出现错误

What steps will reproduce the problem?

安装时候出现下面错误:

Notice: Undefined variable: argv in /var/www/fecmall/common/config/bootstrap.php on line 18

Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fecmall.extensions' doesn't exist in /var/www/fecmall/vendor/yiisoft/yii2/db/Command.php:1290 Stack trace: #0 /var/www/fecmall/vendor/yiisoft/yii2/db/Command.php(1290): PDOStatement->execute() #1 /var/www/fecmall/vendor/yiisoft/yii2/db/Command.php(1158): yii\db\Command->internalExecute('SELECT * FROM ...') #2 /var/www/fecmall/vendor/yiisoft/yii2/db/Command.php(399): yii\db\Command->queryInternal('fetchAll', NULL) #3 /var/www/fecmall/common/config/bootstrap.php(34): yii\db\Command->queryAll() #4 /var/www/fecmall/appfront/web/index.php(25): require('/var/www/fecmal...') #5 {main} Next yii\db\Exception: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'fecmall.extensions' doesn't exist The SQL being executed was: SELECT * FROM extensions where status=1 AND installed_status=1 ORDER BY priority ASC in /var/www/fecmall/vendor/yiisoft/yii2/db/Schema.php:674 Stack trace: #0 /var/www/fecmall/vendor/yiisoft/yii2/db/Command.p in /var/www/fecmall/vendor/yiisoft/yii2/db/Schema.php on line 674

What is the expected result?

What do you get instead?

Additional info

Q A
Fecshop version 2.3.4
PHP version 7.2.19
Operating system ubuntu 19.04

安装应用市场插件时,应检查php zip依赖

问题症状

Ubuntu 18.04 (使用php7.2) 未安装 php7.2-zip 依赖,购买成功应用市场插件后点击“点击安装”,图标提示加载,但之后失去响应,既没有成功,也无错误提示。观察浏览器开发者工具Console面板,提示:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

按钮对应HTML和JS:

<a title="点击该按钮,进行应用的在线安装" class="abutton" href="javascript:void(0)" addonname="furnilife模板,简洁风格的模板" rel="fectfurnilife" foldername="furnilife_theme" packagename="fecmall">点击安装</a>
$(document).off("click").on("click",".abutton",function(){
            namespace = $(this).attr('rel');
            var packageName = $(this).attr('packageName');
            var addonName = $(this).attr('addonName');
            var folderName = $(this).attr('folderName');
            
            var url = "<?= Yii::$service->url->getUrl("system/extensionmarket/install"); ?>";
            url += '?namespace=' + namespace;
            url += '&packageName=' + packageName;
            url += '&folderName=' + folderName;
            url += '&addonName=' + encodeURIComponent(addonName);
            
            $.ajax({
                url: url,
                async: true,
                timeout: 800000,
                dataType: 'json', 
                type: 'get',
                success:function(data, textStatus){
                    if(data.statusCode == 200){
                        //alert(data.statusCode);
                        message = data.message;
                        alertMsg.correct(message);
                        navTab.reloadFlag('page1');
                    } else if (data.statusCode == 300){
                        message = data.message;
                        alertMsg.error(message)
                    } else {
                        alertMsg.error("错误");
                    }
                    //
                },
                error:function(){
                }
            });
        });

从浏览器端看不到太多有价值的信息,用 xdebug 调试

ZipFile.php:28, fecshop\services\helper\ZipFile->unzip()
ExtensionmarketController.php:148, fecshop\app\appadmin\modules\System\controllers\ExtensionmarketController->actionInstall()
InlineAction.php:57, call_user_func_array:{/home/zime/DATA/www/xymall/vendor/yiisoft/yii2/base/InlineAction.php:57}()
InlineAction.php:57, yii\base\InlineAction->runWithParams()
Controller.php:157, fecshop\app\appadmin\modules\System\controllers\ExtensionmarketController->runAction()
Module.php:528, yii\web\Application->runAction()
Application.php:103, yii\web\Application->handleRequest()
Application.php:386, yii\web\Application->run()
index.php:50, {main}()

到以下代码中 zip_open 时出现异常

class ZipFile extends Service
{
    public function unzip($src_file, $dest_dir=false, $create_zip_name_dir=true, $overwrite=true){
        if ($dest_dir) {
            $dest_dir .= '/';
        }
        if ($zip = zip_open($src_file)){
           ...................
        }else{
            return false;
        }
        return true;
    }

由于 zip_open 异常,不会执行到unzip()的任何一条 return 语句,所以 ExtensionmarketController.php 的以下代码不能响应给浏览器合适的 AJAX 响应

// 进行zip文件的解压
        $dest_dir = dirname($zipFilePath);
        if (!Yii::$service->helper->zipFile->unzip($zipFilePath, $dest_dir, true, true)) {
            echo  json_encode([
                'statusCode' => '300',
                'message'    => Yii::$service->page->translate->__('unzip addons fail'),
            ]);
            exit;
        }

调试中可以知道 yiisoft/yii2/base/ErrorHandler.php中handleException()的异常消息为

Call to undefined function fecshop\services\helper\zip_open()

所以可以联想到是 zip_open 函数对应的扩展没有安装

预期的结果

安装插件应该有阶段性指示:如 正在下载插件安装包、正在解压安装包、正在安装插件、正在清理、安装成功

可以考虑的fix

@fecshop/services/helper/ZipFile.php 文件

@@ -28,1 +28,1  @@  public function unzip($src_file, $dest_dir=false, $create_zip_name_dir=true, $overwrite=true){
-           if ($zip = zip_open($src_file)){  
+          if (function_exists('zip_open') && ($zip = zip_open($src_file))){

这样,最起码能够看到 unzip addons fail 的提示,当然,提示语句最好改为 unzip addons fail, please make sure php extension zip is installed

Additional info

Q A
Fecshop version 2.3.6
PHP version 7.2
Operating system Ubuntu 18.04

Very nice Yii2 project

Very nice Yii2 project

This is Yii2 inside, I have seen the best open source project, thanks for sharing

The message file for category 'yii' does not exist: /path/to/vendor/yiisoft/yii2/messages/zh_CN/yii.php Fallback file does not exist as well: /path/to/vendor/yiisoft/yii2/messages/zh/yii.php

在日常的日志巡检过程中,发现了一个不断出现在日志中的翻译的错误很是让人恼火。

The message file for category 'yii' does not exist: /path/to/vendor/yiisoft/yii2/messages/zh_CN/yii.php Fallback file does not exist as well: /path/to/vendor/yiisoft/yii2/messages/zh/yii.php

复现步骤

在vue 端,编辑地址,点保存时,即会触发上述问题。(added 20190216)

经过一番排查,基本定位到了问题的原因:关于语言定义的规范问题。

原因说明

yii 本身使用多语言的定义时,采取这样的格式:zh-CN。如下图:

image

然而 fecshop 在使用多语言的定义时,采用了格式:zh_CN。如下图:

image

fecshop 代码剖析

关于 fecshoplang service 的配置信息相关代码:

return [
    'fecshoplang' => [
        //'class' => 'fecshop\services\FecshopLang',
        //  mongoSearchLangName 在各个语言下字段参考资料如下:(不支持中文)
        //  https://docs.mongodb.com/manual/reference/text-search-languages/#text-search-languages
        'allLangCode' => [
            // 'en_US' 是标准语言简码  code对应的值en取 “标准语言简码”的前两位字符,
            // 该值设置后,进行了产品分类数据的添加后,不能修改,否则会出现部分翻译语言丢失。
            'zh_CN' => [
                'code'                    => 'zh',
            ],
        ],
        // 默认语言。
        'defaultLangCode' => 'zh',
    ],
];

上述代码位于 @common/config/fecshop_local_services/FecshopLang.php

上述代码,删除了原有的其他语言配置项,仅保留了中文。

关于 Yii i18n 的文档链接:https://www.yiiframework.com/doc/guide/2.0/en/tutorial-i18n 中的说明:

For consistency reasons, all locale IDs used in Yii applications should be canonicalized to the format of ll-CC, where ll is a two- or three-letter lowercase language code according to ISO-639 and CC is a two-letter country code according to ISO-3166.

Yii::$service->page->translate 服务中,有一方法定义如下:

    /**
     * @property $language | String,设置当前的语言。
     * 语言部分使用的是Yii2的语言功能。
     */
    protected function actionSetLanguage($language)
    {
        Yii::$app->language = $language;
    }

同时请注意,Yii::$app->language 属性也被 Yii::t() 所使用。

如下:

    public static function t($category, $message, $params = [], $language = null)
    {
        if (static::$app !== null) {
            return static::$app->getI18n()->translate($category, $message, $params, $language ?: static::$app->language);
        }

        $placeholders = [];
        foreach ((array) $params as $name => $value) {
            $placeholders['{' . $name . '}'] = $value;
        }

        return ($placeholders === []) ? $message : strtr($message, $placeholders);
    }

那么此时来讲,fecshop 的语言是什么时候被设置的呢?

答案是在 fecshop 的 store 初始化的时候。

Yii::$service->store 服务的 actionBootstrap() 方法中有关键代码如下:

Yii::$service->page->translate->setLanguage($store['language']);

而 store 的配置相关如下:

            // store key:域名去掉http部分,作为key,这个必须这样定义。
            'appserver.fecshoptest.com' => [
                'language'         => 'zh_CN',        // 语言简码需要在@common/config/fecshop_local_services/FecshopLang.php 中定义。
                'languageName'     => '中文',    // 语言简码对应的文字名称,将会出现在语言切换列表中显示。
                'currency'         => 'CNY', // 当前store的默认货币,这个货币简码,必须在货币配置中配置
                ...
            ]

至此分析结束。

修复方法

使用与 Yii 一致的语言的定义格式:

zh-CN

所有关于语言的设定的地方均要修改。

typo report with *response*

What steps will reproduce the problem?

see the source code

What is the expected result?

correct spelling with response

What do you get instead?

reponse

Additional info

Q A
Fecshop version 1.4.6.4
PHP version Any
Operating system Any

Found unrestricted file upload vulnerability

What steps will reproduce the problem?

Login the admin page and find a place to upload .jpg image. Intercept the request, change the file extension to .php and insert the content of webshell:

What is the expected result?

The backend should deny for uploading unexpected file type (with .php extension) in services/Image.php, function getUniqueImgNameInPath()

$imagePath = $imgSaveFloder.'/'.$name.$randStr.'.'.$imageType;

What do you get instead?

The php webshell was successfully uploaded to the website:

Additional info

Q A
Fecshop version 2.1.6
PHP version 7.1.13
Operating system Debian 8

管理后台采用新的权限系统后,富文本编辑商品图片时报错,没有权限

$uploadImgUrl = 'upimgurl="'.CUrl::getUrl('cms/staticblock/imageupload').'" upimgext="jpg,jpeg,gif,png"';
$uploadFlashUrl = 'upflashurl="'.CUrl::getUrl('cms/staticblock/flashupload').'" upflashext="swf"';
$uploadLinkUrl = 'uplinkurl="'.CUrl::getUrl('cms/staticblock/linkupload').'" uplinkext="zip,rar,txt"';
$uploadMediaUrl = 'upmediaurl="'.CUrl::getUrl('cms/staticblock/mediaupload').'" upmediaext:"avi"="" ';

base里可见这部分代码。不过没有默认的权限。另外个人觉得在AppadminbaseBlockEdit调用cms/staticblock/imageupload的路由,没有解耦

Issues when install Fecshop

I have some issues when tried to install Fecshop in my Arch.

  1. DocRoot.
    I tried to run the command:
    php yii serve

show errors like:

Document root "/srv/http/fecshop/console/web" does not exist.

So, I must tried to:

php yii serve --port=8888 --docroot="/srv/http/fecshop/appserver/web"

How to skip this error?

  1. this domain is not config in store component

Iin /srv/http/fecshop/vendor/fancyecommerce/fecshop/services/Store.php it go to exception at line 113:

if(!$init_compelte){
      throw new InvalidValueException('this domain is not config in store component');
}
  1. Bootstrap error:

I take a photo error relate with Bootstrap.

screenshot_2017-04-27_03-53-26

  1. Another error you will see in this photo. I think I lost any config in your document. I tried. But not a success.

See this photo:
screenshot_2017-04-27_03-56-48

Finally, I tried to using Google Translate to translate your document, but I don't know all. So, I have some error when setup on my PC.

Thanks.

支持多商城吗

What steps will reproduce the problem?

What is the expected result?

What do you get instead?

Additional info

Q A
Fecshop version 1.1.3.?
PHP version
Operating system
支持多商城吗

erro 403

安装后, 打开页面出现403 , 我没有设置redis, 可以不

autoload.php): failed to open stream

What steps will reproduce the problem?

10.1

What is the expected result?

导入数据库

What do you get instead?

./yii migrate --interactive=0 --migrationPath=@fecshop/migrations/mysqldb
PHP Warning: require(/home/xuan/work/fecshop/vendor/autoload.php): failed to open stream: No such file or directory in /home/xuan/work/fecshop/yii on line 16
PHP Fatal error: require(): Failed opening required '/home/xuan/work/fecshop/vendor/autoload.php' (include_path='.:/usr/share/php7:/usr/share/php7/PEAR') in /home/xuan/work/fecshop/yii on line 16

Additional info

composer create-project fancyecommerce/fecshop-app-advanced fecshop 1.7.2.0 -vvv
cd fecshop
proxychains4 composer update -vvv
./init

php -v
PHP 7.2.5 (cli) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

NAME="openSUSE Leap"
VERSION="15.0"
ID="opensuse-leap"
ID_LIKE="suse opensuse"
VERSION_ID="15.0"
PRETTY_NAME="openSUSE Leap 15.0"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:15.0"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

erro import mongobd

[nihaomodas.com.br@Umbler fecshop]$ ./yii mongodb-migrate --interactive=0 --migrationPath=@fecshop/migrations/mongodb
Yii Migration Tool (based on Yii v2.0.13.1)

Exception 'yii\mongodb\Exception' with message 'No suitable servers found (serverSelectionTryOnce set): [Failed to resolve 'mongo_ghjfhjdgh']'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.