Browse Source

规范代码

antshop
linyaostalker 5 years ago
parent
commit
e4c8dfa757
  1. 6
      backend/modules/file/models/ars/File.php
  2. 2
      backend/modules/goods/logic/goods/GoodsManager.php
  3. 2
      backend/modules/goods/models/ars/Category.php

6
backend/modules/file/models/ars/File.php

@ -2,8 +2,8 @@
namespace backend\modules\file\models\ars;
use Yii;
use yii\behaviors\TimestampBehavior;
use yii\db\ActiveRecord;
/**
* This is the model class for table "ats_file".
@ -20,7 +20,7 @@ use yii\behaviors\TimestampBehavior;
* @property int $updated_at 更新时间
* @property int $created_at 创建时间
*/
class File extends \yii\db\ActiveRecord
class File extends ActiveRecord
{
//own_type
const OWN_TYPE_GOODS_INDEX = 1;//商品首页
@ -81,7 +81,7 @@ class File extends \yii\db\ActiveRecord
{
return [
[
'class' => TimestampBehavior::className(),
'class' => TimestampBehavior::class,
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {

2
backend/modules/goods/logic/goods/GoodsManager.php

@ -81,7 +81,7 @@ class GoodsManager
if (!$model->save()) {
throw new \Exception('商品保存失败');
}
$saveCoverImageRes = self::saveFile(explode(',', $model->coverImageId), $model, explode(',', $coverImageOldIdStr));
$saveCoverImageRes = self::saveFile(explode(',', $model->coverImageId), $model, explode(',', $coverImageOldIdStr), File::OWN_TYPE_GOODS_INDEX);
$saveDetailImageRes = self::saveFile(explode(',', $model->detailImageId), $model, explode(',', $detailImageOldIdStr), File::OWN_TYPE_GOODS_DETAILS);
if($saveCoverImageRes['first_file_id'] !== 0) {
$model->image = $saveCoverImageRes['first_file_id'];

2
backend/modules/goods/models/ars/Category.php

@ -88,7 +88,7 @@ class Category extends \yii\db\ActiveRecord
{
return [
[
'class' => TimestampBehavior::className(),
'class' => TimestampBehavior::class,
'createdAtAttribute' => 'created_at',
'updatedAtAttribute' => 'updated_at',
'value' => function() {

Loading…
Cancel
Save