Andrew

第 388 位会员

会员
个人信息
  • 加入于 2018-03-15 13:44:55
  • 最后登录时间 5年前
个人成就
  • 发表文章次数 5
  • 发布回复次数 20
  • 个人主页浏览次数 2
商城后台新增虚拟卡券模块问题5年前

@Fecshop #8楼 问题解决了,appadmin里的fecshop_local_services模块没有加service这个代码,导致controller找不到这个service,开始以为是在common里加上就不用再appadmin里加了:persevere:

商城后台新增虚拟卡券模块问题5年前

感觉是storage这个东西没有注进来

商城后台新增虚拟卡券模块问题5年前

@Fecshop #8楼 我看了您发的这篇文章 http://www.fecshop.com/doc/fecshop-guide/develop/cn-1.0/guide-fecshop-service-use.html ,代码确实是按照这个方式配置的,您可以结合2楼和9楼的代码看下

商城后台新增虚拟卡券模块问题5年前

common\local\local_services\Coupon 代码如下:

<?php

namespace common\local\local_services;

use fecshop\services\Service;
use Yii;

class Coupon extends Service
{
    /**
     * $storagePrex , $storage , $storagePath 为找到当前的storage而设置的配置参数
     * 可以在配置中更改,更改后,就会通过容器注入的方式修改相应的配置值
     */
    public $storage;    // 当前的storage,在config中配置,在初始化的时候会被注入修改
    /**
     * 设置storage的path路径,
     * 如果不设置,则系统使用默认路径
     * 如果设置了路径,则使用自定义的路径
     */
    public $storagePath;
    protected $_coupon;

    public function init()
    {
        parent::init();
        $currentService = $this->getStorageService($this);
        $this->_coupon = new $currentService();
    }
    /**
     * get artile's primary key.
     */
    protected function actionGetPrimaryKey()
    {
        return $this->_coupon->getPrimaryKey();
    }

    /**
     * get artile model by primary key.
     */
    protected function actionGetByPrimaryKey($primaryKey)
    {
        return $this->_coupon->getByPrimaryKey($primaryKey);
    }


    /**
     * 得到category model的全名.
     */
    protected function actionGetModelName()
    {
        return get_class($this->_coupon);
    }

    /**
     * @property $filter|array
     * get artile collection by $filter
     * example filter:
     * [
     * 		'numPerPage' 	=> 20,
     * 		'pageNum'		=> 1,
     * 		'orderBy'	=> ['_id' => SORT_DESC, 'sku' => SORT_ASC ],
    'where'			=> [
    ['>','price',1],
    ['<=','price',10]
     * 			['sku' => 'uk10001'],
     * 		],
     * 	'asArray' => true,
     * ]
     */
    protected function actionColl($filter = '')
    {
        return $this->_coupon->coll($filter);
    }

    /**
     * @property $one|array , save one data .
     * @property $originUrlKey|string , article origin url key.
     * save $data to cms model,then,add url rewrite info to system service urlrewrite.
     */
    protected function actionSave($one, $originUrlKey)
    {
        return $this->_coupon->save($one, $originUrlKey);
    }

    protected function actionRemove($ids)
    {
        return $this->_coupon->remove($ids);
    }

}
商城后台新增虚拟卡券模块问题5年前

@Fecshop #5楼
appadmin\local\local_modules\Coupon\Module 代码如下:

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

namespace appadmin\local\local_modules\Coupon;
use fec\AdminModule;

class Module extends AdminModule
{
    public function init()
    {
        // 以下代码必须指定
        $this->controllerNamespace = __NAMESPACE__ . '\\controller';
        $this->_currentDir = __DIR__;
        $this->_currentNameSpace = __NAMESPACE__;

        // 指定默认的man文件
        $this->layout = '/main_ajax.php';
        parent::init();
    }
}

商城后台新增虚拟卡券模块问题5年前

新增代码目录如下:

商城后台新增虚拟卡券模块问题5年前

common/config/local_services/Coupon.php代码如下: return [

'coupon' => [
    'class' => 'common\local\local_services\Coupon',
    'storage' => 'CouponMysqldb',
],

];

商城后台新增虚拟卡券模块问题5年前

controller 模块和方法都是可以进去的,只有在调用Yii::$service->coupon的时候会报上边的错误

商品配置后台增加日期输入框5年前

@qq3332794598 #2楼 可以啦,谢谢老哥:+1:

生产环境商城配置多台服务器之后,商城后台访问不到css和js文件5年前

@Fecshop #8楼 我们是用商城后台配置商品,然后提供接口给前端,页面是重新开发的

生产环境商城配置多台服务器之后,商城后台访问不到css和js文件5年前

临时的解决方案是生产环境商城后台请求都指向同一台服务器

生产环境商城配置多台服务器之后,商城后台访问不到css和js文件5年前

刚试了下,直接通过ip访问商城后台,css样式和js文件都可以加载到,通过域名分配及其就不行了,assets目录创建文件是不是不支持多台服务器配置?

生产环境商城配置多台服务器之后,商城后台访问不到css和js文件5年前

appadmin接口都可以正常访问,就是后台的css样式和图片都出不来

关于php mongodb的最大连接数5年前

关于阿里云MongoDB超过最大连接数的问题,现在有什么解决方案吗?

商城后台访问报错6年前

找到原因了,php-fpm的用户组被删除了,造成这个文件夹没有读写权限

商城后台二次开发问题6年前

@Fecshop #3楼 好的,我这个是老版本的,Service.php里没有这个方法,升级一下应该就好了,谢啦!

商城后台二次开发问题6年前

问题解决了,这个其实就是获取DiscountMongodb,实例化一下就好

商城后台二次开发问题6年前

common\local\local_services\Discount.php文件报错, public function init()

{
    parent::init();
    $currentService = $this->getStorageService($this);
    $this->_discount = new $currentService();
}
这段报的错,给到的实例里边也没有找到这个方法
Your Site Analytics