作者 王智

新增带你

@@ -40,9 +40,11 @@ class Add extends Api @@ -40,9 +40,11 @@ class Add extends Api
40 $this->error('您不是门店拥有者'); 40 $this->error('您不是门店拥有者');
41 } 41 }
42 $params = $this->request->param(); 42 $params = $this->request->param();
  43 + $battery_type_id=Db::name('battery_code')->where('BatteryCode', $params['battery_code'])->value('battery_type_id');
  44 + if(empty($battery_type_id))$this->error('未在产品库找到给电池类型');
43 $data = [ 45 $data = [
44 'battery_code' => $params['battery_code'], 46 'battery_code' => $params['battery_code'],
45 - 'battery_type_id' => Db::name('battery_code')->where('BatteryCode', $params['battery_code'])->value('battery_type_id'), 47 + 'battery_type_id' => $battery_type_id,
46 'stor_id' => $StorID, 48 'stor_id' => $StorID,
47 'battery' => 0, 49 'battery' => 0,
48 'status' => 1 50 'status' => 1