陈伟 9 months ago
commit c3c1ae0d2f
  1. 3
      app/api/controller/StoreKeeper.php
  2. 18
      app/api/model/ActiveCol.php
  3. 2
      app/api/model/ActiveMain.php
  4. 3
      app/common/model/ActiveCol.php

@ -13,6 +13,7 @@ declare (strict_types=1);
namespace app\api\controller;
use app\api\service\User as UserService;
use app\common\enum\RecoveryStatusEnum;
use app\store\model\article\Category as CategoryModel;
use app\store\model\Express as ExpressModel;
use app\store\model\store\Address as AddressModel;
@ -56,6 +57,8 @@ class StoreKeeper extends Controller
*/
public function list(): Json
{
RecoveryStatusEnum::keys();
// 获取列表记录
$model = new GoodsModel;
$list = $model->getList($this->request->param());

@ -20,15 +20,15 @@ use app\common\model\ActiveCol as ActiveColModel;
*/
class ActiveCol extends ActiveColModel
{
//追加字段
protected $append = [
'col_pic'
];
public function getColPicAttr($value, $data) {
$file = $this->with(['colImage'])->find();
return $file['col_image_url'];
}
// //追加字段
// protected $append = [
// 'col_pic'
// ];
//
// public function getColPicAttr($value, $data) {
// $file = $this->with('colImage')->find();
// return $file['col_image_url'];
// }
}

@ -33,7 +33,7 @@ class ActiveMain extends ActiveMainModel
public function getList($param) {
return $this->with('col')
return $this->with('col.colImage')
->where('status', '=', 1)
->where('id', $param['active_id'])
->find();

@ -28,6 +28,7 @@ class ActiveCol extends BaseModel
// 定义主键
protected $pk = 'id';
/**
* col_image关联
* @return HasOne
@ -35,7 +36,7 @@ class ActiveCol extends BaseModel
public function colImage(): HasOne
{
return $this->hasOne('UploadFile', 'file_id', 'col_image_id')
->bind(['col_image_url' => 'preview_url']);
->bind(['col_pic' => 'preview_url']);
}
}

Loading…
Cancel
Save