|
@@ -5,7 +5,7 @@ namespace app\admin\controller;
|
|
|
use app\admin\model\ActionLog;
|
|
|
use app\admin\model\ChangeLog;
|
|
|
use app\admin\model\DataGroup as DataGroupModel;
|
|
|
-use app\admin\model\GoodCombind;use app\admin\model\GoodStock;use app\admin\model\ProcessOrder;
|
|
|
+use app\admin\model\GoodBasic;use app\admin\model\GoodCombind;use app\admin\model\GoodStock;use app\admin\model\ProcessOrder;
|
|
|
use app\youzan\model\PlatformYouzan;
|
|
|
use think\App;
|
|
|
use think\Exception;
|
|
@@ -1607,7 +1607,6 @@ class Goodup extends Base
|
|
|
|
|
|
if($platform_info['platform_type']==1){
|
|
|
if($fixed==0) return error_show(1005,'有赞平台商品不可使用实时金价');
|
|
|
-
|
|
|
return \app\youzan\logic\Goodup::create([
|
|
|
'platform_id'=>$platform,
|
|
|
'online_reason'=>$online_reason,
|
|
@@ -2725,7 +2724,13 @@ class Goodup extends Base
|
|
|
public function onlineZixunGoods()
|
|
|
{
|
|
|
|
|
|
- $param = $this->request->only(['platform', "is_fixed",'codes', 'online_reason', 'online_remark', 'token'], 'post', 'trim');
|
|
|
+ $param = $this->request->only([
|
|
|
+ 'platform',
|
|
|
+ "is_fixed",
|
|
|
+ 'codes',
|
|
|
+ 'online_reason',
|
|
|
+ 'online_remark',
|
|
|
+ 'token'], 'post', 'trim');
|
|
|
|
|
|
$val = Validate::rule([
|
|
|
'platform|所选上线平台' => 'require|number|gt:0',
|
|
@@ -2852,7 +2857,7 @@ class Goodup extends Base
|
|
|
'good_unit' => $good_zixun_list[$value]['good_unit'],
|
|
|
'good_type' => $good_zixun_list[$value]['good_type'],
|
|
|
'companyNo' => $good_zixun_list[$value]['companyNo'],
|
|
|
- 'companyName' => $good_zixun_list[$value]['companyName'],
|
|
|
+ 'companyName' => $good_zixun_list[$value]['companyName'],
|
|
|
'moq' => $good_zixun_list[$value]['moq'],
|
|
|
'customized' => $good_zixun_list[$value]['customized'],
|
|
|
'tax' => $good_zixun_list[$value]['tax'],
|
|
@@ -3023,6 +3028,7 @@ class Goodup extends Base
|
|
|
if (!empty($good_basic_insert_data)) Db::name('good_basic')->insertAll($good_basic_insert_data);
|
|
|
|
|
|
if (!empty($good_spec_insert_data)) Db::name('good_spec')->insertAll($good_spec_insert_data);
|
|
|
+
|
|
|
|
|
|
if ($create) {
|
|
|
foreach ($good_basic_insert_data as $value) {
|
|
@@ -3455,4 +3461,157 @@ class Goodup extends Base
|
|
|
else return app_show(0,"数据更新成功");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *咨询商品入成本库
|
|
|
+ */
|
|
|
+ public function basicZixunGoods(){
|
|
|
+ $param = $this->request->only(['codes'=>[]], 'post', 'trim');
|
|
|
+ $val = Validate::rule([
|
|
|
+ 'codes|所选上线商品编号' => 'require|array',
|
|
|
+ ]);
|
|
|
+
|
|
|
+ if (!$val->check($param)) return error_show(1004, $val->getError());
|
|
|
+ $good_zixun_list = Db::name('good_zixun')
|
|
|
+ ->where(['is_del' => 0])
|
|
|
+ ->whereIn('spuCode', $param['codes'])
|
|
|
+ ->select();
|
|
|
+ if (empty($good_zixun_list)) return error_show(1004, '未找到相关咨询商品数据');
|
|
|
+ $temp=[];
|
|
|
+ $good_spec_insert_data=[];
|
|
|
+ $GoodBasic = new GoodBasic();
|
|
|
+ foreach ($good_zixun_list as $item){
|
|
|
+ $isT =$GoodBasic->where(["spuCode"=>$item['spuCode'],"is_del"=>0])->findOrEmpty();
|
|
|
+ if($isT->isEmpty()==false)return error_show(1004, "{$item['good_name']}商品已存在成本库中!");
|
|
|
+ $temp[] = [
|
|
|
+ 'spuCode' => $item['spuCode'],
|
|
|
+ 'good_code' => $item['good_code'],
|
|
|
+ 'good_name' => $item['good_name'],
|
|
|
+ 'cat_id' => $item['cat_id'],
|
|
|
+ 'brand_id' => $item['brand_id'],
|
|
|
+ 'companyNo' => $item['companyNo'],
|
|
|
+ 'companyName' => $item['companyName'],
|
|
|
+ 'good_unit' => $item['good_unit'],
|
|
|
+ 'good_type' => $item['good_type'],
|
|
|
+ 'moq' => $item['moq'],
|
|
|
+ 'customized' => $item['customized'],
|
|
|
+ 'tax' => $item['tax'],
|
|
|
+ 'supplierNo' => $item['supplierNo'],
|
|
|
+ 'supplierName' => $item['supplierName'],
|
|
|
+ 'is_auth' => $item['is_auth'],
|
|
|
+ 'auth_img' => $item['auth_img'],
|
|
|
+ 'after_sales' => '',
|
|
|
+ 'craft_desc' => $item['craft_desc'],
|
|
|
+ 'good_remark' => $item['good_remark'],
|
|
|
+ 'weight' => $item['weight'],
|
|
|
+ 'packing_way' => '',
|
|
|
+ 'packing_size' => '',
|
|
|
+ 'packing_spec' => '',
|
|
|
+ 'packing_list' => '',
|
|
|
+ 'packing_weight' => '',
|
|
|
+ 'good_bar' => '',
|
|
|
+ 'supply_area' => $item['supply_area'],
|
|
|
+ 'delivery_place' => '',
|
|
|
+ 'origin_place' => '',
|
|
|
+ 'delivery_day' => '',
|
|
|
+ 'lead_time' => '',
|
|
|
+ 'sample_day' => '',
|
|
|
+ 'sample_fee' => '',
|
|
|
+ 'good_img' => '',//$item['good_img'],
|
|
|
+ 'good_thumb_img' => $item['good_thumb_img'],
|
|
|
+ 'good_info_img' => $item['good_img'],//商品主图对应到商品详情
|
|
|
+ 'cert_fee' => '',
|
|
|
+ 'packing_fee' => '',
|
|
|
+ 'cost_fee' => '',
|
|
|
+ 'mark_fee' => '',
|
|
|
+ 'demo_fee' => '',
|
|
|
+ 'open_fee' => '',
|
|
|
+ 'noble_metal' => $item['noble_metal'],
|
|
|
+ 'noble_weight' => $item['good_weight'],
|
|
|
+ 'is_gold_price' => $item['is_gold_price'],
|
|
|
+ 'cgd_gold_price' => '',
|
|
|
+ 'market_price' => '',
|
|
|
+ 'nake_price' => '',
|
|
|
+ 'is_step' => '',
|
|
|
+ 'is_online' => '',
|
|
|
+ 'status' => 8,//咨询商品待编辑
|
|
|
+ 'createrid' => $this->uid,
|
|
|
+ 'creater' => $this->uname,
|
|
|
+ 'create_source' => 1,
|
|
|
+ 'field_change' => '',
|
|
|
+ 'is_del' => 0,
|
|
|
+ 'addtime' => date('Y-m-d H:i:s'),
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s'),
|
|
|
+ 'is_diff' => $item['is_diff'],
|
|
|
+ 'config' => $item['config'],
|
|
|
+ 'other_config' => $item['other_config'],
|
|
|
+ ];
|
|
|
+
|
|
|
+ if (!empty($item['specinfo'])) {
|
|
|
+
|
|
|
+ $spec_list = json_decode($item['specinfo'], true);
|
|
|
+
|
|
|
+ foreach ($spec_list as $spec) {
|
|
|
+ $specid = $spec['specid']??($spec['spec_id']??'');
|
|
|
+ $specinfo = Db::name('good_spec')
|
|
|
+ ->field('id')
|
|
|
+ ->where(['spuCode' => $item['spuCode'], 'spec_id' => $specid, 'spec_value_id' => $spec['spec_value_id'],
|
|
|
+ 'is_del' => 0])
|
|
|
+ ->find();
|
|
|
+ if (!empty($specinfo)) {
|
|
|
+ $good_spec_insert_data[] = [
|
|
|
+ 'spuCode' => $item['spuCode'],
|
|
|
+ 'spec_id' => $specid,
|
|
|
+ 'spec_value_id' => $spec['spec_value_id'],
|
|
|
+ 'is_del' => 0,
|
|
|
+ 'addtime' => date('Y-m-d H:i:s'),
|
|
|
+ 'updatetime' => date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $GoodBasic->startTrans();
|
|
|
+ try {
|
|
|
+
|
|
|
+ $create = $GoodBasic->saveAll($temp);
|
|
|
+
|
|
|
+ Db::name('good_zixun')
|
|
|
+ ->where(['is_del' => 0, 'status' => 1])
|
|
|
+ ->whereIn('spuCode', $param['codes'])
|
|
|
+ ->update(['status' => 2, 'updatetime' => date('Y-m-d H:i:s')]);
|
|
|
+
|
|
|
+ if (!empty($good_spec_insert_data)) Db::name('good_spec')->insertAll($good_spec_insert_data);
|
|
|
+
|
|
|
+
|
|
|
+ if ($create) {
|
|
|
+ foreach ($good_basic_insert_data as $value) {
|
|
|
+
|
|
|
+ ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], [
|
|
|
+ 'order_code' =>$value['spuCode'],//
|
|
|
+ 'status' => 8,//待产品审核
|
|
|
+ 'action_remark' => '',//备注
|
|
|
+ 'action_type' => 'create'//新建create,编辑edit,更改状态status
|
|
|
+ ], 'SPCB', $value['status'], $value);
|
|
|
+
|
|
|
+ ProcessOrder::AddProcess(['id' =>$this->uid, 'nickname' =>$this->uname], [
|
|
|
+ 'order_type' => 'SPCB',
|
|
|
+ 'order_code' =>$value['spuCode'],//
|
|
|
+ 'order_id' => isset($value['id']) ? $value['id'] : 0,
|
|
|
+ 'order_status' => 8,//待产品审核
|
|
|
+ 'before_status' => 0,//待产品审核
|
|
|
+ 'holder_id'=>$value['createrid'],
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ $GoodBasic->commit();
|
|
|
+ return app_show(0, '提交成功');
|
|
|
+ } else {
|
|
|
+ $GoodBasic->rollback();
|
|
|
+ return error_show(1004, '提交失败');
|
|
|
+ }
|
|
|
+ } catch (Exception $exception) {
|
|
|
+ $GoodBasic->rollback();
|
|
|
+ return error_show(1005, $exception->getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|