Fecmall

第 2 位会员

会员
个人信息
  • 加入于 2017-05-31 17:38:45
  • 城市 Qingdao
  • GitHub https://github.com/fecshop
  • 最后登录时间 3天前
  • 签名 净化自己,潜心编码
个人简介
Terry,Fecmall开源产品作者,12年电商经验一线程序员开发者,擅长规划产品,架构设计。
个人成就
  • 发表文章次数 744
  • 发布回复次数 5760
  • 个人主页浏览次数 683
有关在pc端,微信支付的问题4年前

你微信配置有问题,参看帖子:http://www.fecmall.com/topic/4323

composer 安装 fecmall 报错4年前

网络问题,无法使用composer下载

解决:1.使用宝塔一键部署 2.使用完整压缩包(安装文档有下载地址)

咨询宝塔安装的商城迁移4年前

1.文件和数据库迁移到新服务器

2.新服务器需要配置nginx 这些和老的服务器一致即可,如果更换域名,也需要更改nginx配置

3.如果更改域名,后台配置部分,appfront apphtml5 的store配置都需要更改配置。

2.7.2版本安装完成后直接报错 Call to a member function validateCsrfToken() on string4年前

已经发版 2.7.3 composer 和宝塔下载源都更新了

Q群文件也更新了

fecyo1.7.9的services\Wx 文件缺少方法4年前

有这个方法

<?php

/*
 * FecShop file.
 *
 * @link http://www.fecshop.com/
 * @copyright Copyright (c) 2016 FecShop Software LLC
 * @license http://www.fecshop.com/license/
 */

namespace fecyo\services;

use yii\base\InvalidCallException;
use yii\base\InvalidConfigException;
use fecshop\services\Service;
use Yii;

/**
 * Product Service is the component that you can get product info from it.
 *
 * @property \fecshop\services\Image | \fecshop\services\Product\Image $image image service or product image sub-service
 * @property \fecshop\services\product\Info $info product info sub-service
 * @property \fecshop\services\product\Stock $stock stock sub-service of product service
 *
 * @method getByPrimaryKey($primaryKey) get product model by primary key
 * @see \fecshop\services\Product::actionGetByPrimaryKey()
 * @method getEnableStatus() get enable status
 * @see \fecshop\services\Product::actionGetEnableStatus()
 *
 * @author Terry Zhao <2358269014@qq.com>
 * @since 1.0
 */
class Wx extends Service
{
    // 微信服务号-开发者id
    public $appId = '';
    // 微信服务号-开发者密钥
    public $appSecret = '';
    
    // 微信小程序-开发者id
    public $microAppId = '';
    // 微信小程序-开发者密钥
    public $microAppSecret = '';
    
    public $encodingAESKey = '';
    // 页面展示的微信公众号图片
    public $wxGzQrCodeImg = '';
    
    public $token = '';
    public $tokenCacheTimeOut = 3600;  // token的缓存时间,不能大于7200  ,cache保存token的过期时间
    
    public $apiBaseUrl = 'https://api.weixin.qq.com/cgi-bin';
    /**
     * 参数初始化
     */
    public function init()
    {
        parent::init();
        // 从后台配置中读取配置。
        $this->appId = Yii::$app->store->get('payment_wxpay', 'wechat_service_app_id');
        $this->appSecret = Yii::$app->store->get('payment_wxpay', 'wechat_service_app_secret');
        // 微信小程序配置
        $this->microAppId = Yii::$app->store->get('payment_wxpay', 'wechat_micro_app_id' );
        $this->microAppSecret = Yii::$app->store->get('payment_wxpay', 'wechat_micro_app_secret');

        
        $this->encodingAESKey = Yii::$app->store->get('base_fecphone', 'wx_fuwuhao_encoding_aes_key');
        $this->token = Yii::$app->store->get('base_fecphone', 'wx_fuwuhao_token');
        $tokenCacheTimeOut = Yii::$app->store->get('base_fecphone', 'wx_fuwuhao_token_time_out');
        if ($tokenCacheTimeOut) {
            $this->tokenCacheTimeOut = $tokenCacheTimeOut;
        }
        
    }
    
