|
@@ -1902,6 +1902,9 @@ class NewsService implements NewsServiceInterface
|
|
$data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
$data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
$data['imgurl'] = isset($data['imgurl']) ? json_encode($data['imgurl']) : '';
|
|
$data['imgurl'] = isset($data['imgurl']) ? json_encode($data['imgurl']) : '';
|
|
unset($data['imgUrl']);
|
|
unset($data['imgUrl']);
|
|
|
|
+ if (isset($data['price']) && $data['price'] == '') {
|
|
|
|
+ $data['price'] = 0;
|
|
|
|
+ }
|
|
$result = Good::insert($data);
|
|
$result = Good::insert($data);
|
|
if (empty($result)) {
|
|
if (empty($result)) {
|
|
return Result::error("添加失败", 0);
|
|
return Result::error("添加失败", 0);
|
|
@@ -1918,6 +1921,9 @@ class NewsService implements NewsServiceInterface
|
|
//设置东八区
|
|
//设置东八区
|
|
date_default_timezone_set('Asia/Shanghai');
|
|
date_default_timezone_set('Asia/Shanghai');
|
|
$data['updated_at'] = date('Y-m-d H:i:s');
|
|
$data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
|
+ if (isset($data['price']) && $data['price'] == '') {
|
|
|
|
+ $data['price'] = 0;
|
|
|
|
+ }
|
|
$result = Good::where('id', $data['id'])->update($data);
|
|
$result = Good::where('id', $data['id'])->update($data);
|
|
if (empty($result)) {
|
|
if (empty($result)) {
|
|
return Result::error("更新失败", 0);
|
|
return Result::error("更新失败", 0);
|