getOrderUnusual($order_id); //如果订单在特殊记录表没有记录 则添加特殊表记录 if (isset($orderUnusual[0]['status']) == false) { $addFlag = $this->addOrderUnusual($order_id, $status); if ($addFlag['code'] == 0) { return $addFlag; } } //如果已经存在记录 则修改状态和处理人 $editFlag = $this->editOrderUnusual($order_id, $status); return $editFlag; } /** * Des:修改特殊记录表信息 * Name: editOrderUnusual * @param $order_id * @param $status * @return mixed * @author 倪宗锋 */ public function editOrderUnusual($order_id, $status) { $base = new \Base(); $user_id = $base->user_id; if(empty($base->user_id)) { $user_id = 0; } $sql = '' . "UPDATE order_unusual_process set `status` = {$status}, opera_user_id={$user_id}, process_time = NOW() where order_id = {$order_id}"; if ($this->edit($sql)) { $json['code'] = '0'; $json['info'] = '设置成功!'; } else { $json['code'] = '3'; $json['info'] = '设置异常!'; } return $json; } /** * Des:添加特殊表记录 * Name: addOrderUnusual * @param $order_id * @param $status * @return mixed * @author 倪宗锋 */ private function addOrderUnusual($order_id, $status) { $time = date('Y-m-d H:i:s'); $sql = '' . "INSERT INTO `order_unusual_process` ( `order_id`, `special_state`, `submitter_phone`, `create_time`, `status`, `opera_user_id`, `process_time`) VALUES ( '{$order_id}', '', '', '{$time}', '{$status}', '{$_SESSION['user_id']}', '{$time}');"; if ($this->insert($sql)) { $json['code'] = '0'; $json['info'] = '设置成功!'; } else { $json['code'] = '3'; $json['info'] = '设置异常!'; } return $json; } /** * Des:根据订单ID获取 订单特殊记录数据 * Name: getOrderUnusual * @param $order_id * @return int * @author 倪宗锋 */ private function getOrderUnusual($order_id) { $sql = '' . "SELECT * from order_unusual_process where order_id = {$order_id} LIMIT 1"; $result = $this->query($sql); return $result; } }