多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
### 通过商品信息修改中间表 **位置:** Common\Lib\SyncLib; **参数:** * @param $num_iid 平台商品id * @param $sku_id ERP SKU ID * @param $channel 网店ID * @param $outer_num 修改后平台库存 **调用:** * $sync = new SyncLib(); * $data = $sync->updateOuterStock($num_iid,$sku_id, $channel, $outer_num); **完整代码:** ~~~ /* * 设置访问的当前平台接口的页码 * @param $num_iid 平台商品id * @param $sku_id ERP SKU ID * @param $channel 网店ID * @param $outer_num 修改后平台库存 * return bool */ public function updateOuterStock($num_iid, $sku_id, $channel, $outer_num) { // 条件赋值 $where['num_iid'] = $num_iid; $where['partner_id'] = $channel; $where['erp_sku_id'] = $sku_id; // 查询对应数据 $res = M('oms_goods')->field('id, erp_num')->where($where)->find(); if (!$res) { return false; } // 赋值需要修改的数据 $save['id'] = $res['id']; $save['outer_num'] = $outer_num; // 判断状态 if ($outer_num != $res['erp_num']) { $save['status'] = '1'; } else { $save['status'] = '0'; } $str = M('oms_goods')->save($save); // 判断是否成功 if ($str) { return true; } else { return false; } } ~~~