企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
### 订单的审批 **位置:** Common\Lib\FlowLib.class.php **参数:** * @param $data array 订单信息(如:订单类型,订单ID) * @return array 订单审批返回提示信息 **调用:** * $flow = new FlowLib(); * $order_arr = $flow->orderExecute($data); **完整代码:** ~~~ /** * 订单的审批 * @param $data array 订单信息 * @return array 审批是否成功提示信息 * whz 2018-01-26 * */ public function orderExecute($data) { M()->startTrans(); //1、改变订单状态:2、已审批 $datas = array( 'id' => $data['id'], 'status' => 2 ); $res = M("wms_flow")->save($datas); //2、判断审批失败 if ($res === false) { M()->rollback(); return array('success'=>false, 'code'=>201, 'msg'=>'审批失败!'); } //3、生成日志记录 $add_log['description'] = '审批成功!'; $add_log['order_id'] = $data['id']; $add_log['type'] = $data['type']; $ress = $this->addLog($add_log); if(!$ress){ M()->rollback(); return array('success'=>false, 'code'=>202, 'msg'=>'审批失败!'); } M()->commit(); return array('success'=>true, 'code'=>200, 'msg'=>'审批完成!'); } ~~~