Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

121 rinda
3.9 KiB

  1. <?php
  2. /**
  3. * 司机端 订单特殊备注
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 倪宗锋
  12. * PhpStorm orderUnusual.class.php
  13. * Create By 2017/1/17 10:22 $
  14. */
  15. class orderUnusual extends base
  16. {
  17. /**
  18. * Des:修改标记状态
  19. * Name: editFlag
  20. * @param $param
  21. * @return array
  22. * @author 倪宗锋
  23. */
  24. public function editFlag($param)
  25. {
  26. //获取参数
  27. $order_id = isset($param['order_id']) ? trim($param['order_id']) : '';//订单号
  28. $status = isset($param['status']) ? trim($param['status']) : '';//状态
  29. //参数校验
  30. if (preg_match('/^[1-9][0-9]{0,10}$/', $order_id) == false) {//校验订单单号
  31. $json['code'] = '2';
  32. $json['info'] = '参数错误';
  33. return $json;
  34. }
  35. if (in_array($status, array(1, 2)) == false) {//校验参数
  36. $json['code'] = '2';
  37. $json['info'] = '参数错误';
  38. return $json;
  39. }
  40. //获取标记订单数据
  41. $orderUnusual = $this->getOrderUnusual($order_id);
  42. //如果订单在特殊记录表没有记录 则添加特殊表记录
  43. if (isset($orderUnusual[0]['status']) == false) {
  44. $addFlag = $this->addOrderUnusual($order_id, $status);
  45. if ($addFlag['code'] == 0) {
  46. return $addFlag;
  47. }
  48. }
  49. //如果已经存在记录 则修改状态和处理人
  50. $editFlag = $this->editOrderUnusual($order_id, $status);
  51. return $editFlag;
  52. }
  53. /**
  54. * Des:修改特殊记录表信息
  55. * Name: editOrderUnusual
  56. * @param $order_id
  57. * @param $status
  58. * @return mixed
  59. * @author 倪宗锋
  60. */
  61. public function editOrderUnusual($order_id, $status)
  62. {
  63. $base = new \Base();
  64. $user_id = $base->user_id;
  65. if(empty($base->user_id)) {
  66. $user_id = 0;
  67. }
  68. $sql = '' . "UPDATE order_unusual_process
  69. set `status` = {$status}, opera_user_id={$user_id}, process_time = NOW()
  70. where order_id = {$order_id}";
  71. if ($this->edit($sql)) {
  72. $json['code'] = '0';
  73. $json['info'] = '设置成功!';
  74. } else {
  75. $json['code'] = '3';
  76. $json['info'] = '设置异常!';
  77. }
  78. return $json;
  79. }
  80. /**
  81. * Des:添加特殊表记录
  82. * Name: addOrderUnusual
  83. * @param $order_id
  84. * @param $status
  85. * @return mixed
  86. * @author 倪宗锋
  87. */
  88. private function addOrderUnusual($order_id, $status)
  89. {
  90. $time = date('Y-m-d H:i:s');
  91. $sql = '' . "INSERT INTO `order_unusual_process`
  92. ( `order_id`, `special_state`, `submitter_phone`, `create_time`, `status`, `opera_user_id`, `process_time`)
  93. VALUES ( '{$order_id}', '', '', '{$time}', '{$status}', '{$_SESSION['user_id']}', '{$time}');";
  94. if ($this->insert($sql)) {
  95. $json['code'] = '0';
  96. $json['info'] = '设置成功!';
  97. } else {
  98. $json['code'] = '3';
  99. $json['info'] = '设置异常!';
  100. }
  101. return $json;
  102. }
  103. /**
  104. * Des:根据订单ID获取 订单特殊记录数据
  105. * Name: getOrderUnusual
  106. * @param $order_id
  107. * @return int
  108. * @author 倪宗锋
  109. */
  110. private function getOrderUnusual($order_id)
  111. {
  112. $sql = '' . "SELECT * from order_unusual_process where order_id = {$order_id} LIMIT 1";
  113. $result = $this->query($sql);
  114. return $result;
  115. }
  116. }