    /**
     * 【基础函数 - 得到wx appId】
     * 得到微信的开发者IdappId
     */
    public function getWxAppId()
    {
        return $this->appId;
    }
    /**
     *  【微信通知基础验证 - - 生成签名】
     * @param $timestamp | string,时间戳
     * @param $nonce | string
     * @return Array
     * 生成签名
     */
    public function getSignature($timestamp='', $nonce='')
    {
        if (!$timestamp) {
            $timestamp = time();
        }
        if (!$nonce) {
            $nonce = $this->getNonceStr();
        }
        $tmpArr = array($this->token, $timestamp, $nonce);
        sort($tmpArr);
        $tmpStr = implode($tmpArr);
        $signature = sha1($tmpStr);

        return [$signature, $timestamp,  $nonce];
    }
    /**
     * 【微信通知基础验证 - - 生成签名】
     * 得到32位长的随机字符串
     */
    public function getNonceStr()
    {
        return Yii::$service->helper->createNoncestr(32);
    }
    
    
    /**********************token部分begin***********************/
    /**
     * 【基础部分 - accessToken】
     * 获取 access_token;
     * 通过api远程得到 access_token
     */
	public function getAccessTokenByApi(){
		$url = $this->apiBaseUrl . "/token?grant_type=client_credential&appid=" . $this->appId . "&secret=" . $this->appSecret; 
		$result = $this->curlGet($url);
        $access_token = $result['access_token'];
        $expires_in = $result['expires_in'];
		return $access_token;
	}
    /**
     * 从cache中读取access_token
     */
    public function getAccessTokenFromCache()
    {
        $isReflush = Yii::$app->cache->get('wx_api_need_relush_all');
        if (!$isReflush) {
            Yii::$service->wx->reflushAllTokenCache();
        }
        return $accessToken = Yii::$app->cache->get('wx_api_access_token');
    }
     /**
     * 刷新所有cache存储的 Ticket;
     */
    public function reflushAllTokenCache($forceAll=false)
    {
        //echo '######';
        $isReflush = Yii::$app->cache->get('wx_api_need_relush_all');
        if (!$isReflush || $forceAll ) {
            // 将 access_token 写入cache
            $accessToken = $this->getAccessTokenByApi();
            Yii::$app->cache->set('wx_api_access_token', $accessToken, $this->tokenCacheTimeOut);
            // 将 ticket写入 cache
            $ticket = Yii::$service->wx->h5share->getJsApiTicketByAccessToken($accessToken);
            Yii::$app->cache->set('wx_api_jssdk_ticket', $ticket, $this->tokenCacheTimeOut);
            // 全部刷新后,设置刷新后的值位1
            Yii::$app->cache->set('wx_api_need_relush_all', 1, $this->tokenCacheTimeOut);
        }
    }
    /**********************token部分 End ***********************/
    
    /**
     * @param $url | string, url
     * curl 发送Get请求
     */
    public function curlGet($url)
    {
        $ch = curl_init();
        //设置选项,包括URL
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);//绕过ssl验证
        curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
     
        //执行并获取HTML文档内容
        $output = curl_exec($ch);
        //释放curl句柄
        curl_close($ch);
        return json_decode($output, true);;
    }
    /**
     * @param $url | string, url
     * @param $data | array, 请求发送的post数据
     * @param $timeout | int,超时的时间
     * curl 发送post请求
     */
    public function curlPost($url, $data, $timeout = 10)
    {
        
        return \fec\helpers\CApi::getCurlData($url, 'post', $data, $timeout);
    }
    /**
     *
     * 得到公众号图片url
     */
    public function getGzCodeImg()
    {
        if (!$this->wxGzQrCodeImg) {
            $wxGzQrCodeImg = Yii::$app->store->get('fectb_info', 'wx_gz_qrcode_image');
            if ($wxGzQrCodeImg) {
                $this->wxGzQrCodeImg = Yii::$service->image->getUrlByRelativePath($wxGzQrCodeImg);
            } else {
                $this->wxGzQrCodeImg = Yii::$service->image->getImgUrl('addons/fecyo/qrcode_fecmall.jpg');
            }
        }
        
        return $this->wxGzQrCodeImg;
    }
    
    
}

稍等一下吧,下午fecmall发版。

升级最新版即可

2.7.2版本安装完成后直接报错 Call to a member function validateCsrfToken() on string4年前

@louis #11楼 多谢你的报错贴图

错误已经定位,这个是yii2更新导致的问题:https://github.com/yiisoft/yii2/blob/master/framework/base/Controller.php#L105

yii2加入类变量 $request , 在init函数中初始化,因此如果重写controller的init方法,必须执行 parent:init; , 否则就会出这个报错,而fecmall的有一些controller重新init方法,但是没有执行 parent:init;导致的controller 中的$this->request没有初始化导致的问题。

