terry 是不是应该把上面一坨注释掉,不然不可能执行第二个if,也就不能实现动态添加字段
文件路径!!!!!!!
怀疑版本低,就去github对比一下不就行了?
注意描述清楚问题,自己的帖子别人是否能看懂。
@Terry #1楼 这个文件
历史原因残留代码,把这个代码去掉就行,改成这样吧
public function attributes($origin = false) { $origin = [ '_id', 'product_spu', 'product_sku', 'product_id', 'rate_star', 'name', 'user_id', 'ip', 'summary', 'review_content', // 评论的内容 'review_date', // 评论的最后更新时间 'store', // store 'lang_code', // 语言 'status', // 审核状态 10代表未审核,1代表已审核。 'audit_user', // 审核账号 'audit_date', // 审核时间 ]; if (is_array(self::$_customAttrs) && !empty(self::$_customAttrs)) { $origin = array_merge($origin, self::$_customAttrs); } return $origin; }
我查阅了一下代码,没有实际用到 addCustomAttrs 这个方法的,因此目前对功能没有影响,改成上面的样子把,
addCustomAttrs
https://github.com/fecshop/yii2_fecshop/commit/d02df5c7a9e23a796c9507ea13e254e40288e07d
代码已经提交,下个版本会更新,多谢发现代码问题。