You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

250 lines
7.8 KiB

  1. <?php
  2. /**
  3. *
  4. * ============================================================================
  5. * * 版权所有 蜘蛛出行 * *
  6. * 网站地址: http://www.zhizhuchuxing.com
  7. * ----------------------------------------------------------------------------
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
  9. * 使用;不允许对程序代码以任何形式任何目的的再发布。
  10. * ============================================================================
  11. * Author By: 温依莅
  12. * PhpStorm MsgController.php
  13. * Create By 2017/2/23 10:03 $
  14. */
  15. namespace backend\modules\api\controllers;
  16. use backend\modules\api\models\OperaMessageTemplate;
  17. use backend\modules\zzcs\models\OrderMain;
  18. use common\models\Msg;
  19. use yii\web\Controller;
  20. use Yii;
  21. class MsgController extends Controller
  22. {
  23. public $enableCsrfValidation = false;
  24. /**
  25. * Function Description:入口文件
  26. * Function Name: actionIndex
  27. *
  28. * @return bool
  29. *
  30. * @author 温依莅
  31. */
  32. public function actionIndex()
  33. {
  34. return 'hello me';
  35. }
  36. /**
  37. * Function Description:下单发短信接口
  38. * Function Name: actionOrderSendMsg
  39. *
  40. * @return string
  41. *
  42. * @author 温依莅
  43. */
  44. public function actionOrderSendMsg()
  45. {
  46. //1,获取订单号
  47. $order_id = Yii::$app->request->post('order_id', -1);
  48. $msg_type = Yii::$app->request->post('msg_type', -1);
  49. if ($order_id == -1 || $msg_type == -1) {
  50. $json["code"] = '1';
  51. $json["info"] = '缺少参数';
  52. return json_encode($json);
  53. }
  54. //2,调用model发送短信
  55. $msg = new OperaMessageTemplate();
  56. $res = $msg->orderSendMsg($order_id);
  57. return json_encode($res);
  58. }
  59. /**
  60. * Function Description:下单发短信成功接口
  61. * Function Name: actionOrderSendSuccessMsg
  62. *
  63. * @return string
  64. *
  65. * @author Redstop
  66. */
  67. public function actionOrderSendSuccessMsg()
  68. {
  69. //1,获取订单号
  70. $order_id = Yii::$app->request->post('order_id', -1);
  71. if ($order_id == -1) {
  72. $json["code"] = '1';
  73. $json["info"] = '缺少参数';
  74. return json_encode($json);
  75. }
  76. //2,调用model发送短信
  77. $msg = new OperaMessageTemplate();
  78. $send_msg_info = $msg->getMsgInfo($order_id, 'four');
  79. if ($send_msg_info != "notSend") {
  80. $msg->addSuccessMessage($order_id, $send_msg_info[1], $send_msg_info[2]);
  81. }
  82. $json["code"] = '0';
  83. $json["info"] = '插入发送列表成功';
  84. return json_encode($json);
  85. }
  86. /**
  87. * Function Description:下单发短信成功接口
  88. * Function Name: actionOrderSendSuccessMsg
  89. *
  90. * @return string
  91. *
  92. * @author Redstop
  93. */
  94. public function actionGroupOrderSendSuccessMsg()
  95. {
  96. //1,获取订单号
  97. $order_id = Yii::$app->request->post('order_id', -1);
  98. if ($order_id == -1) {
  99. $json["code"] = '1';
  100. $json["info"] = '缺少参数';
  101. return json_encode($json);
  102. }
  103. //2,调用model发送短信
  104. $msg = new OperaMessageTemplate();
  105. $send_msg_info = $msg->getGroupSuccessMsgInfo($order_id);
  106. if ($send_msg_info != false) {
  107. $msg->addSuccessMessage($order_id, $send_msg_info[1], $send_msg_info[2]);
  108. }
  109. $json["code"] = '0';
  110. $json["info"] = '插入发送列表成功';
  111. return json_encode($json);
  112. }
  113. /**
  114. * Function Description:组合订单下单 发短信接口(发送出行短信)
  115. * Function Name: actionGroupOrderSendMsg
  116. *
  117. * @return string
  118. *
  119. * @author 温依莅
  120. */
  121. public function actionGroupOrderSendMsg()
  122. {
  123. //1,获取订单号
  124. $order_id = Yii::$app->request->post('order_id', -1);
  125. $msg_type = Yii::$app->request->post('msg_type', -1);
  126. $template_type = Yii::$app->request->post('template_type', 'two');
  127. if ($order_id == -1 || $msg_type == -1) {
  128. $json["code"] = '1';
  129. $json["info"] = '缺少参数';
  130. return json_encode($json);
  131. }
  132. //2,调用model发送短信
  133. $msg = new OperaMessageTemplate();
  134. $res = $msg->orderSendMsg($order_id, $template_type);
  135. return json_encode($res);
  136. }
  137. /**
  138. * Function Description:ota获取短信内容(预定短信)
  139. * Function Name: actionGetMsgInfo
  140. *
  141. * @return string
  142. *
  143. * @author 温依莅
  144. */
  145. public function actionGetMsgInfo()
  146. {
  147. //1,获取订单号
  148. $order_id = Yii::$app->request->post('order_id', -1);
  149. if ($order_id == -1) {
  150. $json["code"] = '1';
  151. $json["info"] = '缺少参数';
  152. return json_encode($json);
  153. }
  154. //2,调用model获取短信内容(预定短信)
  155. $msg = new OperaMessageTemplate();
  156. $res = $msg->otaGetMsgInfo($order_id);
  157. return json_encode($res);
  158. }
  159. /**
  160. * Function Description:ota获取短信内容(出行短信)
  161. * Function Name: actionGetMsgInfo2
  162. *
  163. * @return string
  164. *
  165. * @author 温依莅
  166. */
  167. public function actionGetMsgInfo2()
  168. {
  169. //1,获取订单号
  170. $order_id = Yii::$app->request->post('order_id', -1);
  171. if ($order_id == -1) {
  172. $json["code"] = '1';
  173. $json["info"] = '缺少参数';
  174. return json_encode($json);
  175. }
  176. //2,调用model获取短信内容(出行短信)
  177. $msg = new OperaMessageTemplate();
  178. $res = $msg->otaGetMsgInfo($order_id, 'two');
  179. return json_encode($res);
  180. }
  181. /**
  182. * Function Description:车队临时换车时发送给乘客出行提醒短信以及给运营人员提醒短信
  183. * Function Name: actionSendBusChangeMessage
  184. *
  185. * @return string
  186. *
  187. * @author 温依莅
  188. */
  189. public function actionSendBusChangeMessage()
  190. {
  191. $json = array();
  192. $json["code"] = '0';
  193. return json_encode($json);
  194. // //1,获取订单号
  195. // $run_id = Yii::$app->request->post('run_id', -1);
  196. // $bus_order_id = Yii::$app->request->post('bus_order_id', -1);
  197. // $send_bus_count = Yii::$app->request->post('send_bus_count', 1);
  198. // $itinerary_name = Yii::$app->request->post('itinerary_name');
  199. // $run_start_time = Yii::$app->request->post('run_start_time');
  200. // $new_bus_no = Yii::$app->request->post('new_bus_no');
  201. // if ($run_id == -1 || $bus_order_id == -1) {
  202. // $json["code"] = '1';
  203. // $json["info"] = '缺少参数';
  204. // return json_encode($json);
  205. // }
  206. // //2,发送预警短信
  207. // $msg = new OperaMessageTemplate();
  208. // $msg->sendBusChangeRemindMsg($run_start_time, $itinerary_name, $new_bus_no);
  209. // //发送新出行提醒短信
  210. // $msg->sendNewUserRemindMsg($run_id, $bus_order_id, $send_bus_count);
  211. }
  212. /**
  213. * Function Description:发送自由编辑短信接口
  214. * Function Name: actionSendFreeMsg
  215. *
  216. * @return string
  217. *
  218. * @author 邱颂
  219. */
  220. public function actionSendFreeMsg()
  221. {
  222. //1,获取订单号
  223. $order_id = Yii::$app->request->post('order_id', -1);
  224. $user_id = Yii::$app->request->post('user_id', -1);
  225. $send_message = Yii::$app->request->post('send_message', '');
  226. if ($order_id == -1 || $user_id == -1 || $send_message == '' ) {
  227. $json["code"] = '1';
  228. $json["info"] = '缺少参数';
  229. return json_encode($json);
  230. }
  231. //2,调用model发送短信
  232. $msg = new OperaMessageTemplate();
  233. $res = $msg->orderSendFreeMsg($order_id, $user_id, $send_message);
  234. return json_encode($res);
  235. }
  236. }