find($this->image_id)->external_url??''; // return $a; // } // public function file(){ // return $this->hasOne('app\common\model\UploadFile', 'file_id', 'image_id'); // } // /** // * 一对多关联商品表 // */ // public function activity(){ // return $this->belongsTo('MsActivity', 'id','ms_activity_id'); // } // public function add($activity_id, $data){ // // 先删除全部 // static::deleteAll(['ms_activity_id' => $activity_id]); // if (!empty($data)) { // // 添加 // $dataset = []; // foreach ($data as $item) { // // 商品信息 // // $goodsInfo = Goods::detail($item['goods_id']); // // if (empty($goodsInfo)) { // // $this->error = "商品信息错误"; // // return false; // // } // $goods = Goods::where("goods_no",$item['goods_sku_no'])->find(); // if (empty($goods)) { // $this->error = "图片skuno错误"; // return false; // } // $dataset[] = [ // 'ms_activity_id' => $activity_id, // 'goods_id' => $goods['goods_id'], // 'image_id'=>$item['image_id'], // 'goods_sku_no'=>$item['goods_sku_no'] // ]; // } // (new static)->addAll($dataset); // return true; // } // } }