|
|
@@ -422,7 +422,7 @@ class Formula extends Backend
|
|
|
}
|
|
|
$list['gyinfo'] = Db::name('formula_detail')->where('pid',$ids)->where('version',$list['version'])->field('material,percentage,gy_name,gy_num')->select();
|
|
|
foreach ($list['gyinfo'] as $key=>$value){
|
|
|
- $list['gyinfo'][$key]['material'] = decode($value['percentage']);
|
|
|
+ $list['gyinfo'][$key]['percentage'] = decode($value['percentage']);
|
|
|
}
|
|
|
$this->view->assign('ids',$ids);
|
|
|
$this->view->assign('name',$name);
|
|
|
@@ -438,8 +438,21 @@ class Formula extends Backend
|
|
|
$params = [];
|
|
|
$params['examine_status'] = $status;
|
|
|
$params['update'] = date('Y-m-d H:i:s');
|
|
|
- $res = Db::name('formula')->where('id',$ids)->update($params);
|
|
|
- if ($res){
|
|
|
+ $result = false;
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ $list = Db::name('formula')->where('id',$ids)->find();
|
|
|
+ if ($list['version'] == 'v0.1'){
|
|
|
+ Db::name('formula')->where('id',$ids)->setField('version','v1.0');
|
|
|
+ Db::name('formula_detail')->where('pid',$ids)->setField('version','v1.0');
|
|
|
+ }
|
|
|
+ $result = Db::name('formula')->where('id',$ids)->update($params);
|
|
|
+ Db::commit();
|
|
|
+ } catch (Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($e->getMessage());
|
|
|
+ }
|
|
|
+ if ($result){
|
|
|
$this->success('更新成功');
|
|
|
}else{
|
|
|
$this->error('审核失败');
|