Commit 0c029947 by 朱继来

调整

parent 924de079
...@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model; ...@@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
use Request; use Request;
use DB; use DB;
use App\Model\CmsModel; use App\Model\CmsModel;
use App\Model\Mongo\SpuModel;
//公共模型 //公共模型
class CommonModel extends Model class CommonModel extends Model
...@@ -203,7 +204,23 @@ class CommonModel extends Model ...@@ -203,7 +204,23 @@ class CommonModel extends Model
} }
// 判断型号是否存在
public function isGoodsNameExists($goods_name)
{
$SpuModel = new SpuModel;
return $SpuModel->where('spu_name', $goods_name)->value('_id');
}
// 判断品牌是否存在
public function isBrandNameExists($brand_name)
{
return DB::connection("spu")->table('lie_brand')->where('brand_name', $brand_name)->value('brand_id');
}
// 判断供应商是否存在
public function isSupplierNameExists($supplier_name)
{
return DB::connection('ass')->table('lie_supplier_channel')->where('supplier_name', $supplier_name)->value('supplier_id');
}
} }
\ No newline at end of file
...@@ -556,7 +556,7 @@ class QuoteModel extends Model ...@@ -556,7 +556,7 @@ class QuoteModel extends Model
$v['create_time'] = time(); $v['create_time'] = time();
$v['update_time'] = time(); $v['update_time'] = time();
} }
dd($excel);
$res = $this->insert($excel); // 批量插入 $res = $this->insert($excel); // 批量插入
if ($res === false) return [1, '添加报价草稿失败']; if ($res === false) return [1, '添加报价草稿失败'];
...@@ -613,6 +613,14 @@ dd($excel); ...@@ -613,6 +613,14 @@ dd($excel);
} }
if ($val['brand_name']) { // 判断型号是否存在
}
if ($val['supplier_name']) { // 判断型号是否存在
}
if ($val['currency'] != '人民币' && $val['price_origin'] <= 0) { if ($val['currency'] != '人民币' && $val['price_origin'] <= 0) {
$err[] = '第'.($key+1).'行,单价等于或小于0'; $err[] = '第'.($key+1).'行,单价等于或小于0';
return; return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment