|
|
@@ -1009,4 +1009,32 @@ class Product extends Api
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 新增产品
|
|
|
+ * @ApiMethod POST
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function addProduct(){
|
|
|
+ if (Request::instance()->isPost() == false){
|
|
|
+ $this->error('非法请求');
|
|
|
+ }
|
|
|
+ $params = Request::instance()->post();
|
|
|
+ if (empty($params)){
|
|
|
+ $this->error('参数不能为空');
|
|
|
+ }
|
|
|
+ $uniqId = \db('产品_基本资料')->order('UniqID desc')->value('UniqID');
|
|
|
+ if (empty($uniqId)){
|
|
|
+ $params['UniqID'] = 1;
|
|
|
+ }else{
|
|
|
+ $params['UniqID'] = $uniqId + 1;
|
|
|
+ }
|
|
|
+ $params['Sys_rq'] = date('Y-m-d H:i:s');
|
|
|
+ $sql = \db('产品_基本资料')->fetchSql(true)->insert($params);
|
|
|
+ $res = Db::query($sql);
|
|
|
+ if ($res !== false){
|
|
|
+ $this->success('新增成功');
|
|
|
+ }else{
|
|
|
+ $this->error('新增失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|