Compare commits
No commits in common. "bcbcd626c38d63be1840bd30b650c53a3ef46633" and "13a575ca0cd10d9dbedb9bac3b53598454b55cad" have entirely different histories.
bcbcd626c3
...
13a575ca0c
@ -61,100 +61,14 @@ class IndexController extends BaseApiController
|
|||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$arr=Db::connect('demo')->name('sheet1')->where('name','<>','')->limit(2)->select();
|
$arr= Db::name('ceshi_copy_copy')->select();
|
||||||
foreach ($arr as $k => $v) {
|
foreach ($arr as $k => $v) {
|
||||||
$find= Db::connect('demo')->name('store_product_unit')->where('value',$v['unit_name'])->find();
|
$find=Db::name('ceshi_copy')->where('product_id',$v['product_id'])->find();
|
||||||
if(!$find){
|
if($find){
|
||||||
$aa=['mer_id'=>7,'type'=>1,'value'=>$v['unit_name'],'status'=>1];
|
Db::name('ceshi_copy_copy')->where('id',$v['id'])->update(['price_two'=>bcadd($v['price'],bcmul($v['price'], $find['purchase'], 2),2),'purchase'=>bcadd($v['price'],bcmul($v['price'], $find['price'], 2),2)]);
|
||||||
$id=Db::connect('demo')->name('store_product_unit')->insertGetId($aa);
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$data=[
|
|
||||||
'mer_id'=>7,
|
|
||||||
'store_name'=>$v['name'],
|
|
||||||
'store_info'=>$v['name_tow'],
|
|
||||||
'cate_id'=>0,
|
|
||||||
'unit_name'=>$v['unit_name'],
|
|
||||||
'price'=>$v['price'],
|
|
||||||
'cost'=>$v['cost'],
|
|
||||||
'ot_price'=>0,
|
|
||||||
'image'=>$v['image'],
|
|
||||||
'slider_image'=>$v['image'],
|
|
||||||
'mer_svip_status'=>1,
|
|
||||||
'svip_price_type'=>2,
|
|
||||||
'svip_price'=>$v['cost'],
|
|
||||||
|
|
||||||
];
|
|
||||||
$product_id=Db::connect('demo')->name('store_product')->insertGetId($data);
|
|
||||||
$data2=[
|
|
||||||
'mer_id'=>7,
|
|
||||||
'product_id'=>$product_id,
|
|
||||||
'store_name'=>$v['name'],
|
|
||||||
'ot_price'=>0,
|
|
||||||
'image'=>$v['image'],
|
|
||||||
];
|
|
||||||
Db::connect('demo')->name('store_spu')->insert($data2);
|
|
||||||
$sku='';
|
|
||||||
|
|
||||||
$unique=substr(md5($sku . $product_id), 12, 10) . 0;
|
|
||||||
|
|
||||||
|
|
||||||
$data4=[
|
|
||||||
'product_id'=>$product_id,
|
|
||||||
'detail'=>'""',
|
|
||||||
'image'=>$v['image'],
|
|
||||||
'price'=>$v['price'],
|
|
||||||
'unique'=>$unique,
|
|
||||||
'svip_price'=>$v['cost'],
|
|
||||||
];
|
|
||||||
$vid=Db::connect('demo')->name('store_product_attr_value')->insertGetId($data4);
|
|
||||||
|
|
||||||
$json=[
|
|
||||||
'attr'=>[],
|
|
||||||
'attrValue'=>[
|
|
||||||
'value_id'=>$vid,
|
|
||||||
'product_id'=>$product_id,
|
|
||||||
'detail'=>'',
|
|
||||||
'sku'=>'',
|
|
||||||
'stock'=>0,
|
|
||||||
'brand_id'=>0,
|
|
||||||
'sales'>0,
|
|
||||||
'image'=>$v['image'],
|
|
||||||
'bar_code'=>'',
|
|
||||||
'cost'=>0,
|
|
||||||
'ot_price'=>0,
|
|
||||||
'price'=>$v['price'],
|
|
||||||
'svip_price'=>$v['cost'],
|
|
||||||
'weight'=>0,
|
|
||||||
'volume'=>0,
|
|
||||||
'type'=>0,
|
|
||||||
'extension_one'=>0,
|
|
||||||
'extension_two'=>0,
|
|
||||||
'unique'=>$unique,
|
|
||||||
'library_id'=>0,
|
|
||||||
'bar_code_number'=>'',
|
|
||||||
'is_default_select'=>0,
|
|
||||||
'is_show'=>1,
|
|
||||||
'productCdkey'=>[],
|
|
||||||
'select'=>1,
|
|
||||||
'list'=>[]
|
|
||||||
],
|
|
||||||
'params'=>[]
|
|
||||||
];
|
|
||||||
$data3=[
|
|
||||||
'product_id'=>$product_id,
|
|
||||||
'change_time'=>time(),
|
|
||||||
'result'=>json_encode($json),
|
|
||||||
];
|
|
||||||
Db::connect('demo')->name('store_product_attr_result')->insert($data3);
|
|
||||||
|
|
||||||
$data5=[
|
|
||||||
'product_id'=>$product_id,
|
|
||||||
'content'=>'',
|
|
||||||
'type'=>0,
|
|
||||||
];
|
|
||||||
Db::connect('demo')->name('store_product_content')->insert($data5);
|
|
||||||
}
|
|
||||||
d($arr);
|
|
||||||
d(1);
|
d(1);
|
||||||
$arr = Db::name('ceshi_copy')->select();
|
$arr = Db::name('ceshi_copy')->select();
|
||||||
foreach ($arr as $k => $v) {
|
foreach ($arr as $k => $v) {
|
||||||
|
@ -55,7 +55,7 @@ return [
|
|||||||
// 数据库编码默认采用utf8
|
// 数据库编码默认采用utf8
|
||||||
'charset' => 'utf8mb4',
|
'charset' => 'utf8mb4',
|
||||||
// 数据库表前缀
|
// 数据库表前缀
|
||||||
'prefix' => 'eb_',
|
'prefix' => 'la_',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user