Нема описа
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ProductSpecData.php 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 陈风任 <491085389@qq.com>
  11. * Date: 2019-7-9
  12. */
  13. namespace app\admin\model;
  14. use think\Model;
  15. use think\Config;
  16. use think\Db;
  17. use app\admin\logic\ProductSpecLogic; // 用于产品规格逻辑功能处理
  18. /**
  19. * 产品规格预设模型
  20. */
  21. class ProductSpecData extends Model
  22. {
  23. //初始化
  24. protected function initialize()
  25. {
  26. // 需要调用`Model`的`initialize`方法
  27. parent::initialize();
  28. $this->admin_lang = get_admin_lang();
  29. }
  30. public function PresetSpecAddData($Data = array())
  31. {
  32. if (!empty($Data['aid'])) {
  33. // 查询规格库规格信息
  34. $where = [
  35. 'lang' => get_admin_lang(),
  36. 'preset_mark_id' => ['IN', $Data['spec_mark_id']],
  37. ];
  38. $PresetData = Db::name('product_spec_preset')->where($where)->order('preset_mark_id desc')->select();
  39. // 查询商品规格库是否存在选中的规格,不存在则执行添加
  40. $Where = [
  41. 'aid' => $Data['aid'],
  42. 'lang' => $this->admin_lang,
  43. 'spec_mark_id' => $Data['spec_mark_id'],
  44. ];
  45. $count = Db::name('product_spec_data_handle')->where($Where)->count();
  46. if (empty($count)) {
  47. $insertAll = [];
  48. $spec_id = date('is');
  49. foreach ($PresetData as $key => $value) {
  50. $spec_id++;
  51. $insertAll[] = [
  52. 'spec_id' => $spec_id,
  53. 'aid' => $Data['aid'],
  54. 'spec_mark_id' => $value['preset_mark_id'],
  55. 'spec_name' => $value['preset_name'],
  56. 'spec_value_id' => $value['preset_id'],
  57. 'spec_value' => $value['preset_value'],
  58. 'spec_is_select' => 0,
  59. 'lang' => $this->admin_lang,
  60. 'add_time' => getTime(),
  61. 'update_time' => getTime(),
  62. ];
  63. }
  64. }
  65. if (!empty($insertAll)) Db::name('product_spec_data_handle')->insertAll($insertAll);
  66. }
  67. }
  68. public function ProducSpecNameEditSave($post = array(), $action = 'edit')
  69. {
  70. if (!empty($post['aid']) && !empty($post['spec_value_id']) && !empty($post['spec_mark_id'])) {
  71. // $spec_mark_ids = array_keys($post['spec_mark_id']);
  72. // $spec_value_ids = array_keys($post['spec_value_id']);
  73. // 查询条件
  74. $where = [
  75. 'aid' => $post['aid'],
  76. 'lang' => get_admin_lang(),
  77. // 'spec_mark_id' => ['IN', $spec_mark_ids],
  78. ];
  79. $handleAID = session('handleAID');
  80. if ('add' === strval($action) && !empty($handleAID)) $where['aid'] = $handleAID;
  81. // 查询规格数据
  82. $handle = Db::name('product_spec_data_handle')->where($where)->select();
  83. // 删除当前产品下的所有规格数据
  84. if ('edit' === strval($action)) Db::name('product_spec_data')->where($where)->delete(true);
  85. // 添加数组拼装
  86. $time = getTime();
  87. $insertAll = [];
  88. foreach ($handle as $key => $value) {
  89. $value['aid'] = $post['aid'];
  90. $insertAll[$key] = [
  91. 'aid' => $value['aid'],
  92. 'spec_mark_id' => $value['spec_mark_id'],
  93. 'spec_value_id' => $value['spec_value_id'],
  94. 'spec_name' => $value['spec_name'],
  95. 'spec_value' => $value['spec_value'],
  96. 'spec_is_select'=> $value['spec_is_select'],
  97. 'open_image' => $value['open_image'],
  98. 'spec_image' => $value['spec_image'],
  99. 'lang' => get_admin_lang(),
  100. 'add_time' => $time,
  101. 'update_time' => $time,
  102. ];
  103. // if (in_array($value['spec_value_id'], $spec_value_ids)) $insertAll[$key]['spec_is_select'] = 1;
  104. }
  105. if (!empty($insertAll)) {
  106. // 批量添加商品规格
  107. Db::name('product_spec_data')->insertAll($insertAll);
  108. // 删除产品规格数据处理表
  109. Db::name("product_spec_data_handle")->where($where)->delete();
  110. }
  111. }
  112. }
  113. // 编辑产品时,规格原数据处理
  114. public function GetProductSpecData($id)
  115. {
  116. $assign_data = ['spec_mark_id_arr' => 0];
  117. // 商城配置
  118. $shopConfig = getUsersConfigData('shop');
  119. $assign_data['shopConfig'] = $shopConfig;
  120. // 已选规格处理
  121. if (!empty($shopConfig['shop_open']) && isset($shopConfig['shop_open_spec']) && 1 == $shopConfig['shop_open_spec']) {
  122. // session('spec_arr', null);
  123. $SpecWhere = [
  124. 'aid' => $id,
  125. 'lang' => $this->admin_lang,
  126. // 'spec_is_select' => 1,// 已选中的
  127. ];
  128. // 删除商品规格处理表的规格数据
  129. Db::name('product_spec_data_handle')->where($SpecWhere)->delete(true);
  130. Db::name('product_spec_value_handle')->where($SpecWhere)->delete(true);
  131. $order = 'spec_value_id asc, spec_id asc';
  132. $product_spec_data = Db::name('product_spec_data')->where($SpecWhere)->order($order)->select();
  133. // dump($product_spec_data);
  134. $order = 'spec_value_id asc, value_id asc';
  135. $product_spec_value = Db::name('product_spec_value')->where($SpecWhere)->order($order)->select();
  136. // dump($product_spec_value);
  137. // exit;
  138. // 参数预定义
  139. $assign_data['useSpecNum'] = 0;
  140. $assign_data['SpecSelectName'] = $assign_data['HtmlTable'] = $assign_data['spec_mark_id_arr'] = '';
  141. if (!empty($product_spec_data)) {
  142. // 添加商品规格处理表的规格信息
  143. $resultID1 = Db::name('product_spec_data_handle')->insertAll($product_spec_data);
  144. $resultID2 = Db::name('product_spec_value_handle')->insertAll($product_spec_value);
  145. if (empty($resultID1) || empty($resultID2)) $this->error('信息错误,请重新进入');
  146. // 查询规格库现有规格preset_mark_id
  147. $preset_mark_ids = Db::name('product_spec_preset')->column('preset_mark_id');
  148. $preset_mark_ids = array_unique($preset_mark_ids);
  149. $ProductSpecLogic = new ProductSpecLogic;
  150. $spec_arr_new = group_same_key($product_spec_data, 'spec_mark_id');
  151. $spec_mark_id_arr = [];
  152. $index = 0;
  153. foreach ($spec_arr_new as $key => $value) {
  154. // dump($key);
  155. $assign_data['useSpecNum']++;
  156. // 规格库规格显示处理
  157. if (in_array($key, $preset_mark_ids)) {
  158. $spec_mark_id_arr[] = $key;
  159. $SpecSelectName[$key] = '<div class="prset-box" id="spec_'.$key.'">';
  160. $SpecSelectName[$key] .= '<div id="div_'.$key.'">';
  161. $SpecSelectName[$key] .= '<div><span class="preset-bt w150 mr10" style="display: block;"><span class="spec_name_span_'.$key.'">'.$value[0]['spec_name'].'</span><em data-name="'.$value[0]['spec_name'].'" data-mark_id="'.$key.'" onclick="clearPresetSpec(this, '.$key.')"><i class="fa fa-times-circle" title="关闭"></i></em> <label style="user-select: none;"><input type="checkbox" class="openGoodsSpecImage" onclick="openGoodsSpecImage(this);" value="' . $key . '" data-image_level="'.$image_level.'">添加图片</label></span>';
  162. $SpecSelectName[$key] .= '<span class="set-preset-box"></span>';
  163. $SpecSelectName[$key] .= '<span class="set-preset-con"> <span id="SelectEd_'.$key.'">';
  164. for ($i = 0; $i < count($value); $i++) {
  165. if (!empty($value[$i]['spec_is_select'])) {
  166. $spec_arr_new[$key][$i] = $value[$i]['spec_value_id'];
  167. $SpecSelectName[$key] .= '<span class="preset-bt2 mr10" id="preset-bt2_'.$value[$i]['spec_id'].'"><span class="spec_value_span_'.$value[$i]['spec_value_id'].'">'.$value[$i]['spec_value'].'</span><em data-value="'.$value[$i]['spec_value'].'" data-spec_mark_id="'.$value[$i]['spec_mark_id'].'" data-spec_value_id="'.$value[$i]['spec_value_id'].'" onclick="clearPresetSpecValue(this)"><i class="fa fa-times-circle" title="关闭"></i></em> &nbsp; </span>';
  168. } else {
  169. unset($spec_arr_new[$key][$i]);
  170. }
  171. }
  172. $SpecSelectName[$key] .= '</span>';
  173. $SpecSelectName[$key] .= '<select class="preset-select" name="spec_value" id="spec_value_'.$key.'" onchange="addPresetSpecValue(this,'.$key.')">';
  174. $SpecSelectName[$key] .= $ProductSpecLogic->GetPresetValueOption('', $key, $id, 1);
  175. $SpecSelectName[$key] .= '</select>';
  176. $SpecSelectName[$key] .= '<span class="tongbu" title="同步规格数据" data-mark_id="'.$key.'" data-name="'.$value[0]['spec_name'].'" onclick="RefreshSpecValue(this);"><i class="fa fa-refresh"></i></span>';
  177. $SpecSelectName[$key] .= ' </span></div></div></div>';
  178. }
  179. // 自定义规格显示处理
  180. else {
  181. $SpecSelectName[$key] = '<div class="prset-box">';
  182. $SpecSelectName[$key] .= '<span class="set-preset-bt mr10" style="display: block;">';
  183. $SpecSelectName[$key] .= '<input type="text" name="set_spec_name" class="zdy-ggname w150" value="' . $value[0]['spec_name'] . '" placeholder="规格名称.." onchange="setSpecName(this, ' . $key . ');">';
  184. $SpecSelectName[$key] .= '<em onclick="setSpecNameClear(this, ' . $key . ');"> <i class="fa fa-times-circle" title="关闭" style="margin-left: -20px; margin-top: 8px;"></i> </em>';
  185. $none0 = 0 === intval($index) ? '' : 'style="display: none;"';
  186. $checked = !empty($value[0]['open_image']) ? 'checked' : '';
  187. $SpecSelectName[$key] .= <<<EOF
  188. <label {$none0}><input type="checkbox" onclick="openGoodsSpecImage(this);" value="{$key}" {$checked}>添加图片</label>
  189. EOF;
  190. $SpecSelectName[$key] .= '</span>';
  191. $SpecSelectName[$key] .= '<span class="set-preset-box"></span>';
  192. $SpecSelectName[$key] .= '<span class="set-preset-con">';
  193. $openImage = !empty($value[0]['open_image']) ? 'style="display: inline-block;"' : 'style="display: none;"';
  194. for ($i = 0; $i < count($value); $i++) {
  195. $spec_arr_new[$key][$i] = $value[$i]['spec_value_id'];
  196. $SpecSelectName[$key] .= '<span class="set-preset-bt mr10">';
  197. $show0 = !empty($value[$i]["spec_image"]) ? '' : 'style="display: none;"';
  198. $none1 = !empty($value[$i]["spec_image"]) ? 'style="display: none;"' : '';
  199. $SpecSelectName[$key] .= <<<EOF
  200. <div class='spec-dan-pane openGoodsSpecImage_{$key}' {$openImage}>
  201. <div class='images_upload'>
  202. <a href="javascript:void(0);" onclick="goodsSpecImageAdd({$value[$i]["spec_mark_id"]}, {$value[$i]["spec_value_id"]});" class="img-upload" title="上传图片" style="width: 30px; height: 30px;">
  203. <div class="y-line spec_image_y_line_{$value[$i]["spec_value_id"]}" {$none1}></div>
  204. <div class="x-line spec_image_x_line_{$value[$i]["spec_value_id"]}" {$none1}></div>
  205. <img src="{$value[$i]["spec_image"]}" class="pic_con spec_image_src_{$value[$i]["spec_value_id"]}" {$show0}>
  206. </a>
  207. </div>
  208. </div>
  209. EOF;
  210. // $SpecSelectName[$key] .= <<<EOF
  211. // <div class='spec-dan-pane openGoodsSpecImage_{$key}' {$openImage}>
  212. // <div class='images_upload'>
  213. // <a href="javascript:void(0);" onclick="goodsSpecImageAdd({$value[$i]["spec_mark_id"]}, {$value[$i]["spec_value_id"]});" class="img-upload" title="上传图片" style="width: 30px; height: 30px;">
  214. // <div class="y-line spec_image_y_line_{$value[$i]["spec_value_id"]}" {$none1}></div>
  215. // <div class="x-line spec_image_x_line_{$value[$i]["spec_value_id"]}" {$none1}></div>
  216. // <img src="{$value[$i]["spec_image"]}" class="pic_con spec_image_src_{$value[$i]["spec_value_id"]}" {$show0}>
  217. // </a>
  218. // <a href="javascript:void(0)" onclick="goodsSpecImageClear({$value[$i]["spec_mark_id"]}, {$value[$i]["spec_value_id"]});" class="delect spec_image_delect_{$value[$i]["spec_value_id"]}" {$show0}></a>
  219. // </div>
  220. // </div>
  221. // EOF;
  222. $SpecSelectName[$key] .= '<input type="hidden" value="' . $value[$i]['spec_value_id'] . '">';
  223. $SpecSelectName[$key] .= '<input type="text" class="zdy-ggshuzi w150" value="' . $value[$i]['spec_value'] . '" placeholder="规格值.." onchange="setSpecValue(this, ' . $value[$i]['spec_mark_id'] . ');">';
  224. if (0 !== intval($i)) {
  225. $SpecSelectName[$key] .= '<em data-spec_mark_id="' . $value[$i]['spec_mark_id'] . '" data-spec_value_id="' . $value[$i]['spec_value_id'] . '" onclick="setSpecValueClear(this);"><i class="fa fa-times-circle" title="关闭" style="margin-left: -22px; margin-top: 8px; cursor: pointer;"></i></em>';
  226. }
  227. $SpecSelectName[$key] .= '</span>';
  228. }
  229. $SpecSelectName[$key] .= '<a href="javascript:void(0);" onclick="addCustomSpecValue(this, ' . $key . ');" class="preset-bt-shuzi mr10">+增加规格值</a>';
  230. $SpecSelectName[$key] .= '</span>';
  231. $SpecSelectName[$key] .= '</div>';
  232. $index++;
  233. }
  234. }
  235. // session('spec_arr', $spec_arr_new);
  236. $assign_data['SpecSelectName'] = $SpecSelectName;
  237. $assign_data['HtmlTable'] = $ProductSpecLogic->SpecAssemblyEdit($spec_arr_new, $id);
  238. $assign_data['spec_mark_id_arr'] = implode(',', $spec_mark_id_arr);
  239. }
  240. // 预设值名称
  241. $where = ['lang' => $this->admin_lang];
  242. if (!empty($spec_mark_id_arr)) $where['preset_mark_id'] = ['NOT IN',$spec_mark_id_arr];
  243. $assign_data['preset_value'] = Db::name('product_spec_preset')->where($where)->field('preset_id,preset_mark_id,preset_name')->group('preset_mark_id')->order('preset_mark_id desc')->select();
  244. $assign_data['maxPresetMarkID'] = $assign_data['preset_value'][0]['preset_mark_id'];
  245. }
  246. return $assign_data;
  247. }
  248. /**
  249. * 2020/12/18 大黄 秒杀 编辑秒杀商品,规格原数据处理
  250. */
  251. public function GetSharpProductSpecData($id)
  252. {
  253. $assign_data = [];
  254. // 商城配置
  255. $shopConfig = getUsersConfigData('shop');
  256. $assign_data['shopConfig'] = $shopConfig;
  257. // 已选规格处理
  258. if (isset($shopConfig['shop_open_spec']) && 1 == $shopConfig['shop_open_spec']) {
  259. session('spec_arr',null);
  260. $SpecWhere = [
  261. 'aid' => $id,
  262. 'lang' => $this->admin_lang,
  263. 'spec_is_select' => 1,// 已选中的
  264. ];
  265. $order = 'spec_value_id asc, spec_id asc';
  266. $product_spec_data = Db::name('product_spec_data')->where($SpecWhere)->order($order)->select();
  267. // 参数预定义
  268. $assign_data['SpecSelectName'] = $assign_data['HtmlTable'] = $assign_data['spec_mark_id_arr'] = '';
  269. if (!empty($product_spec_data)) {
  270. $ProductSpecLogic = new ProductSpecLogic;
  271. $spec_arr_new = group_same_key($product_spec_data, 'spec_mark_id');
  272. foreach ($spec_arr_new as $key => $value) {
  273. $spec_mark_id_arr[] = $key;
  274. $SpecSelectName[$key] = '<div class="prset-box" id="spec_'.$key.'">';
  275. $SpecSelectName[$key] .= '<div id="div_'.$key.'">';
  276. $SpecSelectName[$key] .= '<div><span class="preset-bt"><span class="spec_name_span_'.$key.'">'.$value[0]['spec_name'].'</span><em data-name="'.$value[0]['spec_name'].'" data-mark_id="'.$key.'" onclick="DelDiv(this)"><i class="fa fa-times-circle" title="关闭"></i></em></span>';
  277. $SpecSelectName[$key] .= '<span id="SelectEd_'.$key.'">';
  278. for ($i=0; $i<count($value); $i++) {
  279. $spec_arr_new[$key][$i] = $value[$i]['spec_value_id'];
  280. $SpecSelectName[$key] .= '<span class="preset-bt2" id="preset-bt2_'.$value[$i]['spec_id'].'"><span class="spec_value_span_'.$value[$i]['spec_value_id'].'">'.$value[$i]['spec_value'].'</span><em data-value="'.$value[$i]['spec_value'].'" data-mark_id="'.$value[$i]['spec_mark_id'].'" data-preset_id="'.$value[$i]['spec_value_id'].'" onclick="DelValue(this)"><i class="fa fa-times-circle" title="关闭"></i></em> &nbsp; </span>';
  281. }
  282. $SpecSelectName[$key] .= '</span>';
  283. $SpecSelectName[$key] .= '<select class="preset-select" name="spec_value" id="spec_value_'.$key.'" onchange="AppEndPreset(this,'.$key.')">';
  284. $SpecSelectName[$key] .= $ProductSpecLogic->GetPresetValueOption('', $key, $id, 1);
  285. $SpecSelectName[$key] .= '</select><span class="tongbu" title="同步规格数据" data-mark_id="'.$key.'" data-name="'.$value[0]['spec_name'].'" onclick="RefreshSpecValue(this);"><i class="fa fa-refresh"></i></span>';
  286. $SpecSelectName[$key] .= '</div></div></div>';
  287. }
  288. session('spec_arr',$spec_arr_new);
  289. $assign_data['SpecSelectName'] = $SpecSelectName;
  290. $assign_data['HtmlTable'] = $ProductSpecLogic->SharpSpecAssemblyEdit($spec_arr_new, $id);
  291. $assign_data['spec_mark_id_arr'] = implode(',', $spec_mark_id_arr);
  292. }
  293. // 预设值名称
  294. $where = ['lang' => $this->admin_lang];
  295. if (!empty($spec_mark_id_arr)) $where['preset_mark_id'] = ['NOT IN',$spec_mark_id_arr];
  296. $assign_data['preset_value'] = Db::name('product_spec_preset')->where($where)->field('preset_id,preset_mark_id,preset_name')->group('preset_mark_id')->order('preset_mark_id desc')->select();
  297. }
  298. return $assign_data;
  299. }
  300. /**
  301. * 2022/03/08 大黄 限时折扣 编辑限时折扣商品,规格原数据处理
  302. */
  303. public function GetDiscountProductSpecData($id)
  304. {
  305. $assign_data = [];
  306. // 商城配置
  307. $shopConfig = getUsersConfigData('shop');
  308. $assign_data['shopConfig'] = $shopConfig;
  309. // 已选规格处理
  310. if (isset($shopConfig['shop_open_spec']) && 1 == $shopConfig['shop_open_spec']) {
  311. session('spec_arr',null);
  312. $SpecWhere = [
  313. 'aid' => $id,
  314. 'lang' => $this->admin_lang,
  315. 'spec_is_select' => 1,// 已选中的
  316. ];
  317. $order = 'spec_value_id asc, spec_id asc';
  318. $product_spec_data = Db::name('product_spec_data')->where($SpecWhere)->order($order)->select();
  319. // 参数预定义
  320. $assign_data['SpecSelectName'] = $assign_data['HtmlTable'] = $assign_data['spec_mark_id_arr'] = '';
  321. if (!empty($product_spec_data)) {
  322. $ProductSpecLogic = new ProductSpecLogic;
  323. $spec_arr_new = group_same_key($product_spec_data, 'spec_mark_id');
  324. foreach ($spec_arr_new as $key => $value) {
  325. $spec_mark_id_arr[] = $key;
  326. $SpecSelectName[$key] = '<div class="prset-box" id="spec_'.$key.'">';
  327. $SpecSelectName[$key] .= '<div id="div_'.$key.'">';
  328. $SpecSelectName[$key] .= '<div><span class="preset-bt"><span class="spec_name_span_'.$key.'">'.$value[0]['spec_name'].'</span><em data-name="'.$value[0]['spec_name'].'" data-mark_id="'.$key.'" onclick="DelDiv(this)"><i class="fa fa-times-circle" title="关闭"></i></em></span>';
  329. $SpecSelectName[$key] .= '<span id="SelectEd_'.$key.'">';
  330. for ($i=0; $i<count($value); $i++) {
  331. $spec_arr_new[$key][$i] = $value[$i]['spec_value_id'];
  332. $SpecSelectName[$key] .= '<span class="preset-bt2" id="preset-bt2_'.$value[$i]['spec_id'].'"><span class="spec_value_span_'.$value[$i]['spec_value_id'].'">'.$value[$i]['spec_value'].'</span><em data-value="'.$value[$i]['spec_value'].'" data-mark_id="'.$value[$i]['spec_mark_id'].'" data-preset_id="'.$value[$i]['spec_value_id'].'" onclick="DelValue(this)"><i class="fa fa-times-circle" title="关闭"></i></em> &nbsp; </span>';
  333. }
  334. $SpecSelectName[$key] .= '</span>';
  335. $SpecSelectName[$key] .= '<select class="preset-select" name="spec_value" id="spec_value_'.$key.'" onchange="AppEndPreset(this,'.$key.')">';
  336. $SpecSelectName[$key] .= $ProductSpecLogic->GetPresetValueOption('', $key, $id, 1);
  337. $SpecSelectName[$key] .= '</select><span class="tongbu" title="同步规格数据" data-mark_id="'.$key.'" data-name="'.$value[0]['spec_name'].'" onclick="RefreshSpecValue(this);"><i class="fa fa-refresh"></i></span>';
  338. $SpecSelectName[$key] .= '</div></div></div>';
  339. }
  340. session('spec_arr',$spec_arr_new);
  341. $assign_data['SpecSelectName'] = $SpecSelectName;
  342. $assign_data['HtmlTable'] = $ProductSpecLogic->DiscountSpecAssemblyEdit($spec_arr_new, $id);
  343. $assign_data['spec_mark_id_arr'] = implode(',', $spec_mark_id_arr);
  344. }
  345. // 预设值名称
  346. $where = ['lang' => $this->admin_lang];
  347. if (!empty($spec_mark_id_arr)) $where['preset_mark_id'] = ['NOT IN',$spec_mark_id_arr];
  348. $assign_data['preset_value'] = Db::name('product_spec_preset')->where($where)->field('preset_id,preset_mark_id,preset_name')->group('preset_mark_id')->order('preset_mark_id desc')->select();
  349. }
  350. return $assign_data;
  351. }
  352. }