后面发版处理这个问题。

微信小程序和后台对应问题4年前

1.id是产品id

2.关于appserver后台设置,本人测试没有问题

后台的设置,都需要全部设置,否则不生效

@fecyo\app\appserver\modules\Wx\controllers\HomeController.php

自行看代码

//   general/start/first
    public function actionIndex()
    {
        if(Yii::$app->request->getMethod() === 'OPTIONS'){
            return [];
        }
        
        $code = Yii::$service->helper->appserver->status_success;
        
        // 首页走马灯大图部分
        $homeData = [];
        $home_bigimg_imgurl_1 = Yii::$app->store->get('appserver_home', 'home_bigimg_imgurl_1');
        $home_bigimg_linkurl_1 = Yii::$app->store->get('appserver_home', 'home_bigimg_linkurl_1');
        $home_bigimg_imgurl_2 = Yii::$app->store->get('appserver_home', 'home_bigimg_imgurl_2');
        $home_bigimg_linkurl_2 = Yii::$app->store->get('appserver_home', 'home_bigimg_linkurl_2');
        if ($home_bigimg_imgurl_1 && $home_bigimg_imgurl_2) {
            // 后台上传的值
            $homeData[] = [
                'linkUrl' => $home_bigimg_linkurl_1,
                'picUrl' => Yii::$service->image->getUrlByRelativePath($home_bigimg_imgurl_1),
            ];
            $homeData[] = [
                'linkUrl' => $home_bigimg_linkurl_2,
                'picUrl' => Yii::$service->image->getUrlByRelativePath($home_bigimg_imgurl_2),
            ];
        } else {
            // 默认值
            $homeData[] = [
                'linkUrl' => '',
                'picUrl' => Yii::$service->image->getImgUrl('wx/6a202e5f215489f5082b5293476f301c.jpg'),
            ];
            $homeData[] = [
                'linkUrl' => '',
                'picUrl' => Yii::$service->image->getImgUrl('wx/2829495b358a87480dcf0abf4b77c9b7.jpg'),
            ];
        }
        
        // 首页的4个banner
        $hotData = [];
        $home_bannerimg_imgurl_1 = Yii::$app->store->get('appserver_home', 'home_bannerimg_imgurl_1');
        $home_bannerimg_linkurl_1 = Yii::$app->store->get('appserver_home', 'home_bannerimg_linkurl_1');
        $home_bannerimg_imgurl_2 = Yii::$app->store->get('appserver_home', 'home_bannerimg_imgurl_2');
        $home_bannerimg_linkurl_2 = Yii::$app->store->get('appserver_home', 'home_bannerimg_linkurl_2');
        $home_bannerimg_imgurl_3 = Yii::$app->store->get('appserver_home', 'home_bannerimg_imgurl_3');
        $home_bannerimg_linkurl_3 = Yii::$app->store->get('appserver_home', 'home_bannerimg_linkurl_3');
        $home_bannerimg_imgurl_4 = Yii::$app->store->get('appserver_home', 'home_bannerimg_imgurl_4');
        $home_bannerimg_linkurl_4 = Yii::$app->store->get('appserver_home', 'home_bannerimg_linkurl_4');
        if ($home_bannerimg_imgurl_1 && $home_bannerimg_imgurl_2 && $home_bannerimg_imgurl_3 && $home_bannerimg_imgurl_4) {
            $hotData[] = [
                'linkUrl' => $home_bannerimg_linkurl_1,
                'picUrl' => Yii::$service->image->getUrlByRelativePath($home_bannerimg_imgurl_1),
            ];
            $hotData[] = [
                'linkUrl' => $home_bannerimg_linkurl_2,
                'picUrl' => Yii::$service->image->getUrlByRelativePath($home_bannerimg_imgurl_2),
            ];
            $hotData[] = [
                'linkUrl' => $home_bannerimg_linkurl_3,
                'picUrl' => Yii::$service->image->getUrlByRelativePath($home_bannerimg_imgurl_3),
            ];
            $hotData[] = [
                'linkUrl' => $home_bannerimg_linkurl_4,
                'picUrl' => Yii::$service->image->getUrlByRelativePath($home_bannerimg_imgurl_4),
            ];
        } else {
            // 默认值
            $hotData[] = [
                'linkUrl' => '/pages/goods-detail/goods-detail?id=115781',
                'picUrl' => Yii::$service->image->getImgUrl('wx/f9d34e8258cdef1dbcb5e1de65bdb404.jpg'),
            ];
            $hotData[] = [
                'linkUrl' => '/pages/goods-detail/goods-detail?id=115781',
                'picUrl' => Yii::$service->image->getImgUrl('wx/a7658f2456e708e6be03d393cef0d368.jpg'),
            ];
            $hotData[] = [
                'linkUrl' => '/pages/goods-detail/goods-detail?id=115781',
                'picUrl' => Yii::$service->image->getImgUrl('wx/868b8a0e1065f7123c949fb404049ce0.jpg'),
            ];
            $hotData[] = [
                'linkUrl' => '/pages/goods-detail/goods-detail?id=115781',
                'picUrl' => Yii::$service->image->getImgUrl('wx/6480b6574ab76caf1d86a9fc327a62e8.jpg'),
            ]; 
        }
        // 四个导航图标
        $salesData = [];
        $salesData[] = [
            'linkUrl' => '/pages/live-player/live-player',
            'picUrl' => Yii::$service->image->getImgUrl('addons/fecyo/qnav2.png'),
            'title'  => Yii::$service->page->translate->__('直播'),
        ];
        $salesData[] = [
            'linkUrl' => '/pages/coupons/coupons',
            'picUrl' => Yii::$service->image->getImgUrl('addons/fecyo/qnav4.png'),
            'title'  => Yii::$service->page->translate->__('Get Coupon'),
        ];
        $salesData[] = [
            'linkUrl' => '/pages/fav-list/fav-list',
            'picUrl' => Yii::$service->image->getImgUrl('addons/fecyo/qnav3.png'),
            'title'  => Yii::$service->page->translate->__('My Favorite'),
        ];
        $salesData[] = [
            'linkUrl' => '/pages/cate/cate',
            'picUrl' => Yii::$service->image->getImgUrl('addons/fecyo/h5/01b097e06ac9fc78bbcc3d3e0dfbe01fcc.png'),
            'title'  => Yii::$service->page->translate->__('All Category'),
        ];
        
        
        $productData = $this->getProduct();
        
        
        $currencys = Yii::$service->page->currency->getCurrencys();
        $currentCurrencyCode = Yii::$service->page->currency->getCurrentCurrency();
        $currencyList = [];
        $currencyCodeList = [];
        foreach ($currencys as $currency) {
            $currencyList[] = $currency['symbol']. '' . $currency['code'];
            $currencyCodeList[] = $currency['code'];
        }
        $currency = [
            'currencyList' => $currencyList,
            'currencyCodeList' => $currencyCodeList,
            'currentCurrency' => $currentCurrencyCode
        ];
        
        
        $data = [
            //'home' => $homeData,
            'banners'  => $homeData,
            'products' => $productData,
            'topgoods'  => [
                'remark' => '备注',
                'value'  => Yii::$service->page->translate->__('Feature Product'),  //'人气推荐',
            ],
            'hot'  => $hotData,
            'sales' => $salesData,
            'currency'  => $currency,
        ];
        $responseData = Yii::$service->helper->appserver->getResponseData($code, $data);
        
        return $responseData;
    }
    

遇到问题,自己去追踪一下代码,很简单的事,追踪一下就清楚

微信小程序和后台对应问题4年前

看不懂

后台界面截图是那个菜单?

配置文件是那个文件路径?

信息不写全,帮不上忙,自行解决,描述个问题,你首先要做的是让别人看懂。

2.7.2版本安装完成后直接报错 Call to a member function validateCsrfToken() on string4年前

@wileep #8楼

1.这种修改,去动yii2框架的代码,本身就是错误的

2.上面说了,出现报错,把报错写信全部贴出来,没有一个把报错全部贴出来,写清楚

报错信息不全,帮不上忙。

2.7.2版本安装完成后直接报错 Call to a member function validateCsrfToken() on string4年前

无论你们怎么叫,不把报错信息写清楚,就没法解决。

咨询宝塔安装的商城迁移4年前

技术能力弱,线上直接安装新的fecmall

fecyo 产品分类 能否 同一个二级分类 对应 多个 一级分类?4年前

1.这种需求很偏门,自己二开

2.你在这两个一级分类下面都新建这个二级分类不就解决了?

fecyo添加模板报错Invalid Call – yii\base\InvalidCallException4年前

fecyo是应用系统级别,不能安装fecmall的模板。

Your Site Analytics