This commit is contained in:
mkm 2023-11-08 11:10:26 +08:00
parent cf86b7fda7
commit 1dffc48f28

View File

@ -150,6 +150,16 @@ class ProductLibrary extends BaseController
$res = Db::name('product_library')->insert($data);
if ($res) {
$group_id=Db::name('system_group')->where('group_key','product_caiji_count')->value('group_id');
if($group_id){
$find=Db::name('system_group_data')->where('group_id',$group_id)->whereDay('create_time')->find();
if($find){
$count=json_decode($find['value'],true)['count']+1;
Db::name('system_group_data')->where('group_data_id',$find['group_data_id'])->update(['value'=>json_encode(['count'=>$count])]);
}else{
Db::name('system_group_data')->insert(['group_id'=>$group_id,'value'=>'{"count":1}','create_time'=>date('Y-m-d H:i:s')]);
}
}
return app('json')->success('添加成功');
} else {
throw new \think\exception\ValidateException('添加失败');