db()->where($where)->find(); $update['type'] = $type; $update['value'] = $value; $update['desc'] = $desc; if (!$info) { $update['status'] = 1; $this->db()->insert($update); } else { $this->db()->where(array('id' => $info['id']))->update($update); } return true; } # 验证数据是否可用 public function check($value) { $where['status'] = 1; $data = $this->db()->where($where)->select()->toArray(); if ($data) { foreach ($data as $k => $v) { if ($v['type'] == 1 && $v['value'] == $value) { return false; } elseif ($v['type'] == 2 && strstr($value, $v['value'])) { return false; } elseif ($v['type'] == 3 && !strstr($value, $v['value'])) { return false; } } } return true; } #验证订单是否拉黑是否可用 public function checkorderid($order_id,$merchant_type) { $orderService = OrderService::instance(); $order = $orderService->db()->field('param')->where(['order_id' => $order_id])->find(); if (!$order) { $orderLastweekHistoryService = OrderLastweekHistoryService::instance(); $order = $orderLastweekHistoryService->db()->field('param')->where(['order_id' => $order_id])->find(); } if (!$order) { $orderLastHistoryService = OrderLastHistoryService::instance(); $order = $orderLastHistoryService->db()->field('param')->where(['order_id' => $order_id])->find(); } if (!$order) { $orderTwoHistoryService = OrderTwoHistoryService::instance(); $order = $orderTwoHistoryService->db()->field('param')->where(['order_id' => $order_id])->find(); } if (!$order) { $orderHistoryService = OrderHistoryService::instance(); $order = $orderHistoryService->db()->field('param')->where(['order_id' => $order_id])->find(); } $param = json_decode($order['param'], true); if (isset($param['By_OpenUid']) && $param['By_OpenUid'] != 'error') { $value = $param['By_OpenUid']; return $this->check($value); } if($merchant_type == 9){ if (isset($param['buyerId']) && $param['buyerId'] != 'error') { $value = $param['buyerId']; return $this->check($value); } } return 'error'; } }